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.

(feat) Track inspector tab in the browser rail (#186) (#396)

Chris Laupamac4d8cea35f9d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80459c57..d6200e2b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,11 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Track inspector** (#186): a new tab at the bottom of the browser's left rail shows the
+ selected track's settings in one place — name, Mute / Solo / Arm, record input and input
+ monitoring or MIDI from, colour, row height and the freeze commands — so they no longer
+ need the track's right-click menu. It follows the track the Devices panel shows and
+ picks up changes made anywhere else at once. The right-click menu keeps its entries.
- **Clip editor track mode** (#49): a **Clip | Track** switch at the top of the Clip editor's
inspector (and *Toggle clip editor track mode* in the command palette). Track shows every MIDI clip of the
track on the arrangement's timeline from bar 1, each clip's borders marked in the clip strip,
diff --git a/FEATURES.md b/FEATURES.md
index 9003abcd..5e782a80 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -1081,9 +1081,15 @@ audio effects after it keep running and keep their settings; saved with the proj
- An **island panel** with an icon rail down its left edge: **Instruments / Audio Effects /
MIDI Effects**, then **Files** (with folder tree navigation), **Presets** (a tree of
- category → device → preset), **Projects**, **Map** (MIDI Learn mappings) and **History**
- (the open project's versions). A hairline
+ category → device → preset), **Projects**, **Map** (MIDI Learn mappings), **History**
+ (the open project's versions) and the **Track inspector**. A hairline
separates the device tabs from the library tabs, and the active one carries an orange edge.
+- **Track inspector**: the last rail tab shows the track the Devices panel shows — its name
+ (type to rename), Mute / Solo / Arm, record input and input monitoring (audio tracks) or
+ MIDI from (instrument tracks), colour, row height and the freeze commands (Freeze, Live
+ freeze, Unfreeze, Flatten, and Edit source / Done / Discard on a live-freeze link). A
+ return shows its name, Mute and colour; the master its name. Changes made from the
+ header, the track menu or undo show in it straight away.
- **Category chips**: above each device tab's list, one chip per kind of device — Synths /
Keys & physical / Drums / Samplers / Racks; EQ & filter / Dynamics / Reverb & delay /
Modulation / Distortion / Pitch & time / Utility / Racks; Generate / Shape. A click
diff --git a/specs/060-track-inspector/checklists/requirements.md b/specs/060-track-inspector/checklists/requirements.md
new file mode 100644
index 00000000..d5ff321f
--- /dev/null
+++ b/specs/060-track-inspector/checklists/requirements.md
@@ -0,0 +1,35 @@
+# Specification Quality Checklist: Track inspector
+
+**Purpose**: Validate specification completeness and quality before proceeding to planning
+**Created**: 2026-10-30
+**Feature**: [spec.md](../spec.md)
+
+## Content Quality
+
+- [x] No implementation details (languages, frameworks, APIs)
+- [x] Focused on user value and business needs
+- [x] Written for non-technical stakeholders
+- [x] All mandatory sections completed
+
+## Requirement Completeness
+
+- [x] No [NEEDS CLARIFICATION] markers remain
+- [x] Requirements are testable and unambiguous
+- [x] Success criteria are measurable
+- [x] Success criteria are technology-agnostic (no implementation details)
+- [x] All acceptance scenarios are defined
+- [x] Edge cases are identified
+- [x] Scope is clearly bounded
+- [x] Dependencies and assumptions identified
+
+## Feature Readiness
+
+- [x] All functional requirements have clear acceptance criteria
+- [x] User scenarios cover primary flows
+- [x] Feature meets measurable outcomes defined in Success Criteria
+- [x] No implementation details leak into specification
+
+## Notes
+
+- Open points were settled with defaults recorded under Clarifications (place, scope of
+ settings, menu left unchanged, returns / master); none needed a [NEEDS CLARIFICATION].
diff --git a/specs/060-track-inspector/plan.md b/specs/060-track-inspector/plan.md
new file mode 100644
index 00000000..19c29512
--- /dev/null
+++ b/specs/060-track-inspector/plan.md
@@ -0,0 +1,61 @@
+# Implementation Plan: Track inspector
+
+**Branch**: `060-track-inspector` | **Date**: 2026-10-30 | **Spec**: [spec.md](spec.md)
+
+## Summary
+
+A `TrackInspectorView` hosted as the browser's ninth rail tab, beside the bespoke Map and
+History tabs. `MainWindow.ShowDevices` — the one place that decides which track the Devices
+panel shows — also points the inspector at that track. The view builds its sections from the
+engine and writes through the calls the header and the track menu already use, so undo,
+arming and automation rules are shared rather than copied. No engine, ABI or format change.
+
+## Technical Context
+
+- **Rail**: `BrowserView` — `TabCount` 9, `InspectorTab = 8` treated as a custom tab (no
+ search, status line or preview), a hairline above it, `SetTrackInspector(Control)`.
+- **View**: `TrackInspectorView.cs` (new). Sections reuse the Session inspector's pieces
+ (`SectionHead`, `Row`, `Chip`, `Pick`, `Segmented`, widened from `private` to `internal`).
+- **Edits**:
+ - name → `SetTrackName`; mute / solo → `SetTrackMute` / `SetTrackSolo`; arm →
+ `TrackArming.Set` (exclusive arm, ⌘-click adds);
+ - record input → `RecordInputPick.ApplyTo`, monitor → `SetTrackMonitor`;
+ - MIDI from → `SetTrackMidiSource`;
+ - colour → `ArrangementView.SetTrackColours` (extracted from the menu's colour row: one
+ undo group); height → `ArrangementView.SetTrackHeights`;
+ - freeze → `MainWindow.TrackFreezeEntries`, the menu's freeze entries as data
+ (`FreezeEntry`), rendered by the menu as items and by the inspector as buttons.
+- **Picker lists**: `ArrangementView.RecordInputChoices` / `MidiSourceChoices` give the same
+ sources, in the same order, as the menu.
+- **Staying current**: a 250 ms timer while the view is attached; it skips when the tab is
+ hidden (browser folded) or the name box has focus, compares a string snapshot of
+ everything shown, and rebuilds on a difference. A rebuild is a few dozen controls.
+
+## Audio-thread impact
+
+None. Every edit goes through an existing message-thread engine setter that the track
+header and menu already use; the inspector only reads state on the UI thread. Nothing new
+runs on the audio thread: no allocation, locks, I/O or logging there, no structural graph
+edit (so no new graph snapshot), and Transport stays the only source of musical time.
+
+## Constitution Check
+
+- I Real-time safety: UI only; every engine call is an existing message-thread setter. ✓
+- II Boundary: no ABI change. ✓
+- III Licensing: one new source file with the SPDX header; no dependencies. ✓
+- IV Verification: no engine behaviour change; the smoke test's design-token checks cover the
+ new view's tokens and labels; `scripts/build-linux.sh` green. ✓
+- V One change: the inspector only (the track menu is untouched apart from building its
+ freeze items from the shared list). ✓
+- VI Docs: CHANGELOG, FEATURES.md; the user manual (nota-docs) follows separately. ✓
+
+## Project Structure (touched)
+
+```
+src/managed/Nota.App/TrackInspectorView.cs (new)
+src/managed/Nota.App/BrowserView.cs
+src/managed/Nota.App/ArrangementView.Tracks.cs
+src/managed/Nota.App/MainWindow.{axaml.cs,Detail.cs,Freeze.cs}
+src/managed/Nota.App/SessionView.{Inspector.cs,Mixer.cs}
+CHANGELOG.md, FEATURES.md
+```
diff --git a/specs/060-track-inspector/quickstart.md b/specs/060-track-inspector/quickstart.md
new file mode 100644
index 00000000..629c56e4
--- /dev/null
+++ b/specs/060-track-inspector/quickstart.md
@@ -0,0 +1,13 @@
+# Quickstart: verify the track inspector
+
+1. `scripts/build-linux.sh` (or `build.sh` / `build-win.ps1`) → smoke test passes.
+2. Run the app, add an audio track and an instrument track. Click the last icon on the
+ browser rail (Track inspector): it shows the selected track.
+3. Audio track: rename it (Enter), set Record input to Ext 1, turn Monitor input on, pick a
+ colour and Large height, press Freeze track. The header follows each change; ⌘Z undoes the
+ colour as it would from the menu.
+4. Instrument track: MIDI from lists the other instrument tracks.
+5. Mute the shown track from its header, then click another track: the inspector shows the
+ mute at once, then switches to the new track.
+6. Select a return, then the master: the inspector shows their reduced sections. Delete the
+ shown track: "No track selected".
diff --git a/specs/060-track-inspector/spec.md b/specs/060-track-inspector/spec.md
new file mode 100644
index 00000000..ec06cfab
--- /dev/null
+++ b/specs/060-track-inspector/spec.md
@@ -0,0 +1,134 @@
+# Feature Specification: Track inspector
+
+**Feature Branch**: `060-track-inspector`
+
+**Created**: 2026-10-30
+
+**Status**: Clarified
+
+**Input**: User description: "Feature Request: Inspector Panel for Tracks (GitHub issue nota-daw/nota#186). Nota already has the vertical tabs to the left. Add another tab that acts as the inspector for the currently selected track, so track settings — colour, record input, freeze/unfreeze and other commonly used options — have an orderly home instead of living in the context menu. The panel can be toggled like any of the other tabs."
+
+## Nota Context *(fill in — drives plan and tasks)*
+
+**Feature area** *(pick the main one)*:
+
+- [ ] Engine (C++, `src/native/nota.engine`) — real-time audio rules apply, see `ARCHITECTURE.md` AR table
+- [ ] Managed app (C#, `src/managed/*`) — domain, application, infrastructure, presentation
+- [x] UI (Avalonia, `src/managed/Nota.Presentation`) — follow `DESIGN.md` (Studio)
+- [ ] Plugin hosting (`pluginhost/`) — the only place JUCE is allowed
+- [ ] Build / packaging / CI (`scripts/`, `.github/`) — see `BUILD.md`
+- [ ] Docs only
+
+UI only: every control writes through engine calls that already exist (the same ones the
+track header and the track menu use). No engine, C ABI or project-format change.
+
+**Nota docs to keep in mind** *(links relative to `specs/<slug>/`, where this file lands)*:
+[`ARCHITECTURE.md`](../../ARCHITECTURE.md) (AR rules),
+[`CONTRIBUTING.md`](../../CONTRIBUTING.md) (licensing, dependency policy, PR
+expectations), [`BUILD.md`](../../BUILD.md), [`DESIGN.md`](../../DESIGN.md),
+[`FEATURES.md`](../../FEATURES.md).
+
+## Clarifications
+
+### Session 2026-10-30
+
+Defaults chosen for the open points (the request was clear on the place — a tab on the
+left rail — and on the purpose):
+
+- Q: Where does the inspector live? → A: A ninth tab on the browser's left icon rail,
+ "Track inspector", last on the rail behind a hairline (devices · library · mappings ·
+ track). It opens, folds and switches like every other rail tab.
+- Q: Which track does it show? → A: The track the Devices panel shows: the selected track
+ (the primary one in a multi-selection), from the Arrangement, the Session grid or the
+ Global view. No track → a one-line empty state.
+- Q: What goes in it? → A: The track's properties that today are reachable only from the
+ track menu, plus the header's state keys: name, mute / solo / record-arm, record input and
+ input monitoring (audio tracks), MIDI from (instrument tracks), colour, row height, and
+ freeze (Freeze / Live freeze / Unfreeze / Flatten / the live-freeze edit actions — the same
+ entries as the menu). Volume, pan, sends and output stay in the header and the mixer.
+- Q: Does the track menu lose those entries? → A: No. The menu is unchanged in this
+ change; trimming it is a separate decision once the inspector has been used.
+- Q: Returns and the master? → A: A return shows name, mute and colour (what its footer
+ row and menu offer). The master
+ shows its name and a line pointing to the Devices panel (it has no other settings).
+- Q: Is anything persisted? → A: No new state. Which rail tab is open is not remembered
+ today and stays that way.
+
+## User Scenarios & Testing *(mandatory)*
+
+### User Story 1 - See and change the selected track's settings (Priority: P1)
+
+A user selects a track and opens the Track inspector tab on the left rail. It shows the
+track's name and kind and every setting listed above; changing one there changes the track
+exactly as the header or the track menu would.
+
+**Why this priority**: The core of the request.
+
+**Independent Test**: Select an audio track, open the inspector, pick a colour, switch the
+record input to Ext 1, turn monitoring on, set the height to Large and freeze the track:
+the header shows each change, and each undoes as the same change made from the menu does.
+
+**Acceptance Scenarios**:
+
+1. **Given** an audio track is selected, **When** the user opens the Track inspector tab,
+ **Then** it shows the name, mute / solo / arm, record input + monitor, colour, height
+ and freeze.
+2. **Given** an instrument track is selected, **When** the inspector shows it, **Then** it
+ offers MIDI from instead of record input + monitor.
+3. **Given** a group track is selected, **When** the inspector shows it, **Then** it offers
+ name, mute / solo, colour and height (no arm, input or freeze).
+4. **Given** the user renames the track in the inspector and presses Enter, **Then** the
+ header shows the new name; Esc instead restores the old one.
+5. **Given** the user picks a colour, height or input in the inspector, **Then** it undoes
+ (or not) exactly as the same pick from the menu.
+
+---
+
+### User Story 2 - The inspector follows the selection and stays current (Priority: P1)
+
+The inspector always describes the track in focus, and it does not show stale state.
+
+**Independent Test**: With the inspector open, click through three tracks: the inspector
+switches each time. Mute the shown track from its header and undo a colour change with ⌘Z:
+the inspector shows both at once.
+
+**Acceptance Scenarios**:
+
+1. **Given** the inspector is open, **When** another track is selected, **Then** it shows
+ that track.
+2. **Given** the inspector shows a track, **When** the track changes elsewhere (header,
+ menu, undo / redo, keyboard), **Then** the inspector reflects it within a moment.
+3. **Given** the shown track is deleted or nothing is selected, **Then** the inspector shows
+ "No track selected".
+
+### Edge Cases
+
+- A frozen track: the input and MIDI-from rows are still shown; the freeze section offers
+ Unfreeze and Flatten.
+- A track in a live-freeze link: the freeze section offers the link's actions (Live freeze
+ off, Edit source / Done / Discard, Flatten), like the menu.
+- The browser folded to its rail: clicking the inspector tab unfolds it on the inspector.
+- A long name is trimmed with an ellipsis in the title; the name field scrolls.
+
+## Requirements *(mandatory)*
+
+### Functional Requirements
+
+- **FR-001**: The browser rail MUST have a "Track inspector" tab that shows the inspector.
+- **FR-002**: The inspector MUST show the track the Devices panel shows, and an empty state
+ when there is none.
+- **FR-003**: For tracks it MUST offer name, mute, solo, colour and height; arm for audio
+ and instrument tracks; record input + monitor for audio tracks; MIDI from for instrument
+ tracks; the freeze entries the track menu offers.
+- **FR-004**: For a return it MUST offer name, mute and colour; for the master, its
+ name only.
+- **FR-005**: Every edit MUST go through the same engine calls as the header / menu, so undo,
+ automation and arming rules behave the same.
+- **FR-006**: The inspector MUST reflect changes made elsewhere while it is visible.
+- **FR-007**: The track menu MUST stay as it is.
+
+## Success Criteria *(mandatory)*
+
+- **SC-001**: Every setting listed in FR-003 can be changed for the selected track without
+ opening a context menu.
+- **SC-002**: A change made elsewhere shows in the open inspector in under half a second.
diff --git a/specs/060-track-inspector/tasks.md b/specs/060-track-inspector/tasks.md
new file mode 100644
index 00000000..3c608b06
--- /dev/null
+++ b/specs/060-track-inspector/tasks.md
@@ -0,0 +1,25 @@
+# Tasks: Track inspector
+
+**Input**: [spec.md](spec.md), [plan.md](plan.md)
+
+## Phase 1 — Shared pieces
+
+- [x] T001 Freeze entries as data: `TrackFreezeEntries` + `FreezeEntry`; the track menu builds its items from them (MainWindow.Freeze.cs)
+- [x] T002 `SetTrackColours`, `RefreshAfterTrackEdit`, `TrackRowHeight`, `RecordInputChoices`, `MidiSourceChoices` (ArrangementView.Tracks.cs)
+- [x] T003 Widen the Session inspector's `SectionHead` / `Row` / `Chip` / `Pick` / `Segmented` to `internal` (SessionView.Inspector.cs, SessionView.Mixer.cs)
+
+## Phase 2 — Inspector (US1)
+
+- [x] T004 `TrackInspectorView`: title, name, Mute / Solo / Arm, input (record input + monitor, or MIDI from), colour, height, freeze; return and master variants; empty state (TrackInspectorView.cs)
+- [x] T005 Ninth rail tab "Track inspector" with a hairline above it; `SetTrackInspector` (BrowserView.cs)
+- [x] T006 Create the view and hand it to the browser; `ShowDevices` points it at its track (MainWindow.axaml.cs, MainWindow.Detail.cs)
+
+## Phase 3 — Staying current (US2)
+
+- [x] T007 Snapshot poll while attached and visible; skipped while the name is being typed (TrackInspectorView.cs)
+
+## Phase 4 — Verification + docs
+
+- [x] T008 CHANGELOG `[Unreleased]`, FEATURES.md
+- [x] T009 `scripts/build-linux.sh` green (smoke test incl. design-token checks)
+- [x] T010 Run the app: walk through [quickstart.md](quickstart.md); screenshots for the PR
diff --git a/src/managed/Nota.App/ArrangementView.Tracks.cs b/src/managed/Nota.App/ArrangementView.Tracks.cs
index 8674f1f0..59d61dab 100644
--- a/src/managed/Nota.App/ArrangementView.Tracks.cs
+++ b/src/managed/Nota.App/ArrangementView.Tracks.cs
@@ -230,16 +230,43 @@ public sealed partial class ArrangementView
{
var stored = ids.Select(id => _engine!.GetTrackColorIndex(id)).Distinct().ToList();
int current = stored.Count == 1 ? stored[0] : int.MinValue;
- return MenuKit.ColourGrid(current, ci =>
- {
- if (_engine is null) return;
- _engine.BeginUndoGroup();
- try { foreach (var id in ids) _engine.SetTrackColorIndex(id, ci); }
- finally { _engine.EndUndoGroup(); }
- Refresh(); SessionChanged?.Invoke();
- });
+ return MenuKit.ColourGrid(current, ci => SetTrackColours(ids, ci));
+ }
+
+ internal void SetTrackColours(IReadOnlyList<int> ids, int colorIndex)
+ {
+ if (_engine is null) return;
+ _engine.BeginUndoGroup();
+ try { foreach (var id in ids) _engine.SetTrackColorIndex(id, colorIndex); }
+ finally { _engine.EndUndoGroup(); }
+ Refresh(); SessionChanged?.Invoke();
+ }
+
+ // ---- the track inspector's view of a track (specs/060) -------------------------------
+
+ /// <summary>Redraws the headers and the Session grid after an edit made outside them.</summary>
+ internal void RefreshAfterTrackEdit() { Refresh(); SessionChanged?.Invoke(); }
+
+ internal double TrackRowHeight(int trackId) => StoredRowHeight(trackId);
+
+ /// <summary>An audio track's record-input choices in picker order (hardware, Master, the
+ /// other tracks, the returns), with their menu labels.</summary>
+ internal List<(RecordInputPick Pick, string Label)> RecordInputChoices(int trackId)
+ {
+ var list = RecordInputPick.Hardware.Select(h => (h.Pick, h.Label)).ToList();
+ list.Add((RecordInputPick.Track(-1), "Master"));
+ foreach (var v in _tracks)
+ if (v.Id != trackId) list.Add((RecordInputPick.Track(v.Id), v.Name.Length > 0 ? v.Name : $"Track {v.Id}"));
+ foreach (var v in _returns)
+ list.Add((RecordInputPick.Track(v.Id), v.Name.Length > 0 ? v.Name : $"Return {v.Id}"));
+ return list;
}
+ /// <summary>The instrument tracks another instrument track can take its MIDI from.</summary>
+ internal List<(int Id, string Name)> MidiSourceChoices(int trackId)
+ => _tracks.Where(v => v.Id != trackId && v.IsInstrument)
+ .Select(v => (v.Id, v.Name.Length > 0 ? v.Name : $"Track {v.Id}")).ToList();
+
// Compact / Standard / Large for one or more tracks (the chosen key when they all sit on
// that preset); Option / Alt applies the height to every track.
private MenuItem TrackHeightRow(IReadOnlyList<int> ids)
diff --git a/src/managed/Nota.App/BrowserView.cs b/src/managed/Nota.App/BrowserView.cs
index 33cf749f..2539bd10 100644
--- a/src/managed/Nota.App/BrowserView.cs
+++ b/src/managed/Nota.App/BrowserView.cs
@@ -156,13 +156,14 @@ public sealed class BrowserView : UserControl
return g;
}
- private const int TabCount = 8; // Instr / FX / MIDI / Files / Preset / Proj / Map / History
+ private const int TabCount = 9; // Instr / FX / MIDI / Files / Preset / Proj / Map / History / Track
private const int EffectsTab = 1; // Audio effects
private const int FilesTab = 3; // samples: the player auditions the file
private const int PresetsTab = 4; // Instr / FX / MIDI / Files / Presets carry the player
private const int MapTab = 6; // MIDI-learn mappings — hosts a MidiMapView, not a list
private const int HistoryTab = 7; // the open project's versions — hosts a HistoryView
- private static bool IsCustomTab(int index) => index is MapTab or HistoryTab;
+ private const int InspectorTab = 8; // the selected track's settings — hosts a TrackInspectorView
+ private static bool IsCustomTab(int index) => index is MapTab or HistoryTab or InspectorTab;
private const double RowH = 26; // single-line index row (almanac list row: 26–28, one line)
private const double GroupRowH = 22;
@@ -176,6 +177,7 @@ public sealed class BrowserView : UserControl
private ISettingsService? _settings;
private MidiMapView? _midiMap;
private HistoryView? _historyView;
+ private Control? _trackInspector;
// Collapsed: only the icon rail shows; clicking an icon unfolds the browser on that tab.
private bool _collapsed;
@@ -267,9 +269,10 @@ public sealed class BrowserView : UserControl
RailTab(5, "Projects", GlyphKind.Doc),
RailTab(6, "MIDI map", GlyphKind.Map),
RailTab(7, "History", GlyphKind.History),
+ RailTab(InspectorTab, "Track inspector", GlyphKind.Track),
};
- // A hairline above Files and above Map: devices · library · mappings.
- foreach (int i in new[] { 3, 6 })
+ // A hairline above Files, Map and the inspector: devices · library · mappings · track.
+ foreach (int i in new[] { 3, 6, InspectorTab })
{
_tabs[i].BorderThickness = new Thickness(0, 1, 0, 0);
_tabs[i].BindResource(Border.BorderBrushProperty, "Brush.BorderDefault");
@@ -455,6 +458,13 @@ public sealed class BrowserView : UserControl
if (_active == HistoryTab) _content.Content = view;
}
+ /// <summary>Give the browser the track inspector tab (specs/060).</summary>
+ internal void SetTrackInspector(Control view)
+ {
+ _trackInspector = view;
+ if (_active == InspectorTab) _content.Content = view;
+ }
+
/// <summary>Reveal the MIDI-mappings tab (called when learn mode is armed).</summary>
public void ShowMidiMap() { SelectTab(MapTab); SetCollapsed(false, persist: true); }
/// <summary>Opens the History tab (the project's versions).</summary>
@@ -685,9 +695,15 @@ public sealed class BrowserView : UserControl
_active = index;
for (int i = 0; i < _tabs.Length; i++)
_tabs[i].Classes.Set("active", !_collapsed && i == index);
- // The MIDI-map and History tabs host bespoke views, not a filtered item list.
+ // The MIDI-map, History and inspector tabs host bespoke views, not a filtered item list.
bool isMap = IsCustomTab(index);
- _content.Content = index == MapTab ? _midiMap : index == HistoryTab ? (Control?)_historyView : _pages[index];
+ _content.Content = index switch
+ {
+ MapTab => _midiMap,
+ HistoryTab => _historyView,
+ InspectorTab => _trackInspector,
+ _ => _pages[index],
+ };
if (index == HistoryTab) _historyView?.Refresh();
_searchWrap.IsVisible = !isMap;
_optionsBtn.IsVisible = !isMap;
diff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.cs
index f7fac457..2f7af2b7 100644
--- a/src/managed/Nota.App/MainWindow.Detail.cs
+++ b/src/managed/Nota.App/MainWindow.Detail.cs
@@ -355,6 +355,7 @@ public partial class MainWindow
// — a browser drop, Convert, the Devices tab — leave it true.
private void ShowDevices(int trackId, bool takeOverPanel = true)
{
+ _trackInspector?.Show(trackId);
if (_vm is null || _deviceChain is null) return;
// No track (the selected one was just deleted): empty the chain instead of leaving the
// dead track's instrument/effect cards on screen — they'd still edit a removed track.
diff --git a/src/managed/Nota.App/MainWindow.Freeze.cs b/src/managed/Nota.App/MainWindow.Freeze.cs
index b5b3e028..75f83e22 100644
--- a/src/managed/Nota.App/MainWindow.Freeze.cs
+++ b/src/managed/Nota.App/MainWindow.Freeze.cs
@@ -147,47 +147,53 @@ public partial class MainWindow
// switching it on live-freezes the track, switching it off unfreezes the link (wakes the
// source). While linked, Edit (or Done / Discard mid-session) and Flatten follow; a track
// frozen in place offers Unfreeze / Flatten instead. Each command first selects its track
- // so the device panel and header buttons follow.
- private IReadOnlyList<Control> BuildTrackFreezeMenu(int trackId)
+ // so the device panel and header buttons follow. The track inspector (specs/060) shows the
+ // same entries as buttons.
+ private IReadOnlyList<FreezeEntry> TrackFreezeEntries(int trackId)
{
- var items = new List<Control>();
+ var items = new List<FreezeEntry>();
if ((LinkForSource(trackId) ?? LinkForFrozen(trackId)) is { } link)
{
int src = link.SourceId;
- items.Add(MenuKit.SwitchItem("Live freeze", GlyphKind.ChainLink, true, () => UnfreezeLink(src)));
+ items.Add(new("Live freeze", GlyphKind.ChainLink, () => UnfreezeLink(src), Switch: true));
if (link.State == LinkState.Editing)
{
- items.Add(MenuKit.Item("Done — re-freeze", GlyphKind.Check,
+ items.Add(new("Done — re-freeze", GlyphKind.Check,
() => { Timeline.Select(trackId, -1); _ = CommitEditSessionAsync(src); }));
- items.Add(MenuKit.Danger("Discard edits", GlyphKind.Cross,
- () => { Timeline.Select(trackId, -1); DiscardEditSession(src); }));
+ items.Add(new("Discard edits", GlyphKind.Cross,
+ () => { Timeline.Select(trackId, -1); DiscardEditSession(src); }, Danger: true));
}
else
// Editing changes the source's notes/devices, so land on the source track.
- items.Add(MenuKit.Item("Edit source", GlyphKind.Edit,
+ items.Add(new("Edit source", GlyphKind.Edit,
() => { Timeline.Select(src, -1); BeginEditSession(src); }));
- items.Add(MenuKit.Danger("Flatten (remove source)", GlyphKind.Flatten, () => FlattenLinkAsync(src)));
+ items.Add(new("Flatten (remove source)", GlyphKind.Flatten, () => FlattenLinkAsync(src), Danger: true));
return items;
}
if (!IsFreezable(trackId)) return items;
if (Engine.IsTrackFrozen(trackId))
{
- items.Add(MenuKit.Item("Unfreeze track", GlyphKind.Freeze,
+ items.Add(new("Unfreeze track", GlyphKind.Freeze,
() => { Timeline.Select(trackId, -1); UnfreezeTrack(trackId); }));
- items.Add(MenuKit.Danger("Flatten to audio track", GlyphKind.Flatten,
- () => { Timeline.Select(trackId, -1); _ = FlattenTrackAsync(trackId); }));
+ items.Add(new("Flatten to audio track", GlyphKind.Flatten,
+ () => { Timeline.Select(trackId, -1); _ = FlattenTrackAsync(trackId); }, Danger: true));
}
else
{
- items.Add(MenuKit.Item("Freeze track", GlyphKind.Freeze,
+ items.Add(new("Freeze track", GlyphKind.Freeze,
() => { Timeline.Select(trackId, -1); _ = FreezeTrackAsync(trackId); }));
- items.Add(MenuKit.SwitchItem("Live freeze", GlyphKind.ChainLink, false,
- () => { Timeline.Select(trackId, -1); _ = LiveFreezeAsync(trackId); }));
+ items.Add(new("Live freeze", GlyphKind.ChainLink,
+ () => { Timeline.Select(trackId, -1); _ = LiveFreezeAsync(trackId); }, Switch: false));
}
return items;
}
+ private IReadOnlyList<Control> BuildTrackFreezeMenu(int trackId)
+ => TrackFreezeEntries(trackId).Select(e => (Control)(e.Switch is { } on ? MenuKit.SwitchItem(e.Label, e.Icon, on, e.Run)
+ : e.Danger ? MenuKit.Danger(e.Label, e.Icon, e.Run)
+ : MenuKit.Item(e.Label, e.Icon, e.Run))).ToList();
+
// Freeze entries for the multi-track menu: freeze the live tracks / unfreeze the frozen
// ones among the selection. Live-freeze pairs are per-track, so they're left to each
// track's own menu, as are returns and groups (never freezable).
@@ -329,3 +335,7 @@ public partial class MainWindow
return tmp;
}
}
+
+/// <summary>One freeze command for a track: a plain or destructive action, or a switch
+/// (<paramref name="Switch"/> = its current state) whose click flips it.</summary>
+internal readonly record struct FreezeEntry(string Label, GlyphKind Icon, Action Run, bool Danger = false, bool? Switch = null);
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index db00df63..94673f6e 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -52,6 +52,7 @@ public partial class MainWindow : Window
// Bottom detail panel (Devices chain / Clip piano roll / Mixer).
private DeviceChainView? _deviceChain;
+ private TrackInspectorView? _trackInspector;
private ClipEditorView? _clipEditor;
private AudioClipEditorView? _audioEditor;
private MixerView? _mixer;
@@ -204,6 +205,8 @@ public partial class MainWindow : Window
Timeline.FreezeMenuItems = BuildTrackFreezeMenu; // track context menu: Freeze / Live Freeze
Timeline.FreezeTracksMenuItems = BuildTracksFreezeMenu; // multi-track menu: Freeze / Unfreeze all
Timeline.RefreshStarting = PruneFreezeLinks; // drop links to deleted / undone tracks
+ _trackInspector = new TrackInspectorView(vm.Engine, Timeline, TrackFreezeEntries, () => vm.SuspendEnginePolling); // browser's Track inspector tab (specs/060)
+ Browser.SetTrackInspector(_trackInspector);
Timeline.MidiClipActivated += OpenClipEditor;
Timeline.EditSelectedClipsRequested += () => EditSelectedClips();
Timeline.ClipSelectionChanged += FollowClipSelection;
diff --git a/src/managed/Nota.App/SessionView.Inspector.cs b/src/managed/Nota.App/SessionView.Inspector.cs
index 596f0f00..ef4e4c8b 100644
--- a/src/managed/Nota.App/SessionView.Inspector.cs
+++ b/src/managed/Nota.App/SessionView.Inspector.cs
@@ -87,7 +87,7 @@ public sealed partial class SessionView
return new StackPanel { Spacing = 4, Children = { head, s } };
}
- private static TextBlock SectionHead(string text) => new()
+ internal static TextBlock SectionHead(string text) => new()
{
Text = text, FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = NotaPalette.TextMuted,
};
@@ -136,7 +136,7 @@ public sealed partial class SessionView
}
// A label on the left and a small value chip on the right (Quantize, Legato…).
- private static Control Row(string label, Control right)
+ internal static Control Row(string label, Control right)
{
var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), Height = 22 };
g.Children.Add(new TextBlock { Text = label, FontSize = 11, Foreground = NotaPalette.TextSecondary, VerticalAlignment = VerticalAlignment.Center });
@@ -146,7 +146,7 @@ public sealed partial class SessionView
return g;
}
- private static Button Chip(string value, bool lit, Action<Button> click)
+ internal static Button Chip(string value, bool lit, Action<Button> click)
{
var b = new Button { Classes = { "chip" }, Height = 22, Padding = new Thickness(8, 0), MinWidth = 0, Content = Mono(value, 10, lit ? NotaPalette.TextOnAccent : NotaPalette.TextPrimary) };
b.Classes.Set("lit", lit);
@@ -154,7 +154,7 @@ public sealed partial class SessionView
return b;
}
- private static void Pick<T>(Control anchor, IEnumerable<(T Value, string Label)> items, Func<T, bool> isCurrent, Action<T> choose)
+ internal static void Pick<T>(Control anchor, IEnumerable<(T Value, string Label)> items, Func<T, bool> isCurrent, Action<T> choose)
{
var f = new MenuFlyout();
foreach (var (v, label) in items)
diff --git a/src/managed/Nota.App/SessionView.Mixer.cs b/src/managed/Nota.App/SessionView.Mixer.cs
index a97b231a..5bba2094 100644
--- a/src/managed/Nota.App/SessionView.Mixer.cs
+++ b/src/managed/Nota.App/SessionView.Mixer.cs
@@ -350,7 +350,7 @@ public sealed partial class SessionView
}
/// <summary>A segmented switch (Border.segmented + ToggleButton.seg); exactly one is lit.</summary>
- private static Border Segmented(IReadOnlyList<string> labels, int selected, Action<int> pick, bool compact = false, bool mono = false)
+ internal static Border Segmented(IReadOnlyList<string> labels, int selected, Action<int> pick, bool compact = false, bool mono = false)
{
var row = new UniformGrid { Rows = 1 };
var buttons = new List<ToggleButton>();
diff --git a/src/managed/Nota.App/TrackInspectorView.cs b/src/managed/Nota.App/TrackInspectorView.cs
new file mode 100644
index 00000000..2eccbbe3
--- /dev/null
+++ b/src/managed/Nota.App/TrackInspectorView.cs
@@ -0,0 +1,380 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The track inspector (specs/060, #186): the browser's Track inspector tab, showing the track
+// the Devices panel shows — name, mute / solo / arm, record input + monitor or MIDI from,
+// colour, row height and freeze — so those settings have a home besides the track menu. Every
+// control calls what the header and the menu call, so undo and arming behave the same.
+// Changes made elsewhere (header, menu, undo, keys) are picked up while the tab is on screen:
+// a snapshot of what it shows — including every record-input and MIDI-from choice — is taken four
+// times a second and the panel rebuilt when it differs. While freeze or export has suspended
+// engine polling, the timer does not read the engine: that job owns it on another thread.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Input;
+using Avalonia.Layout;
+using Avalonia.Media;
+using Avalonia.Threading;
+using Nota.Application;
+
+namespace Nota.App;
+
+internal sealed class TrackInspectorView : UserControl
+{
+ private static readonly (string Label, double Height)[] Heights =
+ {
+ ("Compact", ArrangementView.CompactRowHeight), ("Standard", ArrangementView.StandardRowHeight), ("Large", ArrangementView.LargeRowHeight),
+ };
+
+ private readonly IAudioEngine _engine;
+ private readonly ArrangementView _timeline;
+ private readonly Func<int, IReadOnlyList<FreezeEntry>> _freezeEntries;
+ private readonly Func<bool> _engineSuspended;
+ private readonly DispatcherTimer _poll = new() { Interval = TimeSpan.FromMilliseconds(250) };
+ private int _trackId = -1;
+ private string _shown = "";
+ private TextBox? _nameBox;
+
+ public TrackInspectorView(IAudioEngine engine, ArrangementView timeline, Func<int, IReadOnlyList<FreezeEntry>> freezeEntries,
+ Func<bool> engineSuspended)
+ {
+ _engine = engine;
+ _timeline = timeline;
+ _freezeEntries = freezeEntries;
+ _engineSuspended = engineSuspended;
+ _poll.Tick += (_, _) => Poll();
+ Rebuild();
+ }
+
+ /// <summary>Shows this track (≤ 0: none).</summary>
+ public void Show(int trackId)
+ {
+ if (trackId == _trackId) return;
+ _trackId = trackId;
+ Rebuild();
+ }
+
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+ Rebuild();
+ _poll.Start();
+ }
+
+ protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ _poll.Stop();
+ base.OnDetachedFromVisualTree(e);
+ }
+
+ private void Poll()
+ {
+ // Freeze and export run on a worker and replace the session when they finish. The
+ // progress dialog keeps this timer running, so leave the engine alone until the job
+ // is done (the same SuspendEnginePolling the playhead clock honours).
+ if (_engineSuspended()) return;
+ // A folded browser keeps the tab attached but hidden; a name being typed must not be
+ // swept away by a rebuild.
+ if (!IsEffectivelyVisible || _nameBox?.IsFocused == true) return;
+ if (Snapshot() != _shown) Rebuild();
+ }
+
+ private bool IsMaster => _trackId > 0 && _trackId == _engine.MasterTrackId;
+
+ private bool TryInfo(out NotaTrackInfo info)
+ {
+ for (int i = 0; i < _engine.TrackCount; i++)
+ if (_engine.TryGetTrackInfo(i, out info) && info.Id == _trackId) return true;
+ info = default;
+ return false;
+ }
+
+ private static bool IsAudio(in NotaTrackInfo ti) => !ti.IsInstrument && !ti.IsReturn && !ti.IsGroup;
+
+ // Everything the panel shows, as one string: a difference means something changed elsewhere.
+ private string Snapshot()
+ {
+ if (IsMaster) return "master|" + _engine.GetTrackName(_trackId);
+ if (_trackId <= 0 || !TryInfo(out var ti)) return "none";
+ int id = ti.Id;
+ var sb = new StringBuilder();
+ sb.Append(ti.IsInstrument).Append(ti.IsReturn).Append(ti.IsGroup).Append('|')
+ .Append(TrackNames.Of(_engine, ti)).Append('|')
+ .Append(_engine.GetTrackColorIndex(id)).Append(',').Append(ArrangementView.EffectiveColorIndex(_engine, id)).Append('|')
+ .Append(ti.Muted).Append(ti.Soloed).Append(ti.Armed).Append('|')
+ .Append(_timeline.TrackRowHeight(id)).Append('|');
+ if (IsAudio(ti))
+ {
+ var pick = RecordInputPick.Of(_engine, id);
+ sb.Append(pick).Append(_engine.GetTrackMonitor(id));
+ if (pick.Source > 0) sb.Append(TrackNames.Of(_engine, pick.Source));
+ foreach (var c in _timeline.RecordInputChoices(id))
+ sb.Append('|').Append(c.Pick.Source).Append(':').Append((int)c.Pick.Channels).Append('=').Append(c.Label);
+ }
+ if (ti.IsInstrument)
+ {
+ int src = _engine.GetTrackMidiSource(id);
+ sb.Append(src);
+ if (src > 0) sb.Append(TrackNames.Of(_engine, src));
+ foreach (var c in _timeline.MidiSourceChoices(id))
+ sb.Append('|').Append(c.Id).Append('=').Append(c.Name);
+ }
+ foreach (var f in _freezeEntries(id)) sb.Append('|').Append(f.Label).Append(f.Switch);
+ return sb.ToString();
+ }
+
+ private void Rebuild()
+ {
+ if (_engineSuspended()) return;
+ _shown = Snapshot();
+ _nameBox = null;
+ var s = new StackPanel { Spacing = 18, Margin = new Thickness(12, 12, 12, 16) };
+ if (IsMaster) BuildMaster(s);
+ else if (_trackId > 0 && TryInfo(out var ti)) BuildTrack(s, ti);
+ else
+ {
+ Content = new TextBlock
+ {
+ Text = "No track selected", FontSize = 11, Foreground = NotaPalette.TextTertiary,
+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
+ };
+ return;
+ }
+ Content = new ScrollViewer { Content = s, HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled };
+ }
+
+ // ---- sections -----------------------------------------------------------------------
+
+ private void BuildMaster(StackPanel s)
+ {
+ string name = _engine.GetTrackName(_trackId) is { Length: > 0 } m ? m : "Master";
+ s.Children.Add(Title(NotaPalette.Master, name, "MASTER"));
+ s.Children.Add(Note("Every track ends up here. Its devices are in the Devices panel."));
+ }
+
+ private void BuildTrack(StackPanel s, NotaTrackInfo ti)
+ {
+ int id = ti.Id;
+ bool audio = IsAudio(ti);
+ bool frozen = (audio || ti.IsInstrument) && _engine.IsTrackFrozen(id);
+ string kind = ti.IsReturn ? "Return" : ti.IsGroup ? "Group" : ti.IsInstrument ? "MIDI track" : "Audio track";
+ s.Children.Add(Title(ArrangementView.TrackBrush(ArrangementView.EffectiveColorIndex(_engine, id)), TrackNames.Of(_engine, ti),
+ NotaText.Label(frozen ? kind + " · frozen" : kind)));
+
+ s.Children.Add(Section("Name", NameBox(ti)));
+
+ var state = new UniformGrid { Rows = 1, Columns = 3, ColumnSpacing = 6 };
+ state.Children.Add(Toggle("Mute", ti.Muted != 0, NotaPalette.Mute, "Mute the track",
+ (on, _) => { _engine.SetTrackMute(id, on); Edited(); }));
+ if (!ti.IsReturn)
+ state.Children.Add(Toggle("Solo", ti.Soloed != 0, NotaPalette.Solo, "Solo the track",
+ (on, _) => { _engine.SetTrackSolo(id, on); Edited(); }));
+ if (audio || ti.IsInstrument)
+ state.Children.Add(Toggle("Arm", ti.Armed != 0, NotaPalette.Record, TrackArming.Tip,
+ (on, mods) => { TrackArming.Set(_engine, id, on, TrackArming.IsAdditive(mods)); Edited(); }));
+ s.Children.Add(state);
+
+ if (audio) s.Children.Add(Section("Input", InputRows(id)));
+ if (ti.IsInstrument) s.Children.Add(Section("Input", MidiFromRow(id)));
+
+ s.Children.Add(Section("Color", Swatches(id)));
+
+ if (!ti.IsReturn)
+ {
+ double h = _timeline.TrackRowHeight(id);
+ int chosen = Array.FindIndex(Heights, p => Math.Abs(p.Height - h) < 0.5);
+ s.Children.Add(Section("Height", SessionView.Segmented(Heights.Select(p => p.Label).ToList(), chosen,
+ i => { _timeline.SetTrackHeights(new[] { id }, Heights[i].Height); Rebuild(); })));
+ }
+
+ var freeze = _freezeEntries(id);
+ if (freeze.Count > 0) s.Children.Add(Section("Freeze", FreezeButtons(freeze)));
+ }
+
+ // Enter or leaving the box renames; Esc puts the name back. An empty name returns the
+ // track to its automatic one (the instrument's, "Audio 3"…).
+ private Control NameBox(NotaTrackInfo ti)
+ {
+ int id = ti.Id;
+ string shown = TrackNames.Of(_engine, ti);
+ var box = new TextBox { Text = shown, FontSize = 11, Height = NotaSize.Shell, MinHeight = 0, VerticalContentAlignment = VerticalAlignment.Center };
+ // Leaving the box also happens when a rebuild (another track selected) drops it, so the
+ // rename and the redraw it causes wait for the rebuild to finish.
+ void Commit()
+ {
+ string text = (box.Text ?? "").Trim();
+ if (text == shown) return;
+ Dispatcher.UIThread.Post(() =>
+ {
+ _engine.SetTrackName(id, text);
+ _timeline.RefreshAfterTrackEdit();
+ Rebuild();
+ });
+ }
+ box.KeyDown += (_, e) =>
+ {
+ if (e.Key is not (Key.Enter or Key.Escape)) return;
+ if (e.Key == Key.Escape) box.Text = shown;
+ e.Handled = true;
+ TopLevel.GetTopLevel(box)?.FocusManager?.Focus(null);
+ };
+ box.LostFocus += (_, _) => Commit();
+ _nameBox = box;
+ return box;
+ }
+
+ private Control InputRows(int id)
+ {
+ var choices = _timeline.RecordInputChoices(id);
+ var cur = RecordInputPick.Of(_engine, id);
+ int sel = choices.FindIndex(c => c.Pick.Matches(cur));
+ string label = sel >= 0 ? choices[sel].Label : RecordInputPick.Hardware[0].Label;
+ var rows = new StackPanel { Spacing = 8 };
+ rows.Children.Add(SessionView.Row("Record input", SessionView.Chip(label, false, a =>
+ SessionView.Pick(a, choices.Select(c => (c.Pick, c.Label)), p => p.Matches(cur),
+ p => { p.ApplyTo(_engine, id); Edited(); }))));
+
+ // Master can't be monitored (it would feed back), as on the header's monitor chip.
+ bool canMonitor = cur.Source != -1;
+ bool monitor = _engine.GetTrackMonitor(id);
+ var chip = SessionView.Chip(monitor ? "On" : "Off", monitor, _ => { _engine.SetTrackMonitor(id, !monitor); Edited(); });
+ chip.IsEnabled = canMonitor;
+ ToolTip.SetTip(chip, canMonitor ? "Hear the input live through this track" : "Master can't be monitored (it would feed back)");
+ rows.Children.Add(SessionView.Row("Monitor input", chip));
+ return rows;
+ }
+
+ private Control MidiFromRow(int id)
+ {
+ int cur = _engine.GetTrackMidiSource(id);
+ var choices = new List<(int Id, string Name)> { (-1, "None") };
+ choices.AddRange(_timeline.MidiSourceChoices(id));
+ string label = choices.FirstOrDefault(c => c.Id == cur).Name ?? "None";
+ var chip = SessionView.Chip(label, false, a =>
+ SessionView.Pick(a, choices.Select(c => (c.Id, c.Name)), v => v == cur, v => { _engine.SetTrackMidiSource(id, v); Edited(); }));
+ ToolTip.SetTip(chip, "Play another instrument track's MIDI through this track's instrument");
+ return SessionView.Row("MIDI from", chip);
+ }
+
+ // The track palette — each base in its normal, light and dark shade — and Auto, the
+ // stored colour ringed, as in the track menu.
+ private Control Swatches(int id)
+ {
+ int current = _engine.GetTrackColorIndex(id);
+ int bases = ArrangementView.PaletteBases, shades = ArrangementView.PaletteShades;
+ var grid = new UniformGrid { Columns = bases };
+ for (int shade = 0; shade < shades; shade++)
+ for (int b = 0; b < bases; b++)
+ {
+ int idx = b * shades + shade;
+ grid.Children.Add(Swatch(ArrangementView.TrackBrush(idx), idx == current, () => _timeline.SetTrackColours(new[] { id }, idx)));
+ }
+ var auto = SessionView.Chip("Auto", current == -1, _ => _timeline.SetTrackColours(new[] { id }, -1));
+ ToolTip.SetTip(auto, "The colour the track's position gives it");
+ auto.HorizontalAlignment = HorizontalAlignment.Left;
+ return new StackPanel { Spacing = 6, Children = { grid, auto } };
+ }
+
+ private Control Swatch(IBrush fill, bool on, Action pick)
+ {
+ var sw = new Border
+ {
+ Height = 18, Margin = new Thickness(2), CornerRadius = NotaRadius.Badge, Background = fill,
+ BorderBrush = on ? NotaPalette.TextPrimary : Brushes.Transparent, BorderThickness = new Thickness(on ? 1.5 : 0),
+ Cursor = new Cursor(StandardCursorType.Hand),
+ };
+ sw.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(sw).Properties.IsLeftButtonPressed) return;
+ e.Handled = true;
+ pick();
+ Rebuild();
+ };
+ return sw;
+ }
+
+ private Control FreezeButtons(IReadOnlyList<FreezeEntry> entries)
+ {
+ var wrap = new WrapPanel { Orientation = Orientation.Horizontal };
+ foreach (var f in entries)
+ {
+ var ink = f.Danger ? NotaPalette.Danger : NotaPalette.TextPrimary;
+ string text = f.Switch is { } on ? $"{f.Label} · {(on ? "on" : "off")}" : f.Label;
+ var content = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 6,
+ Children = { new Glyph(f.Icon, 12) { Foreground = ink, VerticalAlignment = VerticalAlignment.Center },
+ new TextBlock { Text = text, FontSize = 11, FontWeight = FontWeight.Medium, Foreground = ink, VerticalAlignment = VerticalAlignment.Center } },
+ };
+ var b = new Button { Height = NotaSize.Shell, Padding = new Thickness(10, 0), Margin = new Thickness(0, 0, 6, 6), Content = content };
+ var run = f.Run;
+ b.Click += (_, _) => run();
+ wrap.Children.Add(b);
+ }
+ return wrap;
+ }
+
+ // ---- pieces -------------------------------------------------------------------------
+
+ private void Edited()
+ {
+ _timeline.RefreshAfterTrackEdit();
+ Rebuild();
+ }
+
+ private static Control Title(IBrush color, string title, string sub)
+ {
+ var dot = new Border { Width = 10, Height = 10, CornerRadius = NotaRadius.Clip, Background = color, VerticalAlignment = VerticalAlignment.Center };
+ var name = new TextBlock
+ {
+ Text = title, FontSize = 15, FontWeight = FontWeight.SemiBold, Foreground = NotaPalette.TextPrimary,
+ TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center,
+ };
+ var head = new DockPanel { Children = { dot, name } };
+ DockPanel.SetDock(dot, Dock.Left);
+ dot.Margin = new Thickness(0, 0, 8, 0);
+ var s = ClipEditorKit.Mono(sub, 10, NotaPalette.TextTertiary);
+ s.TextTrimming = TextTrimming.CharacterEllipsis;
+ return new StackPanel { Spacing = 4, Children = { head, s } };
+ }
+
+ private static Control Section(string head, Control body)
+ => new StackPanel { Spacing = 8, Children = { SessionView.SectionHead(head), body } };
+
+ private static TextBlock Note(string text) => new()
+ {
+ Text = text, FontSize = 11, LineHeight = 16, Foreground = NotaPalette.TextTertiary, TextWrapping = TextWrapping.Wrap,
+ };
+
+ // A worded state key (Mute / Solo / Arm), filled in its colour while on — the header's
+ // chips at inspector size.
+ private static Control Toggle(string text, bool on, SolidColorBrush fill, string tip, Action<bool, KeyModifiers> set)
+ {
+ var tb = new TextBlock
+ {
+ Text = text, FontSize = 10, FontWeight = FontWeight.SemiBold,
+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
+ Foreground = on ? NotaPalette.InkOn(fill) : NotaPalette.TextSecondary,
+ };
+ var chip = new Border
+ {
+ Height = 22, CornerRadius = NotaRadius.Control, BorderThickness = new Thickness(1), Child = tb,
+ Background = on ? fill : NotaPalette.SurfaceRaised, BorderBrush = on ? fill : NotaPalette.Seam,
+ Cursor = new Cursor(StandardCursorType.Hand),
+ };
+ ToolTip.SetTip(chip, tip);
+ chip.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(chip).Properties.IsLeftButtonPressed) return;
+ e.Handled = true;
+ set(!on, e.KeyModifiers);
+ };
+ return chip;
+ }
+}