Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<setting name="GamePath" serializeAs="String">
<value />
</setting>
<setting name="Theme" serializeAs="String">
<value>0</value>
</setting>
</SpaceEditor.Data.Settings>
</userSettings>
</configuration>
15 changes: 10 additions & 5 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
StartupUri="MainWindow.xaml"
Exit="OnExit">
<Application.Resources>
<Style TargetType="GridSplitter">
<Setter Property="ResizeBehavior" Value="PreviousAndNext" />
<Setter Property="Background" Value="#FF7F7F7F"/>
<Setter Property="Width" Value="4"/>
</Style>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--Load all themes and keep them for later-->
<ResourceDictionary Source="Themes/Light.xaml"/>
<ResourceDictionary Source="Themes/Dark.xaml"/>

<!--Override any changes we don't want themes to modify/declare themselves-->
<ResourceDictionary Source="Themes/Global.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
2 changes: 1 addition & 1 deletion Controls/InputsEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</Grid.RowDefinitions>

<TextBox
Margin="2, 0, 2, 2"
Margin="2, 0, 2, 2"
Text="{Binding Path=InputActionsSearchString, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>

Expand Down
6 changes: 0 additions & 6 deletions Controls/KeyBindsEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@
VerticalAlignment="Center"
Name="ActionButtons"
>
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="2, 0, 0, 0" />
<Setter Property="Padding" Value="2" />
</Style>
</StackPanel.Resources>

<Button
Content="Save"
Expand Down
4 changes: 4 additions & 0 deletions Controls/ReflectedObject.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Name="Root">
<UserControl.Resources>
<Style TargetType="local:ReflectedObject">
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
<Setter Property="Background" Value="{DynamicResource Background}" />
</Style>
<local:FlatGroupingDataGridOperator x:Key="FlatGroupingDataGridOperator" />

<DataTemplate x:Key="NotNullTemplate">
Expand Down
12 changes: 12 additions & 0 deletions Data/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Data/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Dictionary<string, string> NamedPresets
public void InvokeGameAction(Action action)
{
var sb = new StringBuilder();
sb.AppendLine("This action is about change Game Content which may result in incompatibilities, bugs or crashes.");
sb.AppendLine("This action is about to change Game Content which may result in incompatibilities, bugs or crashes.");
sb.AppendLine("In case of any issues use Steam Verify Game Integrity feature to automatically revert all modifications.");
sb.AppendLine("Use at your own risk.");
sb.AppendLine("Continue?");
Expand Down
3 changes: 3 additions & 0 deletions Data/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
<Setting Name="Presets" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Theme" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
180 changes: 99 additions & 81 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,113 @@
Width="1000"
d:DataContext="{local:MainWindow}"
>
<TabControl
Name="MainTabs"
>
<TabItem Header="Main">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<StackPanel
Orientation="Horizontal"
Margin="0, 0, 0, 2"
>
<TextBox Text="{Binding GamePath}" Width="400" />
<Button Margin="2, 0, 0, 0" Padding="4, 2, 4, 2" Click="OnLocateGame" Content="Locate Game" />
</StackPanel>

<TextBox
Grid.Row="1"
Grid.Column="0"
Name="InfoText"
IsReadOnly="True"
/>

<Image
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Opacity="0.4"
Stretch="Fill"
Source="pack://application:,,,/Resources/SpaceEditor.png"
/>

<Grid
Grid.Row="1"
Grid.Column="1"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="23*"/>
<ColumnDefinition Width="177*"/>
</Grid.ColumnDefinitions>
<TabControl
Name="MainTabs" Grid.ColumnSpan="2"
>
<TabItem Header="Main" x:Name="MainTabItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="15" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<TextBlock
Text="Change log"
FontSize="35"
FontWeight="Bold"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="5"
/>
<StackPanel
Orientation="Horizontal"
Margin="0, 0, 0, 2"
>
<TextBox Text="{Binding GamePath}" Width="400" />
<Button Margin="2, 0, 0, 0" Padding="4, 2, 4, 2" Click="OnLocateGame" Content="Locate Game" x:Name="LocateGameButton"/>
</StackPanel>

<TextBox
Grid.Row="1"
Grid.Column="0"
Name="InfoText"
IsReadOnly="True"
/>

<Image
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Opacity="0.4"
Stretch="Fill"
Source="pack://application:,,,/Resources/SpaceEditor.png"
/>

<Grid
Grid.Row="1"
Grid.Column="1"
>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="15" />
</Style>
</Grid.Resources>

<ScrollViewer
Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
>
<TextBlock
Margin="10, 0, 0, 0"
>
<Run FontSize="20" FontWeight="Bold">May 12 2025 - v0.9.1</Run>
<LineBreak />
<Run>- Fixed detection of bins location in Steam builds</Run>
<LineBreak />
<LineBreak />

<Run FontSize="20" FontWeight="Bold">May 12 2025 - v0.9</Run>
<LineBreak />
<Run>- Locates and loads SE2 binaries</Run>
<LineBreak />
<Run> - Key Binds Editor Mk1</Run>
<LineBreak />
<Run> - Writes new Bindings to SE2 Content</Run>
Text="Change log"
FontSize="35"
FontWeight="Bold"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="5"
>
</TextBlock>
</ScrollViewer>

<ScrollViewer
Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
>
<TextBlock
Margin="10, 0, 0, 0"
>
<Run FontSize="20" FontWeight="Bold">May 12 2025 - v0.9.1</Run>
<LineBreak />
<Run>- Fixed detection of bins location in Steam builds</Run>
<LineBreak />
<LineBreak />

<Run FontSize="20" FontWeight="Bold">May 12 2025 - v0.9</Run>
<LineBreak />
<Run>- Locates and loads SE2 binaries</Run>
<LineBreak />
<Run> - Key Binds Editor Mk1</Run>
<LineBreak />
<Run> - Writes new Bindings to SE2 Content</Run>
</TextBlock>
</ScrollViewer>
</Grid>
</Grid>
</Grid>
</TabItem>
</TabControl>
</TabItem>
</TabControl>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="Toolbar" Height="{Binding ActualHeight, ElementName=MainTabItem}" Grid.Column="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Margin="5">Theme</TextBlock>
<ComboBox SelectedIndex="{Binding Theme, Mode=TwoWay}" Width="65">
<ComboBoxItem>Light</ComboBoxItem>
<ComboBoxItem>Dark</ComboBoxItem>
</ComboBox>
</StackPanel>
</StackPanel>
</Grid>
</Grid>

</Window>
38 changes: 37 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,38 @@ public string GamePath
}
}

