diff --git a/src/PlanViewer.App/Dialogs/FormatOptionsWindow.axaml.cs b/src/PlanViewer.App/Dialogs/FormatOptionsWindow.axaml.cs index 0e4e24a..60cb457 100644 --- a/src/PlanViewer.App/Dialogs/FormatOptionsWindow.axaml.cs +++ b/src/PlanViewer.App/Dialogs/FormatOptionsWindow.axaml.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Interactivity; @@ -44,6 +45,19 @@ public FormatOptionsWindow() "NewLineBeforeWhereClause", "NewLineBeforeWindowClause", ]; + private static string SplitPascalCase(string name) + { + var sb = new StringBuilder(name.Length + 8); + for (int i = 0; i < name.Length; i++) + { + var c = name[i]; + if (i > 0 && char.IsUpper(c) && !char.IsUpper(name[i - 1])) + sb.Append(' '); + sb.Append(c); + } + return sb.ToString(); + } + private static readonly Dictionary ChoiceOptionsMap = new() { ["KeywordCasing"] = ["Uppercase", "Lowercase", "PascalCase"], @@ -73,7 +87,7 @@ private void LoadSettings() _rows.Add(new FormatOptionRow { - Name = prop.Name, + Name = SplitPascalCase(prop.Name), CurrentValue = currentVal?.ToString() ?? "", DefaultValue = defaultVal?.ToString() ?? "", IsBool = isBool, @@ -289,6 +303,7 @@ public bool BoolValue get => _boolValue; set { + if (_boolValue == value) return; _boolValue = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BoolValue))); // Keep CurrentValue in sync for serialization @@ -313,6 +328,7 @@ public string CurrentValue get => _currentValue; set { + if (_currentValue == value) return; _currentValue = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentValue))); }