From f152a020e38f5eb8f69501f933026b3889fa8cd5 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 1 Nov 2026 16:06:16 +0100 Subject: [PATCH] Rebuild the settings page A sticky quality bar, a level and a reset per section, key bindings in their own tab. UART moves into the page. A log and tools window replaces AdvancedSettingsWindow, and the developer tab is gone. --- StarterNG/Controls/KeySlot.cs | 21 + StarterNG/Controls/SettingRow.cs | 18 + StarterNG/Controls/SettingsSection.cs | 49 + StarterNG/Styles/Carbon.axaml | 15 +- StarterNG/Styles/Settings.axaml | 79 +- StarterNG/Views/AdvancedSettingsWindow.cs | 187 --- StarterNG/Views/Developer.axaml | 65 - StarterNG/Views/Developer.axaml.cs | 78 - StarterNG/Views/ExeProblemText.cs | 1 + StarterNG/Views/IniChangesWindow.cs | 93 ++ StarterNG/Views/KeyBindingsTab.cs | 688 ++++++++ StarterNG/Views/LogAndToolsWindow.cs | 105 ++ StarterNG/Views/MessageBox.cs | 110 +- StarterNG/Views/SettingTexts.cs | 124 ++ StarterNG/Views/Settings.axaml | 476 ++++-- StarterNG/Views/Settings.axaml.cs | 1856 +++++++++++---------- StarterNG/Views/SimulatorKeyRows.cs | 251 +++ StarterNG/Views/SliderSteps.cs | 42 + StarterNG/Views/UartWindow.cs | 129 -- 19 files changed, 2817 insertions(+), 1570 deletions(-) create mode 100644 StarterNG/Controls/KeySlot.cs delete mode 100644 StarterNG/Views/AdvancedSettingsWindow.cs delete mode 100644 StarterNG/Views/Developer.axaml delete mode 100644 StarterNG/Views/Developer.axaml.cs create mode 100644 StarterNG/Views/IniChangesWindow.cs create mode 100644 StarterNG/Views/KeyBindingsTab.cs create mode 100644 StarterNG/Views/LogAndToolsWindow.cs create mode 100644 StarterNG/Views/SettingTexts.cs create mode 100644 StarterNG/Views/SimulatorKeyRows.cs create mode 100644 StarterNG/Views/SliderSteps.cs delete mode 100644 StarterNG/Views/UartWindow.cs diff --git a/StarterNG/Controls/KeySlot.cs b/StarterNG/Controls/KeySlot.cs new file mode 100644 index 0000000..c274075 --- /dev/null +++ b/StarterNG/Controls/KeySlot.cs @@ -0,0 +1,21 @@ +using Avalonia; +using Avalonia.Controls; + +namespace StarterNG.Controls; + +/// +/// Where the settings layout wants the row of one of the SimulatorKeys, so it +/// sits among the rows it belongs with; the row is put in when the page is built. +/// +public sealed class KeySlot : Decorator +{ + public static readonly StyledProperty KeyProperty = + AvaloniaProperty.Register(nameof(Key)); + + /// The eu07.ini key whose row goes here. + public string? Key + { + get => GetValue(KeyProperty); + set => SetValue(KeyProperty, value); + } +} diff --git a/StarterNG/Controls/SettingRow.cs b/StarterNG/Controls/SettingRow.cs index bee10d4..42a993b 100644 --- a/StarterNG/Controls/SettingRow.cs +++ b/StarterNG/Controls/SettingRow.cs @@ -17,6 +17,13 @@ public class SettingRow : ContentControl public static readonly StyledProperty ValueTextProperty = AvaloniaProperty.Register(nameof(ValueText)); + /// + /// Why the simulator to be started would pass this setting over; the row dims + /// and says so. The input stays usable - the file may serve another build. + /// + public static readonly StyledProperty IdleNoteProperty = + AvaloniaProperty.Register(nameof(IdleNote)); + public string? Label { get => GetValue(LabelProperty); @@ -41,6 +48,12 @@ public class SettingRow : ContentControl set => SetValue(ValueTextProperty, value); } + public string? IdleNote + { + get => GetValue(IdleNoteProperty); + set => SetValue(IdleNoteProperty, value); + } + public SettingRow() { UpdatePseudoClasses(); @@ -54,8 +67,12 @@ public class SettingRow : ContentControl change.Property == DescriptionProperty || change.Property == ConfigKeyProperty || change.Property == ValueTextProperty || + change.Property == IdleNoteProperty || change.Property == ContentProperty) UpdatePseudoClasses(); + + if (change.Property == IdleNoteProperty) + ToolTip.SetTip(this, string.IsNullOrEmpty(IdleNote) ? null : IdleNote); } private void UpdatePseudoClasses() @@ -65,5 +82,6 @@ public class SettingRow : ContentControl PseudoClasses.Set(":no-key", string.IsNullOrEmpty(ConfigKey)); PseudoClasses.Set(":no-value", string.IsNullOrEmpty(ValueText)); PseudoClasses.Set(":no-content", Content is null); + PseudoClasses.Set(":idle", !string.IsNullOrEmpty(IdleNote)); } } diff --git a/StarterNG/Controls/SettingsSection.cs b/StarterNG/Controls/SettingsSection.cs index 7cb092d..02fd743 100644 --- a/StarterNG/Controls/SettingsSection.cs +++ b/StarterNG/Controls/SettingsSection.cs @@ -1,4 +1,6 @@ +using System; using Avalonia; +using Avalonia.Controls; using Avalonia.Controls.Primitives; namespace StarterNG.Controls; @@ -8,9 +10,56 @@ public class SettingsSection : HeaderedContentControl public static readonly StyledProperty ToggleProperty = AvaloniaProperty.Register(nameof(Toggle)); + public static readonly StyledProperty ToggleKeyProperty = + AvaloniaProperty.Register(nameof(ToggleKey)); + + public static readonly StyledProperty ResetLabelProperty = + AvaloniaProperty.Register(nameof(ResetLabel)); + + public static readonly StyledProperty LevelProperty = + AvaloniaProperty.Register(nameof(Level)); + + private Button? _reset; + + /// The header's choice of a level of detail for this section alone; none where it has no such thing. + public object? Level + { + get => GetValue(LevelProperty); + set => SetValue(LevelProperty, value); + } + public object? Toggle { get => GetValue(ToggleProperty); set => SetValue(ToggleProperty, value); } + + /// The eu07.ini key the header's switch sets. + public string? ToggleKey + { + get => GetValue(ToggleKeyProperty); + set => SetValue(ToggleKeyProperty, value); + } + + /// The words on the header's button that puts the section back as the simulator has it; none, no button. + public string? ResetLabel + { + get => GetValue(ResetLabelProperty); + set => SetValue(ResetLabelProperty, value); + } + + /// Raised when the header's reset button is pressed. + public event Action? ResetRequested; + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + base.OnApplyTemplate(e); + if (_reset is not null) + _reset.Click -= OnResetClick; + _reset = e.NameScope.Find