Debugger: Script window - Added option to show line numbers

This commit is contained in:
Sour 2025-03-18 21:48:09 +09:00
parent 4e63730c73
commit d324582c6f
5 changed files with 14 additions and 1 deletions

View file

@ -29,6 +29,8 @@ namespace Mesen.Config
[Reactive] public bool AllowIoOsAccess { get; set; } = false;
[Reactive] public bool AllowNetworkAccess { get; set; } = false;
[Reactive] public bool ShowLineNumbers { get; set; } = false;
[Reactive] public UInt32 ScriptTimeout { get; set; } = 1;
public void AddRecentScript(string scriptFile)

View file

@ -45,6 +45,9 @@ namespace Mesen.Debugger.ViewModels
[Reactive] public List<ContextMenuAction> HelpMenuActions { get; private set; } = new();
[Reactive] public List<ContextMenuAction> ToolbarActions { get; private set; } = new();
[Obsolete("For designer only")]
public ScriptWindowViewModel() : this(null) { }
public ScriptWindowViewModel(ScriptStartupBehavior? behavior = null)
{
this.WhenAnyValue(x => x.ScriptName).Select(x => {

View file

@ -95,6 +95,11 @@
<CheckBox IsChecked="{Binding Script.AutoRestartScriptAfterPowerCycle}" Content="{l:Translate chkAutoRestartScriptAfterPowerCycle}" />
<CheckBox IsChecked="{Binding Script.AutoReloadScriptWhenFileChanges}" Content="{l:Translate chkAutoReloadScriptWhenFileChanges}" />
</c:OptionSection>
<c:OptionSection Header="{l:Translate lblDisplaySettings}">
<CheckBox IsChecked="{Binding Script.ShowLineNumbers}" Content="{l:Translate chkShowLineNumbers}" />
</c:OptionSection>
<c:OptionSection Header="{l:Translate lblRestrictions}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Translate lblMaxExecutionTime}" />

View file

@ -50,7 +50,7 @@
<Border Grid.Row="0" BorderBrush="Gray" BorderThickness="1" Margin="1">
<dc:MesenTextEditor
Name="Editor"
ShowLineNumbers="False"
ShowLineNumbers="{Binding Config.ShowLineNumbers}"
TextBinding="{Binding Code}"
FontFamily="{DynamicResource MesenScriptWindowFont}"
FontSize="{DynamicResource MesenScriptWindowFontSize}"

View file

@ -1493,6 +1493,9 @@
<Control ID="chkAutoStartScriptOnLoad">Auto-start script when loaded (or reloaded)</Control>
<Control ID="chkAutoReloadScriptWhenFileChanges">Auto-reload script from disk when file changes</Control>
<Control ID="chkAutoRestartScriptAfterPowerCycle">Auto-restart script after power cycling or reloading a game</Control>
<Control ID="lblDisplaySettings">Display settings</Control>
<Control ID="chkShowLineNumbers">Show line numbers</Control>
<Control ID="lblRestrictions">Restrictions</Control>
<Control ID="lblMaxExecutionTime">Maximum execution time:</Control>