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) Arrangement groups as trays, the 0.59 staircase in the classic look, header meters that fit (#584) (#587)
Egor Khindikaynen39c7857c3c11
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 76210c7b..46a03f00 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -207,6 +207,14 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.notes in their articulation's colour instead of the track's.### Changed+- **Groups in the Arrangement read as trays** (#584, specs/094). In the new look a group's+ header row and its tracks now sit on one tray of the group's colour, with its edge down the+ left, and the tray closes under the group's last track, so a track after the group is+ clearly outside it. A track inside a group shows only its own colour bar, and nested groups+ are trays inside trays, a few pixels further in each, instead of a stripe per level. A+ folded group shows how many tracks it holds ("Instruments · 4"). The controls stay in the+ same columns however deep a track sits. In the classic look the headers draw groups as+ 0.59 did: each row's own colour stripe, stepped in per level, and no group tints.- **The menu under a Menu key, and the menu bar hidden** (Windows / Linux, #518, specs/093).The row of File, Edit, View, Transport and Help no longer sits between the title bar andthe transport bar, so the work area gains its height. The whole menu — the same items,@@ -578,6 +586,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.MCP: `list_audio_inputs`, `set_track_input`, `get_track_input`.### Fixed+- **Track header meters stay inside the header** (#584): on a Compact or a low Standard row a+ track's level meter ran into the bottom edge of its header, and a folded group's meter ran+ under its name and buttons. Every header meter now fits its row, and a group's meter stands+ at the right in the same column as the tracks'.- **The Files icon in the browser rail is the same size as its neighbours** (#579): thefolder is drawn on the same grid as the other rail icons.- **Monitoring a track through an audio track no longer crackles** (#563): an audio track whosediff --git a/DESIGN.md b/DESIGN.mdindex fd9f38bb..093cba8c 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -1156,14 +1156,28 @@ The controls at the left of each track in the arrangement.in ink 3, M, S, arm (monitor on audio tracks). Controls row (20): volume (a flat sliderwith its value inside), the pan knob and its value, the input picker. Every control theheader had stays.-- **Colour:** a 3 px bar in the track colour down the left edge. Inside a group the member- is indented 14: the group's 4 px bar runs down through it, then its own 3 px bar.+- **Colour:** a 3 px bar in the track colour down the left edge.+- **Groups** (specs/094) — a group is a **tray**: a 16 % wash of its colour on its own row,+ 8 % on the rest of the tray, a 3 px edge in the group colour down the tray's left side,+ the right corners rounded where it opens and closes. Its tracks sit in it as plain cards+ (`Panel`, inset 4 from the right) carrying only their own 3 px bar — no stripe per+ enclosing group, no tint on the card. A nested group is a tray inside the tray, 6 further+ in (3 edge + 3 gap). A tray closes under its last row with a 4 px strip (2 px for each+ further tray closing on the same row), taken out of that row so rows stay aligned with+ their lanes. The group row: chevron, name, M / S / (Cue) / Link and the meter in the+ tracks' column; folded, " · N" after the name (the tracks it hides, nested ones+ included). The group's lane keeps the 16 % wash; its tracks' lanes have none.+ **Classic look:** 0.59's staircase — each row's own 3 px spine, 10 further in per level,+ full height (the accent when selected); group rows on `SurfaceRaised`, tracks on+ `SurfaceCard`; no tints; the slim group row has the "Group" tag and its meter as a rail on+ a line of its own under the title.- **Keys:** M, S and arm are 18 × 18, 4 apart; the type tag is Label 11 in ink 3; theinput picker is 66 wide (a custom picker, not a ComboBox, so its text never truncates),and the monitor key goes ink 4 while Master is the input.- **Selected:** the header takes `TrackHeaderSelected` (background only, no outline) and itslane `LaneSelected`.-- **Meter** down the right edge.+- **Meter** down the right edge, inside the header on every row height (6 from the top and+ bottom, less on a Compact row), in one column for tracks and groups.- **Large** (from 100): a third row with the input picker, then the track's send to eachreturn, two per row as the height allows: the return's colour square and letter (tooltip"Send to Reverb"), then a value bar with the amount inside ("–" at 0), double-click todiff --git a/FEATURES.md b/FEATURES.mdindex b9e8e71c..2459cc0e 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -186,7 +186,10 @@ docks as a panel under any of the three, or floats in its own window — seemute/solo and level, and opens to the full control set when selected, so groups read asfamilies rather than as more tracks. A track without a colour of its own takes itsgroup's hue, shaded per sibling. The disclosure folds the group here and in the Mixer- alike; folded groups are saved with the project.+ alike; folded groups are saved with the project, and a folded group shows how many tracks+ it holds. In the new look a group is a **tray** of its colour holding its tracks (nested+ groups are trays inside trays, closing under their last track); in the classic look the+ rows step in per level as in 0.59 (specs/094).- **Return and Master rows stay pinned** under the tracks, each with a level meter, avolume fader and its dB value (the Master fader is the same master volume as thetransport's and the Mixer's). They start Compact and resize like tracks — drag thediff --git a/specs/094-arrangement-group-trays/checklists/requirements.md b/specs/094-arrangement-group-trays/checklists/requirements.mdnew file mode 100644index 00000000..a0505e10--- /dev/null+++ b/specs/094-arrangement-group-trays/checklists/requirements.md@@ -0,0 +1,39 @@+# Specification Quality Checklist: Arrangement group trays++**Purpose**: Validate specification completeness and quality before proceeding to planning+**Created**: 2026-11-12+**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++- Pixel sizes (3 px edge, ~4 px inset, 10 px step) are visual design values the issue+ agreed, not implementation details; the code pointers stay in the Input line only.+- Open points with sensible defaults recorded under Assumptions, good candidates for+ `/speckit-clarify`: the tray wash strength, whether the folded count includes tracks in+ nested groups, and whether member lanes (not only the group's own lane) get a wash in the+ new look (FR-014).diff --git a/specs/094-arrangement-group-trays/contracts/header-geometry.md b/specs/094-arrangement-group-trays/contracts/header-geometry.mdnew file mode 100644index 00000000..787c4700--- /dev/null+++ b/specs/094-arrangement-group-trays/contracts/header-geometry.md@@ -0,0 +1,51 @@+# Contract: Arrangement header geometry for groups++The visual contract the implementation and the screenshots are checked against. Colours+are tokens / track tints; radii are `NotaRadius` steps (the look and skin pick the values).++## New look — trays++```text+x: 0 6 12+ ▐ ▾ Group M S ∞ ▮ ← tray head: 16 % wash, top-right rounded+ ▐ ▐ ▾ DRUMS M S ∞ ▮ ← inner head: 16 % of DRUMS over Group's 8 %+ ▐ ▐ ┃Nota Drum Rack MIDI M S ● ▮ ← card on Brush.Panel, own 3 px bar only+ ▐ ▐ ┃Audio 4 Audio M S ● ◠ ▮+ ▐ ▐▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╯ ← DRUMS closing strip (4 px, from the row)+ ▐ ▐ › Instruments · 4 M S ∞ ▮ ← folded: count, closes its own tray+ ▐▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╯ ← Group closing strip+ ┃Nota Consort MIDI M S ● ▮ ← top level: full-width card, no tray+```++| Item | Value |+|---|---|+| Step per level | 6 px (3 px edge + 3 px gap) |+| Tray edge | 3 px, group colour (full) |+| Wash, tray head row | `TrackTint(color, 0.16)` |+| Wash, rest of tray | `TrackTint(color, 0.08)` |+| Member card | `Brush.Panel` (selected: `TrackHeaderSelected`), inset `TrayInsetR` = 4 px right |+| Own colour bar | 3 px, inset 6 top / bottom (as today) |+| Closing strip | 4 px for the innermost tray closing on a row, 2 px for each further one; bottom of the last row, inner above outer |+| Tray corners | top-right on the head row, bottom-right on the closing strip; `NotaRadius` field step |+| Slim group row | 26 px (unchanged): chevron, name, ` · N` when folded, M / S / (Cue) / Link, vertical meter |+| "Group" tag | not shown in the new look (the tray carries it) |+| Meter | vertical, same column and margins as a track's; inside the card above any closing strip |+| Right content edge | the same constant for every row (top-level or member) |+| Group lane | `GroupLaneBg` + `TrackTint(color, 0.16)` (unchanged); member lanes unwashed |++## Classic look — 0.59.2 staircase++| Item | Value |+|---|---|+| Spine | 3 px, own colour, at `depth * 10`; full row height; accent when selected |+| Track card | `Brush.SurfaceCard` |+| Group row | `Brush.SurfaceRaised` |+| Tints | none on headers; none on the group lane (keeps `GroupLaneBg`) |+| Slim group row | chevron, name 11 / SemiBold (+ ` · N` folded), M / S / (Cue) / Link, "Group" tag; horizontal meter on its own line under the title (dock bottom, 3 px from the edge) |+| Track meter | vertical, right edge, inside the card on every row height |++## Both looks++- No header row changes height; header rows and lanes stay aligned.+- No meter pixel outside its card; no meter under a name or chip.+- The name trims (ellipsis) before any control moves or clips.diff --git a/specs/094-arrangement-group-trays/data-model.md b/specs/094-arrangement-group-trays/data-model.mdnew file mode 100644index 00000000..f5f65773--- /dev/null+++ b/specs/094-arrangement-group-trays/data-model.md@@ -0,0 +1,61 @@+# Data model: Arrangement group trays++The pure layout that both looks draw from. It lives in `Nota.Presentation`+(`GroupTrayLayout`), takes no Avalonia types, and is what `GroupTrayTests` checks.++## Input: `TrayRow` (one per visible header row, in display order)++| Field | Type | Meaning |+|---|---|---|+| `Id` | int | Track id |+| `ParentId` | int | Enclosing group's id, −1 at top level |+| `IsGroup` | bool | The row is a group |+| `Folded` | bool | Group only: its members are hidden |+| `ColorIndex` | int | Track colour slot |+| `HiddenTracks` | int | Group only: non-group descendants (`GroupSlotCount`); 0 otherwise |++Rows come from `ArrangementView._tracks` after `ApplyHierarchy` (DFS order, folded+descendants already removed). Rule: a row's parent, if any, appears earlier in the list.++## Output: `TraySlice` (one per input row)++| Field | Type | Meaning |+|---|---|---|+| `Depth` | int | Number of enclosing groups |+| `Chain` | `TrayRef[]` | Trays the row is drawn in, outer → inner. A group's own row includes its own tray as the last entry |+| `Heads` | bool | The row is the header row of the last tray in `Chain` (new look) |+| `Closings` | int | Trays that end on this row, innermost first (0..`Chain.Length`) |+| `ContentLeft` | double | x where the row's own content (colour bar / chevron) starts |+| `SpineX` | double | Classic: x of the row's own 3 px spine; new look: x of its own colour bar |+| `FoldedCount` | int? | Folded group: `HiddenTracks`; otherwise null |++`TrayRef` = (`GroupId`, `ColorIndex`, `Level`) where `Level` is the tray's index in the+chain (its edge sits at `Level * Step`).++## Rules++- **Chain**: the ancestors of the row, outer → inner; plus the row itself if it is a group.+- **Closings**: tray *T* closes on row *r* when *r* is the last row (in display order)+ whose chain contains *T*. A folded or empty group's tray closes on its own row. Counted+ innermost first.+- **New look**: `Step = 6` (3 px edge + 3 px gap); `ContentLeft = Chain.Length * Step` for+ a member track; for a group's own row `ContentLeft = (Chain.Length − 1) * Step + 3 + 3`+ (past its own tray's edge and gap). A top-level track: `ContentLeft = 0`.+- **Classic look**: no chain painting; `SpineX = Depth * 10`, `ContentLeft = SpineX + 3`.+ `Closings` is still computed but unused.+- **Invariants** (tested):+ - `ContentLeft(depth 2 track) − ContentLeft(top-level track) ≤ 12` in the new look+ (SC-001).+ - Every tray opened is closed exactly once; total closings = number of visible groups.+ - Closings on a row ≤ `Chain.Length`; closing band (4 px + 2 px per further closing) leaves 20 px on a Compact row+ closing four trays and 18 px (one line of chips) on a slim group row closing three.+ - The layout never outputs anything about the right side: the right content edge is a+ constant of the view (FR-007).++## State transitions++- **Fold / unfold** → `_tracks` changes → slices recomputed → headers rebuilt (existing path).+- **Look change** → `HeaderLook` set → slices recomputed with the other look → headers+ rebuilt, lanes invalidated.+- **Selection** → no slice change; the selected group's full card takes the head slice.+- **Row height drag** → no slice change; the painter uses the row's current height.diff --git a/specs/094-arrangement-group-trays/plan.md b/specs/094-arrangement-group-trays/plan.mdnew file mode 100644index 00000000..6f7e1fd3--- /dev/null+++ b/specs/094-arrangement-group-trays/plan.md@@ -0,0 +1,149 @@+# Implementation Plan: Arrangement group trays++**Branch**: `feat/arrangement-group-trays` | **Date**: 2026-11-12 | **Spec**: [spec.md](spec.md)++**Input**: Feature specification from `specs/094-arrangement-group-trays/spec.md`+(issue nota-daw/nota#584, milestone 0.60.1)++## Summary++Redraw groups in the Arrangement's track headers per look. In the **new look** a group is a+tray: its header row on a 16 % wash, the rest of the tray on an 8 % wash with a 3 px edge in+the group colour, members as plain cards carrying only their own colour bar, nested trays+stepped in 6 px per level, and a 4 px closing strip carved out of the last row's height.+In the **classic look** the headers return to 0.59.2's staircase (own 3 px spine stepped in+10 px per depth, raised / card surfaces, the 0.59.2 slim group row with its meter on its own+line). In both looks header meters fit inside their card (the root cause is the vertical+`MeterBar`'s `MinHeight = 40`), the slim group row's meter moves to the right-hand column+(new look), controls keep their columns at every depth, and a folded group shows how many+tracks it hides. The tray / spine geometry is a pure layout in `Nota.Presentation`, tested+by the smoke test; `ArrangementView` paints it and rebuilds on a look change. See+[research.md](research.md).++## Nota: Read Before Planning++- **UI work** → [`DESIGN.md`](../../DESIGN.md) § Track header, § Track colours, and the+ `nota-design` skill.+- **Anything** → [`CONTRIBUTING.md`](../../CONTRIBUTING.md).++## Technical Context++**Language/Version**: C# / .NET 10 (managed app only)++**Primary Dependencies**: Avalonia (existing). No new dependency.++**Storage**: N/A — the look is already stored (spec 091); fold state and row heights are+already per project.++**Audio-Thread Impact**: None: UI-only change. Meters keep reading the existing level feed+on the UI tick.++**Testing**: `tests/Nota.SmokeTest` — new `GroupTrayTests` on the pure layout+(`Nota.Presentation`); `DesignTokenCheck` keeps the source free of raw radii / colours;+visual check with the headless-Avalonia screenshot harness (quickstart).++**Target Platform**: macOS, Windows, Linux desktop (Avalonia).++**Project Type**: Desktop app.++**Performance Goals**: Header rebuild on a look switch within one frame (SC-005); no new+per-tick work (tray layers are static; meters unchanged).++**Constraints**: Header rows never change height (FR-009); controls' right content edge is+the same for every row (FR-007); colours only from `NotaPalette` / track tints, radii from+`NotaRadius`.++**Scale/Scope**: Typical projects 10–100 rows, nesting rarely deeper than 3; the layout is+O(rows × depth).++## Constitution Check++*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*++| Principle | Status |+|---|---|+| 0. Approved issue first | ✅ nota-daw/nota#584 carries `approved`, milestone 0.60.1 |+| I. Real-time audio safety | ✅ No engine or audio-thread change |+| II. Boundary discipline | ✅ No C ABI change, no JUCE |+| III. Licensing hygiene | ✅ New files get the two-line SPDX header; no dependency |+| IV. Verification gate | ✅ `scripts/build.sh` + smoke test; new `GroupTrayTests` |+| V. One logical change per PR | ✅ One PR: Arrangement group headers in both looks + meter fit |+| VI. Docs in sync | ✅ CHANGELOG `[Unreleased]`, DESIGN.md § Track header, nota-docs (arrangement / groups page screenshots), FEATURES.md via nota-features if the folded count counts as a capability |+| VII. Spec-first | ✅ spec → clarify → this plan |+| VIII. Rules not weakened | ✅ N/A |++Post-design re-check (after Phase 1): unchanged — the design adds one pure class in+`Nota.Presentation`, one paint layer and builder branches in `Nota.App`; nothing crosses+into the engine.++## Project Structure++### Documentation (this feature)++```text+specs/094-arrangement-group-trays/+├── spec.md+├── plan.md # this file+├── research.md # Phase 0+├── data-model.md # Phase 1: the layout's inputs and per-row slices+├── quickstart.md # Phase 1: how to see and verify it+├── contracts/+│ └── header-geometry.md # the visual contract: numbers per look+├── checklists/requirements.md+└── tasks.md # /speckit-tasks+```++### Source Code (repository root)++```text+src/managed/+├── Nota.Presentation/+│ └── GroupTrayLayout.cs # NEW pure layout: rows → per-row slices (both looks)+└── Nota.App/+ ├── ArrangementView.cs # HeaderBars → slice-based; BuildGroupBar / BuildTrackCard+ │ # per look; meters MinHeight 0; folded count; HeaderLook+ ├── ArrangementView.Groups.cs # feed the layout from _tracks (Depth, GroupId, fold)+ ├── ArrangementView.LaneControl.cs # group lane wash: new look only+ ├── Controls/GroupTrayLayer.cs # NEW: draws one row's tray slice (washes, edges, corners,+ │ # closing strips) under the card content+ └── MainWindow.axaml.cs # set Timeline.HeaderLook at start-up and on a look change++tests/Nota.SmokeTest/+├── GroupTrayTests.cs # NEW: layout rules (SC-001, SC-003, closings, counts, classic)+└── Program.cs # register GroupTrayTests++DESIGN.md # § Track header: trays (new), staircase (classic), meter+CHANGELOG.md # [Unreleased] Changed / Fixed+```++**Structure Decision**: the geometry is data (`Nota.Presentation`) so it is testable without+a window; painting and control layout stay in `Nota.App` beside the existing header+builders. No new project.++## Design outline++1. **Layout** (`GroupTrayLayout.Compute(rows, look)`): see [data-model.md](data-model.md).+ New look: chain, heads, closings, content left `k * 6`; classic: spine x `depth * 10`,+ content left `depth * 10 + 3`. Folded count passed through from `GroupSlotCount`.+2. **Painting**: `GroupTrayLayer` (custom `Render`) draws, for one row, each tray in the+ chain outer → inner: the 8 % wash (16 % on the tray's own header row) over the full+ width from the tray's edge, its 3 px edge, the rounded top-right on a head row and the+ rounded bottom-right on the closing strip. The member card body is a `Brush.Panel`+ rectangle from `contentLeft` to `HeaderW − TrayInsetR`, above the closing strips.+ Replaces `HeaderBars` + the 6 % / 16 % `Border` tints in the new look.+3. **Builders**: `BuildTrackCard` / `BuildGroupBar` take the slice: content margin from+ `contentLeft`, bottom margin from closings, a constant right content edge. Slim group+ row (new): chevron, name (+ folded count), chips, vertical meter right; the "Group" tag+ goes (the tray says it). Classic: the 0.59.2 slim row and `SpineGrid`-style columns.+4. **Meters**: header `MeterBar`s get `MinHeight = 0`; margins symmetric; checked on+ Compact / Standard / Large.+5. **Look switch**: `ArrangementView.HeaderLook` → `RebuildHeaders()` + lanes invalidate;+ `MainWindow` sets it from `NotaThemeService.Look` at start-up and on `Changed` when it+ differs.+6. **Lanes**: group lane colour wash only when `HeaderLook == New`.+7. **Docs**: DESIGN.md § Track header (replace the "indented 14 … 4 px bar" bullet),+ CHANGELOG, nota-docs screenshots of grouped tracks in both looks.++## Complexity Tracking++No constitution violations.diff --git a/specs/094-arrangement-group-trays/quickstart.md b/specs/094-arrangement-group-trays/quickstart.mdnew file mode 100644index 00000000..364f30a2--- /dev/null+++ b/specs/094-arrangement-group-trays/quickstart.md@@ -0,0 +1,54 @@+# Quickstart: verifying Arrangement group trays++## Prerequisites++- A Release engine build in `build/` (`scripts/build.sh` once).+- A test project: a top-level group "Group" holding a group "DRUMS" (two tracks: one MIDI,+ one Audio) and a group "Instruments" (four tracks), then a top-level MIDI track+ "Nota Consort". Fold "Instruments".++## 1. Smoke test (layout rules)++```bash+scripts/build.sh+```++Expect the new `GroupTrayTests` lines to pass, among them:++- a depth-2 track's content starts ≤ 12 px further in than a top-level track's (new look);+- DRUMS closes on "Audio 4", Instruments and Group both close on the folded Instruments row+ (inner first), nothing closes on "Nota Consort";+- the folded Instruments row reports 4; a folded group holding a nested group counts only+ tracks;+- classic spines at 0 / 10 / 20 px for depths 0 / 1 / 2;+- no row's closing strips leave less than 20 px on a Compact (30) or slim group (26) row.++## 2. Screens (both looks × four themes × three row heights)++Use the headless-Avalonia harness (MainWindow with its view model, engine-built tracks,+`CaptureRenderedFrame`), or run the app and screenshot:++1. New look, Studio Dark, Standard rows: trays as in+ [contracts/header-geometry.md](contracts/header-geometry.md); one colour stripe per+ member; "Nota Consort" clearly outside the tray; DRUMS group row's meter on the right.+2. Same at Compact and Large rows: meters fully inside each card (zoom on the bottom-right+ corner of a Compact track row — the meter stops 6 px above the edge).+3. Studio Light, Ember Graphite, Ember Paper: washes readable, text and chips legible.+4. Preferences → Appearance → Look: Classic: headers switch at once to the staircase;+ compare with 0.59.2 (`git worktree add /tmp/n0592 v0.59.2`, same project) side by side.+5. Back to New: trays return; fold states, row heights and the selection are kept.+6. Narrow the header column to its minimum: names trim, the M chips of all rows stay in one+ column.++## 3. Interactions++- Fold / unfold DRUMS and Group from the chevron: trays close on the right rows, the count+ appears only while folded.+- Select a group: its full card (fader, pan, meter) sits as the tray head.+- Drag a track out of DRUMS to the top level and back: trays redraw.+- Drag a row seam inside a tray: the tray follows, rows stay aligned with lanes.++## 4. Done when++All smoke-test lines pass, the screens match the contract in both looks and four themes,+and `/speckit-converge` reports Converged.diff --git a/specs/094-arrangement-group-trays/research.md b/specs/094-arrangement-group-trays/research.mdnew file mode 100644index 00000000..c1b3977c--- /dev/null+++ b/specs/094-arrangement-group-trays/research.md@@ -0,0 +1,140 @@+# Research: Arrangement group trays++**Feature**: [spec.md](spec.md) · **Plan**: [plan.md](plan.md) · **Issue**: nota-daw/nota#584++What the code does today, and the decisions this feature takes. Line numbers are as of+`develop` @ eec6a4ff and only a guide.++## Today++- **Header column.** `ArrangementView.RebuildHeaders` (`ArrangementView.cs` ~2265) places+ one card per visible row on the `_headers` canvas at `RowTop(i)`, `HeaderW` wide and+ `RowH(i)` tall, so cards line up with the lanes by construction. `_tracks` is in+ hierarchy order with `Depth` set and folded descendants dropped+ (`ArrangementView.Groups.cs` `ApplyHierarchy`).+- **Slim group row.** An unselected group is `BuildGroupBar` (26 px, `GroupRowHeight`):+ chevron, name, M / S / (Cue) / Link, the "Group" tag, and a `MeterBar(horizontal)`+ 3 px tall with `VerticalAlignment.Bottom` in a `Panel` over the whole row — that is why+ it runs under the name and the chips. A selected group is a full `BuildTrackCard`.+- **Nesting.** `HeaderBars` draws one 4 px bar per enclosing group at `k * GroupIndent`+ (14), then the row's own bar (3 px, inset 6 top/bottom for tracks; 4 px full height for a+ group's own row). Content starts at `x + NameGap` (12).+- **Tints.** Group card: `TrackTint(color, 0.16)`; a member card: `TrackTint(groupColor,+ 0.06)` of its direct group. Group lane: `GroupLaneBg` plus `TrackTint(color, 0.16)`+ (`ArrangementView.LaneControl.cs` ~1158).+- **Track meter overflow — root cause.** `MeterBar`'s vertical constructor sets+ `MinHeight = 40` (`Controls/MeterBar.cs`). The header meter has `Margin(6, 6, 4, 6)` and+ `VerticalAlignment.Stretch`; on a Compact row (30 px) only 18 px are left, on the+ smallest Standard row (50 px) 38 px. Avalonia honours `MinHeight`, so the meter is laid+ out 40 px tall from its top margin and runs into (and is clipped at) the card's bottom+ edge — the "pokes out" in the issue's screenshot.+- **Folded count.** `ApplyHierarchy` already walks the full child map (folded groups+ included) and sets `GroupSlotCount` = the number of non-group descendant tracks. That is+ exactly the clarified count. (The Mixer's `HiddenIds` includes nested groups; not reused.)+- **Look.** `NotaThemeService.Look` (`Nota.App/Theme`), enum `Look` in+ `Nota.Application/Looks.cs`. A look change calls `RepaintEverything` (invalidate only)+ and raises `NotaThemeService.Changed`; it does not rebuild the header cards. The clip+ style follows the look through `ArrangementView.ClipStyle`, set by `MainWindow` from+ settings.+- **0.59.2 reference** (`git show v0.59.2:src/managed/Nota.App/ArrangementView.cs`):+ `SpineGrid(depth, spine, body)` = columns `[depth*10 px][3 px spine][*]`;+ `BuildGroupBar` on `Brush.SurfaceRaised`, name 11 / SemiBold, chips 3 apart, a+ horizontal meter 4 tall docked **bottom** of a `DockPanel` (margin 0,0,0,3) so it takes+ its own line, body margin 8,0,8,0; track cards on `Brush.SurfaceCard`, vertical meter+ 8 wide, margin `(0,4,3,4)` compact / `(0,6,3,6)` otherwise; a selected row's spine in+ `NotaPalette.Accent`. No group lane tint.+- **Tests.** `tests/Nota.SmokeTest` references `Nota.Presentation`, not `Nota.App`;+ pure layout code there is testable (precedent: `PianoRowMap` + `FoldTests`).+ `DesignTokenCheck*` scans `ArrangementView*.cs` source for raw radii / numbers with+ allow-lists.++## Decisions++### R1 — Tray geometry (new look)++- **Decision**: one fixed step per nesting level, **6 px = a 3 px tray edge + a 3 px gap**.+ For a row whose tray chain (enclosing groups, outer → inner; a group's own header row+ includes itself) has length *k*, tray *i* has its edge at `x = i * 6`; the row's card (a+ member) or its header content (a group) starts at `x = k * 6`. Every tray and every card+ share one right edge; the trays' right corners are rounded where a tray starts (top+ right, on its header row) and where it closes (bottom right). The member card is inset+ `TrayInsetR` (4 px) from the right so the tray shows around it; top-level tracks are not+ inset, but every row lays out its controls against the same right content edge (R3).+- **Rationale**: SC-001 asks a depth-2 track's name to start ≤ 12 px further in than a+ top-level track's: two levels × 6 = 12 ✓. The issue's "about 4 px" inset meant the visible+ gap; 3 px plus the 3 px edge keeps the step at 6. A shared right edge is what keeps the+ controls' columns fixed at every depth (FR-007).+- **Alternatives**: 4 px gap + 3 px edge (7 px/level → 14 px at depth 2, fails SC-001);+ nested `Border`s per group (cannot work: header rows are separate canvas children per+ row, aligned to lanes); insetting nested trays on the right too (moves the controls per+ depth, fails FR-007).++### R2 — Tray painting++- **Decision**: a pure layout in `Nota.Presentation` (`GroupTrayLayout`) turns the visible+ rows (id, parent id, is-group, folded, colour) into per-row **slices**: the chain of+ trays the row sits in, which tray (if any) the row heads, how many trays close on the+ row (innermost first), and the content left. `ArrangementView` paints each card's+ background from its slice (a small custom-drawn layer under the existing card content),+ so cards stay per-row and aligned to their lanes.+- **Rationale**: rows are already per-row canvas children and rebuilt per change; a slice+ per row needs no cross-row visual tree. The layout is testable headlessly.+- **Alternatives**: one big backdrop control behind all headers (must track every row's+ `RowTop`, fold and live row-height drags — more coupling for no gain).++### R3 — Wash, closings and row heights++- **Decision**: wash = 16 % of the group colour on its header row (today's group tint), 8 %+ on the rest of its tray (`TrackTint(color, 0.08)`); a member card sits on+ `Brush.Panel` (no 6 % tint). The innermost tray closing on a row takes a **4 px** strip at the bottom of that row,+ each further tray closing there a **2 px** one (outer below inner), carved out of the row's+ height (found in implementation: four 4 px strips left a Compact row 14 px, short of its+ 20 px name row); the card / content is laid out in the remaining height. A folded group's row+ closes its own tray. Controls and the meter lay out against one right content edge for+ every row: `HeaderW − TrayInsetR − HeaderRightPad`-style constant, the same for a+ top-level track as for a member.+- **Rationale**: FR-009 (no row grows), FR-004 (no stacked tints on a card). Two closings+ on a Compact row leave 22 px — the 20 px name row fits.+- **Alternatives**: a separate spacer row after each group (breaks the row ↔ lane mapping+ and every `RowTop` caller).++### R4 — Group row meter (new look)++- **Decision**: the slim group row gets the same vertical `MeterBar` as track cards,+ docked right in the same column; the horizontal rail goes. All header meters (both+ looks) get `MinHeight = 0` and margins that leave equal inner padding top and bottom.+- **Rationale**: FR-005, FR-008; the `MinHeight` is the overflow's root cause.+- **Alternatives**: shrinking the margins only (still overflows on Compact).++### R5 — Classic look staircase++- **Decision**: a second header-geometry path that reproduces 0.59.2's `SpineGrid` and+ slim `BuildGroupBar` (surfaces `SurfaceRaised` / `SurfaceCard`, 11 px name, horizontal+ meter docked below the title, accent spine when selected), with today's controls inside+ (Cue key when shown, Link) and the folded count. No tray, no group lane wash. Tokens, not+ 0.59.2's raw numbers, wherever a token exists (the classic look already maps radii and+ colours).+- **Rationale**: FR-010–FR-012, SC-004.+- **Alternatives**: restoring 0.59.2's whole header builder (would drop features added+ since: sends, Cue, Link marks, takes toggle, player tag).++### R6 — Live look switch++- **Decision**: `ArrangementView` gets a `HeaderLook` property (like `ClipStyle`). The main+ window sets it at start-up and from `NotaThemeService.Changed` **only when the look+ differs**; the setter rebuilds the headers and invalidates the lanes (group lane wash).+- **Rationale**: FR-013 / SC-005; a theme or accent change must not rebuild headers.+- **Alternatives**: reading `NotaThemeService.Look` inside the builders without a+ rebuild trigger (headers would keep the old look until the next refresh).++### R7 — Folded count text++- **Decision**: after the name, " · N" in the type-tag style (Label 11, ink 3); N =+ `GroupSlotCount`. Shown only when folded, in both looks. Localized as a number only (no+ word), so no new string.+- **Rationale**: FR-006 + clarification; no new localization key.++### R8 — Out of scope, confirmed++Mixer group bands, Nota Remote, sticky headers, the group lane's mini-clip preview, the+takes rows and the footer rows (returns, master) are untouched.diff --git a/specs/094-arrangement-group-trays/spec.md b/specs/094-arrangement-group-trays/spec.mdnew file mode 100644index 00000000..63c64e45--- /dev/null+++ b/specs/094-arrangement-group-trays/spec.md@@ -0,0 +1,291 @@+# Feature Specification: Arrangement group trays++**Feature Branch**: `feat/arrangement-group-trays`++**Created**: 2026-11-12++**Status**: Draft++**Issue**: [nota-daw/nota#584](https://github.com/nota-daw/nota/issues/584) (milestone 0.60.1)++**Input**: User description: "Issue #584 (approved, milestone 0.60.1): Arrangement groups — trays in the new look, the 0.59.2 staircase in the classic look, meters that fit. New look: a group is a tray (group-colour wash behind its header row and members, 3 px left edge in the group colour, rounded right corners, bottom padding closing the tray); members are normal cards with only their own 3 px colour bar (no ancestor bars, no 6% member tint); a nested group is a tray inside the tray inset ~4 px per level; the group header row has chevron, name, M/S/(Cue)/Link and a vertical meter in the same right-hand column as tracks; a folded group shows its member count after the name; nesting moves only the left side, the name trims before controls are pushed or clipped; header rows stay aligned with their lanes (tray padding comes out of existing row heights); the group lane tint follows the tray if needed. Classic look: as in v0.59.2 — each row only its own 3 px spine stepped in 10 px per depth, no ancestor bars or tints, group row on SurfaceRaised and tracks on SurfaceCard, selected spine in accent; the 0.59.2 slim group row (chevron, 11 px name, M/S/Link, Group tag, horizontal meter docked below the title row); switching look rebuilds headers live. Both looks: track and group meters sit fully inside the header card on every row height and theme. Out of scope: Mixer group bands, sticky group headers, child-clip summary in group lanes."++## 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+- [x] 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++**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).++**Related specs**: [038 style guide](../038-style-guide/spec.md) (the new look and its+§ Groups rules this replaces for the Arrangement headers),+[091 classic look](../091-classic-look/spec.md) (the New / Classic switch this follows),+[015 track list sizing](../015-track-list-sizing/) (Compact / Standard / Large rows),+[070 mixer groups](../070-mixer-groups-compact-strips/) (out of scope here),+[076 group Link](../076-group-link/) (the Link chip on the group row).++**Background.** In the new look (#296) every group a track sits in draws its own 4 px bar+14 px further in, and the track then adds its own 3 px bar: a track two levels deep shows+three stripes, often two of the same colour, and loses about 50 px of the header column+before its name starts. The group colour is also washed over the group row (16 %) and+every member (6 %), so nested groups stack tints and turn muddy. Nothing marks where a+group ends — the first top-level track after a group reads as part of it. On the slim group+row the level meter is a thin horizontal rail along the bottom of the whole row, running+under the name and the chips; on a track row the vertical meter pokes slightly past the+card's edge. Version 0.59.2 drew nesting as a simple "staircase" of each row's own colour+spine; the classic look (#572) brings 0.59.2's appearance back and should bring this back+too.++## Clarifications++### Session 2026-11-12++- Q: In the new look, should the Arrangement lanes (with the clips) carry the group colour+ too, so a group reads as one block across the grid? → A: Only the group's own lane keeps+ its wash, as today; member lanes stay unwashed.+- Q: What does a folded group's count show when it holds nested groups? → A: Every track it+ hides, including tracks inside nested groups; the nested groups themselves are not+ counted (the Mixer's group bar counts nested groups too; the Arrangement does not).+- Q: Does the classic look show the folded count too, though 0.59.2 had none? → A: Yes, in+ both looks — it is information, not styling.+- Q: How strong is the tray's wash in the new look? → A: The group's header row keeps+ today's 16 %; the rest of the tray (around the member cards) is lighter, about 8 %.++## User Scenarios & Testing *(mandatory)*++### User Story 1 - Read nested groups at a glance in the new look (Priority: P1)++A producer with drums, instruments and vocals grouped — and a sub-group inside a group —+scans the Arrangement's track headers and immediately sees which tracks belong to which+group, where each group starts and ends, and which track is which, without a stack of+same-coloured stripes or muddy tints.++**Why this priority**: This is the complaint that opened the issue; the new look is the+default, so every user with groups sees it.++**Independent Test**: Open a project with a group holding a nested group of two tracks+and a second (folded) nested group, followed by a top-level track; in the new look,+check the headers against the acceptance scenarios below.++**Acceptance Scenarios**:++1. **Given** the new look and a group with members, **When** the headers are shown,+ **Then** the group reads as one tray: a wash of the group's colour behind the group's+ row and all its members, a 3 px edge in the group's colour down the tray's left side,+ rounded right corners, and a small bottom padding that closes the tray under its last+ member.+2. **Given** a track inside one or more groups, **When** its header is shown, **Then** it+ carries only its own 3 px colour bar — no bar per enclosing group — and its own card+ background is not tinted by any group.+3. **Given** a group nested in another group, **When** the headers are shown, **Then**+ the inner group is a tray inside the outer tray, inset about 4 px per nesting level,+ and the outer tray visibly continues around it.+4. **Given** a top-level track right after a group, **When** the headers are shown,+ **Then** it is clearly outside the group: the group's tray has closed above it.+5. **Given** a folded group, **When** the headers are shown, **Then** its tray shows only+ its header row, with the number of tracks it holds after its name (e.g.+ "Instruments · 4"); the same count shows on a folded group in the classic look.++---++### User Story 2 - Group controls and meters that don't collide (Priority: P1)++A user mixing from the Arrangement watches the level of each group and track in its+header, and clicks M / S / Link on a group row without a meter drawn under the buttons or+a meter spilling out of the card.++**Why this priority**: The overlap and overflow are visible defects on every project with+a group, in both looks.++**Independent Test**: With audio playing through a group and its members, view the+headers at Compact, Standard and Large row heights in each of the four colour themes and+both looks; check meters and controls.++**Acceptance Scenarios**:++1. **Given** the new look and a group row in its slim (unselected) form, **When** audio+ plays through the group, **Then** its level shows on a vertical meter in the same+ right-hand column as the tracks' meters, and nothing is drawn under the name or the+ chips.+2. **Given** any track or group header at any row height, theme and look, **When** its+ meter is drawn, **Then** the meter lies fully inside the header card with the same+ inner padding on every side it touches.+3. **Given** a track or group several levels deep and a narrow header column, **When** the+ header is laid out, **Then** the name trims (with an ellipsis) before any chip, fader,+ pan, input picker or meter is pushed out of place or clipped, and those controls sit in+ the same columns as on a top-level row.++---++### User Story 3 - The 0.59.2 staircase in the classic look (Priority: P2)++A user who switched to the classic look gets the group headers they knew in 0.59.2: each+row's own colour spine, stepped in a little per nesting level, and the slim group row+with its meter below the title.++**Why this priority**: The classic look exists to bring 0.59.2's appearance back; groups+are part of that, but fewer users wear the classic look than the default.++**Independent Test**: Switch to the classic look with the grouped project open and compare+the track headers with 0.59.2 on the same project.++**Acceptance Scenarios**:++1. **Given** the classic look, **When** the headers are shown, **Then** each row carries+ only its own 3 px colour spine, stepped in 10 px per nesting level, with no bars for+ enclosing groups and no group-colour tints.+2. **Given** the classic look, **When** a group row and a track row are shown, **Then** the+ group row sits on the raised surface and tracks on the card surface, as in 0.59.2, and+ the selected row's spine is drawn in the accent.+3. **Given** the classic look and an unselected group, **When** its row is shown, **Then**+ it is 0.59.2's slim group row: disclosure chevron, the name in the smaller title size,+ M / S / Link, the "Group" tag, and the level as a horizontal meter on its own line under+ the title — not under the chips.+4. **Given** the Arrangement is open, **When** the user switches between New and Classic in+ Preferences → Appearance (or an MCP tool sets the look), **Then** the track headers+ change to the other look's group drawing at once, without reopening the project.++---++### Edge Cases++- **Selected group**: a selected group shows its full header (fader, pan, meter) as today;+ in the new look it still sits in its tray as the tray's header row.+- **Deep nesting** (4 or more levels): each level insets its tray by the same step; the+ name trims first; controls keep their columns. Nesting deeper than the column can show+ still renders without overlapping controls.+- **Empty group** (no members): the tray is just the header row, closed below it.+- **Group whose last member is itself a group**: both trays close, inner first, then outer,+ within the existing row heights.+- **Group colour equal to a member's colour**: the member's own bar still reads against the+ tray wash (the wash is soft, the bar is the full colour).+- **Light themes** (Studio Light, Ember Paper): the tray wash stays a soft tint that keeps+ text and chips readable.+- **Row height changes** (dragging a row seam, Compact / Standard / Large) inside a tray:+ the tray follows; header rows stay aligned with their lanes.+- **Drag-reordering tracks into, out of or between groups**: the drop line and the trays+ redraw for the new hierarchy.+- **Takes rows / footer rows (returns, master)**: not part of a group; unaffected.+- **A user skin worn**: the tray uses the skin's track colours and surfaces; the look+ (New / Classic) decides tray vs staircase.++## Requirements *(mandatory)*++### Functional Requirements++**New look — trays**++- **FR-001**: In the new look, a group's header row and all of its visible members MUST be+ drawn on one tray: a wash of the group's colour (16 % on the group's header row, about+ 8 % on the rest of the tray around the member cards), a 3 px edge in the group's colour+ down the tray's left side, rounded right corners, and a small bottom padding under the+ last visible member that closes the tray.+- **FR-002**: In the new look, a member track's header MUST carry only its own 3 px colour+ bar; it MUST NOT draw a bar for any enclosing group, and its card MUST NOT be tinted by+ any group's colour.+- **FR-003**: In the new look, a nested group MUST be drawn as a tray inside its parent's+ tray, inset by one fixed step (about 4 px) per nesting level, replacing today's 14 px+ indent plus 4 px bar per level.+- **FR-004**: Group tints MUST NOT stack: a member card sits on the tray, not under one or+ more washes of its own.+- **FR-005**: In the new look, the group header row MUST show the disclosure chevron, the+ name, M / S, the Cue key when Cue is shown, Link, and a vertical level meter in the same+ right-hand column as the tracks' meters.+- **FR-006**: In both looks, a folded group's row MUST show after its name the number of+ tracks it hides — every track inside it, including tracks in nested groups; nested groups+ themselves are not counted. In the new look its tray shows only that row.++**Both looks — layout and meters**++- **FR-007**: Nesting MUST move only the left side of a header (spine or tray edge, colour+ bar, name). Chips, fader, pan, input picker and meter MUST keep the same columns at+ every depth; when space runs out, the name trims first.+- **FR-008**: Track and group meters MUST lie fully inside their header card, with the same+ inner padding, on every row height (Compact, Standard, Large), every built-in theme and+ both looks.+- **FR-009**: Header rows MUST stay aligned with their lanes: tray insets and paddings MUST+ come out of the existing row heights, never add to them.++**Classic look — 0.59.2 staircase**++- **FR-010**: In the classic look, each row MUST carry only its own 3 px colour spine,+ stepped in 10 px per nesting level, with no bars for enclosing groups and no group-colour+ tints on headers.+- **FR-011**: In the classic look, group rows MUST sit on the raised surface and track rows+ on the card surface, and the selected row's spine MUST be drawn in the accent, as in+ 0.59.2.+- **FR-012**: In the classic look, the slim group row MUST be 0.59.2's: chevron, name in the+ smaller title size, M / S / Link (and Cue when shown), the "Group" tag, and a horizontal+ level meter on its own line beneath the title row, never beneath the chips.++**Switching and lanes**++- **FR-013**: Changing the look (Preferences → Appearance or the MCP look tool) MUST redraw+ the track headers in the other look's group drawing immediately, with the project open.+- **FR-014**: In the new look, a group's own lane in the Arrangement MUST keep its wash of+ the group colour (16 %, as today), and member lanes MUST carry no group wash; in the classic+ look, the group's lane MUST carry no group-colour wash, as in 0.59.2. The preview of+ members' clips on a group's lane is unchanged in both looks.+- **FR-015**: The style guide (DESIGN.md § Groups and the track-header section) MUST+ describe the tray rules for the new look and the staircase for the classic look.++### Key Entities++- **Group tray** (new look): the visual container of one group in the header column — its+ header row plus its visible members, with its colour, nesting level and folded state.+- **Spine** (classic look): a row's own 3 px colour stripe and its step-in for the row's+ nesting depth.+- **Header meter**: the level display on a track or group header; its placement differs by+ look and row form (slim group row vs full card).++## Success Criteria *(mandatory)*++### Measurable Outcomes++- **SC-001**: In the new look, a track two levels deep shows exactly one colour stripe+ (its own), and its name starts at most 12 px further in than a top-level track's+ (today: about 50 px).+- **SC-002**: In both looks, at every row height and in all four built-in themes, no meter+ pixel falls outside its header card and no meter is drawn under a name or a chip.+- **SC-003**: At every nesting depth from 0 to 4, the M chip of every track row of the same+ kind starts at the same horizontal position.+- **SC-004**: In the classic look, the headers of a grouped project match 0.59.2's on the+ same project, row for row (spine positions, surfaces, slim group row), judged from side+ by side screenshots.+- **SC-005**: Switching the look with a grouped project open redraws the headers within one+ frame of the switch, with no reopen and no lost row heights, fold states or selection.+- **SC-006**: In a hallway check, a user shown the new-look headers of a project with a+ nested group correctly names every track's group and where each group ends on the first+ try.++## Assumptions++- The selected-group full card (fader, pan, meter) stays as today in both looks; only its+ surroundings (tray or spine) follow the look.+- The group lane's preview of members' clips (stacked mini-clips folded, a colour strip+ unfolded) is an existing feature and is not changed; "child-clip summary" in the issue's+ out-of-scope list means no new summary beyond it.+- Clip drawing (Solid / Tinted, #572) is independent of this feature.+- The Mixer's group bands (specs/070), sticky group headers while scrolling, and the Nota+ Remote view are out of scope.+- No engine or C ABI change: this is presentation only.++## Nota Compliance Checklist *(review before implementation; re-check in tasks.md)*++- [x] Every new source file will carry the AGPL-3.0-only SPDX header (two lines, see CONTRIBUTING.md)+- [x] No new dependency — or: license checked, AGPL-compatible, `LICENSES/third-party.md` row planned+- [x] Audio-thread impact considered: no alloc / lock / I/O on the audio thread (AR-6), command queue for data in (AR-4), immutable snapshots for structural edits (AR-5) — UI only, meters read the existing level feed+- [x] Managed/native crossings go through the pure C ABI in `nota_engine.h` only (AR-7); no JUCE outside `pluginhost/` — no new crossings+- [x] Smoke-test impact assessed: engine behaviour change → extend `tests/Nota.SmokeTest` — no engine change+- [ ] User-visible change → `CHANGELOG.md` `[Unreleased]` entry planned (and FEATURES.md / user docs via the nota-features / nota-docs skills when working with an agent that has them)+- [ ] UI change → follows `DESIGN.md` (Studio design language)diff --git a/specs/094-arrangement-group-trays/tasks.md b/specs/094-arrangement-group-trays/tasks.mdnew file mode 100644index 00000000..b506369a--- /dev/null+++ b/specs/094-arrangement-group-trays/tasks.md@@ -0,0 +1,160 @@+---++description: "Tasks for Arrangement group trays (specs/094, issue #584)"+---++# Tasks: Arrangement group trays++**Input**: Design documents from `specs/094-arrangement-group-trays/`++**Prerequisites**: [plan.md](plan.md), [spec.md](spec.md), [research.md](research.md),+[data-model.md](data-model.md), [contracts/header-geometry.md](contracts/header-geometry.md),+[quickstart.md](quickstart.md)++**Tests**: The plan asks for `GroupTrayTests` in the smoke test (the layout rules); visual+checks follow the quickstart.++**Organization**: Tasks are grouped by user story (US1 trays, US2 meters and columns, US3+classic staircase).++## Format: `[ID] [P?] [Story] Description`++- **[P]**: Can run in parallel (different files, no dependencies)+- **[Story]**: Which user story this task belongs to (US1, US2, US3)++## Path Conventions++- Managed app: `src/managed/Nota.App/`, pure layout: `src/managed/Nota.Presentation/`+- Tests: `tests/Nota.SmokeTest/`++---++## Phase 1: Setup++**Purpose**: Branch and baseline++- [X] T001 Create branch `feat/arrangement-group-trays` off `develop` in the main checkout (carry the untracked `specs/094-arrangement-group-trays/`); confirm `scripts/build.sh` builds the managed app (`dotnet build src/managed/Nota.App/Nota.App.csproj`) before any change++---++## Phase 2: Foundational (Blocking Prerequisites)++**Purpose**: The pure layout and the look plumbing every story draws from++**⚠️ CRITICAL**: No user story work can begin until this phase is complete++- [X] T002 Create `GroupTrayLayout` in `src/managed/Nota.Presentation/GroupTrayLayout.cs` (SPDX header): input record `TrayRow(Id, ParentId, IsGroup, Folded, ColorIndex, HiddenTracks)`, output `TraySlice(Depth, Chain: TrayRef[], Heads, Closings, ContentLeft, SpineX, FoldedCount)` and `TrayRef(GroupId, ColorIndex, Level)`; `Compute(IReadOnlyList<TrayRow> rows, bool classic)` per data-model.md rules — chain = ancestors outer → inner plus the row itself if a group; tray T closes on the last row whose chain contains T, innermost first, a folded or empty group closing on its own row; new look `Step = 6`, `ContentLeft = Chain.Length * Step` (0 at top level); classic `SpineX = Depth * 10`, `ContentLeft = SpineX + 3`; `FoldedCount = HiddenTracks` only for a folded group; constants `Step`, `EdgeW = 3`, `ClosingH = 4`, `ClassicStep = 10` public for the view and tests+- [X] T003 [P] Write `tests/Nota.SmokeTest/GroupTrayTests.cs` (SPDX header) on the quickstart project shape (Group ⊃ DRUMS{2 tracks}, Instruments folded{4}; then top-level Consort): depth-2 `ContentLeft` − top-level ≤ 12 (SC-001); DRUMS closes on "Audio 4" with Closings 1; folded Instruments row closes 2 (Instruments then Group); Consort closes 0 and has an empty chain; every visible group closed exactly once; folded count 4 and a folded group holding a nested group counts tracks only; classic SpineX 0/10/20 for depths 0/1/2; `ClosingH * maxClosings ≤ rowH − 20` for row heights 30 and 26 at depth ≤ 3; register `GroupTrayTests.Run()` in `tests/Nota.SmokeTest/Program.cs`+- [X] T004 Add `HeaderLook` (`Look`, default `Look.New`) to `ArrangementView` in `src/managed/Nota.App/ArrangementView.cs` next to `ClipStyle`: setter stores, calls `RebuildHeaders()` and invalidates `_lanes`; set it in `src/managed/Nota.App/MainWindow.axaml.cs` at start-up from `NotaThemeService.Look` and subscribe `NotaThemeService.Changed` to update it only when the look differs (FR-013, research R6)+- [X] T005 Feed the layout in `src/managed/Nota.App/ArrangementView.Groups.cs`: after `ApplyHierarchy`, build `TrayRow`s from `_tracks` (Id, GroupId, IsGroup, `_fold.IsFolded`, ColorIndex, `GroupSlotCount` for groups) and keep `Dictionary<int, TraySlice> _traySlices` from `GroupTrayLayout.Compute(rows, HeaderLook == Look.Classic)`; recompute on every hierarchy rebuild and on a `HeaderLook` change++**Checkpoint**: layout computed and tested; headers still drawn the old way++---++## Phase 3: User Story 1 - Read nested groups at a glance in the new look (Priority: P1) 🎯 MVP++**Goal**: Groups as trays in the new look (FR-001–FR-006, FR-014)++**Independent Test**: Quickstart § 2 steps 1 and 3 and § 3 fold / reorder in the new look++- [X] T006 [P] [US1] Create `GroupTrayLayer` in `src/managed/Nota.App/Controls/GroupTrayLayer.cs` (SPDX header, custom `Render`, not hit-testable): given a `TraySlice`, the header width, the row height and `TrayInsetR = 4`, draw each tray in the chain outer → inner from `x = Level * Step` to the right edge — wash `TrackTint(color, 0.16)` when the row heads that tray, else `TrackTint(color, 0.08)`; its 3 px edge in `TrackBrush(color)`; rounded top-right (`NotaRadius` field step) on a head row; then the closing strips (4 px each, innermost above outer) at the row bottom with the bottom-right corner rounded; then, for a member track, the card body (`Brush.Panel`, or `TrackHeaderSelected` when selected) from `ContentLeft` to `width − TrayInsetR`, above the closing strips; repaint on `NotaThemeService` change through the existing invalidate path+- [X] T007 [US1] In `src/managed/Nota.App/ArrangementView.cs` replace the new-look use of `HeaderBars` in `BuildTrackCard` and `BuildGroupBar`: put a `GroupTrayLayer` for the row's slice under the content; drop the 6 % member `Border` tint and the 16 % group `Border` tint; the track's own 3 px bar at `ContentLeft` (inset 6 top / bottom, as today); content margin left `ContentLeft + bar + NameGap`, bottom `Closings * ClosingH`; keep `_headerCards` spine / selection repaint working (`UpdateHeaderSelection` must repaint the layer's card body for a member)+- [X] T008 [US1] New-look slim group row in `BuildGroupBar` (`src/managed/Nota.App/ArrangementView.cs`): chevron, name, M / S / (Cue) / Link, no "Group" tag; the selected-group full card (`BuildTrackCard` for a group) also sits on its tray head slice+- [X] T009 [US1] Folded count (both looks) in `BuildGroupBar` and the group branch of `BuildTrackCard` in `src/managed/Nota.App/ArrangementView.cs`: when `FoldedCount` is set, show ` · N` after the name via `TypeTag`-style text (Label 11, ink 3), trimming with the name (FR-006)+- [X] T010 [US1] Group lane wash in `src/managed/Nota.App/ArrangementView.LaneControl.cs` (~1158): keep `TrackTint(color, 0.16)` on a group's own lane only when `_o.HeaderLook == Look.New`; member lanes unwashed (FR-014)++**Checkpoint**: new look shows trays; quickstart § 2.1 passes++---++## Phase 4: User Story 2 - Group controls and meters that don't collide (Priority: P1)++**Goal**: Meters inside the card, group meter in the right column, fixed control columns (FR-005, FR-007, FR-008, FR-009)++**Independent Test**: Quickstart § 2 step 2 and step 6, all three row heights, four themes++- [X] T011 [US2] Header meters in `src/managed/Nota.App/ArrangementView.cs`: set `MinHeight = 0` on every header `MeterBar` (track cards, group cards, slim group rows); margins equal top and bottom inside the space left after closing strips, so no meter pixel leaves the card on Compact (30), Standard (50+) and Large rows (research: `MinHeight = 40` is the overflow's root cause)+- [X] T012 [US2] New-look slim group row meter in `BuildGroupBar` (`src/managed/Nota.App/ArrangementView.cs`): replace the horizontal rail with a vertical `MeterBar` docked right with the same width and right margin as a track card's meter, so both sit in one column; keep `_meters[t.Id]` registration+- [X] T013 [US2] One right content edge in `src/managed/Nota.App/ArrangementView.cs`: lay out the chips / volume / pan / picker / meter of every row (top-level and member, track and group) against the same right edge (`HeaderW − TrayInsetR − HeaderRightPad` or equivalent constant), so the M chip of rows of the same kind lines up at depths 0–4; the name trims first; update the picker room maths in the Standard tier (`room = HeaderW − x − …`) to the new left / right edges++**Checkpoint**: meters and controls correct in the new look at every row height++---++## Phase 5: User Story 3 - The 0.59.2 staircase in the classic look (Priority: P2)++**Goal**: Classic look headers as in v0.59.2 (FR-010–FR-013)++**Independent Test**: Quickstart § 2 steps 4–5 against a v0.59.2 build++- [X] T014 [US3] Classic geometry in `src/managed/Nota.App/ArrangementView.cs`: when `HeaderLook == Look.Classic`, build cards with the 0.59.2 column layout (`git show v0.59.2:src/managed/Nota.App/ArrangementView.cs`, `SpineGrid`): empty column `SpineX`, the row's own 3 px spine full height (accent when selected), body after it; no `GroupTrayLayer`, no tints; track cards on `Brush.SurfaceCard`, group cards on `Brush.SurfaceRaised`; keep today's controls (sends, Cue, Link marks, takes toggle, player tag)+- [X] T015 [US3] Classic slim group row in `BuildGroupBar` (`src/managed/Nota.App/ArrangementView.cs`): 0.59.2's — chevron, name 11 / SemiBold (+ folded count), M / S / (Cue) / Link 3 apart, the "Group" tag, and a horizontal `MeterBar` (`MinWidth = 0`) docked bottom of a `DockPanel` with margin 0,0,0,3 so it takes its own line under the title; body margin 8,0,8,0+- [X] T016 [US3] Check the live switch: changing Preferences → Appearance → Look rebuilds headers in the other look with fold states, row heights and selection kept (`HeaderLook` from T004); MCP `set_look` takes the same path++**Checkpoint**: both looks correct and switchable live++---++## Phase 6: Polish & Cross-Cutting Concerns++- [X] T017 Remove now-unused code in `src/managed/Nota.App/ArrangementView.cs` (`HeaderBars`' per-ancestor bars, `GroupIndent = 14`, `GroupBarW`) once both looks use the slices; keep comments explaining why each layer exists+- [X] T018 [P] DESIGN.md § Track header: replace the "Inside a group the member is indented 14 …" bullet with the tray rules (new look) and the staircase (classic look); state the header meter fits inside the card; mention the folded count+- [X] T019 [P] `CHANGELOG.md` `[Unreleased]`: Changed — groups in the Arrangement headers drawn as trays (new look) / 0.59.2 staircase (classic), folded count; Fixed — header meters spilling out of the card, group meter under the buttons (#584)+- [X] T020 Visual verification per quickstart § 2–3 with the headless-Avalonia harness: both looks × Studio Dark / Studio Light / Ember Graphite / Ember Paper × Compact / Standard / Large; fix anything off the contract — done with /private/tmp/n094harness (24 shots + fold, selected group, live look switch); not exercised headlessly: drag-reordering into / out of a group and dragging a row seam inside a tray+- [X] T021 `DesignTokenCheck` clean: no raw colours or radii in the new code (`tests/Nota.SmokeTest/DesignTokenCheck*.cs` allow-lists only if a value is a deliberate geometry constant)++### Nota closing tasks *(always include — these are the PR gates)*++- [X] T022 Run `scripts/build.sh` until native + managed + smoke test are green — builds green; smoke test all pass except the render-pool timing checks ("overloaded", VST3 deadline), which fail on this machine on clean develop too+- [X] T023 AGPL-3.0-only SPDX two-line header on `GroupTrayLayout.cs`, `GroupTrayLayer.cs`, `GroupTrayTests.cs`+- [X] T024 New dependency: none → N/A+- [X] T025 User-visible change → `CHANGELOG.md` `[Unreleased]` entry (T019)+- [X] T026 FEATURES.md via `nota-features` (folded group count; group display per look) and user docs via `nota-docs` (arrangement groups page and screenshots, EN + RU); shortcuts: none → N/A — FEATURES.md done; nota-docs in ~/repos/nota/nota-docs-584 (branch docs/arrangement-group-trays): basics/tracks + views/arrangement EN + RU, 5 arrangement shots × 2 themes retaken; FR left behind (allowed)+- [X] T027 Engine behaviour change: none → N/A (smoke test extended by T003 for the layout)++---++## Dependencies & Execution Order++### Phase Dependencies++- **Setup (T001)** → **Foundational (T002–T005)** → user stories.+- **US1 (T006–T010)** and **US2 (T011–T013)** both edit `ArrangementView.cs` builders; do+ US1 first, then US2 (same file, same methods).+- **US3 (T014–T016)** after US1/US2 (shares the builders; the classic path branches off them).+- **Polish (T017–T027)** after all stories.++### Within stories++- T002 before T003 (tests compile against the layout) and T005.+- T004 before T005 (layout depends on the look) and T010, T016.+- T006 before T007; T007 before T008–T009.++### Parallel Opportunities++- T003 (tests) alongside T004 once T002 exists.+- T006 (`GroupTrayLayer.cs`, new file) alongside T005.+- T018 (DESIGN.md) and T019 (CHANGELOG) alongside T020.++### Parallel Example: Foundational++```text+T003 GroupTrayTests.cs (tests/Nota.SmokeTest)+T004 HeaderLook plumbing (ArrangementView.cs, MainWindow.axaml.cs)+```++## Implementation Strategy++### MVP++T001–T013: the new look (the default) with trays, meters that fit and fixed columns — that+alone fixes what users see by default.++### Incremental delivery++1. Foundation (layout + tests + look plumbing).+2. US1 trays → screenshot check.+3. US2 meters / columns → screenshot check at three row heights.+4. US3 classic → side-by-side with v0.59.2.+5. Polish, docs, build gate.diff --git a/src/managed/Nota.App/ArrangementView.Groups.cs b/src/managed/Nota.App/ArrangementView.Groups.csindex 451ec1c8..6f222ba9 100644--- a/src/managed/Nota.App/ArrangementView.Groups.cs+++ b/src/managed/Nota.App/ArrangementView.Groups.cs@@ -13,6 +13,7 @@ using System.Collections.Generic;using System.Linq;using Nota.Application;using Nota.Application.Editing;+using Nota.Presentation;namespace Nota.App;@@ -141,6 +142,26 @@ public sealed partial class ArrangementView/// renderer to pick the stacked-clip vs. span-strip preview.</summary>internal bool IsGroupCollapsed(int groupId) => _fold.IsFolded(groupId);+ // Each visible row's share of the group drawing (specs/094), worked out once per header+ // rebuild from the hierarchy order ApplyHierarchy left in _tracks.+ private readonly Dictionary<int, TraySlice> _traySlices = new();+ private static readonly TraySlice NoTray = new(0, Array.Empty<TrayRef>(), false, 0, 0, 0, null);++ private void ComputeTraySlices()+ {+ _traySlices.Clear();+ var rows = new TrayRow[_tracks.Count];+ for (int i = 0; i < _tracks.Count; i++)+ {+ var t = _tracks[i];+ rows[i] = new TrayRow(t.Id, t.GroupId, t.IsGroup, t.IsGroup && _fold.IsFolded(t.Id), t.ColorIndex, t.IsGroup ? t.GroupSlotCount : 0);+ }+ var slices = GroupTrayLayout.Compute(rows, ClassicHeaders);+ for (int i = 0; i < rows.Length; i++) _traySlices[rows[i].Id] = slices[i];+ }++ private TraySlice SliceOf(TrackVM t) => _traySlices.TryGetValue(t.Id, out var s) ? s : NoTray;+private void ToggleCollapse(int groupId) => _fold.Toggle(groupId); // Changed → Refresh// ---- multi-track selection (Shift/Cmd-click headers, Cmd+A) --------------diff --git a/src/managed/Nota.App/ArrangementView.LaneControl.cs b/src/managed/Nota.App/ArrangementView.LaneControl.csindex 0031c816..a6d1e401 100644--- a/src/managed/Nota.App/ArrangementView.LaneControl.cs+++ b/src/managed/Nota.App/ArrangementView.LaneControl.cs@@ -1160,8 +1160,9 @@ public sealed partial class ArrangementView// A group row reads as chrome between its children, not as another lane.ctx.FillRectangle(_o.IsSlimRowAt(i) ? GroupLaneBg : (i & 1) == 0 ? LaneBgA : LaneBgB,new Rect(0, y, w, rh));- // A group's lane carries the same 16% tint of its colour as its header.- if (_o._tracks[i].IsGroup) ctx.FillRectangle(TrackTint(_o._tracks[i].ColorIndex, 0.16), new Rect(0, y, w, rh));+ // A group's lane carries the same 16% tint of its colour as its header (new look;+ // 0.59.2's classic lanes have none — specs/094).+ if (_o._tracks[i].IsGroup && !_o.ClassicHeaders) ctx.FillRectangle(TrackTint(_o._tracks[i].ColorIndex, 0.16), new Rect(0, y, w, rh));ctx.DrawLine(BeatPen, new Point(0, y + rh), new Point(w, y + rh));}if (_o._tracks.Count == 0)diff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.csindex 47731d6a..6ea2d3b8 100644--- a/src/managed/Nota.App/ArrangementView.cs+++ b/src/managed/Nota.App/ArrangementView.cs@@ -115,6 +115,9 @@ public sealed partial class ArrangementView : UserControl}/// <summary>Height of arrangement row <paramref name="i"/>: its clip area plus any open take lanes.</summary>+ /// <summary>The height a row's header card is laid out for: the slim group bar or the track row.</summary>+ private double HeaderRowHeight(TrackVM t) => IsSlimRow(t) ? GroupRowHeight : TrackRowHeight(t);+internal double RowHeightAt(int i)=> ClipAreaHeightAt(i) + (i >= 0 && i < _tracks.Count ? TakesHeight(_tracks[i]) : 0);@@ -615,6 +618,21 @@ public sealed partial class ArrangementView : UserControlset { if (_clipStyle == value) return; _clipStyle = value; _lanes.InvalidateVisual(); }}private ClipStyle _clipStyle = ClipStyle.Tinted;+ /// <summary>How groups are drawn in the track headers (specs/094): trays in the new look,+ /// 0.59.2's staircase of spines in the classic one. Follows the worn look.</summary>+ public Look HeaderLook+ {+ get => _headerLook;+ set+ {+ if (_headerLook == value) return;+ _headerLook = value;+ RebuildHeaders();+ _lanes.InvalidateVisual(); // a group lane's wash follows the look+ }+ }+ private Look _headerLook = Look.New;+ private bool ClassicHeaders => _headerLook == Look.Classic;/// <summary>Audio-clip waveform style (Settings → Appearance).</summary>public WaveformStyle Waveform{@@ -2259,20 +2277,23 @@ public sealed partial class ArrangementView : UserControlQueueSelectionNotify(); // every clip-selection change repaints the headersforeach (var (id, h) in _headerCards){- // Selected row (style guide): a slightly lighter background; the colour bar stays.- bool selected = IsTrackMultiSelected(id);- h.card.Background = selected ? SelHeaderBg : Brush("Brush.Panel");+ // Selected row (style guide): a slightly lighter background; the colour bar stays+ // (classic: the spine goes accent, as in 0.59.2).+ if (_tracks.Find(v => v.Id == id) is { } t)+ PaintHeaderFill(h.card, t, IsTrackMultiSelected(id), h.spine, h.spineIdle);}}private void RebuildHeaders(){+ ComputeTraySlices();_headers.Children.Clear();_meters.Clear();_volFaders.Clear();_sendFaders.Clear();_panBars.Clear();_headerCards.Clear();+ _trayLayers.Clear();_cardTiers.Clear();_cardSends.Clear();_sendKnobs.Clear();@@ -2299,25 +2320,29 @@ public sealed partial class ArrangementView : UserControl// A group's row, collapsed to a title bar: disclosure, name, its own mute/solo, kind tag.// The fader, pan and meter live on the same card when the group is selected (BuildTrackCard),// so nothing is lost — it just stops costing a full row while you work on its children.- // Style guide: the row is tinted 16% in the group colour, and the group's 4px bar starts- // here and runs down through every member.+ // New look (specs/094): the row heads the group's tray (its 16 % wash, the tray's edge), and+ // its meter stands at the right in the tracks' column. Classic: 0.59.2's slim row — the+ // "Group" tag and the level as a rail on its own line under the title.private Control BuildGroupBar(TrackVM t){bool selected = IsTrackMultiSelected(t.Id);var spineBrush = TrackBrush(t.ColorIndex);+ bool classic = ClassicHeaders;+ var slice = SliceOf(t);var tri = new Border{- Background = Brushes.Transparent, Padding = new Thickness(2, 0), Margin = new Thickness(0, 0, 6, 0),+ Background = Brushes.Transparent, Padding = new Thickness(2, 0), Margin = new Thickness(0, 0, classic ? 0 : 6, 0),Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center,- Child = new Glyph(_fold.IsFolded(t.Id) ? GlyphKind.ChevronRight : GlyphKind.ChevronDown, 9) { Foreground = Brush("Brush.TextSecondary") },+ Child = new Glyph(_fold.IsFolded(t.Id) ? GlyphKind.ChevronRight : GlyphKind.ChevronDown, classic ? 8 : 9) { Foreground = Brush("Brush.TextSecondary") },};tri.PointerPressed += (_, e) => { e.Handled = true; ToggleCollapse(t.Id); };var name = HeaderName(t.Name);+ if (classic) { name.FontSize = NotaType.Name; name.Margin = new Thickness(4, 0, 0, 0); }var chips = new StackPanel{- Orientation = Orientation.Horizontal, Spacing = ChipGap, VerticalAlignment = VerticalAlignment.Center,+ Orientation = Orientation.Horizontal, Spacing = classic ? ClassicChipGap : ChipGap, VerticalAlignment = VerticalAlignment.Center,Children ={ChipToggle("M", t.Muted, NotaPalette.Mute, v => { t.Muted = v; _engine?.SetTrackMute(t.Id, v); }),@@ -2327,37 +2352,66 @@ public sealed partial class ArrangementView : UserControl};if (_engine is { } groupEngine && CueKey.Shown(groupEngine)) // Cue (specs/089)chips.Children.Insert(2, CueKey.Create(groupEngine, t.Id, 18, 18, NotaRadius.Field, out _, offFill: NotaPalette.Well));- var kind = TypeTag(Loc.T("common.group"));var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto,Auto"), VerticalAlignment = VerticalAlignment.Center };- Grid.SetColumn(name, 1);+ var title = NameWithCount(name, slice);+ Grid.SetColumn(title, 1);Grid.SetColumn(chips, 2);-- Grid.SetColumn(kind, 3);row.Children.Add(tri);- row.Children.Add(name);+ row.Children.Add(title);row.Children.Add(chips);- row.Children.Add(kind);+ if (classic)+ {+ var kind = TypeTag(Loc.T("common.group"));+ Grid.SetColumn(kind, 3);+ row.Children.Add(kind);+ }- // A group keeps its level readable on the slim row as a thin rail under the title.- var meter = new MeterBar(horizontal: true) { Height = 3, MinWidth = 0, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(0, 0, 0, 2) };- _meters[t.Id] = meter;var (bars, spine, x) = HeaderBars(t, own: false);- var body = new Panel { Margin = new Thickness(x + 6, 0, HeaderRightPad, 0), Children = { row, meter } };+ Control body;+ if (classic)+ {+ // 0.59.2: the level as a rail on a line of its own under the title.+ var meter = new MeterBar(horizontal: true) { Height = 4, MinWidth = 0, Margin = new Thickness(0, 0, 0, 3) };+ _meters[t.Id] = meter;+ DockPanel.SetDock(meter, Dock.Bottom);+ body = new DockPanel { LastChildFill = true, Margin = new Thickness(x + 8, 0, 8, 0), Children = { meter, row } };+ }+ else+ {+ var meter = HeaderMeter(GroupRowHeight - GroupTrayLayout.ClosingBand(slice.Closings, GroupRowHeight));+ _meters[t.Id] = meter;+ DockPanel.SetDock(meter, Dock.Right);+ body = new DockPanel+ {+ LastChildFill = true, Children = { meter, row },+ Margin = new Thickness(x + 2, 0, GroupTrayLayout.TrayInsetR, GroupTrayLayout.ClosingBand(slice.Closings, GroupRowHeight)),+ };+ }var card = new Border{Width = HeaderW, Height = GroupRowHeight, ClipToBounds = true,- Background = selected ? SelHeaderBg : Brush("Brush.Panel"),BorderBrush = Brush("Brush.BorderDefault"),- BorderThickness = CardBorder,- Child = new Panel { Children = { new Border { Background = TrackTint(t.ColorIndex, 0.16) }, bars, body } },+ BorderThickness = CardBorderFor(t),+ Child = new Panel { Children = { bars, body } },};_headerCards[t.Id] = (card, name, true, spine, spineBrush);+ PaintHeaderFill(card, t, selected, spine, spineBrush);AttachHeaderGestures(card, t);ValueEntry.SetScope(card, true); // Tab in a value box: volume → pan on this headerreturn card;}+ // A group's name with " · N" after it while it is folded (specs/094): the tracks it hides,+ // nested groups' tracks included. The name trims first; the count stays beside it.+ private Control NameWithCount(TextBlock name, TraySlice slice)+ {+ if (slice.FoldedCount is not { } n) return name;+ var count = TypeTag("· " + n.ToString(CultureInfo.CurrentCulture));+ count.Margin = new Thickness(6, 1, 0, 0);+ return new NameTagPanel { Children = { name, count } };+ }+// One builder, three layouts picked by the row's height (specs/015, style guide): compact is// the name row alone (name, kind, M S ● and the monitor); standard adds a second row with// the volume bar (value inside), the pan knob and the input picker; large gives the input@@ -2407,7 +2461,8 @@ public sealed partial class ArrangementView : UserControl}// The name trims before it can push M / S / ● out of the card; the tag stays beside it.// A member linked with its group carries the link mark before its name (specs/076).- Control nameCell = name;+ Control nameCell = t.IsGroup ? NameWithCount(name, SliceOf(t)) : name; // a folded group's count (specs/094)+ if (t.IsGroup && !ClassicHeaders) typeTag.IsVisible = false; // the tray says it's a groupif (LinkMemberMark(t) is { } mark){var dock = new DockPanel { LastChildFill = true };@@ -2522,7 +2577,7 @@ public sealed partial class ArrangementView : UserControl// and a sliver of volume can't sit beside the pan does it go to the context menu.if (picker is not null){- double room = HeaderW - x - NameGap - MeterW - PanBar.W - 2 * 6;+ double room = HeaderW - x - NameGap - MeterW - PanBar.W - 2 * 6 - ContentRightInset;double pickerW = Math.Clamp(room - MiniFader.MinW, PickerMinW, PickerW);double faderMin = Math.Min(MiniFader.MinW, room - pickerW);if (faderMin < FaderSqueezeW)@@ -2543,33 +2598,30 @@ public sealed partial class ArrangementView : UserControlbreak;}- // The meter down the right edge: two 3px channels.- var meter = new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = 7, Margin = new Thickness(6, 6, 4, 6) }; // MeterW in all+ // The meter down the right edge: two 3px channels, inside the card on every row height+ // (specs/094). New look: above any closing strips of the trays that end on this row.+ double band = ClassicHeaders ? 0 : GroupTrayLayout.ClosingBand(SliceOf(t).Closings, rowH);+ MeterBar meter = ClassicHeaders+ ? new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = 8, MinHeight = 0, Margin = tier == HeaderTier.Compact ? new Thickness(0, 4, 3, 4) : new Thickness(0, 6, 3, 6) }+ : HeaderMeter(rowH - band);_meters[t.Id] = meter;DockPanel.SetDock(meter, Dock.Right);- var body = new DockPanel { LastChildFill = true, Margin = new Thickness(x + NameGap, 0, 0, 0), Children = { meter, stack } };-- // Inside a group: a 6% wash of the group's colour under the card's content.- var layers = new Panel();- if (t.IsGroup) layers.Children.Add(new Border { Background = TrackTint(t.ColorIndex, 0.16) });- else if (GroupOf(t) is { } g) layers.Children.Add(new Border { Background = TrackTint(g.ColorIndex, 0.06) });- layers.Children.Add(bars);- layers.Children.Add(body);+ var body = new DockPanel { LastChildFill = true, Margin = new Thickness(x + NameGap, 0, ContentRightInset, band), Children = { meter, stack } };var card = new Border{Width = HeaderW,Height = rowH,ClipToBounds = true,- Background = selected ? SelHeaderBg : (t.Frozen || t.LiveRole != 0) ? FrozenHeaderBg : Brush("Brush.Panel"),BorderBrush = Brush("Brush.BorderDefault"),- BorderThickness = CardBorder,- Child = layers,+ BorderThickness = CardBorderFor(t),+ Child = new Panel { Children = { bars, body } },};// A background import is still filling the track: the disabled look (by colour, not// opacity), still clickable so the track can be deleted to cancel.if (IsProcessingTrack(t.Id)) card.AttachedToVisualTree += (_, _) => Inactive.Set(card, true, interactive: true);_headerCards[t.Id] = (card, name, t.IsGroup, spine, spineBrush); // for in-place selection repaint+ PaintHeaderFill(card, t, selected, spine, spineBrush);AttachHeaderGestures(card, t);ValueEntry.SetScope(card, true); // Tab in a value box: volume → pan on this headerreturn card;@@ -2620,51 +2672,90 @@ public sealed partial class ArrangementView : UserControlTextTrimming = TextTrimming.CharacterEllipsis,};- private TrackVM? GroupOf(TrackVM t) => t.GroupId < 0 ? null : _tracks.FirstOrDefault(v => v.Id == t.GroupId);+ // Nesting (specs/094). New look: the row's slice of every group tray it sits in+ // (GroupTrayLayer) — a member keeps only its own 3 px bar, at the start of its card. Classic+ // look: 0.59.2's staircase — the row's own 3 px spine, stepped in per nesting level, full+ // height, nothing for the groups around it. Returns the layer, the row's own stripe (the+ // selection repaint's handle) and where the row's content starts.+ private const double OwnBarW = 3, ClassicChipGap = 3;+ private readonly Dictionary<int, GroupTrayLayer> _trayLayers = new();- // Nesting reads from the bars (style guide § Groups): every group a row sits in draws its- // 4px bar down the row's left edge, one GroupIndent further in per level, so a group's bar- // runs unbroken from its own row through its last member. A track then shows its own- // colour on a 3px bar just past them, inset 6 from the top and bottom; a group's own bar is- // the 4px one, full height. Returns the bars, the track's own bar and where content starts.- private const double GroupIndent = 14, GroupBarW = 4, OwnBarW = 3;+ // Every row's controls end at the same x (FR-007): the trays' right inset in the new look.+ private double ContentRightInset => ClassicHeaders ? 0 : GroupTrayLayout.TrayInsetR;private (Control bars, Border own, double contentX) HeaderBars(TrackVM t, bool own){- var canvas = new Grid { HorizontalAlignment = HorizontalAlignment.Left };- var chain = new List<TrackVM>();- for (var g = GroupOf(t); g is not null && chain.Count < 8; g = GroupOf(g)) chain.Insert(0, g);- for (int k = 0; k < chain.Count; k++)- canvas.Children.Add(new Border- {- Width = GroupBarW, HorizontalAlignment = HorizontalAlignment.Left,- Margin = new Thickness(k * GroupIndent, 0, 0, 0), Background = TrackBrush(chain[k].ColorIndex),- });- double x = chain.Count * GroupIndent;+ var slice = SliceOf(t);+ var canvas = new Panel();Border bar;- if (own && !t.IsGroup)+ if (ClassicHeaders){- if (chain.Count > 0) x += GroupBarW;bar = new Border{- Width = OwnBarW, HorizontalAlignment = HorizontalAlignment.Left, CornerRadius = new CornerRadius(OwnBarW / 2),- Margin = new Thickness(x, 6, 0, 6), Background = TrackBrush(t.ColorIndex),+ Width = GroupTrayLayout.ClassicSpineW, HorizontalAlignment = HorizontalAlignment.Left,+ Margin = new Thickness(slice.SpineX, 0, 0, 0), Background = TrackBrush(t.ColorIndex),};- x += OwnBarW;+ canvas.Children.Add(bar);+ return (canvas, bar, slice.ContentLeft);}- else++ if (slice.Chain.Length > 0){+ // The strips are sized for the row height the controls were laid out for, so a+ // seam drag (which resizes the card without a rebuild) can't move them apart.+ var layer = new GroupTrayLayer(slice, t.IsGroup ? null : Brush("Brush.Panel"), HeaderRowHeight(t));+ _trayLayers[t.Id] = layer;+ canvas.Children.Add(layer);+ }+ double x = slice.ContentLeft;+ if (own && !t.IsGroup)+ {+ double band = GroupTrayLayout.ClosingBand(slice.Closings, HeaderRowHeight(t));bar = new Border{- Width = GroupBarW, HorizontalAlignment = HorizontalAlignment.Left,- Margin = new Thickness(x, 0, 0, 0), Background = TrackBrush(t.ColorIndex),+ Width = OwnBarW, HorizontalAlignment = HorizontalAlignment.Left, CornerRadius = new CornerRadius(OwnBarW / 2),+ Margin = new Thickness(x, 6, 0, 6 + band), Background = TrackBrush(t.ColorIndex),};- x += GroupBarW;+ canvas.Children.Add(bar);+ x += OwnBarW;}- canvas.Children.Add(bar);+ else+ bar = new Border { Width = 0 }; // a group's stripe is its tray's edgereturn (canvas, bar, x);}+ // The header meter (specs/094): a vertical stereo bar at the right, inside the card on every+ // row height — MeterBar's 40 px floor is for the mixer, a Compact header has 18 px for it.+ private static MeterBar HeaderMeter(double rowInner)+ {+ double v = Math.Clamp((rowInner - 12) / 2, 3, 6);+ return new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = 7, MinHeight = 0, Margin = new Thickness(6, v, 4, v) }; // MeterW in all+ }++ // A row inside a tray draws its own seam under its card body; the card keeps only the+ // column divider so the tray runs unbroken from row to row.+ private Thickness CardBorderFor(TrackVM t)+ {+ var b = CardBorder;+ return !ClassicHeaders && SliceOf(t).Chain.Length > 0 ? new Thickness(b.Left, 0, b.Right, 0) : b;+ }++ // The header's fill for its state. New look: a member's card body is painted by its tray+ // layer (the card itself stays the panel the trays wash over); classic: 0.59.2's raised+ // group rows and card-surface tracks, the selected row's spine in the accent.+ private void PaintHeaderFill(Border card, TrackVM t, bool selected, Border spine, IBrush spineIdle)+ {+ IBrush rest = ClassicHeaders ? Brush(t.IsGroup ? "Brush.SurfaceRaised" : "Brush.SurfaceCard") : Brush("Brush.Panel");+ IBrush fill = selected ? SelHeaderBg : (t.Frozen || t.LiveRole != 0) ? FrozenHeaderBg : rest;+ if (_trayLayers.TryGetValue(t.Id, out var layer) && layer.IsMember)+ {+ card.Background = Brush("Brush.Panel");+ layer.Body = fill;+ }+ else card.Background = fill;+ if (ClassicHeaders) spine.Background = selected ? NotaPalette.Accent : spineIdle;+ }+// Select / reorder / context-menu gestures shared by a full track card and a slim group bar.private void AttachHeaderGestures(Border card, TrackVM t){diff --git a/src/managed/Nota.App/Controls/GroupTrayLayer.cs b/src/managed/Nota.App/Controls/GroupTrayLayer.csnew file mode 100644index 00000000..3efc6f61--- /dev/null+++ b/src/managed/Nota.App/Controls/GroupTrayLayer.cs@@ -0,0 +1,99 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// One header row's share of the group trays (specs/094, new look). A group is drawn as a+// tray — a wash of its colour with a 3 px edge down the left — that holds its header row and+// its members; rows are separate cards (one per lane), so each row paints its own slice of+// every tray it sits in, outer first: the wash (stronger on the tray's own header row), the+// edge, the rounded right corners where a tray opens and closes, and the closing strips at+// the bottom of the row a tray ends on. A member track's card then sits on the trays as a+// plain body, so tints never stack on it. Only paints: the row's controls sit above it.++using System;+using Avalonia;+using Avalonia.Controls;+using Avalonia.Media;+using Nota.Presentation;++namespace Nota.App;++internal sealed class GroupTrayLayer : Control+{+ /// <summary>The tray wash on a tray's own header row, and on the rest of the tray.</summary>+ public const double HeadWash = 0.16, TrayWash = 0.08;++ private readonly TraySlice _slice;+ private IBrush? _body;+ private readonly double[] _strips;++ /// <param name="body">A member track's card fill; null for a group's own row (the trays show).</param>+ /// <param name="rowH">The row height the card's controls were laid out for; the closing strips+ /// are sized for it and keep that size while a seam drag resizes the row live, so they always+ /// match the space the controls leave for them.</param>+ public GroupTrayLayer(TraySlice slice, IBrush? body, double rowH)+ {+ _slice = slice;+ _strips = GroupTrayLayout.ClosingStrips(slice.Closings, rowH);+ _body = body;+ IsHitTestVisible = false;+ }++ /// <summary>True when the row is a track sitting in a tray (it has a card body to paint).</summary>+ public bool IsMember => _body is not null;++ /// <summary>The member card's fill (selection repaints it in place).</summary>+ public IBrush? Body+ {+ get => _body;+ set { if (ReferenceEquals(_body, value)) return; _body = value; InvalidateVisual(); }+ }++ public override void Render(DrawingContext ctx)+ {+ double w = Bounds.Width, h = Bounds.Height;+ var chain = _slice.Chain;+ if (w <= 0 || h <= 0 || chain.Length == 0) return;+ int n = chain.Length;+ var strips = _strips;+ double band = 0;+ foreach (var s in strips) band += s;+ double bodyBottom = Math.Max(0, h - band);+ // Only the right corners round, by the field step, where a tray opens and closes; the+ // left side is square against the tray edge and the column.+ double r = NotaRadius.FieldValue, square = 0;++ for (int k = 0; k < n; k++)+ {+ var tray = chain[k];+ double x0 = tray.Level * GroupTrayLayout.Step;+ bool heads = _slice.Heads && k == n - 1;+ // The trays closing here are the innermost ones; the innermost strip sits on top.+ int fromInside = n - 1 - k;+ bool closes = fromInside < _slice.Closings;+ double bottom = h;+ if (closes)+ {+ bottom = bodyBottom;+ for (int m = 0; m <= fromInside; m++) bottom += strips[m];+ bottom = Math.Min(h, bottom);+ }+ var rect = new Rect(x0, 0, Math.Max(0, w - x0), bottom);+ var corners = new CornerRadius(square, heads ? r : square, closes ? r : square, square);+ ctx.DrawRectangle(ArrangementView.TrackTint(tray.ColorIndex, heads ? HeadWash : TrayWash), null, new RoundedRect(rect, corners));+ ctx.FillRectangle(ArrangementView.TrackBrush(tray.ColorIndex), new Rect(x0, 0, GroupTrayLayout.EdgeW, bottom));+ }++ // A member's card: a plain body from its own colour bar to just short of the right+ // edge, above the closing strips, with the row seam under it.+ if (_body is { } body)+ {+ double x = _slice.ContentLeft, right = w - GroupTrayLayout.TrayInsetR;+ if (right > x && bodyBottom > 0)+ {+ ctx.FillRectangle(body, new Rect(x, 0, right - x, bodyBottom));+ if (NotaPalette.ByKey("Brush.BorderDefault") is IBrush seam)+ ctx.FillRectangle(seam, new Rect(x, bodyBottom - 1, right - x, 1));+ }+ }+ }+}diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex fca4bd68..d5a386b8 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -426,6 +426,10 @@ public partial class MainWindow : Window};Timeline.Waveform = (WaveformStyle)Math.Clamp(vm.Settings.Current.ArrangementWaveform, 0, 2);Timeline.ClipStyle = Looks.ClipStyleOf(vm.Settings.Current);+ // Groups in the track headers follow the worn look (specs/094); a theme or accent+ // change leaves them be — the setter rebuilds only when the look itself moved.+ Timeline.HeaderLook = NotaThemeService.Look;+ NotaThemeService.Changed += () => Timeline.HeaderLook = NotaThemeService.Look;Timeline.PhraseBars = vm.Settings.Current.ArrangementPhraseBars;vm.Engine.SplitFades = vm.Settings.Current.SplitFades;ApplyHeadersRight(vm.Settings.Current.ArrangementHeadersRight);diff --git a/src/managed/Nota.Presentation/GroupTrayLayout.cs b/src/managed/Nota.Presentation/GroupTrayLayout.csnew file mode 100644index 00000000..f5812b02--- /dev/null+++ b/src/managed/Nota.Presentation/GroupTrayLayout.cs@@ -0,0 +1,131 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Where groups sit in the Arrangement's header column (specs/094). The header rows are+// separate cards, one per lane, so a group can't be one control around its members; each+// row instead draws its slice of every group it sits in. This works the slices out from+// the visible rows alone — which trays a row is in, which one it heads, how many close on+// it — so the view only paints, and the rules can be checked without a window. The new+// look draws trays; the classic look draws 0.59.2's staircase of each row's own spine.++namespace Nota.Presentation;++/// <summary>One visible header row, in display order (a group before its members).</summary>+/// <param name="ParentId">The enclosing group's id, −1 at the top level.</param>+/// <param name="HiddenTracks">A group's tracks, nested groups' tracks included and the+/// nested groups themselves not counted; 0 for a track.</param>+public readonly record struct TrayRow(int Id, int ParentId, bool IsGroup, bool Folded, int ColorIndex, int HiddenTracks);++/// <summary>A tray a row is drawn in. Its edge sits at <c>Level × Step</c>.</summary>+public readonly record struct TrayRef(int GroupId, int ColorIndex, int Level);++/// <summary>One row's share of the group drawing.</summary>+/// <param name="Chain">The trays the row is in, outer → inner; a group's own row ends with its own tray.</param>+/// <param name="Heads">The row is the header row of the last tray in <paramref name="Chain"/>.</param>+/// <param name="Closings">Trays that end on this row (their closing strips, innermost on top).</param>+/// <param name="ContentLeft">Where the row's own content starts (its colour bar, or a group's chevron).</param>+/// <param name="SpineX">The row's own colour stripe: a track's bar (new look) or the 0.59.2 spine (classic).</param>+/// <param name="FoldedCount">A folded group's hidden tracks; null otherwise.</param>+public sealed record TraySlice(int Depth, TrayRef[] Chain, bool Heads, int Closings, double ContentLeft, double SpineX, int? FoldedCount);++public static class GroupTrayLayout+{+ /// <summary>New look: one level = a tray edge plus the gap before the next thing in.</summary>+ public const double EdgeW = 3, Gap = 3, Step = EdgeW + Gap;++ /// <summary>New look: the strip that closes the innermost tray under its last row, taken out+ /// of that row; each further tray closing on the same row adds a thinner one.</summary>+ public const double ClosingH = 4, ClosingNestH = 2;++ /// <summary>What a row keeps above its closing strips whatever closes on it: one line of+ /// 18 px chips on a slim group row, so the strips never run under its buttons.</summary>+ public const double MinRowContent = 18;++ /// <summary>The heights of the <paramref name="closings"/> closing strips on a row of+ /// <paramref name="rowH"/>, innermost first. Natural sizes are 4 px, then 2 px each; when they+ /// would eat into <see cref="MinRowContent"/>, the outer strips thin to 1 px first, then the+ /// innermost, and only past that do the outermost go to nothing.</summary>+ public static double[] ClosingStrips(int closings, double rowH)+ {+ if (closings <= 0) return [];+ var strips = new double[closings];+ for (int k = 0; k < closings; k++) strips[k] = k == 0 ? ClosingH : ClosingNestH;+ double excess = strips.Sum() - Math.Max(0, rowH - MinRowContent);+ for (int k = closings - 1; k >= 0 && excess > 0; k--)+ {+ double cut = Math.Min(excess, strips[k] - 1);+ strips[k] -= cut;+ excess -= cut;+ }+ for (int k = closings - 1; k >= 0 && excess > 0; k--)+ {+ double cut = Math.Min(excess, strips[k]);+ strips[k] -= cut;+ excess -= cut;+ }+ return strips;+ }++ /// <summary>The height at the bottom of a row of <paramref name="rowH"/> taken by its closing strips.</summary>+ public static double ClosingBand(int closings, double rowH) => ClosingStrips(closings, rowH).Sum();++ /// <summary>New look: member cards stop this far from the column's right edge so the tray shows.</summary>+ public const double TrayInsetR = 4;++ /// <summary>Classic look (0.59.2): the spine steps in this far per nesting level.</summary>+ public const double ClassicStep = 10, ClassicSpineW = 3;++ public static TraySlice[] Compute(IReadOnlyList<TrayRow> rows, bool classic)+ {+ var at = new Dictionary<int, int>(rows.Count);+ for (int i = 0; i < rows.Count; i++) at[rows[i].Id] = i;++ // Ancestors, outer → inner. A parent always precedes its children, so walking up+ // stays inside the visible rows; the guard stops a malformed chain from hanging.+ var chains = new TrayRef[rows.Count][];+ var depth = new int[rows.Count];+ for (int i = 0; i < rows.Count; i++)+ {+ var up = new List<int>();+ for (int p = rows[i].ParentId, guard = 0; p >= 0 && guard < 32 && at.TryGetValue(p, out int pi); guard++)+ {+ up.Add(pi);+ p = rows[pi].ParentId;+ }+ depth[i] = up.Count;+ up.Reverse();+ if (rows[i].IsGroup) up.Add(i);+ var chain = new TrayRef[up.Count];+ for (int k = 0; k < up.Count; k++) chain[k] = new TrayRef(rows[up[k]].Id, rows[up[k]].ColorIndex, k);+ chains[i] = chain;+ }++ // A tray closes on the last row whose chain holds it.+ var lastRow = new Dictionary<int, int>();+ for (int i = 0; i < rows.Count; i++)+ foreach (var t in chains[i]) lastRow[t.GroupId] = i;+ var closings = new int[rows.Count];+ foreach (var last in lastRow.Values) closings[last]++;++ var slices = new TraySlice[rows.Count];+ for (int i = 0; i < rows.Count; i++)+ {+ var r = rows[i];+ int? folded = r.IsGroup && r.Folded ? r.HiddenTracks : null;+ double spine, content;+ if (classic)+ {+ spine = depth[i] * ClassicStep;+ content = spine + ClassicSpineW;+ }+ else+ {+ content = chains[i].Length * Step;+ // A group's own stripe is its tray's edge; a track's bar starts where its card does.+ spine = r.IsGroup ? (chains[i].Length - 1) * Step : content;+ }+ slices[i] = new TraySlice(depth[i], chains[i], r.IsGroup, closings[i], content, spine, folded);+ }+ return slices;+ }+}diff --git a/tests/Nota.SmokeTest/GroupTrayTests.cs b/tests/Nota.SmokeTest/GroupTrayTests.csnew file mode 100644index 00000000..f1dfd69c--- /dev/null+++ b/tests/Nota.SmokeTest/GroupTrayTests.cs@@ -0,0 +1,87 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Arrangement group trays (specs/094, #584): the per-row slices the header column draws+// groups from. New look: trays stepped in 6 per level, closing under their last row;+// classic look: 0.59.2's own spine stepped in 10 per level. Headless: no window.++using Nota.Presentation;++namespace Nota.SmokeTest;++internal static class GroupTrayTests+{+ // Group ⊃ { DRUMS ⊃ { Drum Rack, Audio 4 }, Instruments (folded, 4 tracks) }, then Consort.+ private const int Group = 1, Drums = 2, Rack = 3, Audio4 = 4, Instr = 5, Consort = 6;++ private static TrayRow[] Project() =>+ [+ new(Group, -1, true, false, 0, 6),+ new(Drums, Group, true, false, 6, 2),+ new(Rack, Drums, false, false, 6, 0),+ new(Audio4, Drums, false, false, 6, 0),+ new(Instr, Group, true, true, 2, 4),+ new(Consort, -1, false, false, 0, 0),+ ];++ public static IEnumerable<(bool, string)> Run()+ {+ var rows = Project();+ var s = GroupTrayLayout.Compute(rows, classic: false);+ TraySlice Of(int id) => s[Array.FindIndex(rows, r => r.Id == id)];++ yield return (Of(Rack).ContentLeft - Of(Consort).ContentLeft <= 12,+ $"trays: a track two levels deep starts at most 12 px further in (got {Of(Rack).ContentLeft - Of(Consort).ContentLeft})");+ yield return (Of(Rack).Chain.Length == 2 && Of(Rack).Chain[0].GroupId == Group && Of(Rack).Chain[1].GroupId == Drums,+ "trays: a member sits in its groups' trays, outer first");+ yield return (Of(Drums).Chain.Length == 2 && Of(Drums).Chain[^1].GroupId == Drums && Of(Drums).Heads,+ "trays: a group's row heads its own tray, inside its parent's");+ yield return (Of(Rack).Closings == 0 && Of(Audio4).Closings == 1,+ "trays: DRUMS closes under its last track");+ yield return (Of(Instr).Closings == 2, "trays: a folded last group closes itself and its parent on its row");+ yield return (Of(Consort).Closings == 0 && Of(Consort).Chain.Length == 0 && Of(Consort).ContentLeft == 0,+ "trays: a top-level track after a group is outside every tray");+ yield return (s.Sum(x => x.Closings) == rows.Count(r => r.IsGroup), "trays: every visible group closes exactly once");+ yield return (Of(Instr).FoldedCount == 4 && Of(Drums).FoldedCount is null && Of(Rack).FoldedCount is null,+ "trays: only a folded group carries a count");++ // A folded group holding a nested group counts tracks only (the caller passes them).+ var nested = new TrayRow[] { new(10, -1, true, true, 1, 3) };+ yield return (GroupTrayLayout.Compute(nested, false)[0] is { FoldedCount: 3, Closings: 1 },+ "trays: a folded group alone closes on its own row with its track count");++ // An empty group closes on its own row.+ var empty = new TrayRow[] { new(20, -1, true, false, 1, 0), new(21, -1, false, false, 2, 0) };+ var e = GroupTrayLayout.Compute(empty, false);+ yield return (e[0].Closings == 1 && e[1].Closings == 0, "trays: an empty group's tray closes under its header");++ // Closing strips must leave the name row on the smallest rows, four levels deep: a Compact+ // track closing four trays keeps its natural 10 px band and 20 px; a slim group row (one+ // line of 18 px chips) closing four trays — the innermost folded or empty — keeps 18.+ int most = 0;+ var deep = new List<TrayRow>();+ for (int d = 0; d < 4; d++) deep.Add(new(100 + d, d == 0 ? -1 : 99 + d, true, false, d, 1));+ deep.Add(new(200, 103, false, false, 4, 0));+ foreach (var x in GroupTrayLayout.Compute(deep, false)) most = Math.Max(most, x.Closings);+ yield return (most == 4 && GroupTrayLayout.ClosingBand(most, 30) == 10 && 30 - GroupTrayLayout.ClosingBand(most, 30) >= 20,+ $"trays: a Compact track closing four trays keeps its name row (band {GroupTrayLayout.ClosingBand(most, 30)})");++ var slim = new List<TrayRow>();+ for (int d = 0; d < 4; d++) slim.Add(new(300 + d, d == 0 ? -1 : 299 + d, true, d == 3, d, 1));+ int slimClosings = GroupTrayLayout.Compute(slim, false)[3].Closings;+ var strips = GroupTrayLayout.ClosingStrips(slimClosings, 26);+ yield return (slimClosings == 4 && 26 - strips.Sum() >= 18 && strips.All(x => x >= 1) && strips[0] >= strips[^1],+ $"trays: a slim group row closing four trays keeps 18 px for its buttons (strips {string.Join("/", strips)})");+ var many = GroupTrayLayout.ClosingStrips(12, 26);+ yield return (many.Length == 12 && 26 - many.Sum() >= 18 && many.All(x => x >= 0),+ "trays: even a dozen closings never eat into a row's content");++ // Classic: 0.59.2's staircase of each row's own spine.+ var c = GroupTrayLayout.Compute(rows, classic: true);+ TraySlice C(int id) => c[Array.FindIndex(rows, r => r.Id == id)];+ yield return (C(Group).SpineX == 0 && C(Drums).SpineX == 10 && C(Rack).SpineX == 20 && C(Consort).SpineX == 0,+ "classic: the spine steps in 10 px per nesting level");+ yield return (C(Rack).ContentLeft == 23 && C(Instr).FoldedCount == 4,+ "classic: content starts past the spine, and a folded group still counts");+ }+}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 766b4c66..a1e701f7 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -858,6 +858,14 @@ if (args.Length >= 1 && args[0] == "--vocoder")Console.WriteLine(failures == 0 ? "VOCODER PASSED" : $"VOCODER FAILED ({failures})");return failures == 0 ? 0 : 1;}+// Arrangement group trays alone (fast iteration): `--group-trays`. Also part of the full run.+if (args.Length >= 1 && args[0] == "--group-trays")+{+ Console.WriteLine("-- arrangement group trays --");+ foreach (var (ok, label) in GroupTrayTests.Run()) Check(ok, label);+ Console.WriteLine(failures == 0 ? "GROUP TRAYS PASSED" : $"GROUP TRAYS FAILED ({failures})");+ return failures == 0 ? 0 : 1;+}// Piano roll Fold alone (fast iteration): `--piano-fold`. Also part of the full run.if (args.Length >= 1 && args[0] == "--piano-fold"){@@ -15676,6 +15684,10 @@ foreach (var (ok, label) in ProjectSummaryTests.Run()) Check(ok, label);Console.WriteLine("-- piano roll fold --");foreach (var (ok, label) in FoldTests.Run()) Check(ok, label);+// --- Arrangement group trays (specs/094): the header column's group slices ---+Console.WriteLine("-- arrangement group trays --");+foreach (var (ok, label) in GroupTrayTests.Run()) Check(ok, label);+// --- browser: preset audition (offline-rendered, cached, played on the preview voice) ---Console.WriteLine("-- browser: preset audition --");foreach (var (ok, label) in AuditionTests.Run()) Check(ok, label);