Skip to content
Merged
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
18 changes: 17 additions & 1 deletion src/PlanViewer.App/Dialogs/FormatOptionsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<string, string[]> ChoiceOptionsMap = new()
{
["KeywordCasing"] = ["Uppercase", "Lowercase", "PascalCase"],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -313,6 +328,7 @@ public string CurrentValue
get => _currentValue;
set
{
if (_currentValue == value) return;
_currentValue = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentValue)));
}
Expand Down
Loading