Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(style) Redesign of Settings

Egor Khindikaynen6c681beae3d8
diff --git a/.claude/skills/nota-shortcuts/SKILL.md b/.claude/skills/nota-shortcuts/SKILL.md
index 57d2bcf8..0a5f876e 100644
--- a/.claude/skills/nota-shortcuts/SKILL.md
+++ b/.claude/skills/nota-shortcuts/SKILL.md
@@ -21,7 +21,10 @@ Shortcuts pane matches.
`src/managed/Nota.App/PreferencesWindow.cs` → the static **`ShortcutGroups`** array (feeds
`ShortcutsPane`). It's grouped: `TRANSPORT`, `ARRANGEMENT & EDITING`, `PIANO ROLL`,
`PLAY NOTES (COMPUTER KEYBOARD)`, `MOUSE`. Each row is `(Key, Action)`; the `Key` string is
-mono-rendered as a key-cap, the `Action` is a short sentence. Use `⌘` for Meta/Ctrl, `⇧`
+split on spaces and each token becomes its own mono key-cap (`/` and `·` stay plain
+separators) — as long as every token is a key: no lower-case letters, or one of `Space`
+`Return` `Delete` `Tab` `Esc` (`IsKeyToken`). Anything else (`Drag note edge`, `Face
+buttons`) is a gesture and shows as plain text. The `Action` is a short sentence. Use `⌘` for Meta/Ctrl, `⇧`
for Shift, `⌥` for Alt, and the arrow glyphs `← → ↑ ↓`. Keep actions imperative and terse
(design language: sentence case, `·`/` / ` as separators).
@@ -51,7 +54,7 @@ map changes, update the `PLAY NOTES` group (white vs. black keys, and the starti
5. Visually verify (see [nota-ui-verify] memory): the pane can't be reached by a click in a
headless run, so temporarily open it via an env-guarded hook in
`MainWindow.OnDataContextChanged` (`new PreferencesWindow(new SettingsViewModel(settings),
- _vm).Show(this)`), and select the Shortcuts section (index 5) — e.g. a temporary env read
+ _vm).Show(this)`), and select the Shortcuts section (index 7) — e.g. a temporary env read
in front of the constructor's `Select(0)`. Screenshot with `screencapture -x -o -l<winid>`
(get the id from the `winlist` swift helper), check the rows read correctly, then **revert
the temp hooks** and rebuild.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 115bfc1b..b59a122c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -86,6 +86,13 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
copy, cut, paste, duplicate and delete. Each command is one undo step.
### Changed
+- **A new look for Settings.** The window is larger, and the sidebar groups its pages
+ under Devices, Plug-ins and General, each with an icon. Every page has a short
+ description under its title. MIDI inputs and the other on/off options use larger
+ switches. Latency shows in milliseconds. Get Plug-ins is now called Downloads, shows how
+ many plugins you can still install, counts each filter and lists the download size. The
+ theme buttons show a sample of each theme's colour. Shortcuts can be filtered and show
+ each key on its own key-cap.
- "Add track" in a track's right-click menu puts the new track right after that track. On a
group it adds the track inside the group.
- Copying, duplicating or deleting a group now includes its tracks. Pasted tracks go after
diff --git a/DESIGN.md b/DESIGN.md
index 37f51ab0..8427c0ed 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -199,6 +199,7 @@ now points at the new hue.
| Tab segment (`Seg`) in container (`SegGroup`) | 24 in 30 |
| Filter chip (`Chip`) | 20 |
| Switch | 18 × 10, knob 7, inset 1.5 |
+| Switch, Settings rows | 28 × 16, knob 12, inset 2 (`SwitchTrack(large: true)`) |
| Knob (`KnobSecondary` / `KnobRegular` / `KnobMain`) | 34 / 36 / 44 · `KnobInline` 24 in a table row |
| Parameter cell (`ParamCell`) | 53 tall |
| Slider track | 3, handle 6 × 7 |
@@ -293,7 +294,7 @@ Builders live in `DeviceCardKit`; controls in `Controls/`. Reuse before writing
|---|---|
| `Knob` | 52-grid: groove r21 stroke 5, 270° from −135°, cap r14, pointer 2.4 Brass Light. Sizes snap to 34 / 36 / 44; `Inline` pins 24 for a knob inside a table row. `IsModified`, `IsDim`, `ArcColor` for a modulation source. |
| `DeviceCardKit.KnobCell` | Knob → label 7/700 caps → value mono 7, no gap; 53 tall under a 34 knob. Label and value go Brass Light when modified or `emphasised`. |
-| `SwitchTrack` / `DeviceCardKit.Switch` | 18 × 10, knob 7, inset 1.5; on = brass + panel-coloured knob right, off = Track off + Ink 5 knob left. Word to the right, caps 7 in a device, 11 in the shell. |
+| `SwitchTrack` / `DeviceCardKit.Switch` | 18 × 10, knob 7, inset 1.5; on = brass + panel-coloured knob right, off = Track off + Ink 5 knob left. Word to the right, caps 7 in a device, 11 in the shell. The Settings window uses the large 28 × 16 size (knob 12, inset 2) with a 12px sentence. |
| `DeviceCardKit.Segments` | Sunken container; selected = solid brass with dark text. 9 px in a device, 11 in the shell (`ToggleButton.seg` in `Border.segmented`). |
| `SliderTrack` / `DeviceCardKit.SliderRow` | Label · 3 px well track · 6 × 7 handle · fixed-width mono value right. Bipolar fills from centre. Inactive loses brass, keeps the number. |
| `MiniFader`, `PanBar`, `VFader` | Track-header gain and pan, mixer fader — same drag contract. |
diff --git a/src/managed/Nota.App/Controls/SwitchTrack.cs b/src/managed/Nota.App/Controls/SwitchTrack.cs
index fc64696b..74b28c3f 100644
--- a/src/managed/Nota.App/Controls/SwitchTrack.cs
+++ b/src/managed/Nota.App/Controls/SwitchTrack.cs
@@ -22,7 +22,11 @@ internal sealed class SwitchTrack : Control
private static readonly IBrush KnobOff = NotaPalette.TextTertiary;
public const double W = 18, H = 10, KnobD = 7, Inset = 1.5;
+ // The settings-window size: a 28×16 track with a 12px knob inset 2 — a standalone row
+ // toggle at the shell scale, not a parameter inside a device card.
+ public const double LargeW = 28, LargeH = 16, LargeKnobD = 12, LargeInset = 2;
+ private readonly double _w, _h, _knob, _inset;
private bool _on, _dim;
public bool IsOn { get => _on; set { if (_on == value) return; _on = value; InvalidateVisual(); } }
@@ -30,17 +34,18 @@ internal sealed class SwitchTrack : Control
/// <summary>On, but inert — the section it gates is switched off. Loses brass, keeps position.</summary>
public bool IsDim { get => _dim; set { if (_dim == value) return; _dim = value; InvalidateVisual(); } }
- public SwitchTrack()
+ public SwitchTrack(bool large = false)
{
- Width = W; Height = H;
+ (_w, _h, _knob, _inset) = large ? (LargeW, LargeH, LargeKnobD, LargeInset) : (W, H, KnobD, Inset);
+ Width = _w; Height = _h;
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center;
}
public override void Render(DrawingContext ctx)
{
var track = _on ? (_dim || !IsEffectivelyEnabled ? TrackDim : TrackOn) : TrackOff;
- ctx.DrawRectangle(track, null, new RoundedRect(new Rect(0, 0, W, H), H / 2));
- double x = _on ? W - Inset - KnobD : Inset;
- ctx.DrawEllipse(_on ? KnobOn : KnobOff, null, new Point(x + KnobD / 2, H / 2), KnobD / 2, KnobD / 2);
+ ctx.DrawRectangle(track, null, new RoundedRect(new Rect(0, 0, _w, _h), _h / 2));
+ double x = _on ? _w - _inset - _knob : _inset;
+ ctx.DrawEllipse(_on ? KnobOn : KnobOff, null, new Point(x + _knob / 2, _h / 2), _knob / 2, _knob / 2);
}
}
diff --git a/src/managed/Nota.App/Controls/ToggleSwitch.cs b/src/managed/Nota.App/Controls/ToggleSwitch.cs
index 4958d7a3..417fe984 100644
--- a/src/managed/Nota.App/Controls/ToggleSwitch.cs
+++ b/src/managed/Nota.App/Controls/ToggleSwitch.cs
@@ -15,16 +15,18 @@ namespace Nota.App;
// SwitchTrack (almanac § Controls), for call sites that want a self-toggling control.
internal sealed class ToggleSwitch : Control
{
- private readonly SwitchTrack _track = new();
+ private readonly SwitchTrack _track;
public event Action<bool>? Changed;
- public ToggleSwitch(bool on)
+ public ToggleSwitch(bool on, bool large = false)
{
- _track.IsOn = on;
- Width = SwitchTrack.W; Height = SwitchTrack.H;
+ _track = new SwitchTrack(large) { IsOn = on };
+ Width = _track.Width; Height = _track.Height;
Cursor = new Cursor(StandardCursorType.Hand);
LogicalChildren.Add(_track); VisualChildren.Add(_track);
}
public bool IsOn { get => _track.IsOn; set => _track.IsOn = value; }
+ /// <summary>Flip it as a click would (fires Changed) — for a row whose label is clickable too.</summary>
+ public void Toggle() { _track.IsOn = !_track.IsOn; Changed?.Invoke(_track.IsOn); }
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
// Left button only — right-click bubbles to the CV-modulate / MIDI Learn menu.
@@ -32,5 +34,5 @@ internal sealed class ToggleSwitch : Control
_track.IsOn = !_track.IsOn; Changed?.Invoke(_track.IsOn); e.Handled = true;
}
protected override Size ArrangeOverride(Size finalSize) { _track.Arrange(new Rect(finalSize)); return finalSize; }
- protected override Size MeasureOverride(Size availableSize) { _track.Measure(availableSize); return new Size(SwitchTrack.W, SwitchTrack.H); }
+ protected override Size MeasureOverride(Size availableSize) { _track.Measure(availableSize); return new Size(Width, Height); }
}
diff --git a/src/managed/Nota.App/PreferencesWindow.Store.cs b/src/managed/Nota.App/PreferencesWindow.Store.cs
index 498a918b..e1cbe907 100644
--- a/src/managed/Nota.App/PreferencesWindow.Store.cs
+++ b/src/managed/Nota.App/PreferencesWindow.Store.cs
@@ -13,6 +13,8 @@ using System.Threading;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Threading;
@@ -33,22 +35,36 @@ public sealed partial class PreferencesWindow
private StoreProgress _storeProgress;
private string? _storeMessage; // last result or error, shown under the toolbar
private CancellationTokenSource? _storeCts;
- private StackPanel? _storeList; // null while another pane is showing
+ private Task? _storeLoad;
+ private ContentControl? _storeList; // null while another pane is showing
+ private TextBlock[]? _storeCounts; // mono counts on the filter segments
private TextBlock? _storeStatus;
private ProgressBar? _storeBar;
private Control StorePane()
{
- var body = new StackPanel { Spacing = 10 };
- body.Children.Add(SectionLabel("GET PLUG-INS"));
- body.Children.Add(Caption("Open-source VST3 plugins from the Nota plugin registry. Each one downloads from the project's own GitHub release, is checked against the registry's checksum and unpacked — installers never run."));
+ var intro = Caption("Open-source VST3 plugins from the Nota plugin registry. Each one downloads from the project's own GitHub release, is checked against the registry's checksum and unpacked — installers never run.", muted: true);
+ intro.MaxWidth = 600;
+ intro.HorizontalAlignment = HorizontalAlignment.Left;
+ // Filter segments carry a mono count; RenderStoreList keeps the counts current.
var strip = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2 };
- var segs = new List<Avalonia.Controls.Primitives.ToggleButton>();
+ var segs = new List<ToggleButton>();
+ _storeCounts = new TextBlock[StoreFilters.Length];
for (int i = 0; i < StoreFilters.Length; i++)
{
int idx = i;
- var b = new Avalonia.Controls.Primitives.ToggleButton { Content = StoreFilters[i], Classes = { "seg" }, IsChecked = i == _storeFilter };
+ var count = new TextBlock { FontSize = 9, FontFamily = NotaFonts.MonoFamily, VerticalAlignment = VerticalAlignment.Center };
+ _storeCounts[i] = count;
+ var b = new ToggleButton
+ {
+ Classes = { "seg" }, FontSize = 12, IsChecked = i == _storeFilter,
+ Content = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 6,
+ Children = { new TextBlock { Text = StoreFilters[i], VerticalAlignment = VerticalAlignment.Center }, count },
+ },
+ };
b.Click += (_, _) =>
{
for (int k = 0; k < segs.Count; k++) segs[k].IsChecked = k == idx;
@@ -58,35 +74,47 @@ public sealed partial class PreferencesWindow
segs.Add(b);
strip.Children.Add(b);
}
- var search = new TextBox { PlaceholderText = "Search", Text = _storeSearch, Width = 160, Classes = { "search" }, VerticalAlignment = VerticalAlignment.Center };
+ var search = new TextBox { PlaceholderText = "Search", Text = _storeSearch, Classes = { "search" }, FontSize = 12 };
search.TextChanged += (_, _) => { _storeSearch = search.Text ?? ""; RenderStoreList(); };
- var refresh = new Button { Content = "Refresh", Classes = { "ghost" } };
+ var refresh = new Button { Content = "Refresh", Classes = { "ghost" }, Height = 30, FontSize = 12, Padding = new Thickness(12, 0), Foreground = TextSecondary };
ToolTip.SetTip(refresh, "Reload the registry");
refresh.Click += (_, _) => _ = LoadStoreAsync(refresh: true);
- var toolbar = new DockPanel { LastChildFill = false };
- DockPanel.SetDock(strip, Dock.Left);
+ var toolbar = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto"), ColumnSpacing = 10 };
toolbar.Children.Add(new Border { Classes = { "segmented" }, Child = strip });
- var right = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { search, refresh } };
- DockPanel.SetDock(right, Dock.Right);
- toolbar.Children.Add(right);
- body.Children.Add(toolbar);
+ var searchField = SearchField(search, double.PositiveInfinity);
+ searchField.MinWidth = 140;
+ Grid.SetColumn(searchField, 1); toolbar.Children.Add(searchField);
+ Grid.SetColumn(refresh, 2); toolbar.Children.Add(refresh);
_storeStatus = Caption("");
_storeBar = new ProgressBar { Minimum = 0, Maximum = 1, Height = 4, IsVisible = false };
- body.Children.Add(_storeStatus);
- body.Children.Add(_storeBar);
-
- _storeList = new StackPanel { Spacing = 6 };
- body.Children.Add(_storeList);
- body.Children.Add(Caption($"Installed to {_store.PluginsDir}"));
+ _storeList = new ContentControl();
- body.DetachedFromVisualTree += (_, _) => { _storeList = null; _storeStatus = null; _storeBar = null; };
- if (_storePlugins is null) _ = LoadStoreAsync(refresh: false);
+ var body = new StackPanel
+ {
+ Spacing = 14,
+ Children =
+ {
+ intro, toolbar,
+ new StackPanel { Spacing = 6, Children = { _storeStatus, _storeBar } },
+ _storeList,
+ Caption($"Installed to {_store.PluginsDir}"),
+ },
+ };
+ body.DetachedFromVisualTree += (_, _) => { _storeList = null; _storeStatus = null; _storeBar = null; _storeCounts = null; };
+ if (_storePlugins is null) EnsureStoreLoading();
else RenderStoreList();
return body;
}
+ // The registry index is cached on disk, so the window starts this on open: the sidebar's
+ // Downloads count needs it before the pane is ever shown.
+ private void EnsureStoreLoading()
+ {
+ if (_storePlugins is null && _storeLoad is not { IsCompleted: false }) _storeLoad = LoadStoreAsync(refresh: false);
+ }
+
private async Task LoadStoreAsync(bool refresh)
{
_storeMessage = "Loading the plugin registry…";
@@ -105,20 +133,15 @@ public sealed partial class PreferencesWindow
private void RenderStoreList()
{
+ UpdateStoreBadge();
if (_storeList is null) return;
UpdateStoreStatus();
- _storeList.Children.Clear();
- if (_storePlugins is null) return;
+ if (_storePlugins is null) { _storeList.Content = null; UpdateStoreCounts(null); return; }
var installed = _store.Installed.ToDictionary(i => i.Id);
+ UpdateStoreCounts(installed);
var q = _storeSearch.Trim();
- var shown = _storePlugins.Where(p => _storeFilter switch
- {
- 1 => p.Kind is "instrument",
- 2 => p.Kind is "effect" or "midi" or "bundle",
- 3 => installed.ContainsKey(p.Id),
- _ => true,
- })
+ var shown = _storePlugins.Where(p => MatchesFilter(p, _storeFilter, installed))
.Where(p => q.Length == 0
|| p.Name.Contains(q, StringComparison.OrdinalIgnoreCase)
|| p.Developer.Contains(q, StringComparison.OrdinalIgnoreCase)
@@ -128,11 +151,42 @@ public sealed partial class PreferencesWindow
if (shown.Count == 0)
{
- _storeList.Children.Add(Caption(_storeFilter == 3 && q.Length == 0 ? "Nothing installed from the registry yet." : "No plugins match."));
+ var empty = new TextBlock
+ {
+ Text = _storeFilter == 3 && q.Length == 0 ? "Nothing installed from the registry yet." : "Nothing matches.",
+ FontSize = 12, Foreground = TextTertiary, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(28),
+ };
+ _storeList.Content = Table(new List<Control> { empty });
return;
}
- foreach (var p in shown)
- _storeList.Children.Add(StoreRow(p, installed.GetValueOrDefault(p.Id)));
+ _storeList.Content = Table(shown.Select(p => StoreRow(p, installed.GetValueOrDefault(p.Id))).ToList());
+ }
+
+ private static bool MatchesFilter(StorePlugin p, int filter, IReadOnlyDictionary<string, InstalledStorePlugin> installed) => filter switch
+ {
+ 1 => p.Kind is "instrument",
+ 2 => p.Kind is "effect" or "midi" or "bundle",
+ 3 => installed.ContainsKey(p.Id),
+ _ => true,
+ };
+
+ private void UpdateStoreCounts(IReadOnlyDictionary<string, InstalledStorePlugin>? installed)
+ {
+ if (_storeCounts is null) return;
+ for (int i = 0; i < _storeCounts.Length; i++)
+ {
+ _storeCounts[i].Text = _storePlugins is null || installed is null ? "" : _storePlugins.Count(p => MatchesFilter(p, i, installed)).ToString();
+ // On the brass segment the count drops to the brass edge; off it, Ink 6.
+ _storeCounts[i].Foreground = i == _storeFilter ? NotaPalette.AccentEdge : TextDisabled;
+ }
+ }
+
+ // Sidebar: how many registry plugins this computer could still install.
+ private void UpdateStoreBadge()
+ {
+ if (_storePlugins is null) return;
+ var installed = _store.Installed.Select(i => i.Id).ToHashSet();
+ UpdateDownloadsBadge(_storePlugins.Count(p => p.Asset is not null && !installed.Contains(p.Id)));
}
private void UpdateStoreStatus()
@@ -142,83 +196,106 @@ public sealed partial class PreferencesWindow
_storeStatus.Text = busy ? _storeProgress.Message : _storeMessage ?? "";
_storeStatus.IsVisible = _storeStatus.Text.Length > 0;
_storeBar.IsVisible = busy;
+ if (_storeStatus.Parent is Control holder) holder.IsVisible = _storeStatus.IsVisible || busy;
_storeBar.IsIndeterminate = busy && _storeProgress.Fraction < 0;
if (busy && _storeProgress.Fraction >= 0) _storeBar.Value = _storeProgress.Fraction;
}
private Control StoreRow(StorePlugin p, InstalledStorePlugin? inst)
{
- var name = new TextBlock { Text = p.Name, FontSize = 12, FontWeight = FontWeight.SemiBold, Foreground = TextPrimary };
- var kind = new TextBlock
- {
- Text = KindLabel(p.Kind), FontSize = 9, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary,
- VerticalAlignment = VerticalAlignment.Center,
- };
- var meta = new TextBlock
- {
- Text = $"{p.Developer} · {p.Version} · {p.License}",
- FontSize = 10, Foreground = TextTertiary,
- };
var text = new StackPanel
{
- Spacing = 3,
+ Spacing = 4,
Children =
{
- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { name, kind } },
- meta,
- new TextBlock { Text = p.Description, FontSize = 11, Foreground = TextSecondary, TextWrapping = TextWrapping.Wrap },
+ new WrapPanel
+ {
+ Children =
+ {
+ new TextBlock { Text = p.Name, FontSize = 13, FontWeight = FontWeight.SemiBold, Foreground = TextPrimary, Margin = new Thickness(0, 0, 8, 0), VerticalAlignment = VerticalAlignment.Center },
+ new TextBlock { Text = KindLabel(p.Kind), FontSize = 9, LetterSpacing = 0.7, FontFamily = NotaFonts.MonoFamily, Foreground = TextMuted, VerticalAlignment = VerticalAlignment.Center },
+ },
+ },
+ new TextBlock { Text = $"{p.Developer} · {p.Version} · {p.License}", FontSize = 10, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary },
+ new TextBlock { Text = p.Description, FontSize = 12, LineHeight = 18, Foreground = TextSecondary, TextWrapping = TextWrapping.Wrap },
},
};
if (p.Notes is { Length: > 0 } notes)
- text.Children.Add(new TextBlock { Text = notes, FontSize = 10, Foreground = NotaPalette.TextMuted, TextWrapping = TextWrapping.Wrap });
+ text.Children.Add(new TextBlock { Text = notes, FontSize = 11, LineHeight = 16, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap });
- var actions = new StackPanel { Spacing = 6, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top };
+ var actions = new StackPanel { Spacing = 8, MinWidth = 96, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top };
bool busy = _storeBusyId is not null;
if (_storeBusyId == p.Id)
{
- actions.Children.Add(Caption("Working…"));
+ actions.Children.Add(StoreButton(inst is null ? "Installing…" : "Working…", enabled: false, () => { }));
}
else if (p.Asset is null)
{
- actions.Children.Add(new TextBlock { Text = "Not available for this computer", FontSize = 10, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap, Width = 110, TextAlignment = TextAlignment.Right });
+ actions.Children.Add(new TextBlock { Text = "Not available for this computer", FontSize = 11, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap, Width = 110, TextAlignment = TextAlignment.Right, HorizontalAlignment = HorizontalAlignment.Right });
}
else if (inst is null)
{
- actions.Children.Add(StoreButton("Install", ghost: false, enabled: !busy, () => InstallFromStore(p)));
+ actions.Children.Add(StoreButton("Install", enabled: !busy, () => InstallFromStore(p)));
}
else
{
if (inst.Version != p.Version)
- actions.Children.Add(StoreButton($"Update to {p.Version}", ghost: false, enabled: !busy, () => InstallFromStore(p)));
+ actions.Children.Add(StoreButton($"Update to {p.Version}", enabled: !busy, () => InstallFromStore(p)));
else
- actions.Children.Add(new TextBlock { Text = "Installed", FontSize = 10, Foreground = AccentBright, HorizontalAlignment = HorizontalAlignment.Right });
- actions.Children.Add(StoreButton("Remove", ghost: true, enabled: !busy, () => RemoveFromStore(p)));
+ actions.Children.Add(new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 6, Height = 26, HorizontalAlignment = HorizontalAlignment.Right,
+ Children = { Dot(Brass), new TextBlock { Text = "Installed", FontSize = 11, FontWeight = FontWeight.Medium, Foreground = Brass, VerticalAlignment = VerticalAlignment.Center } },
+ });
+ actions.Children.Add(StoreLink("Remove", null, busy ? null : () => RemoveFromStore(p)));
}
- var source = StoreButton("Source", ghost: true, enabled: true, () => _ = Launcher.LaunchUriAsync(new Uri(p.Repo)));
+ if (inst is null && p.Asset is { Size: > 0 } asset)
+ actions.Children.Add(new TextBlock
+ {
+ Text = NotaNum.Unit(asset.Size / 1048576.0, "0.0", "MB"), FontSize = 10, FontFamily = NotaFonts.MonoFamily,
+ Foreground = TextTertiary, HorizontalAlignment = HorizontalAlignment.Right,
+ });
+ var source = StoreLink("Source", GlyphKind.PopOut, () => _ = Launcher.LaunchUriAsync(new Uri(p.Repo)));
ToolTip.SetTip(source, "Open the source repository");
actions.Children.Add(source);
- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 12 };
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 16, Margin = new Thickness(16, 14, 14, 14) };
grid.Children.Add(text);
Grid.SetColumn(actions, 1);
grid.Children.Add(actions);
- return new Border
- {
- Background = Raised, BorderBrush = Divider, BorderThickness = new Thickness(1),
- CornerRadius = NotaRadius.Tile, Padding = new Thickness(12, 10), Child = grid,
- };
+ return grid;
}
- // Rows use raised buttons for actions and ghost for secondary links: a list of solid brass
- // Install buttons would break "one primary action per context".
- private static Button StoreButton(string label, bool ghost, bool enabled, Action onClick)
+ // Rows use raised buttons for actions: a list of solid brass Install buttons would break
+ // "one primary action per context".
+ private static Button StoreButton(string label, bool enabled, Action onClick)
{
- var b = new Button { Content = label, IsEnabled = enabled, HorizontalAlignment = HorizontalAlignment.Right };
- if (ghost) b.Classes.Add("ghost");
+ var b = new Button
+ {
+ Content = label, IsEnabled = enabled, Height = 26, MinWidth = 88, FontSize = 12, Padding = new Thickness(12, 0),
+ CornerRadius = NotaRadius.Tile, HorizontalAlignment = HorizontalAlignment.Right,
+ };
b.Click += (_, _) => onClick();
return b;
}
+ // A text link: Ink 4, Ink 1 on hover; null action = inert (Ink 6).
+ private static Control StoreLink(string label, GlyphKind? glyph, Action? onClick)
+ {
+ var text = new TextBlock { Text = label, FontSize = 11, VerticalAlignment = VerticalAlignment.Center };
+ var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4, HorizontalAlignment = HorizontalAlignment.Right, Background = Brushes.Transparent };
+ row.Children.Add(text);
+ if (glyph is { } g) row.Children.Add(new Glyph(g, 9));
+ void Ink(IBrush b) { text.Foreground = b; foreach (var gl in row.Children.OfType<Glyph>()) gl.Foreground = b; }
+ Ink(onClick is null ? TextDisabled : TextMuted);
+ if (onClick is null) return row;
+ row.Cursor = new Cursor(StandardCursorType.Hand);
+ row.PointerEntered += (_, _) => Ink(TextPrimary);
+ row.PointerExited += (_, _) => Ink(TextMuted);
+ row.PointerPressed += (_, e) => { if (e.GetCurrentPoint(row).Properties.IsLeftButtonPressed) onClick(); };
+ return row;
+ }
+
private static string KindLabel(string kind) => kind switch
{
"instrument" => "INSTRUMENT",
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index 0db1cfd5..859576b3 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -1,18 +1,19 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Preferences (mockup 1h): 760×560 with a 170px sidebar (Audio / MIDI /
-// Plug-ins / Library / Appearance / Shortcuts) and a content pane per section.
-// Audio device / sample-rate / buffer are persisted natively (audio.json) and
-// applied by restarting the backend (MainWindowViewModel.ApplyAudioSettings);
-// toolbar side persists via SettingsViewModel; scan folders via the catalog.
-// Test: a 440 Hz sine through the master (toggle; stopped when the pane or window
-// goes away) and a 5 s CPU check sampling the live DSP load + dropout count.
+// Settings (nota-design/Nota Settings.html): 880×640 with a 188px sidebar grouped as
+// Devices (Audio / MIDI / Gamepads), Plug-ins (Plug-ins / Downloads) and General (Library /
+// Appearance / Shortcuts), and a content pane per section under a title + subtitle header.
+// Audio device / sample-rate / buffer are persisted natively (audio.json) and applied by
+// restarting the backend (MainWindowViewModel.ApplyAudioSettings); scan folders go through
+// the catalog. Test: a 440 Hz sine through the master (toggle; stopped when the pane or
+// window goes away) and a 5 s CPU check sampling the live DSP load + dropout count.
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Linq;
using Avalonia;
+using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Shapes;
@@ -20,6 +21,7 @@ using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Layout;
using Avalonia.Media;
+using Avalonia.Media.Immutable;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
using Microsoft.Extensions.DependencyInjection;
@@ -30,24 +32,53 @@ namespace Nota.App;
public sealed partial class PreferencesWindow : NotaWindow
{
- private static readonly IBrush Panel = NotaPalette.SurfaceCard;
- private static readonly IBrush Sidebar = NotaPalette.SurfaceInset;
+ private static readonly IBrush Ground = NotaPalette.SurfaceCard;
+ private static readonly IBrush Sidebar = NotaPalette.Panel;
+ private static readonly IBrush RowBg = NotaPalette.Panel;
private static readonly IBrush Sunken = NotaPalette.BgSunken;
private static readonly IBrush Raised = NotaPalette.SurfaceRaised;
+ private static readonly IBrush Hover = NotaPalette.SurfaceHover;
private static readonly IBrush Divider = NotaPalette.BorderDefault;
+ private static readonly IBrush Hairline = NotaPalette.GraphBorder; // Brush.Hairline — rules between rows
private static readonly IBrush BorderStrong = NotaPalette.BorderStrong;
private static readonly IBrush Brass = NotaPalette.Accent;
- private static readonly IBrush AccentBright = NotaPalette.AccentBright;
+ private static readonly IBrush AccentHover = NotaPalette.AccentHover;
private static readonly IBrush AccentSubtle = NotaPalette.AccentSubtle;
private static readonly IBrush Success = NotaPalette.Success;
- private static readonly IBrush OnAccent = NotaPalette.TextOnAccent;
private static readonly IBrush TextPrimary = NotaPalette.TextPrimary;
private static readonly IBrush TextSecondary = NotaPalette.TextSecondary;
+ private static readonly IBrush TextMuted = NotaPalette.TextMuted;
private static readonly IBrush TextTertiary = NotaPalette.TextTertiary;
+ private static readonly IBrush TextDisabled = NotaPalette.TextDisabled;
- private static readonly string[] Sections = { "Audio", "MIDI", "Gamepads", "Plug-ins", "Get Plug-ins", "Library", "Appearance", "Shortcuts" };
+ private const double LabelCol = 150; // the label column every form row shares
+
+ // Sidebar: group heading, then its pages. Icons are 24×24 stroke paths drawn at 14px.
+ private sealed record Page(string Title, string Subtitle, string Icon);
+
+ private static readonly (string Group, Page[] Pages)[] Nav =
+ {
+ ("DEVICES", new[]
+ {
+ new Page("Audio", "Device, sample rate and buffer", "M4 10 V14 M8 7 V17 M12 4 V20 M16 8 V16 M20 11 V13"),
+ new Page("MIDI", "Controllers Nota listens to", "M4 5 H20 V19 H4 Z M8 5 V13 M12 5 V13 M16 5 V13"),
+ new Page("Gamepads", "Play notes or drive mapped controls", "M7 8 H17 A4 4 0 0 1 21 12 V13 A4 4 0 0 1 14 16 H10 A4 4 0 0 1 3 13 V12 A4 4 0 0 1 7 8 Z M7 11 V13 M6 12 H8 M16 11.5 H16.01 M18 12.5 H18.01"),
+ }),
+ ("PLUG-INS", new[]
+ {
+ new Page("Plug-ins", "Where Nota looks for VST3", "M9 3 V7 M15 3 V7 M6 7 H18 V11 A6 6 0 0 1 6 11 Z M12 17 V21"),
+ new Page("Downloads", "Nota plugin registry", "M12 4 V15 M7 10 L12 15 L17 10 M5 19 H19"),
+ }),
+ ("GENERAL", new[]
+ {
+ new Page("Library", "Default save and sample locations", "M3 7 A1 1 0 0 1 4 6 H9 L11 8 H20 A1 1 0 0 1 21 9 V18 A1 1 0 0 1 20 19 H4 A1 1 0 0 1 3 18 Z"),
+ new Page("Appearance", "Theme and AI control", "M12 4 A8 8 0 1 0 12 20 Z M12 4 A8 8 0 0 1 12 20"),
+ new Page("Shortcuts", "Keyboard reference", "M3 7 H21 V17 H3 Z M7 11 H7.01 M11 11 H11.01 M15 11 H15.01 M8 14 H16"),
+ }),
+ };
+
+ private const string SearchIcon = "M4 10.5 A6.5 6.5 0 1 0 17 10.5 A6.5 6.5 0 1 0 4 10.5 Z M15.5 15.5 L21 21";
- private readonly ObservableCollection<string> _paths = new();
private readonly MainWindowViewModel? _main;
private readonly IPluginCatalog _catalog = App.Services.GetRequiredService<IPluginCatalog>();
@@ -61,36 +92,53 @@ public sealed partial class PreferencesWindow : NotaWindow
private readonly List<string> _inputUids = new();
private bool _loading;
- private TextBlock? _audioStatus;
+ private TextBlock? _latencyValue, _latencyDetail;
private const double TestToneHz = 440;
private const int CpuCheckTicks = 50; // × 100 ms = 5 s
private bool _toneOn;
private DispatcherTimer? _cpuTimer;
+ private int _selFolder;
+ private string _shortcutFilter = "";
+
private readonly ContentControl _content = new();
- private readonly List<Border> _navItems = new();
+ private readonly List<NavItem> _navItems = new();
+ private int _selected = -1;
+
+ private sealed class NavItem
+ {
+ public required Border Root;
+ public required Border Edge;
+ public required Path Icon;
+ public required TextBlock Label;
+ public required TextBlock Badge;
+ }
public PreferencesWindow(SettingsViewModel vm, MainWindowViewModel? main = null)
{
_ = vm; // toolbar-side pref retired with the fixed 1b layout
_main = main;
- Title = "Preferences";
- Width = 760;
- Height = 596; // + title-bar band
- Background = Panel;
-
- var nav = new StackPanel { Spacing = 2, Margin = new Thickness(8) };
- for (int i = 0; i < Sections.Length; i++)
- {
- int idx = i;
- var item = new Border { CornerRadius = NotaRadius.Tile, Padding = new Thickness(10, 6), Cursor = new Cursor(StandardCursorType.Hand) };
- item.Child = new TextBlock { Text = Sections[i], FontSize = 11, VerticalAlignment = VerticalAlignment.Center };
- item.PointerPressed += (_, _) => Select(idx);
- _navItems.Add(item);
- nav.Children.Add(item);
+ Title = "Settings";
+ Width = 880;
+ Height = 640;
+ Background = Ground;
+
+ var nav = new StackPanel { Spacing = 2, Margin = new Thickness(10, 12) };
+ int index = 0;
+ foreach (var (group, pages) in Nav)
+ {
+ nav.Children.Add(new TextBlock
+ {
+ Text = group, FontSize = 9, FontWeight = FontWeight.Bold, LetterSpacing = 1.1,
+ Foreground = TextDisabled, Margin = new Thickness(10, 12, 10, 5),
+ });
+ foreach (var page in pages) nav.Children.Add(BuildNavItem(page, index++));
}
- var sidebar = new Border { Width = 170, Background = Sidebar, BorderBrush = Divider, BorderThickness = new Thickness(0, 0, 1, 0), Child = nav };
+ var sidebar = new Border
+ {
+ Width = 188, Background = Sidebar, BorderBrush = Divider, BorderThickness = new Thickness(0, 0, 1, 0), Child = nav,
+ };
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
grid.Children.Add(sidebar);
@@ -100,21 +148,86 @@ public sealed partial class PreferencesWindow : NotaWindow
Closed += (_, _) => { StopTests(); CancelStoreWork(); };
Select(0);
+ EnsureStoreLoading();
}
+ private static IEnumerable<Page> Pages => Nav.SelectMany(g => g.Pages);
+
+ private Control BuildNavItem(Page page, int idx)
+ {
+ var edge = new Border
+ {
+ Width = 2, CornerRadius = NotaRadius.Bar, Margin = new Thickness(0, 7),
+ HorizontalAlignment = HorizontalAlignment.Left, Background = Brushes.Transparent,
+ };
+ var icon = new Path { Data = Geometry.Parse(page.Icon), StrokeThickness = 1.6, StrokeLineCap = PenLineCap.Round, StrokeJoin = PenLineJoin.Round };
+ var label = new TextBlock { Text = page.Title, FontSize = 12, VerticalAlignment = VerticalAlignment.Center };
+ var badge = new TextBlock
+ {
+ FontSize = 9, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary,
+ VerticalAlignment = VerticalAlignment.Center, IsVisible = false,
+ };
+ var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto"), ColumnSpacing = 8, Margin = new Thickness(10, 0) };
+ var iconBox = IconBox(icon, 14);
+ row.Children.Add(iconBox);
+ Grid.SetColumn(label, 1); row.Children.Add(label);
+ Grid.SetColumn(badge, 2); row.Children.Add(badge);
+
+ var root = new Border
+ {
+ Height = 28, CornerRadius = NotaRadius.Tile, Background = Brushes.Transparent,
+ Cursor = new Cursor(StandardCursorType.Hand),
+ Child = new Panel { Children = { row, edge } },
+ };
+ root.PointerPressed += (_, e) => { if (e.GetCurrentPoint(root).Properties.IsLeftButtonPressed) Select(idx); };
+ root.PointerEntered += (_, _) => { if (idx != _selected) root.Background = Hover; };
+ root.PointerExited += (_, _) => { if (idx != _selected) root.Background = Brushes.Transparent; };
+ _navItems.Add(new NavItem { Root = root, Edge = edge, Icon = icon, Label = label, Badge = badge });
+ return root;
+ }
+
+ // A 24×24 stroke path scaled into a square box — the sidebar and search icons.
+ private static Control IconBox(Path path, double size)
+ => new Viewbox { Width = size, Height = size, VerticalAlignment = VerticalAlignment.Center, Child = new Canvas { Width = 24, Height = 24, Children = { path } } };
+
private void Select(int index)
{
StopTests(); // the Audio pane is rebuilt on every visit — don't leave a tone / check orphaned
+ _selected = index;
for (int i = 0; i < _navItems.Count; i++)
{
bool on = i == index;
- _navItems[i].Background = on ? AccentSubtle : Brushes.Transparent;
- ((TextBlock)_navItems[i].Child!).Foreground = on ? AccentBright : TextSecondary;
- ((TextBlock)_navItems[i].Child!).FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ var n = _navItems[i];
+ n.Root.Background = on ? AccentSubtle : Brushes.Transparent;
+ n.Edge.Background = on ? Brass : Brushes.Transparent;
+ n.Icon.Stroke = on ? Brass : TextTertiary;
+ n.Label.Foreground = on ? AccentHover : TextSecondary;
+ n.Label.FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
}
+
+ var page = Pages.ElementAt(index);
+ var header = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(0, 0, 0, 20) };
+ header.Children.Add(new TextBlock { Text = page.Title, FontSize = 17, FontWeight = FontWeight.SemiBold, Foreground = TextPrimary, VerticalAlignment = VerticalAlignment.Bottom });
+ header.Children.Add(new TextBlock { Text = page.Subtitle, FontSize = 11, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(0, 0, 0, 2) });
+
// Padding lives inside the scrolled content: a ScrollViewer's own Padding isn't part of
// its extent, so the last rows of a long pane (Shortcuts) couldn't be scrolled into view.
- _content.Content = new ScrollViewer { Content = new Border { Padding = new Thickness(20, 18), Child = BuildPane(index) } };
+ _content.Content = new ScrollViewer
+ {
+ Content = new Border
+ {
+ Padding = new Thickness(32, 26, 32, 40),
+ Child = new StackPanel { Children = { header, BuildPane(index) } },
+ },
+ };
+ }
+
+ // The Downloads item carries the number of registry plugins not installed yet.
+ private void UpdateDownloadsBadge(int count)
+ {
+ var badge = _navItems[4].Badge;
+ badge.Text = count.ToString();
+ badge.IsVisible = count > 0;
}
private Control BuildPane(int index) => index switch
@@ -133,88 +246,74 @@ public sealed partial class PreferencesWindow : NotaWindow
private Control AudioPane()
{
- var body = new StackPanel { Spacing = 14 };
- body.Children.Add(SectionLabel("AUDIO DEVICE"));
-
- if (_main is null)
- {
- body.Children.Add(new TextBlock { Text = "Audio settings are unavailable in this window.", FontSize = 11, Foreground = TextTertiary });
- return body;
- }
+ if (_main is null) return Caption("Audio settings are unavailable in this window.");
_loading = true;
var engine = _main.Engine;
var cfg = engine.GetAudioConfig();
- var outputCombo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
+ var outputCombo = Combo(280);
FillDeviceCombo(outputCombo, _outputUids, _audioDevices.OutputDevices(), cfg.OutputUid);
outputCombo.SelectionChanged += (_, _) => { int i = outputCombo.SelectedIndex; if (i >= 0 && i < _outputUids.Count) { engine.SetAudioOutputDevice(_outputUids[i]); Apply(); } };
- var inputCombo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
+ var inputCombo = Combo(280);
FillDeviceCombo(inputCombo, _inputUids, _audioDevices.InputDevices(), cfg.InputUid);
inputCombo.SelectionChanged += (_, _) => { int i = inputCombo.SelectedIndex; if (i >= 0 && i < _inputUids.Count) { engine.SetAudioInputDevice(_inputUids[i]); Apply(); } };
- var srCombo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
- foreach (var sr in SampleRates) srCombo.Items.Add(sr == 0 ? "Device default" : $"{sr:0}\u2009Hz");
+ var srCombo = Combo(150);
+ foreach (var sr in SampleRates) srCombo.Items.Add(sr == 0 ? "Device default" : NotaNum.Unit(sr, "0", "Hz"));
srCombo.SelectedIndex = IndexOf(SampleRates, cfg.SampleRate);
srCombo.SelectionChanged += (_, _) => { int i = srCombo.SelectedIndex; if (i >= 0) { engine.SetAudioSampleRate(SampleRates[i]); Apply(); } };
- var bufCombo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
- foreach (var b in BufferSizes) bufCombo.Items.Add(b == 0 ? "Device default" : $"{b} frames");
+ var bufCombo = Combo(150);
+ foreach (var b in BufferSizes) bufCombo.Items.Add(b == 0 ? "Device default" : b.ToString());
bufCombo.SelectedIndex = IndexOf(BufferSizes, cfg.BufferFrames);
bufCombo.SelectionChanged += (_, _) => { int i = bufCombo.SelectedIndex; if (i >= 0) { engine.SetAudioBufferFrames(BufferSizes[i]); Apply(); } };
- // WASAPI exclusive (Windows only): lets Nota own the output device for
- // the lowest latency, at the cost of muting other apps. The device then
- // dictates the sample rate / buffer, so those combos are ignored while
- // it's on. If the device refuses exclusive (busy / not allowed), the
- // backend falls back to shared mode and the status line warns the user.
- var exclusiveCheck = new CheckBox
- {
- Content = "WASAPI exclusive mode (lowest latency — mutes other apps)",
- IsChecked = cfg.WasapiExclusive,
- FontSize = 11,
- };
- exclusiveCheck.IsCheckedChanged += (_, _) =>
+ _latencyValue = new TextBlock { FontSize = 12, FontFamily = NotaFonts.MonoFamily, Foreground = TextPrimary };
+ _latencyDetail = new TextBlock { FontSize = 12, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap };
+ UpdateLatency();
+ var latency = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, VerticalAlignment = VerticalAlignment.Center, Children = { _latencyValue, _latencyDetail } };
+
+ var device = new List<Control>
{
- if (_loading) return;
- engine.SetAudioWasapiExclusive(exclusiveCheck.IsChecked ?? false);
- Apply();
+ Row("Output", outputCombo), Row("Input", inputCombo),
+ Row("Sample rate", srCombo), Row("Buffer size", bufCombo),
};
- var exclusiveNote = Caption("Exclusive mode takes over the device, so the sample rate and buffer size above are ignored — the device's native values are used. If the device is busy or doesn't allow exclusive access, Nota falls back to shared mode automatically.");
-
- _audioStatus = new TextBlock { FontSize = 11, Foreground = Success, TextWrapping = TextWrapping.Wrap, Text = StatusLine() };
- _audioStatus.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
-
- body.Children.Add(Row("Output", outputCombo));
- body.Children.Add(Row("Input", inputCombo));
- body.Children.Add(Row("Sample rate", srCombo));
- body.Children.Add(Row("Buffer size", bufCombo));
- // WASAPI exclusive is a Windows/WASAPI concept — hide it on other platforms.
+ // WASAPI exclusive (Windows only): lets Nota own the output device for the lowest
+ // latency, at the cost of muting other apps. The device then dictates the sample rate /
+ // buffer, so those are ignored while it's on. If the device refuses exclusive (busy /
+ // not allowed), the backend falls back to shared mode and the latency line says so.
if (OperatingSystem.IsWindows())
{
- body.Children.Add(exclusiveCheck);
- body.Children.Add(exclusiveNote);
+ device.Add(Row("Exclusive mode", SwitchRow("WASAPI exclusive — lowest latency, mutes other apps", cfg.WasapiExclusive, on =>
+ {
+ if (_loading) return;
+ engine.SetAudioWasapiExclusive(on);
+ Apply();
+ })));
+ device.Add(Row("", Caption("The device's native sample rate and buffer size are used instead of the ones above. If it is busy or doesn't allow exclusive access, Nota falls back to shared mode.")));
}
- body.Children.Add(Row("Latency", _audioStatus));
-
- body.Children.Add(DividerLine());
- body.Children.Add(SectionLabel("TEST"));
- body.Children.Add(TestToneRow(engine));
- body.Children.Add(CpuCheckRow(engine));
+ device.Add(Row("Latency", latency));
+ var body = Sections(
+ Section("AUDIO DEVICE", 6, device.ToArray()),
+ Section("TEST", 8, TestToneRow(), CpuCheckRow(engine)));
_loading = false;
return body;
}
- private Control TestToneRow(IAudioEngine engine)
+ private Control TestToneRow()
{
- var button = new Button { Content = "Play test tone", MinWidth = 120 };
+ var button = Btn("Play test tone");
+ button.Width = 132;
var note = Caption($"{TestToneHz:0}\u2009Hz sine at −14\u2009dBFS, through the master.");
button.Click += (_, _) =>
{
SetTone(!_toneOn);
- button.Content = _toneOn ? "Stop test tone" : "Play test tone";
+ button.Content = _toneOn
+ ? new StackPanel { Orientation = Orientation.Horizontal, Spacing = 7, Children = { new Glyph(GlyphKind.Stop, 8), new TextBlock { Text = "Stop tone" } } }
+ : "Play test tone";
button.Classes.Set("primary", _toneOn);
};
return TestRow("Output check", button, note);
@@ -232,7 +331,8 @@ public sealed partial class PreferencesWindow : NotaWindow
// counts dropouts over the same window, then gives a verdict for the current buffer size.
private Control CpuCheckRow(IAudioEngine engine)
{
- var button = new Button { Content = "CPU check", MinWidth = 120 };
+ var button = Btn("CPU check");
+ button.Width = 132;
var result = Caption("Measures audio-thread load for 5\u2009s — play your project for a real-world figure.");
button.Click += (_, _) =>
{
@@ -243,7 +343,7 @@ public sealed partial class PreferencesWindow : NotaWindow
result.Foreground = NotaPalette.Danger;
return;
}
- button.IsEnabled = false;
+ button.Content = "Measuring…";
result.Foreground = TextTertiary;
int ticks = 0, xrunsStart = engine.XrunCount;
double sum = 0, peak = 0;
@@ -254,21 +354,21 @@ public sealed partial class PreferencesWindow : NotaWindow
sum += load; peak = Math.Max(peak, load); ticks++;
if (ticks < CpuCheckTicks)
{
- result.Text = $"Measuring… {(CpuCheckTicks - ticks + 9) / 10}\u2009s · now {load * 100:0}\u2009%";
+ result.Text = $"Measuring… {(CpuCheckTicks - ticks + 9) / 10}\u2009s left · now {load * 100:0}\u2009%";
return;
}
StopCpuCheck();
- button.IsEnabled = true;
+ button.Content = "CPU check";
int xruns = Math.Max(0, engine.XrunCount - xrunsStart);
var (verdict, brush) = peak > 0.9 || xruns > 0
? ("overloaded — raise the buffer size", NotaPalette.Danger)
: peak > 0.7
? ("close to the limit — consider a larger buffer", NotaPalette.Warning)
- : ("plenty of headroom", Success);
- result.Text = $"Avg {sum / ticks * 100:0}\u2009% · peak {peak * 100:0}\u2009% · {xruns} dropout{(xruns == 1 ? "" : "s")} — {verdict}";
+ : ("plenty of headroom", TextSecondary);
+ result.Text = $"Last check: {sum / ticks * 100:0}\u2009% average, {peak * 100:0}\u2009% peak · {xruns} dropout{(xruns == 1 ? "" : "s")} — {verdict}.";
result.Foreground = brush;
};
- result.Text = "Measuring… 5\u2009s";
+ result.Text = "Measuring… 5\u2009s left — play your project for a real-world figure.";
_cpuTimer.Start();
};
return TestRow("Performance", button, result);
@@ -290,131 +390,121 @@ public sealed partial class PreferencesWindow : NotaWindow
{
if (_loading || _main is null) return;
_main.ApplyAudioSettings();
- if (_audioStatus is not null) _audioStatus.Text = StatusLine();
+ UpdateLatency();
}
- private string StatusLine()
+ // "11.6 ms" · "512 frames @ 44.1 kHz" — the negotiated block, not the requested one.
+ private void UpdateLatency()
{
- if (_main is null) return "";
+ if (_main is null || _latencyValue is null || _latencyDetail is null) return;
double sr = _main.Engine.NegotiatedSampleRate;
int buf = _main.Engine.NegotiatedBufferFrames;
- if (sr <= 0) return "Audio device not running.";
string mode = OperatingSystem.IsWindows() && _main.Engine.AudioExclusiveFallback
? " · exclusive refused → shared"
: OperatingSystem.IsWindows() && _main.Engine.GetAudioConfig().WasapiExclusive ? " · exclusive" : "";
- return buf > 0 ? $"{sr:0}\u2009Hz · {buf} frames{mode}" : $"{sr:0} Hz{mode}";
+ string rate = NotaNum.Unit(sr / 1000, "0.#", "kHz");
+ (_latencyValue.Text, _latencyDetail.Text) = sr <= 0
+ ? ("", "Audio device not running.")
+ : buf > 0
+ ? (NotaNum.Unit(buf / sr * 1000, "0.0", "ms"), $"{buf} frames @ {rate}{mode}")
+ : (rate, mode.TrimStart(' ', '·'));
+ _latencyValue.IsVisible = _latencyValue.Text.Length > 0;
}
// ---- MIDI -------------------------------------------------------------
private Control MidiPane()
{
- var body = new StackPanel { Spacing = 10 };
- body.Children.Add(SectionLabel("MIDI INPUTS"));
- if (_main is null) { body.Children.Add(Caption("MIDI settings are unavailable in this window.")); return body; }
+ if (_main is null) return Caption("MIDI settings are unavailable in this window.");
var engine = _main.Engine;
var devices = _midiDevices.InputDevices();
- if (devices.Count == 0) { body.Children.Add(Caption("No MIDI inputs detected.")); return body; }
-
- _loading = true;
- foreach (var dev in devices)
+ var items = new List<Control> { };
+ if (devices.Count == 0)
+ items.Add(EmptyBox("No MIDI inputs detected. Connect a controller and reopen Settings."));
+ else
{
- string uid = dev.Uid;
- var check = new CheckBox { Content = dev.Name, IsChecked = engine.IsMidiInputEnabled(uid) };
- check.IsCheckedChanged += (_, _) => { if (_loading) return; engine.SetMidiInputEnabled(uid, check.IsChecked ?? true); _main.ApplyMidiSettings(); };
- body.Children.Add(check);
+ var rows = new List<Control>();
+ foreach (var dev in devices)
+ {
+ string uid = dev.Uid;
+ bool on = engine.IsMidiInputEnabled(uid);
+ var dot = Dot(on ? Brass : BorderStrong);
+ var name = new TextBlock
+ {
+ Text = dev.Name, FontSize = 12, Foreground = on ? TextPrimary : TextTertiary,
+ VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis,
+ };
+ var sw = new ToggleSwitch(on, large: true) { VerticalAlignment = VerticalAlignment.Center };
+ sw.Changed += v =>
+ {
+ dot.Fill = v ? Brass : BorderStrong;
+ name.Foreground = v ? TextPrimary : TextTertiary;
+ engine.SetMidiInputEnabled(uid, v);
+ _main.ApplyMidiSettings();
+ };
+ var row = ListRow(40, "Auto,*,Auto", dot, name, sw);
+ row.Cursor = new Cursor(StandardCursorType.Hand);
+ row.PointerPressed += (_, e) => { if (e.GetCurrentPoint(row).Properties.IsLeftButtonPressed && !e.Handled) sw.Toggle(); };
+ rows.Add(row);
+ }
+ items.Add(Table(rows));
}
- body.Children.Add(Caption("Uncheck a controller to stop Nota listening to it. New devices are on by default."));
- _loading = false;
- return body;
+ items.Add(Caption("Switch a controller off to stop Nota listening to it. New devices are on by default."));
+ return Sections(Section("MIDI INPUTS", 8, items.ToArray()));
}
// ---- Gamepads -----------------------------------------------------------
private Control GamepadsPane()
{
- var body = new StackPanel { Spacing = 10 };
- body.Children.Add(SectionLabel("GAMEPAD INPUT"));
- if (_main is null) { body.Children.Add(Caption("Gamepad settings are unavailable in this window.")); return body; }
- if (!OperatingSystem.IsMacOS())
- {
- body.Children.Add(Caption("Gamepad input is macOS-only in this build."));
- return body;
- }
+ if (_main is null) return Caption("Gamepad settings are unavailable in this window.");
+ if (!OperatingSystem.IsMacOS()) return Caption("Gamepad input is macOS-only in this build.");
// The master switch lives in Settings (not the native engine): the pad thread
// always runs once started so new pads are still detected, but button edges only
// reach the engine while this is on.
- var enable = new CheckBox
+ var enable = SwitchRow("Use a connected gamepad for notes and mapped controls", _main.Settings.Current.GamepadEnabled, on =>
{
- Content = "Use a connected gamepad for notes and mapped controls",
- IsChecked = _main.Settings.Current.GamepadEnabled,
- };
- enable.IsCheckedChanged += (_, _) =>
- {
- _main.Settings.Current.GamepadEnabled = enable.IsChecked ?? false;
+ _main.Settings.Current.GamepadEnabled = on;
_main.Settings.Save();
- };
- body.Children.Add(enable);
+ });
- // Connected pads, refreshed by the service hot-plug event (the UI tick
- // raises it when the pad count changes). Each row shows a live-connection
- // dot, the pad name, and a "Last:" readout that flashes on every button
- // press so the user can confirm the pad is wired up before they record.
- var padList = new StackPanel { Spacing = 6 };
+ // Connected pads, refreshed by the service hot-plug event (the UI tick raises it when
+ // the pad count changes). Each row shows a live-connection dot, the pad name, and a
+ // "Last" readout that flashes on every button press so the user can confirm the pad is
+ // wired up before they record.
+ var padHost = new ContentControl();
var lastLabels = new Dictionary<int, TextBlock>(); // pad slot → activity readout
var flashTimers = new Dictionary<int, DispatcherTimer>(); // pad slot → fade-back timer
void RebuildPads()
{
- padList.Children.Clear();
lastLabels.Clear();
var pads = _gamepads.Pads();
if (pads.Count == 0)
{
- padList.Children.Add(Caption("No gamepad detected. Connect one and it appears here."));
+ padHost.Content = EmptyBox("No gamepad detected. Connect one and it appears here.");
return;
}
+ var rows = new List<Control>();
for (int i = 0; i < pads.Count; i++)
{
var last = new TextBlock
{
- Text = "—", FontSize = 11, Foreground = TextTertiary,
+ Text = "—", FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary,
VerticalAlignment = VerticalAlignment.Center, MinWidth = 64, TextAlignment = TextAlignment.Right,
};
lastLabels[i] = last;
-
- var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto,Auto") };
- var dot = new Ellipse
- {
- Width = 8, Height = 8, Fill = Success, Margin = new Thickness(0, 0, 8, 0),
- VerticalAlignment = VerticalAlignment.Center,
- };
var name = new TextBlock
{
Text = pads[i].Name, FontSize = 12, Foreground = TextPrimary,
VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis,
};
- var lastCap = new TextBlock
- {
- Text = "Last: ", FontSize = 11, Foreground = TextTertiary,
- VerticalAlignment = VerticalAlignment.Center,
- };
- Grid.SetColumn(dot, 0);
- Grid.SetColumn(name, 1);
- Grid.SetColumn(lastCap, 2);
- Grid.SetColumn(last, 3);
- row.Children.Add(dot);
- row.Children.Add(name);
- row.Children.Add(lastCap);
- row.Children.Add(last);
- padList.Children.Add(new Border
- {
- Background = Sunken, CornerRadius = NotaRadius.Panel,
- Padding = new Thickness(10, 6), Child = row,
- });
+ var cap = new TextBlock { Text = "Last", FontSize = 11, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center };
+ rows.Add(ListRow(40, "Auto,*,Auto,Auto", Dot(Success), name, cap, last));
}
+ padHost.Content = Table(rows);
}
RebuildPads();
_gamepads.PadsChanged += RebuildPads;
@@ -449,25 +539,78 @@ public sealed partial class PreferencesWindow : NotaWindow
_gamepads.Activity -= OnActivity;
foreach (var t in flashTimers.Values) t.Stop();
};
- body.Children.Add(padList);
- body.Children.Add(DividerLine());
- body.Children.Add(SectionLabel("LAYOUT"));
- body.Children.Add(Caption("Face buttons play C4 D4 E4 F4 · shoulder buttons play G4 A4 B4 C5 · d-pad up/down shifts the octave · d-pad left/right nudges velocity. Notes go to the armed (record-enabled) instrument track — enable Record to capture them, or use the audition track to just play."));
- body.Children.Add(Caption("Any button can be mapped to a control instead: click MIDI in the top-right, click the control, then press the button. A mapped button drives that control and stops playing its note; the rest of the pad keeps the layout above. The sticks and the trigger travel map the same way and are continuous, so they suit a knob or a fader — they play no notes, and do nothing until mapped. Mappings are listed in the browser's MIDI Map tab and travel with the project."));
- return body;
+ var map = new List<Control>();
+ foreach (var (input, action) in new[]
+ {
+ ("Face buttons", "C4 D4 E4 F4"), ("Shoulder buttons", "G4 A4 B4 C5"),
+ ("D-pad up / down", "Octave −1 / +1"), ("D-pad left / right", "Velocity − / +"),
+ })
+ {
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions($"{LabelCol},*") };
+ grid.Children.Add(new TextBlock { Text = input, FontSize = 12, Foreground = TextSecondary, Margin = new Thickness(12, 9) });
+ var a = new TextBlock { Text = action, FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = TextPrimary, Margin = new Thickness(12, 9), VerticalAlignment = VerticalAlignment.Center };
+ Grid.SetColumn(a, 1);
+ grid.Children.Add(a);
+ map.Add(grid);
+ }
+
+ return Sections(
+ Section("GAMEPAD INPUT", 10, enable, padHost),
+ Section("LAYOUT", 10,
+ Table(map),
+ Caption("Notes go to the armed (record-enabled) instrument track — enable Record to capture them, or use the audition track to just play.", muted: true),
+ Caption("Any button can be mapped to a control instead: click MIDI in the top-right, click the control, then press the button. A mapped button drives that control and stops playing its note; the rest of the pad keeps the layout above. The sticks and the trigger travel map the same way and are continuous, so they suit a knob or a fader — they play no notes, and do nothing until mapped. Mappings are listed in the browser's MIDI Map tab and travel with the project.")));
}
// ---- Plug-ins ---------------------------------------------------------
private Control PluginsPane()
{
- var body = new StackPanel { Spacing = 10 };
- body.Children.Add(SectionLabel("PLUGIN SCAN FOLDERS"));
+ var list = new StackPanel();
+ var well = new Border
+ {
+ Background = Sunken, BorderBrush = Divider, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Panel, Padding = new Thickness(4), MinHeight = 132, Child = list,
+ };
+ var addBtn = Btn("Add folder…");
+ var removeBtn = Btn("Remove");
+
+ // Nota's own install folder (Downloads) is always searched — it is re-added at startup,
+ // so it is tagged and can't be removed.
+ bool IsDefault(string? path) => string.Equals(path, _store.PluginsDir, StringComparison.Ordinal);
+
+ void RenderFolders()
+ {
+ list.Children.Clear();
+ int n = _catalog.ScanPathCount;
+ if (_selFolder >= n) _selFolder = n - 1;
+ for (int i = 0; i < n; i++)
+ {
+ int idx = i;
+ var path = _catalog.ScanPath(i) ?? "?";
+ bool sel = i == _selFolder;
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 8 };
+ grid.Children.Add(new TextBlock
+ {
+ Text = path, FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = sel ? TextPrimary : TextSecondary,
+ VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis,
+ });
+ var tag = new TextBlock { Text = IsDefault(path) ? "default" : "", FontSize = 10, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center };
+ Grid.SetColumn(tag, 1);
+ grid.Children.Add(tag);
+ var row = new Border
+ {
+ Height = 28, Padding = new Thickness(8, 0), CornerRadius = NotaRadius.Control,
+ Background = sel ? AccentSubtle : Brushes.Transparent, Cursor = new Cursor(StandardCursorType.Hand), Child = grid,
+ };
+ row.PointerPressed += (_, _) => { _selFolder = idx; RenderFolders(); };
+ list.Children.Add(row);
+ }
+ removeBtn.IsEnabled = _selFolder >= 0 && _selFolder < n && !IsDefault(_catalog.ScanPath(_selFolder));
+ }
+ RenderFolders();
- var pathList = new ListBox { ItemsSource = _paths, Height = 200 };
- RefreshPaths();
- var addBtn = new Button { Content = "Add folder…" };
addBtn.Click += async (_, _) =>
{
Activate();
@@ -476,83 +619,94 @@ public sealed partial class PreferencesWindow : NotaWindow
var path = folders[0].TryGetLocalPath();
if (path is null) return;
_catalog.AddScanPath(path);
- RefreshPaths();
+ _selFolder = _catalog.ScanPathCount - 1;
+ RenderFolders();
+ };
+ removeBtn.Click += (_, _) =>
+ {
+ if (_selFolder < 0 || _selFolder >= _catalog.ScanPathCount) return;
+ _catalog.RemoveScanPath(_selFolder);
+ _selFolder = Math.Max(0, _selFolder - 1);
+ RenderFolders();
};
- var removeBtn = new Button { Content = "Remove" };
- removeBtn.Click += (_, _) => { int i = pathList.SelectedIndex; if (i >= 0) { _catalog.RemoveScanPath(i); RefreshPaths(); } };
-
- body.Children.Add(pathList);
- body.Children.Add(new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { addBtn, removeBtn } });
- body.Children.Add(Caption("Extra folders are searched for VST3 plugins on the next rescan (AU uses the system registry)."));
- body.Children.Add(DividerLine());
- body.Children.Add(SectionLabel("SCAN"));
- var rescanStatus = Caption("");
- var rescan = new Button { Content = "Rescan plugins" };
+ var rescanStatus = new TextBlock { FontSize = 11, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
+ var rescan = Btn("Rescan plugins");
rescan.Click += async (_, _) =>
{
if (_main is null) { rescanStatus.Text = "Plugin scanning is unavailable in this window."; return; }
rescan.IsEnabled = false;
- rescanStatus.Text = "Scanning…";
+ rescan.Content = "Scanning…";
+ int folders = _catalog.ScanPathCount;
+ rescanStatus.Text = $"Searching {folders} folder{(folders == 1 ? "" : "s")}";
try
{
int? n = await PluginScan.RescanAsync(_main);
rescanStatus.Text = n is { } c ? $"Found {c} plugin{(c == 1 ? "" : "s")}." : "Scanner worker not found.";
}
- finally { rescan.IsEnabled = true; }
+ finally { rescan.IsEnabled = true; rescan.Content = "Rescan plugins"; }
};
- body.Children.Add(rescan);
- body.Children.Add(rescanStatus);
- return body;
+
+ return Sections(
+ Section("PLUGIN SCAN FOLDERS", 10,
+ well,
+ new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { addBtn, removeBtn } },
+ Caption("Extra folders are searched for VST3 plugins on the next rescan (AU uses the system registry).")),
+ Section("SCAN", 10,
+ new StackPanel { Orientation = Orientation.Horizontal, Spacing = 14, Children = { rescan, rescanStatus } }));
}
// ---- Library ----------------------------------------------------------
private Control LibraryPane()
{
- var body = new StackPanel { Spacing = 12 };
- body.Children.Add(SectionLabel("CONTENT FOLDERS"));
- if (_main is null) { body.Children.Add(Caption("Content folders are unavailable in this window.")); return body; }
+ if (_main is null) return Caption("Content folders are unavailable in this window.");
var settings = _main.Settings;
- body.Children.Add(FolderRow("Samples",
- () => settings.Current.SamplesFolder, () => settings.ResolvedSamplesFolder(),
- path => { settings.Current.SamplesFolder = path; settings.Save(); _main.Browser.RebuildSamples(); }));
- body.Children.Add(FolderRow("Projects",
- () => settings.Current.ProjectsFolder, () => settings.ResolvedProjectsFolder(),
- path => { settings.Current.ProjectsFolder = path; settings.Save(); _main.Browser.RebuildProjects(); }));
- return body;
+ return Sections(Section("CONTENT FOLDERS", 10, Table(new List<Control>
+ {
+ FolderRow("Samples",
+ () => settings.Current.SamplesFolder, () => settings.ResolvedSamplesFolder(),
+ path => { settings.Current.SamplesFolder = path; settings.Save(); _main.Browser.RebuildSamples(); }),
+ FolderRow("Projects",
+ () => settings.Current.ProjectsFolder, () => settings.ResolvedProjectsFolder(),
+ path => { settings.Current.ProjectsFolder = path; settings.Save(); _main.Browser.RebuildProjects(); }),
+ })));
}
private Control FolderRow(string label, Func<string> get, Func<string> resolved, Action<string> set)
{
- var pathText = Caption(string.IsNullOrWhiteSpace(get()) ? $"(default) {resolved()}" : get());
- var choose = new Button { Content = "Choose…", Classes = { "ghost" } };
+ bool custom = !string.IsNullOrWhiteSpace(get());
+ var path = new TextBlock
+ {
+ Text = custom ? get() : resolved(), FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = TextPrimary,
+ TextTrimming = TextTrimming.CharacterEllipsis,
+ };
+ var tag = new TextBlock { Text = custom ? "custom" : "default", FontSize = 10, Foreground = TextTertiary };
+ var choose = Btn("Choose…");
choose.Click += async (_, _) =>
{
Activate();
var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { Title = $"Choose {label} folder", AllowMultiple = false });
if (folders.Count == 0) return;
- var path = folders[0].TryGetLocalPath();
- if (path is null) return;
- set(path);
- pathText.Text = path;
- };
- return new StackPanel
- {
- Spacing = 3,
- Children =
- {
- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { new TextBlock { Text = label, FontSize = 11, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center }, choose } },
- pathText,
- },
+ var p = folders[0].TryGetLocalPath();
+ if (p is null) return;
+ set(p);
+ path.Text = p;
+ tag.Text = "custom";
};
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("110,*,Auto"), ColumnSpacing = 12, Margin = new Thickness(14, 12) };
+ grid.Children.Add(new TextBlock { Text = label, FontSize = 12, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center });
+ var text = new StackPanel { Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { path, tag } };
+ Grid.SetColumn(text, 1); grid.Children.Add(text);
+ Grid.SetColumn(choose, 2); grid.Children.Add(choose);
+ return grid;
}
// ---- Appearance -------------------------------------------------------
- // Dark / Light / System as a segmented control. The choice applies immediately —
- // NotaThemeService re-tints the palette and repaints every open window — and is
- // persisted so the next launch starts in the same variant.
+ // Graphite / Paper / System as a segmented control, each with a swatch of its ground. The
+ // choice applies immediately — NotaThemeService re-tints the palette and repaints every
+ // open window — and is persisted so the next launch starts in the same variant.
private static Control ThemePicker()
{
var settings = App.Services.GetRequiredService<ISettingsService>();
@@ -569,7 +723,12 @@ public sealed partial class PreferencesWindow : NotaWindow
var m = mode;
var btn = new ToggleButton
{
- Content = label, Classes = { "seg" },
+ Classes = { "seg" }, FontSize = 12,
+ Content = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 7,
+ Children = { new ThemeSwatch(m), new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center } },
+ },
IsChecked = settings.Current.Theme == m,
};
btn.Click += (_, _) =>
@@ -585,40 +744,102 @@ public sealed partial class PreferencesWindow : NotaWindow
strip.Children.Add(btn);
}
- return new Border { Classes = { "segmented" }, Child = strip };
+ return new Border { Classes = { "segmented" }, HorizontalAlignment = HorizontalAlignment.Left, Child = strip };
}
- private Control AppearancePane()
+ // A 10px chip of a variant's ground — both variants at once, whichever one is live.
+ // System is split corner to corner, Paper over Graphite.
+ private sealed class ThemeSwatch : Control
{
- var body = new StackPanel { Spacing = 14 };
- body.Children.Add(SectionLabel("UI"));
+ private readonly AppTheme _mode;
+ public ThemeSwatch(AppTheme mode) { _mode = mode; Width = 10; Height = 10; VerticalAlignment = VerticalAlignment.Center; }
- body.Children.Add(Row("Theme", ThemePicker()));
- body.Children.Add(Caption("Ember Graphite is the warm dark palette; Ember Paper is the same system on a light ground. System follows the OS appearance and switches with it."));
+ public override void Render(DrawingContext ctx)
+ {
+ var dark = new ImmutableSolidColorBrush(NotaPalette.ColorIn(NotaPalette.SurfaceCard, NotaThemeVariant.Dark));
+ var light = new ImmutableSolidColorBrush(NotaPalette.ColorIn(NotaPalette.SurfaceCard, NotaThemeVariant.Light));
+ var r = new Rect(0, 0, Width, Height);
+ var box = new RoundedRect(r, NotaRadius.ClipValue);
+ using (ctx.PushClip(box))
+ {
+ ctx.FillRectangle(_mode == AppTheme.Dark ? dark : light, r);
+ if (_mode == AppTheme.System)
+ {
+ var g = new StreamGeometry();
+ using (var c = g.Open())
+ {
+ c.BeginFigure(new Point(r.Right, r.Top), true);
+ c.LineTo(r.BottomRight);
+ c.LineTo(r.BottomLeft);
+ c.EndFigure(true);
+ }
+ ctx.DrawGeometry(dark, null, g);
+ }
+ }
+ ctx.DrawRectangle(null, new Pen(BorderStrong, 1), new RoundedRect(r.Deflate(0.5), NotaRadius.ClipValue));
+ }
+ }
- // ---- AI control (MCP server) ----
- body.Children.Add(DividerLine());
- body.Children.Add(SectionLabel("AI CONTROL (MCP)"));
+ private Control AppearancePane()
+ {
var settings = App.Services.GetService<ISettingsService>();
var mcp = App.Services.GetService<McpService>();
- var enable = new CheckBox { Content = "Enable MCP server (let an AI drive Nota)", FontSize = 11, IsChecked = settings?.Current.McpEnabled ?? false };
- var portBox = new TextBox { Text = (settings?.Current.McpPort ?? 3900).ToString(), Width = 90, Classes = { "field" } };
- var status = Caption("");
- void RefreshStatus() => status.Text = (settings?.Current.McpEnabled ?? false)
- ? $"Listening on http://127.0.0.1:{settings!.Current.McpPort}/ (loopback)"
- : "Off.";
- void ApplyMcp()
+
+ // ---- AI control (MCP server) ----
+ var portBox = new TextBox
+ {
+ Text = (settings?.Current.McpPort ?? 3900).ToString(), Width = 96, Classes = { "field" },
+ FontSize = 12, FontFamily = NotaFonts.MonoFamily, HorizontalAlignment = HorizontalAlignment.Left,
+ };
+ var statusDot = Dot(BorderStrong);
+ var status = new TextBlock
+ {
+ FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = TextSecondary,
+ VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis,
+ };
+ var copyBtn = Btn("Copy config");
+ copyBtn.HorizontalAlignment = HorizontalAlignment.Left;
+ var details = new StackPanel
+ {
+ Spacing = 10,
+ Children =
+ {
+ Row("Port", portBox),
+ Row("Status", new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { statusDot, status } }),
+ Row("", new StackPanel
+ {
+ Spacing = 10,
+ Children =
+ {
+ copyBtn,
+ Caption("Add this config (or the URL) as an MCP server in Claude Desktop / Claude Code. Loopback only; off by default."),
+ },
+ }),
+ },
+ };
+
+ bool Enabled() => settings?.Current.McpEnabled ?? false;
+ void Refresh()
+ {
+ bool on = Enabled();
+ status.Text = on ? $"Listening on http://127.0.0.1:{settings!.Current.McpPort}/ (loopback)" : "Off";
+ statusDot.Fill = on ? NotaPalette.SuccessDim : BorderStrong;
+ portBox.IsEnabled = on;
+ portBox.Foreground = on ? TextPrimary : TextDisabled;
+ copyBtn.IsEnabled = on;
+ Inactive.Set(details, !on);
+ }
+ void ApplyMcp(bool on)
{
if (settings is null) return;
- settings.Current.McpEnabled = enable.IsChecked ?? false;
+ settings.Current.McpEnabled = on;
if (int.TryParse(portBox.Text, out var p) && p is > 0 and < 65536) settings.Current.McpPort = p;
settings.Save();
_ = mcp?.ApplyAsync();
- RefreshStatus();
+ Refresh();
}
- enable.IsCheckedChanged += (_, _) => ApplyMcp();
- portBox.LostFocus += (_, _) => ApplyMcp();
- RefreshStatus();
+ var enable = SwitchRow("Enable MCP server (let an AI drive Nota)", Enabled(), ApplyMcp);
+ portBox.LostFocus += (_, _) => ApplyMcp(Enabled());
// Copy a ready client-config JSON (Claude Desktop / Claude Code) with the current port.
string McpConfigJson()
@@ -626,18 +847,26 @@ public sealed partial class PreferencesWindow : NotaWindow
int port = settings?.Current.McpPort ?? 3900;
return "{\n \"mcpServers\": {\n \"nota\": {\n \"type\": \"http\",\n \"url\": \"http://127.0.0.1:" + port + "/\"\n }\n }\n}";
}
- var copyBtn = new Button { Content = "Copy config", FontSize = 11 };
+ DispatcherTimer? copied = null;
copyBtn.Click += async (_, _) =>
{
var cb = TopLevel.GetTopLevel(this)?.Clipboard;
- if (cb is not null) { await cb.SetTextAsync(McpConfigJson()); status.Text = "Config copied to clipboard."; }
+ if (cb is null) return;
+ await cb.SetTextAsync(McpConfigJson());
+ copyBtn.Content = "Copied";
+ copied?.Stop();
+ copied = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(1500) };
+ copied.Tick += (_, _) => { copied!.Stop(); copyBtn.Content = "Copy config"; };
+ copied.Start();
};
-
- body.Children.Add(enable);
- body.Children.Add(Row("Port", portBox));
- body.Children.Add(new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { copyBtn, status } });
- body.Children.Add(Caption("Add this config (or the URL) as an MCP server in Claude Desktop / Claude Code. Loopback only; off by default."));
- return body;
+ // Inactive.Set walks the visual tree, so the dimming waits until the pane is shown.
+ details.AttachedToVisualTree += (_, _) => Refresh();
+
+ return Sections(
+ Section("UI", 10,
+ Row("Theme", ThemePicker()),
+ Row("", Caption("Ember Graphite is the warm dark palette; Ember Paper is the same system on a light ground. System follows the OS appearance and switches with it."))),
+ Section("AI CONTROL (MCP)", 12, enable, details));
}
// ---- Shortcuts --------------------------------------------------------
@@ -645,8 +874,8 @@ public sealed partial class PreferencesWindow : NotaWindow
// NB: this list mirrors the real key handlers — keep the two in sync (see the
// `nota-shortcuts` skill). Bindings live in MainWindow.Input.cs (transport, global
// editing, computer-keyboard notes), PianoRollView.cs (note editing) and PreviewPlayer.cs
- // (the Files tab's sample player). ⌘ = Meta on
- // macOS / Ctrl on Windows.
+ // (the Files tab's sample player). ⌘ = Meta on macOS / Ctrl on Windows. A Key made only of
+ // keys (see IsKeyToken) is drawn as one key-cap per token; a gesture is plain text.
private static readonly (string Title, (string Key, string Action)[] Rows)[] ShortcutGroups =
{
("TRANSPORT", new[]
@@ -745,46 +974,206 @@ public sealed partial class PreferencesWindow : NotaWindow
private Control ShortcutsPane()
{
- var body = new StackPanel { Spacing = 14 };
- foreach (var (title, rows) in ShortcutGroups)
+ var groups = new StackPanel { Spacing = 18 };
+ var filter = new TextBox { PlaceholderText = "Filter shortcuts", Text = _shortcutFilter, Classes = { "search" }, FontSize = 12 };
+
+ void Render()
{
- body.Children.Add(SectionLabel(title));
- var stack = new StackPanel { Spacing = 6 };
- foreach (var (key, action) in rows) stack.Children.Add(ShortcutRow(key, action));
- body.Children.Add(stack);
+ groups.Children.Clear();
+ var q = _shortcutFilter.Trim();
+ foreach (var (title, rows) in ShortcutGroups)
+ {
+ var shown = rows.Where(r => q.Length == 0
+ || r.Action.Contains(q, StringComparison.OrdinalIgnoreCase)
+ || r.Key.Contains(q, StringComparison.OrdinalIgnoreCase)).ToList();
+ if (shown.Count == 0) continue;
+ var head = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 8, Margin = new Thickness(0, 0, 0, 4),
+ Children =
+ {
+ new TextBlock { Text = title, Classes = { "SectionLabel" }, VerticalAlignment = VerticalAlignment.Center },
+ new TextBlock { Text = shown.Count.ToString(), FontSize = 9, FontFamily = NotaFonts.MonoFamily, Foreground = TextDisabled, VerticalAlignment = VerticalAlignment.Center },
+ },
+ };
+ groups.Children.Add(new StackPanel { Spacing = 6, Children = { head, Table(shown.Select(r => ShortcutRow(r.Key, r.Action)).ToList()) } });
+ }
+ if (groups.Children.Count == 0) groups.Children.Add(Caption("Nothing matches."));
}
- return body;
+ filter.TextChanged += (_, _) => { _shortcutFilter = filter.Text ?? ""; Render(); };
+ Render();
+
+ return new StackPanel { Spacing = 18, Children = { SearchField(filter, 320), groups } };
}
- private Control ShortcutRow(string key, string action)
+ private static readonly HashSet<string> NamedKeys = new(StringComparer.Ordinal) { "Space", "Return", "Delete", "Tab", "Esc" };
+
+ // A token that names a key: no lower-case letters (⌘⇧Z, ←, A, 0), or a named key.
+ private static bool IsKeyToken(string t) => NamedKeys.Contains(t) || !t.Any(char.IsLower);
+
+ private static Control ShortcutRow(string key, string action)
{
- var cap = new Border
+ var tokens = key.Split(' ', StringSplitOptions.RemoveEmptyEntries);
+ Control keys;
+ if (tokens.All(IsKeyToken))
{
- Background = Raised, BorderBrush = BorderStrong, BorderThickness = new Thickness(1),
- CornerRadius = NotaRadius.Control, Padding = new Thickness(7, 2),
- VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left,
- };
- var kt = new TextBlock { Text = key, FontSize = 10, Foreground = TextPrimary };
- kt.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
- cap.Child = kt;
- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("190,*") };
- grid.Children.Add(cap);
- var a = new TextBlock { Text = action, FontSize = 11, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
+ var wrap = new WrapPanel { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center };
+ foreach (var t in tokens)
+ wrap.Children.Add(t is "/" or "·"
+ ? new TextBlock { Text = t, FontSize = 11, Foreground = TextTertiary, Margin = new Thickness(0, 0, 4, 0), VerticalAlignment = VerticalAlignment.Center }
+ : KeyCap(t));
+ keys = wrap;
+ }
+ else
+ {
+ keys = new TextBlock { Text = key, FontSize = 12, Foreground = TextPrimary, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center };
+ }
+
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions($"{LabelCol},*"), ColumnSpacing = 12, MinHeight = 20, Margin = new Thickness(12, 7) }; // 34 with the margin
+ grid.Children.Add(keys);
+ var a = new TextBlock { Text = action, FontSize = 12, LineHeight = 17, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
Grid.SetColumn(a, 1);
grid.Children.Add(a);
return grid;
}
+ // A key-cap: raised face, hairline sides and a stronger bottom edge.
+ private static Control KeyCap(string label)
+ {
+ var text = new TextBlock
+ {
+ Text = label, FontSize = 11, FontFamily = NotaFonts.MonoFamily, Foreground = TextPrimary,
+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
+ };
+ return new Border
+ {
+ Height = 20, MinWidth = 20, Margin = new Thickness(0, 1, 4, 1),
+ CornerRadius = NotaRadius.Control, Background = BorderStrong,
+ BorderBrush = Divider, BorderThickness = new Thickness(1, 1, 1, 0),
+ Child = new Border
+ {
+ Background = Raised, CornerRadius = NotaRadius.Badge, Margin = new Thickness(0, 0, 0, 1),
+ Padding = new Thickness(6, 0), Child = text,
+ },
+ };
+ }
+
// ---- helpers ----------------------------------------------------------
+ // Stacks sections top to bottom; every one after the first sits under a hairline.
+ private static Control Sections(params Control[] sections)
+ {
+ var stack = new StackPanel();
+ for (int i = 0; i < sections.Length; i++)
+ stack.Children.Add(i == 0 ? sections[i] : new Border
+ {
+ Margin = new Thickness(0, 22, 0, 0), Padding = new Thickness(0, 20, 0, 0),
+ BorderBrush = Hairline, BorderThickness = new Thickness(0, 1, 0, 0), Child = sections[i],
+ });
+ return stack;
+ }
+
+ private static Control Section(string title, double spacing, params Control[] children)
+ {
+ var stack = new StackPanel { Spacing = spacing };
+ stack.Children.Add(SectionLabel(title));
+ foreach (var c in children) stack.Children.Add(c);
+ return stack;
+ }
+
+ // Rows in one bordered box on the panel ground, a hairline between them.
+ private static Control Table(IReadOnlyList<Control> rows)
+ {
+ var stack = new StackPanel();
+ for (int i = 0; i < rows.Count; i++)
+ stack.Children.Add(new Border
+ {
+ Background = RowBg, BorderBrush = Hairline, BorderThickness = new Thickness(0, i == 0 ? 0 : 1, 0, 0), Child = rows[i],
+ });
+ return new Border
+ {
+ BorderBrush = Divider, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel,
+ ClipToBounds = true, Child = stack,
+ };
+ }
+
+ // A fixed-height table row: cells laid into the given columns, 12 apart.
+ private static Grid ListRow(double height, string columns, params Control[] cells)
+ {
+ var grid = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions(columns), ColumnSpacing = 12, Height = height,
+ Margin = new Thickness(12, 0), Background = Brushes.Transparent,
+ };
+ for (int i = 0; i < cells.Length; i++) { Grid.SetColumn(cells[i], i); grid.Children.Add(cells[i]); }
+ return grid;
+ }
+
+ // The empty state of a device list: a dashed outline, an idle dot and one line.
+ private static Control EmptyBox(string text)
+ {
+ var outline = new Rectangle
+ {
+ Stroke = Divider, StrokeThickness = 1, StrokeDashArray = new AvaloniaList<double> { 3, 3 },
+ RadiusX = NotaRadius.PanelValue, RadiusY = NotaRadius.PanelValue,
+ };
+ var line = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(14, 0), VerticalAlignment = VerticalAlignment.Center,
+ Children = { Dot(BorderStrong), new TextBlock { Text = text, FontSize = 11, Foreground = TextMuted, VerticalAlignment = VerticalAlignment.Center } },
+ };
+ return new Panel { Height = 44, Children = { outline, line } };
+ }
+
+ private static Ellipse Dot(IBrush fill) => new() { Width = 6, Height = 6, Fill = fill, VerticalAlignment = VerticalAlignment.Center };
+
+ // A settings switch (28×16) with its sentence; the sentence toggles it too.
+ private static Control SwitchRow(string text, bool on, Action<bool> changed)
+ {
+ var sw = new ToggleSwitch(on, large: true) { VerticalAlignment = VerticalAlignment.Center };
+ sw.Changed += changed;
+ var label = new TextBlock { Text = text, FontSize = 12, Foreground = TextPrimary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
+ label.Cursor = new Cursor(StandardCursorType.Hand);
+ label.PointerPressed += (_, e) => { if (e.GetCurrentPoint(label).Properties.IsLeftButtonPressed) { sw.Toggle(); e.Handled = true; } };
+ return new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, Children = { sw, label } };
+ }
+
+ // A search / filter box: the sunken field with a magnifier, the borderless TextBox inside.
+ private static Control SearchField(TextBox box, double maxWidth)
+ {
+ var icon = new Path { Data = Geometry.Parse(SearchIcon), Stroke = TextTertiary, StrokeThickness = 2, StrokeLineCap = PenLineCap.Round };
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), ColumnSpacing = 7 };
+ grid.Children.Add(IconBox(icon, 11));
+ box.VerticalAlignment = VerticalAlignment.Center;
+ Grid.SetColumn(box, 1);
+ grid.Children.Add(box);
+ return new Border
+ {
+ Height = 30, MaxWidth = maxWidth, Padding = new Thickness(10, 0), Background = Sunken,
+ BorderBrush = Divider, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Child = grid,
+ HorizontalAlignment = double.IsInfinity(maxWidth) ? HorizontalAlignment.Stretch : HorizontalAlignment.Left,
+ Width = double.IsInfinity(maxWidth) ? double.NaN : maxWidth,
+ };
+ }
+
+ // Settings buttons sit at the form scale: 28 tall, 12px label.
+ private static Button Btn(string text) => new()
+ {
+ Content = text, Height = 28, FontSize = 12, CornerRadius = NotaRadius.Tile, Padding = new Thickness(14, 0),
+ };
+
+ private static ComboBox Combo(double width) => new()
+ {
+ Width = width, FontSize = 12, CornerRadius = NotaRadius.Tile, HorizontalAlignment = HorizontalAlignment.Left,
+ };
+
// Label · button · caption; the caption gets the remaining width so a long result wraps.
private static Control TestRow(string label, Button button, TextBlock caption)
{
- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("130,Auto,*") };
- grid.Children.Add(new TextBlock { Text = label, FontSize = 11, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center });
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions($"{LabelCol},132,*"), ColumnSpacing = 14, MinHeight = 34 };
+ grid.Children.Add(RowLabel(label));
Grid.SetColumn(button, 1);
grid.Children.Add(button);
- caption.Margin = new Thickness(10, 0, 0, 0);
Grid.SetColumn(caption, 2);
grid.Children.Add(caption);
return grid;
@@ -792,26 +1181,32 @@ public sealed partial class PreferencesWindow : NotaWindow
private static TextBlock SectionLabel(string text) => new()
{
- Text = text, FontSize = 10, FontWeight = FontWeight.Bold, Foreground = TextTertiary,
+ Text = text, Classes = { "SectionLabel" }, LetterSpacing = 1.2, Margin = new Thickness(0, 0, 0, 4),
};
- private static TextBlock Caption(string text) => new()
+ private static TextBlock RowLabel(string text) => new()
{
- Text = text, FontSize = 10, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center,
+ Text = text, FontSize = 12, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center,
};
- private static Control DividerLine() => new Border { Height = 1, Background = Divider };
-
- private static Control Row(string label, Control control) => new StackPanel
+ // Ink 5 for a note; Ink 4 (muted) for the explanation a pane leads with.
+ private static TextBlock Caption(string text, bool muted = false) => new()
{
- Orientation = Orientation.Horizontal,
- Children =
- {
- new TextBlock { Text = label, Width = 130, FontSize = 11, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center },
- control,
- },
+ Text = text, FontSize = 11, LineHeight = 17, Foreground = muted ? TextMuted : TextTertiary,
+ TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center,
};
+ // Label column · control, 34 tall at least. An empty label indents under the controls.
+ private static Control Row(string label, Control control)
+ {
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions($"{LabelCol},*"), MinHeight = 34 };
+ if (label.Length > 0) grid.Children.Add(RowLabel(label));
+ control.VerticalAlignment = VerticalAlignment.Center;
+ Grid.SetColumn(control, 1);
+ grid.Children.Add(control);
+ return grid;
+ }
+
private static void FillDeviceCombo(ComboBox combo, List<string> uids, IReadOnlyList<AudioDevice> devices, string savedUid)
{
uids.Clear();
@@ -829,11 +1224,4 @@ public sealed partial class PreferencesWindow : NotaWindow
private static int IndexOf(double[] values, double v) { for (int i = 0; i < values.Length; i++) if (values[i] == v) return i; return 0; }
private static int IndexOf(int[] values, int v) { for (int i = 0; i < values.Length; i++) if (values[i] == v) return i; return 0; }
-
- private void RefreshPaths()
- {
- _paths.Clear();
- int n = _catalog.ScanPathCount;
- for (int i = 0; i < n; i++) _paths.Add(_catalog.ScanPath(i) ?? "?");
- }
}
diff --git a/src/managed/Nota.App/Theme/NotaPalette.cs b/src/managed/Nota.App/Theme/NotaPalette.cs
index 6e522642..c76c1a0e 100644
--- a/src/managed/Nota.App/Theme/NotaPalette.cs
+++ b/src/managed/Nota.App/Theme/NotaPalette.cs
@@ -77,6 +77,16 @@ internal static class NotaPalette
Changed?.Invoke();
}
+ /// <summary>The colour <paramref name="slot"/> holds in <paramref name="variant"/>, whatever
+ /// the current one is — for previews of a variant (the theme picker's swatches). Read it
+ /// at draw time like any other colour.</summary>
+ public static Color ColorIn(SolidColorBrush slot, NotaThemeVariant variant)
+ {
+ foreach (var s in Slots)
+ if (ReferenceEquals(s.Brush, slot)) return variant == NotaThemeVariant.Dark ? s.Dark : s.Light;
+ return slot.Color;
+ }
+
/// <summary>A translucent tint of a palette slot. Shared per (slot, alpha) and
/// re-tinted with its source, so washes follow the theme like any other token.</summary>
public static SolidColorBrush Wash(SolidColorBrush src, byte alpha)