public int Theme
{
get => this.Settings.Theme;
set
{
if (this.Settings.Theme == value)
return;

this.Settings.Theme = value;
OnPropertyChanged();
OnThemeChanged(value);
}
}

private List<ResourceDictionary> _themes = new();
private ResourceDictionary _globalTheme;

public MainWindow()
{
this.DataContext = this;
this.Loaded += Reload;
InitializeComponent();

var resources = Application.Current.Resources.MergedDictionaries;
//Theme index is determined in App.xaml
for (int i = 0; i < resources.Count - 1; i++)
{
_themes.Add(resources[i]);
}

_globalTheme = resources.Last();
OnThemeChanged(this.Settings.Theme);
}

private async void Reload(object sender, RoutedEventArgs e)
Expand All @@ -46,7 +73,7 @@ private async void Reload(object sender, RoutedEventArgs e)

if (string.IsNullOrWhiteSpace(this.GamePath))
{
this.InfoText.Text = "First, please show me where is the Game installed";
this.InfoText.Text = $"First, please show me where is the Game installed by pressing the '{LocateGameButton.Content.ToString()}' button";
return;
}

Expand Down Expand Up @@ -106,6 +133,7 @@ private void OnLocateGame(object sender, RoutedEventArgs e)
var dialog = new OpenFolderDialog
{
Multiselect = false,
Title = "Select Space Engineers 2's Directory"
};

var found = dialog.ShowDialog(this);
Expand All @@ -119,4 +147,12 @@ protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

private void OnThemeChanged(int themeIndex)
{
var resources = Application.Current.Resources.MergedDictionaries;
resources.Clear();
resources.Add(_themes[themeIndex]);
resources.Add(_globalTheme);
}
}
9 changes: 9 additions & 0 deletions SpaceEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@
<None Remove="Resources\SpaceEditor.png" />
</ItemGroup>

<ItemGroup>
<Page Remove="Themes\Dark.xaml" />
<Page Remove="Themes\Global.xaml" />
<Page Remove="Themes\Light.xaml" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\SpaceEditor.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="Themes\Dark.xaml" />
<Resource Include="Themes\Global.xaml" />
<Resource Include="Themes\Light.xaml" />
<Content Include="SpaceEditor.ico" />
</ItemGroup>

Expand Down
Loading