Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new "Use "Disassembly" code editor tab by default" setting. #1485

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
17 changes: 16 additions & 1 deletion UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,22 @@ private async void UserControl_DataContextChanged(object sender, DependencyPrope
CurrentDecompiled = null;
CurrentDisassembled = null;

if (MainWindow.CodeEditorDecompile != Unstated) //if opened from the code search results "link"
// If there is no override (e.g. from opened tab)
if (MainWindow.CodeEditorDecompile == Unstated)
{
if (!SettingsWindow.OpenDisassemblyByDefault)
{
CodeModeTabs.SelectedItem = DecompiledTab;
MainWindow.CodeEditorDecompile = Decompile;
}
else
{
CodeModeTabs.SelectedItem = DisassemblyTab;
MainWindow.CodeEditorDecompile = DontDecompile;
}
}

if (MainWindow.CodeEditorDecompile != Unstated)
{
if (MainWindow.CodeEditorDecompile == DontDecompile && code != CurrentDisassembled)
{
Expand Down
1 change: 1 addition & 0 deletions UndertaleModTool/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Settings

public bool EnableDarkMode { get; set; } = false;
public bool ShowDebuggerOption { get; set; } = false;
public bool OpenDisassemblyByDefault { get; set; } = false;

public static Settings Instance;

Expand Down
30 changes: 17 additions & 13 deletions UndertaleModTool/Windows/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,27 @@
<CheckBox Grid.Row="5" Grid.Column="2" Margin="3" Content="" IsChecked="{Binding ShowDebuggerOption}"/>
<TextBlock Grid.Row="5" Grid.Column="2" Margin="25 2 2 2" Text="Show &quot;Run game under GMS debugger&quot; file option" ToolTip="Whether to show the option in the &quot;File&quot; menu. Disabled by default."/>

<Separator Grid.Row="6" Grid.ColumnSpan="4" Margin="10"/>
<CheckBox Grid.Row="6" Grid.Column="0" Margin="3" Content="" IsChecked="{Binding OpenDisassemblyByDefault}"/>
<TextBlock Grid.Row="6" Grid.Column="0" Margin="25 2 2 2" Text="Open the &quot;Disassembly&quot; code editor tab by default" ToolTip="Whether to open the &quot;Disassembly&quot; tab in the code editor by default. Disabled by default."/>

<CheckBox Grid.Row="7" Grid.Column="0" Margin="3" Content="" IsChecked="{Binding EnableDarkMode}"/>
<TextBlock Grid.Row="7" Grid.Column="0" Margin="25 2 2 2" Text="Enable dark mode" ToolTip="Makes the program interface dark. Disabled by default."/>
<Separator Grid.Row="7" Grid.ColumnSpan="4" Margin="10"/>

<Separator Grid.Row="8" Grid.ColumnSpan="4" Margin="10"/>
<CheckBox Grid.Row="8" Grid.Column="0" Margin="3" Content="" IsChecked="{Binding EnableDarkMode}"/>
<TextBlock Grid.Row="8" Grid.Column="0" Margin="25 2 2 2" Text="Enable dark mode" ToolTip="Makes the program interface dark. Disabled by default."/>

<CheckBox Grid.Row="9" Grid.Column="0" Margin="3" VerticalAlignment="Center" Name="gridWidthCheckbox" Content="" IsChecked="{Binding GridWidthEnabled}"/>
<TextBlock Grid.Row="9" Grid.Column="0" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid width" ToolTip="This option globally overrides the automatic assignment of a room's grid width based on the most used tile's width in that room."/>
<local:TextBoxDark Grid.Row="9" Grid.Column="1" Margin="3" IsEnabled="{Binding ElementName=gridWidthCheckbox, Path=IsChecked}" Text="{Binding GlobalGridWidth}"/>
<Separator Grid.Row="9" Grid.ColumnSpan="4" Margin="10"/>

<CheckBox Grid.Row="10" Grid.Column="0" Margin="3" VerticalAlignment="Center" Name="gridHeightCheckbox" Content="" IsChecked="{Binding GridHeightEnabled}"/>
<TextBlock Grid.Row="10" Grid.Column="0" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid height" ToolTip="This option globally overrides the automatic assignment of a room's grid height based on the most used tile's height in that room."/>
<local:TextBoxDark Grid.Row="10" Grid.Column="1" Margin="3" IsEnabled="{Binding ElementName=gridHeightCheckbox, Path=IsChecked}" Text="{Binding GlobalGridHeight}"/>
<CheckBox Grid.Row="10" Grid.Column="0" Margin="3" VerticalAlignment="Center" Name="gridWidthCheckbox" Content="" IsChecked="{Binding GridWidthEnabled}"/>
<TextBlock Grid.Row="10" Grid.Column="0" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid width" ToolTip="This option globally overrides the automatic assignment of a room's grid width based on the most used tile's width in that room."/>
<local:TextBoxDark Grid.Row="10" Grid.Column="1" Margin="3" IsEnabled="{Binding ElementName=gridWidthCheckbox, Path=IsChecked}" Text="{Binding GlobalGridWidth}"/>

<CheckBox Grid.Row="9" Grid.Column="2" Margin="3" VerticalAlignment="Center" Name="gridThicknessCheckBox" Content="" IsChecked="{Binding GridThicknessEnabled}"/>
<TextBlock Grid.Row="9" Grid.Column="2" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid thickness" ToolTip="This option globally overrides the automatic assignment of a room's grid thickness."/>
<local:TextBoxDark Grid.Row="9" Grid.Column="3" Margin="3" IsEnabled="{Binding ElementName=gridThicknessCheckBox, Path=IsChecked}" Text="{Binding GlobalGridThickness}"/>
<CheckBox Grid.Row="11" Grid.Column="0" Margin="3" VerticalAlignment="Center" Name="gridHeightCheckbox" Content="" IsChecked="{Binding GridHeightEnabled}"/>
<TextBlock Grid.Row="11" Grid.Column="0" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid height" ToolTip="This option globally overrides the automatic assignment of a room's grid height based on the most used tile's height in that room."/>
<local:TextBoxDark Grid.Row="11" Grid.Column="1" Margin="3" IsEnabled="{Binding ElementName=gridHeightCheckbox, Path=IsChecked}" Text="{Binding GlobalGridHeight}"/>

<CheckBox Grid.Row="10" Grid.Column="2" Margin="3" VerticalAlignment="Center" Name="gridThicknessCheckBox" Content="" IsChecked="{Binding GridThicknessEnabled}"/>
<TextBlock Grid.Row="10" Grid.Column="2" Margin="25 2 2 2" VerticalAlignment="Center" Text="Global grid thickness" ToolTip="This option globally overrides the automatic assignment of a room's grid thickness."/>
<local:TextBoxDark Grid.Row="10" Grid.Column="3" Margin="3" IsEnabled="{Binding ElementName=gridThicknessCheckBox, Path=IsChecked}" Text="{Binding GlobalGridThickness}"/>

<Separator Grid.Row="13" Grid.ColumnSpan="4" Margin="10"/>

Expand All @@ -93,6 +96,7 @@
<TextBlock Grid.Row="17" Grid.Column="0" Margin="25 2 2 2" VerticalAlignment="Center" Text="Delete old profile on saving" ToolTip="Deletes the profile obsoleted on saving. Saves on file space at the expense of losing code information for variants. Enabled by default."/>

<Separator Grid.Row="18" Grid.ColumnSpan="4" Margin="10"/>

<local:ButtonDark Grid.Row="19" Grid.Column="0" Grid.ColumnSpan="1" Margin="5" Click="AppDataButton_Click">Open application data folder</local:ButtonDark>
<local:ButtonDark Grid.Row="19" Grid.Column="2" Grid.ColumnSpan="2" Margin="5" Click="UpdateAppButton_Click" x:Name="UpdateAppButton" HorizontalAlignment="Right" Width="223">Update app to latest commit</local:ButtonDark>
</Grid>
Expand Down
10 changes: 10 additions & 0 deletions UndertaleModTool/Windows/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ public static bool ShowDebuggerOption
}
}

public static bool OpenDisassemblyByDefault
{
get => Settings.Instance.OpenDisassemblyByDefault;
set
{
Settings.Instance.OpenDisassemblyByDefault = value;
Settings.Save();
}
}

public bool UpdateButtonEnabled
{
get => UpdateAppButton.IsEnabled;
Expand Down
Loading