Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
(feat) Add icons for context menus
Egor Khindikaynena5d61f5b20a0
diff --git a/src/managed/Nota.App/ArrangementView.LaneControl.cs b/src/managed/Nota.App/ArrangementView.LaneControl.csindex d332d1da..5095da11 100644--- a/src/managed/Nota.App/ArrangementView.LaneControl.cs+++ b/src/managed/Nota.App/ArrangementView.LaneControl.cs@@ -829,13 +829,13 @@ public sealed partial class ArrangementView{bool hasSel = _o.HasAutoSelection && ReferenceEquals(_o._autoSelTrack, t);var flyout = new MenuFlyout();- var copy = new MenuItem { Header = "Copy automation", IsEnabled = hasSel };+ var copy = new MenuItem { Header = "Copy automation", IsEnabled = hasSel, Icon = MenuKit.Icon(GlyphKind.Copy), InputGesture = MenuKit.CopyKey };copy.Click += (_, _) => _o.CopyAutoSelection();- var cut = new MenuItem { Header = "Cut automation", IsEnabled = hasSel };+ var cut = new MenuItem { Header = "Cut automation", IsEnabled = hasSel, Icon = MenuKit.Icon(GlyphKind.Cut), InputGesture = MenuKit.CutKey };cut.Click += (_, _) => _o.CutAutoSelection();- var del = new MenuItem { Header = "Delete automation", IsEnabled = hasSel };+ var del = new MenuItem { Header = "Delete automation", IsEnabled = hasSel, Icon = MenuKit.Icon(GlyphKind.Trash), InputGesture = MenuKit.DeleteKey };del.Click += (_, _) => _o.DeleteAutoSelection();- var paste = new MenuItem { Header = "Paste automation", IsEnabled = _o.HasAutoClip };+ var paste = new MenuItem { Header = "Paste automation", IsEnabled = _o.HasAutoClip, Icon = MenuKit.Icon(GlyphKind.Paste), InputGesture = MenuKit.PasteKey };paste.Click += (_, _) => _o.PasteAutoAt(t, _o.Snap(beat));flyout.Items.Add(copy);flyout.Items.Add(cut);@@ -845,20 +845,12 @@ public sealed partial class ArrangementViewflyout.ShowAt(this, showAtPointer: true);}- // ⌘J / Ctrl+J, shown next to the context-menu Consolidate items.- private static readonly KeyGesture ConsolidateGesture =- new(Key.J, OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control);-- // ⌘⇧V / Ctrl+⇧V, shown next to the context-menu Paste bounced audio items.- private static readonly KeyGesture PasteBouncedGesture =- new(Key.V, (OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control) | KeyModifiers.Shift);-// "Paste bounced audio" onto this track at `at`, or null when there's nothing to paste// or the track can't take it (only audio tracks can).private MenuItem? PasteBouncedItem(int trackId, double at){if (!_o.CanPasteBouncedOnto(trackId)) return null;- var mi = new MenuItem { Header = "Paste bounced audio", InputGesture = PasteBouncedGesture };+ var mi = new MenuItem { Header = "Paste bounced audio", Icon = MenuKit.Icon(GlyphKind.Paste), InputGesture = MenuKit.PasteBouncedKey };mi.Click += (_, _) => _o.RequestPasteBounced(trackId, at);return mi;}@@ -875,20 +867,20 @@ public sealed partial class ArrangementViewbool inRange = _o.TimeSelectionCovers(trackId, beat);double at = _o.Snap(beat);var flyout = new MenuFlyout();- var paste = new MenuItem { Header = "Paste", IsEnabled = _o.HasClipClipboard };+ var paste = new MenuItem { Header = "Paste", IsEnabled = _o.HasClipClipboard, Icon = MenuKit.Icon(GlyphKind.Paste), InputGesture = MenuKit.PasteKey };paste.Click += (_, _) => _o.PasteClipboardAt(trackId, at);flyout.Items.Add(paste);if (PasteBouncedItem(trackId, at) is { } bounced) flyout.Items.Add(bounced);if (track.IsInstrument){- var insert = new MenuItem { Header = "Insert MIDI clip" };+ var insert = new MenuItem { Header = "Insert MIDI clip", Icon = MenuKit.Icon(GlyphKind.Plus) };insert.Click += (_, _) => _o.AddMidiClipAt(trackId, beat);flyout.Items.Add(new Separator());flyout.Items.Add(insert);}if (inRange){- var consolidate = new MenuItem { Header = "Consolidate selection", InputGesture = ConsolidateGesture };+ var consolidate = new MenuItem { Header = "Consolidate selection", Icon = MenuKit.Icon(GlyphKind.Consolidate), InputGesture = MenuKit.ConsolidateKey };consolidate.Click += (_, _) => _o.ConsolidateSelection();flyout.Items.Add(new Separator());flyout.Items.Add(consolidate);@@ -906,11 +898,11 @@ public sealed partial class ArrangementViewbool inGroup = _o.IsSelected(trackId, idx) && _o.Selection.Count > 1;var flyout = new MenuFlyout();- var split = new MenuItem { Header = "Split here" };+ var split = new MenuItem { Header = "Split here", Icon = MenuKit.Icon(GlyphKind.Split), InputGesture = MenuKit.SplitKey };split.Click += (_, _) => { _o._engine?.SplitClip(trackId, idx, at); _o.Refresh(); };- var dup = new MenuItem { Header = inGroup ? "Duplicate selection" : "Duplicate" };+ var dup = new MenuItem { Header = inGroup ? "Duplicate selection" : "Duplicate", Icon = MenuKit.Icon(GlyphKind.Duplicate), InputGesture = MenuKit.DuplicateKey };dup.Click += (_, _) => { EnsureSelected(); _o.DuplicateSelectedClip(); };- var del = new MenuItem { Header = inGroup ? "Delete selection" : "Delete" };+ var del = new MenuItem { Header = inGroup ? "Delete selection" : "Delete", Icon = MenuKit.Icon(GlyphKind.Trash), InputGesture = MenuKit.DeleteKey };del.Click += (_, _) =>{if (inGroup) _o.DeleteSelectedClips();@@ -921,7 +913,8 @@ public sealed partial class ArrangementView{Header = clip.Active ? (inGroup ? "Deactivate selection" : "Deactivate clip"): (inGroup ? "Activate selection" : "Activate clip"),- InputGesture = new KeyGesture(Key.D0),+ Icon = MenuKit.Icon(GlyphKind.Bypass),+ InputGesture = MenuKit.ActivateKey,};deact.Click += (_, _) => { EnsureSelected(); _o.ToggleSelectedClipsActive(); };// Reverse (audio only): non-destructive, so the header reflects the clicked clip.@@ -933,6 +926,7 @@ public sealed partial class ArrangementView{Header = on ? (inGroup ? "Un-reverse selection" : "Un-reverse"): (inGroup ? "Reverse selection" : "Reverse"),+ Icon = MenuKit.Icon(GlyphKind.Reverse),};reverse.Click += (_, _) => { EnsureSelected(); _o.ToggleSelectedClipsReverse(); };}@@ -942,20 +936,21 @@ public sealed partial class ArrangementViewvar consolidate = new MenuItem{Header = inRange || inGroup ? "Consolidate selection" : "Consolidate",- InputGesture = ConsolidateGesture,+ Icon = MenuKit.Icon(GlyphKind.Consolidate),+ InputGesture = MenuKit.ConsolidateKey,};consolidate.Click += (_, _) =>{if (!inRange) EnsureSelected();_o.ConsolidateSelection();};- var copy = new MenuItem { Header = inGroup ? "Copy selection" : "Copy" };+ var copy = new MenuItem { Header = inGroup ? "Copy selection" : "Copy", Icon = MenuKit.Icon(GlyphKind.Copy), InputGesture = MenuKit.CopyKey };copy.Click += (_, _) => { EnsureSelected(); _o.CopySelectedClip(); };- var cut = new MenuItem { Header = inGroup ? "Cut selection" : "Cut" };+ var cut = new MenuItem { Header = inGroup ? "Cut selection" : "Cut", Icon = MenuKit.Icon(GlyphKind.Cut), InputGesture = MenuKit.CutKey };cut.Click += (_, _) => { EnsureSelected(); _o.CutSelectedClip(); };- var paste = new MenuItem { Header = "Paste", IsEnabled = _o.HasClipClipboard };+ var paste = new MenuItem { Header = "Paste", IsEnabled = _o.HasClipClipboard, Icon = MenuKit.Icon(GlyphKind.Paste), InputGesture = MenuKit.PasteKey };paste.Click += (_, _) => _o.PasteClipboardAt(trackId, at);- var rename = new MenuItem { Header = "Rename…" };+ var rename = new MenuItem { Header = "Rename…", Icon = MenuKit.Icon(GlyphKind.Edit) };rename.Click += (_, _) => PromptRename(clip.Name, s => { _o._engine?.SetClipName(trackId, idx, s); _o.Refresh(); });flyout.Items.Add(rename);flyout.Items.Add(copy);@@ -971,7 +966,7 @@ public sealed partial class ArrangementViewflyout.Items.Add(del);// Loop the current selection (or just this clip if nothing is selected).- var loop = new MenuItem { Header = "Loop selection" };+ var loop = new MenuItem { Header = "Loop selection", Icon = MenuKit.Icon(GlyphKind.Cycle), InputGesture = MenuKit.LoopKey };loop.Click += (_, _) =>{if (!_o.LoopSelection())@@ -984,7 +979,7 @@ public sealed partial class ArrangementView// ship now; Melody + Harmony (pitch detection) are disabled until their DSP lands.if (!clip.IsMidi){- var convert = new MenuItem { Header = "Convert" };+ var convert = new MenuItem { Header = "Convert", Icon = MenuKit.Icon(GlyphKind.Arrow) };MenuItem ConvItem(string header, ClipConvertMode mode, bool enabled){var mi = new MenuItem { Header = header, IsEnabled = enabled };@@ -1003,7 +998,7 @@ public sealed partial class ArrangementViewif (_o._engine is { } eng){bool midi = clip.IsMidi;- var toSession = new MenuItem { Header = "Copy to session" };+ var toSession = new MenuItem { Header = "Copy to session", Icon = MenuKit.Icon(GlyphKind.Grid) };for (int s = 0; s < eng.SceneCount; s++){int sc = s;diff --git a/src/managed/Nota.App/ArrangementView.Sections.cs b/src/managed/Nota.App/ArrangementView.Sections.csindex 690687a9..d7645a58 100644--- a/src/managed/Nota.App/ArrangementView.Sections.cs+++ b/src/managed/Nota.App/ArrangementView.Sections.cs@@ -315,20 +315,20 @@ public sealed partial class ArrangementViewvar flyout = new MenuFlyout();if (s is not null){- var rename = new MenuItem { Header = "Rename…" };+ var rename = new MenuItem { Header = "Rename…", Icon = MenuKit.Icon(GlyphKind.Edit) };rename.Click += (_, _) => _o.RenameSection(this, s);- var loop = new MenuItem { Header = "Loop section" };+ var loop = new MenuItem { Header = "Loop section", Icon = MenuKit.Icon(GlyphKind.Cycle) };loop.Click += (_, _) => _o.SetLoopRegion(s.StartBeat, s.StartBeat + s.LengthBeats); // raises LoopChanged itself- var select = new MenuItem { Header = "Select section" };+ var select = new MenuItem { Header = "Select section", Icon = MenuKit.Icon(GlyphKind.Select) };select.Click += (_, _) => _o.SelectSectionRange(s);- var dup = new MenuItem { Header = "Duplicate" };+ var dup = new MenuItem { Header = "Duplicate", Icon = MenuKit.Icon(GlyphKind.Duplicate) };dup.Click += (_, _) =>{var copy = _o.AddSection(s.StartBeat + s.LengthBeats, s.LengthBeats);copy.Name = s.Name;_o.SectionsEdited();};- var del = new MenuItem { Header = "Delete" };+ var del = new MenuItem { Header = "Delete", Icon = MenuKit.Icon(GlyphKind.Trash) };del.Click += (_, _) => _o.RemoveSection(s);flyout.Items.Add(rename);flyout.Items.Add(loop);@@ -339,12 +339,12 @@ public sealed partial class ArrangementView}else{- var add = new MenuItem { Header = "Add section here" };+ var add = new MenuItem { Header = "Add section here", Icon = MenuKit.Icon(GlyphKind.Plus) };add.Click += (_, _) => _o.AddSection(_o.SnapBar(beat), _o._beatsPerBar * 8);flyout.Items.Add(add);if (_o._sections.Count > 0){- var clear = new MenuItem { Header = "Delete all sections" };+ var clear = new MenuItem { Header = "Delete all sections", Icon = MenuKit.Icon(GlyphKind.Trash) };clear.Click += (_, _) => { _o.ClearSections(); _o.SectionsChangedRaise(); };flyout.Items.Add(clear);}diff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.csindex 42b91358..b7ad7dcd 100644--- a/src/managed/Nota.App/ArrangementView.cs+++ b/src/managed/Nota.App/ArrangementView.cs@@ -1747,11 +1747,7 @@ public sealed partial class ArrangementView : UserControlprivate IEnumerable<MenuItem> AddTrackItems(){MenuItem Item(string header, NewTrackKind kind)- {- var mi = new MenuItem { Header = header };- mi.Click += (_, _) => AddTrackRequested?.Invoke(kind);- return mi;- }+ => MenuKit.Item(header, GlyphKind.Plus, () => AddTrackRequested?.Invoke(kind));yield return Item("Add instrument track", NewTrackKind.Instrument);yield return Item("Add audio track", NewTrackKind.Audio);yield return Item("Add return track", NewTrackKind.Return);@@ -1765,7 +1761,7 @@ public sealed partial class ArrangementView : UserControlvar flyout = new MenuFlyout();foreach (var mi in AddTrackItems()) flyout.Items.Add(mi);flyout.Items.Add(new Separator());- var paste = new MenuItem { Header = "Paste track", IsEnabled = _engine.HasTrackClipboard() };+ var paste = new MenuItem { Header = "Paste track", IsEnabled = _engine.HasTrackClipboard(), Icon = MenuKit.Icon(GlyphKind.Paste) };paste.Click += (_, _) =>{int nid = _engine.PasteTrack();@@ -1783,7 +1779,7 @@ public sealed partial class ArrangementView : UserControlif (_engine is null) return;var flyout = new MenuFlyout();- var rename = new MenuItem { Header = "Rename…" };+ var rename = new MenuItem { Header = "Rename…", Icon = MenuKit.Icon(GlyphKind.Edit) };rename.Click += (_, _) => PromptRenameTrack(anchor, trackId);var color = BuildColorSubmenu(trackId);@@ -1794,7 +1790,7 @@ public sealed partial class ArrangementView : UserControlif (isAudio){int cur = _engine.GetTrackRecordInput(trackId);- recInput = new MenuItem { Header = "Record input" };+ recInput = new MenuItem { Header = "Record input", Icon = MenuKit.Icon(GlyphKind.Input) };MenuItem Src(string label, int source){var mi = new MenuItem { Header = label, ToggleType = MenuItemToggleType.Radio, IsChecked = cur == source };@@ -1818,7 +1814,7 @@ public sealed partial class ArrangementView : UserControlif (isInstr){int curSrc = _engine.GetTrackMidiSource(trackId);- midiFrom = new MenuItem { Header = "MIDI from" };+ midiFrom = new MenuItem { Header = "MIDI from", Icon = MenuKit.Icon(GlyphKind.Note) };MenuItem Src(string label, int src){var mi = new MenuItem { Header = label, ToggleType = MenuItemToggleType.Radio, IsChecked = curSrc == src };@@ -1832,9 +1828,9 @@ public sealed partial class ArrangementView : UserControlmidiFrom.Items.Add(Src(v.Name.Length > 0 ? v.Name : $"Track {v.Id}", v.Id));}- var copy = new MenuItem { Header = "Copy track" };+ var copy = new MenuItem { Header = "Copy track", Icon = MenuKit.Icon(GlyphKind.Copy) };copy.Click += (_, _) => _engine.CopyTrack(trackId);- var cut = new MenuItem { Header = "Cut track" };+ var cut = new MenuItem { Header = "Cut track", Icon = MenuKit.Icon(GlyphKind.Cut) };cut.Click += (_, _) =>{if (!_engine.CopyTrack(trackId)) return;@@ -1842,7 +1838,7 @@ public sealed partial class ArrangementView : UserControlif (SelTrackId == trackId) SelTrackId = -1;Refresh(); SessionChanged?.Invoke(); TrackSelected?.Invoke(SelTrackId);};- var paste = new MenuItem { Header = "Paste track", IsEnabled = _engine.HasTrackClipboard() };+ var paste = new MenuItem { Header = "Paste track", IsEnabled = _engine.HasTrackClipboard(), Icon = MenuKit.Icon(GlyphKind.Paste) };paste.Click += (_, _) =>{int nid = _engine.PasteTrack();@@ -1850,7 +1846,7 @@ public sealed partial class ArrangementView : UserControlRefresh(); SessionChanged?.Invoke(); TrackSelected?.Invoke(SelTrackId);};- var dup = new MenuItem { Header = "Duplicate track" };+ var dup = new MenuItem { Header = "Duplicate track", Icon = MenuKit.Icon(GlyphKind.Duplicate) };dup.Click += (_, _) =>{int nid = _engine.DuplicateTrack(trackId);@@ -1859,7 +1855,7 @@ public sealed partial class ArrangementView : UserControlSessionChanged?.Invoke();TrackSelected?.Invoke(SelTrackId);};- var del = new MenuItem { Header = "Delete track" };+ var del = new MenuItem { Header = "Delete track", Icon = MenuKit.Icon(GlyphKind.Trash) };del.Click += (_, _) =>{_engine.RemoveTrack(trackId);@@ -1871,13 +1867,13 @@ public sealed partial class ArrangementView : UserControl// Group / Ungroup (submix). "Group" folds the multi-selection (or this track) into a// new group; "Ungroup" dissolves the group this track is/belongs to.- var group = new MenuItem { Header = "Group tracks" };+ var group = new MenuItem { Header = "Group tracks", Icon = MenuKit.Icon(GlyphKind.Folder), InputGesture = MenuKit.GroupKey };group.Click += (_, _) => GroupTracks(trackId);int ungroupId = GroupToUngroupFor(trackId);MenuItem? ungroup = null;if (ungroupId > 0){- ungroup = new MenuItem { Header = "Ungroup" };+ ungroup = new MenuItem { Header = "Ungroup", Icon = MenuKit.Icon(GlyphKind.Ungroup), InputGesture = MenuKit.UngroupKey };ungroup.Click += (_, _) => UngroupGroup(ungroupId);}@@ -1896,7 +1892,7 @@ public sealed partial class ArrangementView : UserControlflyout.Items.Add(new Separator());flyout.Items.Add(group);if (ungroup is not null) flyout.Items.Add(ungroup);- var addTrack = new MenuItem { Header = "Add track" }; // submenu: this menu is long already+ var addTrack = new MenuItem { Header = "Add track", Icon = MenuKit.Icon(GlyphKind.Plus) }; // submenu: this menu is long alreadyforeach (var mi in AddTrackItems()) addTrack.Items.Add(mi);flyout.Items.Add(new Separator());@@ -2043,7 +2039,7 @@ public sealed partial class ArrangementView : UserControl// swatches, plus Auto. Picking sets the track's stored palette index.private MenuItem BuildColorSubmenu(int trackId){- var color = new MenuItem { Header = "Color" };+ var color = new MenuItem { Header = "Color", Icon = MenuKit.Icon(GlyphKind.Palette) };for (int b = 0; b < PaletteBases; b++){var baseItem = new MenuItem { Header = TrackColorNames[b], Icon = Swatch(b * PaletteShades) };@@ -2219,7 +2215,7 @@ public sealed partial class ArrangementView : UserControl{if (_engine is null) return;var flyout = new MenuFlyout();- var rename = new MenuItem { Header = "Rename…" };+ var rename = new MenuItem { Header = "Rename…", Icon = MenuKit.Icon(GlyphKind.Edit) };rename.Click += (_, _) => PromptRenameTrack(anchor, trackId);flyout.Items.Add(rename);flyout.Items.Add(BuildColorSubmenu(trackId));diff --git a/src/managed/Nota.App/Controls/Glyph.cs b/src/managed/Nota.App/Controls/Glyph.csindex de03c04b..c60617a2 100644--- a/src/managed/Nota.App/Controls/Glyph.cs+++ b/src/managed/Nota.App/Controls/Glyph.cs@@ -24,6 +24,9 @@ internal enum GlyphKindStepLeft, StepRight, // filled small triangles (◀ ▶ as "move")Edit, Freeze, PopOut, Cycle, Dot, Bypass, Plus, Grip, Minus,Headphones, // input monitoring+ // Context-menu icons+ Copy, Cut, Paste, Trash, Duplicate, Split, Consolidate, Reverse, Folder, Ungroup,+ Palette, Note, Input, Arrow, Grid, Select, Save, List, Compare, Flatten,}internal sealed class Glyph : Control@@ -218,6 +221,171 @@ internal sealed class Glyph : ControlStroke(ctx, pen, new Point(cx - s * 0.12, cy - rr - s * 0.14), new Point(cx, cy - rr), new Point(cx - s * 0.12, cy - rr + s * 0.14));break;}+ case GlyphKind.Copy:+ {+ // A sheet in front of another whose top-left edges peek out.+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx - s * 0.12, cy - s * 0.12, s * 0.5, s * 0.5), 1));+ Stroke(ctx, pen, new Point(cx - s * 0.38, cy + s * 0.14), new Point(cx - s * 0.38, cy - s * 0.38), new Point(cx + s * 0.14, cy - s * 0.38));+ break;+ }+ case GlyphKind.Cut:+ {+ // Scissors: two crossing blades over two finger rings.+ double rr = s * 0.13;+ ctx.DrawEllipse(null, pen, new Point(cx - s * 0.24, cy + s * 0.28), rr, rr);+ ctx.DrawEllipse(null, pen, new Point(cx + s * 0.24, cy + s * 0.28), rr, rr);+ ctx.DrawLine(pen, new Point(cx - s * 0.16, cy + s * 0.16), new Point(cx + s * 0.22, cy - s * 0.42));+ ctx.DrawLine(pen, new Point(cx + s * 0.16, cy + s * 0.16), new Point(cx - s * 0.22, cy - s * 0.42));+ break;+ }+ case GlyphKind.Paste:+ {+ // A clipboard: the board and its clip.+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx - s * 0.34, cy - s * 0.3, s * 0.68, s * 0.74), 1));+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx - s * 0.2, cy - s * 0.46, s * 0.4, s * 0.28), 1));+ break;+ }+ case GlyphKind.Trash:+ {+ ctx.DrawLine(pen, new Point(cx - s * 0.4, cy - s * 0.24), new Point(cx + s * 0.4, cy - s * 0.24));+ Stroke(ctx, pen, new Point(cx - s * 0.12, cy - s * 0.26), new Point(cx - s * 0.12, cy - s * 0.4), new Point(cx + s * 0.12, cy - s * 0.4), new Point(cx + s * 0.12, cy - s * 0.26));+ Stroke(ctx, pen, new Point(cx - s * 0.28, cy - s * 0.2), new Point(cx - s * 0.22, cy + s * 0.4), new Point(cx + s * 0.22, cy + s * 0.4), new Point(cx + s * 0.28, cy - s * 0.2));+ break;+ }+ case GlyphKind.Duplicate:+ {+ // A clip and its filled twin right after it.+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx - s * 0.42, cy - s * 0.22, s * 0.36, s * 0.44), 1));+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx + s * 0.04, cy - s * 0.26, s * 0.42, s * 0.52), 1));+ break;+ }+ case GlyphKind.Split:+ {+ // Two clip halves either side of a cut line.+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx - s * 0.46, cy - s * 0.22, s * 0.3, s * 0.44), 1));+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx + s * 0.16, cy - s * 0.22, s * 0.3, s * 0.44), 1));+ ctx.DrawLine(pen, new Point(cx, cy - s * 0.44), new Point(cx, cy + s * 0.44));+ break;+ }+ case GlyphKind.Consolidate:+ {+ // Converging strokes folding into one block.+ Stroke(ctx, pen, new Point(cx - s * 0.42, cy - s * 0.32), new Point(cx - s * 0.1, cy), new Point(cx - s * 0.42, cy + s * 0.32));+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx + s * 0.04, cy - s * 0.28, s * 0.4, s * 0.56), 1));+ break;+ }+ case GlyphKind.Reverse:+ {+ // ⇄: one arrow each way.+ double y1 = cy - s * 0.2, y2 = cy + s * 0.2, d = s * 0.4, hd = s * 0.15;+ ctx.DrawLine(pen, new Point(cx - d, y1), new Point(cx + d, y1));+ Stroke(ctx, pen, new Point(cx + d - hd, y1 - hd), new Point(cx + d, y1), new Point(cx + d - hd, y1 + hd));+ ctx.DrawLine(pen, new Point(cx + d, y2), new Point(cx - d, y2));+ Stroke(ctx, pen, new Point(cx - d + hd, y2 - hd), new Point(cx - d, y2), new Point(cx - d + hd, y2 + hd));+ break;+ }+ case GlyphKind.Folder:+ {+ var g = new StreamGeometry();+ using (var c = g.Open())+ {+ c.BeginFigure(new Point(cx - s * 0.42, cy + s * 0.34), false);+ c.LineTo(new Point(cx - s * 0.42, cy - s * 0.34));+ c.LineTo(new Point(cx - s * 0.1, cy - s * 0.34));+ c.LineTo(new Point(cx + s * 0.02, cy - s * 0.2));+ c.LineTo(new Point(cx + s * 0.42, cy - s * 0.2));+ c.LineTo(new Point(cx + s * 0.42, cy + s * 0.34));+ c.EndFigure(true);+ }+ ctx.DrawGeometry(null, pen, g);+ break;+ }+ case GlyphKind.Ungroup:+ {+ // Two blocks pulled apart.+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx - s * 0.42, cy - s * 0.42, s * 0.36, s * 0.36), 1));+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx + s * 0.06, cy + s * 0.06, s * 0.36, s * 0.36), 1));+ break;+ }+ case GlyphKind.Palette:+ {+ // Three swatches.+ double dr = s * 0.15;+ ctx.DrawEllipse(ink, null, new Point(cx, cy - s * 0.24), dr, dr);+ ctx.DrawEllipse(ink, null, new Point(cx - s * 0.26, cy + s * 0.2), dr, dr);+ ctx.DrawEllipse(ink, null, new Point(cx + s * 0.26, cy + s * 0.2), dr, dr);+ break;+ }+ case GlyphKind.Note:+ {+ // An eighth note: head, stem, flag.+ ctx.DrawEllipse(ink, null, new Point(cx - s * 0.12, cy + s * 0.26), s * 0.18, s * 0.14);+ Stroke(ctx, pen, new Point(cx + s * 0.05, cy + s * 0.24), new Point(cx + s * 0.05, cy - s * 0.42), new Point(cx + s * 0.34, cy - s * 0.2));+ break;+ }+ case GlyphKind.Input:+ {+ // An arrow entering a bracket.+ ctx.DrawLine(pen, new Point(cx - s * 0.44, cy), new Point(cx + s * 0.08, cy));+ Stroke(ctx, pen, new Point(cx - s * 0.1, cy - s * 0.18), new Point(cx + s * 0.08, cy), new Point(cx - s * 0.1, cy + s * 0.18));+ Stroke(ctx, pen, new Point(cx + s * 0.08, cy - s * 0.38), new Point(cx + s * 0.38, cy - s * 0.38), new Point(cx + s * 0.38, cy + s * 0.38), new Point(cx + s * 0.08, cy + s * 0.38));+ break;+ }+ case GlyphKind.Arrow:+ {+ ctx.DrawLine(pen, new Point(cx - s * 0.4, cy), new Point(cx + s * 0.38, cy));+ Stroke(ctx, pen, new Point(cx + s * 0.12, cy - s * 0.26), new Point(cx + s * 0.38, cy), new Point(cx + s * 0.12, cy + s * 0.26));+ break;+ }+ case GlyphKind.Grid:+ {+ // 2×2 slots: the session grid.+ double q = s * 0.34, o = s * 0.04;+ for (int i = 0; i < 2; i++)+ for (int j = 0; j < 2; j++)+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx + (i == 0 ? -q - o : o), cy + (j == 0 ? -q - o : o), q, q), 1));+ break;+ }+ case GlyphKind.Select:+ {+ // Four corner marks framing a range.+ double d = s * 0.4, l = s * 0.22;+ Stroke(ctx, pen, new Point(cx - d, cy - d + l), new Point(cx - d, cy - d), new Point(cx - d + l, cy - d));+ Stroke(ctx, pen, new Point(cx + d - l, cy - d), new Point(cx + d, cy - d), new Point(cx + d, cy - d + l));+ Stroke(ctx, pen, new Point(cx + d, cy + d - l), new Point(cx + d, cy + d), new Point(cx + d - l, cy + d));+ Stroke(ctx, pen, new Point(cx - d + l, cy + d), new Point(cx - d, cy + d), new Point(cx - d, cy + d - l));+ break;+ }+ case GlyphKind.Save:+ {+ // An arrow dropping into a tray.+ ctx.DrawLine(pen, new Point(cx, cy - s * 0.42), new Point(cx, cy + s * 0.12));+ Stroke(ctx, pen, new Point(cx - s * 0.2, cy - s * 0.08), new Point(cx, cy + s * 0.12), new Point(cx + s * 0.2, cy - s * 0.08));+ Stroke(ctx, pen, new Point(cx - s * 0.4, cy + s * 0.1), new Point(cx - s * 0.4, cy + s * 0.38), new Point(cx + s * 0.4, cy + s * 0.38), new Point(cx + s * 0.4, cy + s * 0.1));+ break;+ }+ case GlyphKind.List:+ {+ for (int i = -1; i <= 1; i++)+ ctx.DrawLine(pen, new Point(cx - s * 0.38, cy + i * s * 0.3), new Point(cx + s * 0.38, cy + i * s * 0.3));+ break;+ }+ case GlyphKind.Compare:+ {+ // A / B: a square, half filled.+ double d = s * 0.38;+ ctx.DrawRectangle(null, pen, new RoundedRect(new Rect(cx - d, cy - d, d * 2, d * 2), 1));+ ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(cx - d, cy - d, d, d * 2), 1));+ break;+ }+ case GlyphKind.Flatten:+ {+ // A wave above the flat line it becomes.+ Stroke(ctx, pen, new Point(cx - s * 0.42, cy - s * 0.1), new Point(cx - s * 0.21, cy - s * 0.38), new Point(cx, cy - s * 0.1),+ new Point(cx + s * 0.21, cy - s * 0.38), new Point(cx + s * 0.42, cy - s * 0.1));+ ctx.DrawLine(pen, new Point(cx - s * 0.42, cy + s * 0.3), new Point(cx + s * 0.42, cy + s * 0.3));+ break;+ }}}diff --git a/src/managed/Nota.App/DeviceChainView.Clipboard.cs b/src/managed/Nota.App/DeviceChainView.Clipboard.csindex da058972..069bcd0c 100644--- a/src/managed/Nota.App/DeviceChainView.Clipboard.cs+++ b/src/managed/Nota.App/DeviceChainView.Clipboard.cs@@ -157,19 +157,15 @@ public sealed partial class DeviceChainViewSelectDevice(kind, di);var flyout = new MenuFlyout();header?.Invoke(flyout);- void Add(string header, bool enabled, Action act)- {- var mi = new MenuItem { Header = header, IsEnabled = enabled };- mi.Click += (_, _) => act();- flyout.Items.Add(mi);- }+ void Add(string header, GlyphKind icon, bool enabled, Action act, KeyGesture? gesture = null)+ => flyout.Items.Add(MenuKit.Item(header, icon, act, gesture, enabled));bool selectable = SelectableKind(kind);- Add("Copy", selectable, CopySelectedDevice);- Add("Cut", selectable, CutSelectedDevice);- Add("Paste", _clip != null, PasteDevice);- Add("Delete", selectable, DeleteSelectedDevice);+ Add("Copy", GlyphKind.Copy, selectable, CopySelectedDevice, MenuKit.CopyKey);+ Add("Cut", GlyphKind.Cut, selectable, CutSelectedDevice, MenuKit.CutKey);+ Add("Paste", GlyphKind.Paste, _clip != null, PasteDevice, MenuKit.PasteKey);+ Add("Delete", GlyphKind.Trash, selectable, DeleteSelectedDevice, MenuKit.DeleteKey);flyout.Items.Add(new Separator());- Add("Save preset", true, () => PresetSaveRequested?.Invoke(di));+ Add("Save preset", GlyphKind.Save, true, () => PresetSaveRequested?.Invoke(di));flyout.ShowAt(anchor, showAtPointer: true);}diff --git a/src/managed/Nota.App/DeviceChainView.Shell.cs b/src/managed/Nota.App/DeviceChainView.Shell.csindex c5b5bd4b..e490fb08 100644--- a/src/managed/Nota.App/DeviceChainView.Shell.cs+++ b/src/managed/Nota.App/DeviceChainView.Shell.cs@@ -218,9 +218,9 @@ public sealed partial class DeviceChainView{if (presets.Count > 0){- var menu = new MenuItem { Header = $"Preset: {(string.IsNullOrEmpty(extra.Preset) ? "Init" : extra.Preset)}" };- var prev = new MenuItem { Header = "Previous preset" }; prev.Click += (_, _) => StepPreset(-1);- var next = new MenuItem { Header = "Next preset" }; next.Click += (_, _) => StepPreset(+1);+ var menu = new MenuItem { Header = $"Preset: {(string.IsNullOrEmpty(extra.Preset) ? "Init" : extra.Preset)}", Icon = MenuKit.Icon(GlyphKind.List) };+ var prev = new MenuItem { Header = "Previous preset", Icon = MenuKit.Icon(GlyphKind.ChevronLeft) }; prev.Click += (_, _) => StepPreset(-1);+ var next = new MenuItem { Header = "Next preset", Icon = MenuKit.Icon(GlyphKind.ChevronRight) }; next.Click += (_, _) => StepPreset(+1);menu.Items.Add(prev); menu.Items.Add(next); menu.Items.Add(new Separator());for (int i = 0; i < presets.Count; i++){@@ -234,7 +234,7 @@ public sealed partial class DeviceChainView// A / B compare of two full-parameter snapshots.float[] Capture() => CaptureParams(s.Kind, di);if (extra.A == null) { extra.A = Capture(); extra.B = (float[])extra.A.Clone(); extra.Active = 0; }- var ab = new MenuItem { Header = $"Compare: {(extra.Active == 0 ? "A" : "B")}" };+ var ab = new MenuItem { Header = $"Compare: {(extra.Active == 0 ? "A" : "B")}", Icon = MenuKit.Icon(GlyphKind.Compare) };void Switch(int slot){if (slot == extra.Active) return;@@ -245,14 +245,14 @@ public sealed partial class DeviceChainView}var toA = new MenuItem { Header = "A", ToggleType = MenuItemToggleType.Radio, IsChecked = extra.Active == 0 }; toA.Click += (_, _) => Switch(0);var toB = new MenuItem { Header = "B", ToggleType = MenuItemToggleType.Radio, IsChecked = extra.Active == 1 }; toB.Click += (_, _) => Switch(1);- var copy = new MenuItem { Header = extra.Active == 0 ? "Copy A to B" : "Copy B to A" };+ var copy = new MenuItem { Header = extra.Active == 0 ? "Copy A to B" : "Copy B to A", Icon = MenuKit.Icon(GlyphKind.Copy) };copy.Click += (_, _) => { var c = Capture(); if (extra.Active == 0) extra.B = (float[])c.Clone(); else extra.A = (float[])c.Clone(); };ab.Items.Add(toA); ab.Items.Add(toB); ab.Items.Add(new Separator()); ab.Items.Add(copy);flyout.Items.Add(ab);if (s.CanMove){- var left = new MenuItem { Header = "Move left", IsEnabled = di > 0 }; left.Click += (_, _) => Move(di - 1);- var rightMi = new MenuItem { Header = "Move right", IsEnabled = di < s.Count - 1 }; rightMi.Click += (_, _) => Move(di + 1);+ var left = new MenuItem { Header = "Move left", IsEnabled = di > 0, Icon = MenuKit.Icon(GlyphKind.StepLeft) }; left.Click += (_, _) => Move(di - 1);+ var rightMi = new MenuItem { Header = "Move right", IsEnabled = di < s.Count - 1, Icon = MenuKit.Icon(GlyphKind.StepRight) }; rightMi.Click += (_, _) => Move(di + 1);flyout.Items.Add(left); flyout.Items.Add(rightMi);}flyout.Items.Add(new Separator());diff --git a/src/managed/Nota.App/MainWindow.Freeze.cs b/src/managed/Nota.App/MainWindow.Freeze.csindex 5463b7ea..92902ae3 100644--- a/src/managed/Nota.App/MainWindow.Freeze.cs+++ b/src/managed/Nota.App/MainWindow.Freeze.cs@@ -162,8 +162,8 @@ public partial class MainWindow// Editing changes the source's notes/devices, so land on the source track.items.Add(FreezeMenuItem("Edit source", GlyphIcon(GlyphKind.Edit, accent: true),() => { Timeline.Select(src, -1); BeginEditSession(src); }));- items.Add(FreezeMenuItem("Unfreeze (wake source)", null, () => UnfreezeLink(src)));- items.Add(FreezeMenuItem("Flatten (remove source)", null, () => FlattenLinkAsync(src)));+ items.Add(FreezeMenuItem("Unfreeze (wake source)", MenuKit.Icon(GlyphKind.Freeze), () => UnfreezeLink(src)));+ items.Add(FreezeMenuItem("Flatten (remove source)", MenuKit.Icon(GlyphKind.Flatten), () => FlattenLinkAsync(src)));return items;}@@ -172,7 +172,7 @@ public partial class MainWindow{items.Add(FreezeMenuItem("Unfreeze track", SnowflakeIcon(),() => { Timeline.Select(trackId, -1); UnfreezeTrack(trackId); }));- items.Add(FreezeMenuItem("Flatten to audio track", null,+ items.Add(FreezeMenuItem("Flatten to audio track", MenuKit.Icon(GlyphKind.Flatten),async () => { Timeline.Select(trackId, -1); await FlattenTrackAsync(trackId); }));}elsediff --git a/src/managed/Nota.App/MenuKit.cs b/src/managed/Nota.App/MenuKit.csnew file mode 100644index 00000000..86200e77--- /dev/null+++ b/src/managed/Nota.App/MenuKit.cs@@ -0,0 +1,49 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Context-menu items with a drawn icon on the left and the matching shortcut on the right.+// The gesture is display-only (MenuItem.InputGesture doesn't bind anything): the real key+// handlers live in MainWindow.Input.cs / the native Edit menu / DeviceChainView, so only+// list a gesture here when one of those actually performs the same command.++using System;+using Avalonia.Controls;+using Avalonia.Input;++namespace Nota.App;++internal static class MenuKit+{+ private static KeyModifiers Primary => OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control;++ /// <summary>⌘ + key on macOS, Ctrl + key elsewhere.</summary>+ public static KeyGesture Cmd(Key key, bool shift = false)+ => new(key, Primary | (shift ? KeyModifiers.Shift : KeyModifiers.None));++ public static readonly KeyGesture CopyKey = Cmd(Key.C);+ public static readonly KeyGesture CutKey = Cmd(Key.X);+ public static readonly KeyGesture PasteKey = Cmd(Key.V);+ public static readonly KeyGesture PasteBouncedKey = Cmd(Key.V, shift: true);+ public static readonly KeyGesture DuplicateKey = Cmd(Key.D);+ public static readonly KeyGesture SplitKey = Cmd(Key.E);+ public static readonly KeyGesture ConsolidateKey = Cmd(Key.J);+ public static readonly KeyGesture LoopKey = Cmd(Key.L);+ public static readonly KeyGesture GroupKey = Cmd(Key.G);+ public static readonly KeyGesture UngroupKey = Cmd(Key.G, shift: true);+ public static readonly KeyGesture ActivateKey = new(Key.D0);+ // Delete and Backspace both delete; show the key the platform calls "delete".+ public static readonly KeyGesture DeleteKey = new(OperatingSystem.IsMacOS() ? Key.Back : Key.Delete);++ /// <summary>A menu icon. Its ink inherits the item's foreground, so it follows hover and+ /// disabled like the label does.</summary>+ public static Control Icon(GlyphKind kind) => new Glyph(kind, 11);++ public static MenuItem Item(string header, GlyphKind? icon = null, Action? click = null,+ KeyGesture? gesture = null, bool enabled = true)+ {+ var mi = new MenuItem { Header = header, IsEnabled = enabled, InputGesture = gesture };+ if (icon is { } k) mi.Icon = Icon(k);+ if (click is not null) mi.Click += (_, _) => click();+ return mi;+ }+}diff --git a/src/managed/Nota.App/Theme/NotaTheme.axaml b/src/managed/Nota.App/Theme/NotaTheme.axamlindex e09ca30c..a84ba39e 100644--- a/src/managed/Nota.App/Theme/NotaTheme.axaml+++ b/src/managed/Nota.App/Theme/NotaTheme.axaml@@ -1148,6 +1148,13 @@<Style Selector="MenuItem:disabled"><Setter Property="Foreground" Value="{DynamicResource Brush.TextDisabled}"/></Style>+ <!-- Shortcut on the right of an item (MenuItem.InputGesture): the label's own ink, faded,+ so it follows hover / disabled but stays secondary to the command name. -->+ <Style Selector="MenuItem /template/ TextBlock#PART_InputGestureText">+ <Setter Property="Foreground" Value="{Binding $parent[MenuItem].Foreground}"/>+ <Setter Property="Opacity" Value="0.45"/>+ <Setter Property="Margin" Value="20,0,0,0"/>+ </Style><Style Selector="Separator"><Setter Property="Background" Value="{DynamicResource Brush.BorderDefault}"/>