Skip to content

Commit

Permalink
rearrange and add new editor button
Browse files Browse the repository at this point in the history
  • Loading branch information
bluepilledgreat committed Jan 23, 2025
1 parent 802ae6a commit 4aee0a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,31 @@
SyntaxHighlighting="XML"
TextChanged="OnCodeChanged" />

<ui:Button
Grid.Row="2"
Margin="10"
Command="{Binding Path=OpenThemeFolderCommand, Mode=OneTime}"
Content="Open Theme Folder" />

<Grid
Grid.Row="2"
Margin="10"
HorizontalAlignment="Center">
HorizontalAlignment="Right">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<ui:Button
Grid.Column="0"
Margin="0,0,5,0"
HorizontalAlignment="Center"
Margin="0,0,4,0"
Command="{Binding Path=PreviewCommand, Mode=OneTime}"
Content="Preview" />

<ui:Button
Grid.Column="1"
Margin="5,0,0,0"
HorizontalAlignment="Center"
Margin="4,0,0,0"
Appearance="Primary"
Command="{Binding Path=SaveCommand, Mode=OneTime}"
Content="Save" />
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ public BootstrapperEditorWindow(string name)
{
CustomBootstrapperSchema.ParseSchema();

string themeContents = File.ReadAllText(Path.Combine(Paths.CustomThemes, name, "Theme.xml"));
string directory = Path.Combine(Paths.CustomThemes, name);

string themeContents = File.ReadAllText(Path.Combine(directory, "Theme.xml"));
themeContents = ToCRLF(themeContents); // make sure the theme is in CRLF. a function expects CRLF.

var viewModel = new BootstrapperEditorWindowViewModel();
viewModel.Directory = directory;
viewModel.Name = name;
viewModel.Title = $"Editing \"{name}\"";
viewModel.Code = themeContents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class BootstrapperEditorWindowViewModel : NotifyPropertyChangedViewModel

public ICommand PreviewCommand => new RelayCommand(Preview);
public ICommand SaveCommand => new RelayCommand(Save);
public ICommand OpenThemeFolderCommand => new RelayCommand(OpenThemeFolder);

public string Directory { get; set; } = "";

public string Name { get; set; } = "";
public string Title { get; set; } = "Editing \"Custom Theme\"";
Expand Down Expand Up @@ -66,5 +69,10 @@ private void Save()
Frontend.ShowMessageBox($"Failed to save theme: {ex.Message}", MessageBoxImage.Error, MessageBoxButton.OK);
}
}

private void OpenThemeFolder()
{
Process.Start("explorer.exe", Directory);
}
}
}

0 comments on commit 4aee0a3

Please sign in to comment.