Cut core/instrument/ui comment bloat ~49% (comments only, zero code change)
This commit is contained in:
@@ -1,27 +1,18 @@
|
||||
// knob_deck.h — PURE knob-deck layout + hit-test for the r11 Sample-face recomposition
|
||||
// (Wave B, FB1). NO VST3, NO REAPER, NO SWELL/LICE types at the boundary, and — like
|
||||
// param_slider — NO engine types: cells and toggles carry opaque shell-owned control ids.
|
||||
// The mirror of action_bar / param_slider: the fiddly group-box / caption-row / cell-grid
|
||||
// arithmetic lives here, unit-tested outside the DAW, while the editor shell draws each
|
||||
// group (fence, caption, compact toggles, knobs) through the L1 kit and routes clicks/drags
|
||||
// via the hit-test. The KNOB PRIMITIVE itself (value<->needle-angle, vertical drag) is
|
||||
// param_slider's (FA4); a knob cell here is just a rect — the shell composes the two.
|
||||
// knob_deck.h — knob-deck layout + hit-test for the Sample-face knob deck. Engine-free
|
||||
// like param_slider: cells and toggles carry opaque shell-owned control ids. Mirror of
|
||||
// action_bar/param_slider; the knob primitive itself (value<->needle-angle, drag) is
|
||||
// param_slider's — a knob cell here is just a rect the shell composes it into.
|
||||
//
|
||||
// THE DECK (CONTEXT.md §S-VIEW r11). A horizontal run of FENCED GROUPS, left -> right, each
|
||||
// a hairline-bordered bg/panel box with a CAPTION ROW (micro-caps caption left; the group's
|
||||
// compact mode toggle right-anchored IN the caption row — this is where the not-full-width
|
||||
// toggles live) over a KNOB ROW of fixed 48x58 cells (28px knob centered, 12px label band
|
||||
// beneath). A group may additionally place one 18px-tall two-segment toggle IN the knob row
|
||||
// after its cells (the VOICE group's Retrig|Legato — same Mono/Stereo segment grammar,
|
||||
// vertically centered). Groups that must keep stable geometry across a mode flip reserve
|
||||
// blank cells (id -1): the AMP ENVELOPE group always spans 5 cells so Gate<->Trigger never
|
||||
// reflows its neighbours.
|
||||
// The deck is a horizontal run of fenced groups, left->right, each a bordered box with a
|
||||
// caption row (caption left, the group's compact mode toggle right-anchored) over a knob
|
||||
// row of fixed cells (knob centered, label band beneath). A group may also place one
|
||||
// two-segment toggle in the knob row after its cells. Groups that must keep stable
|
||||
// geometry across a mode flip reserve blank cells (id -1) so a mode flip never reflows
|
||||
// neighbouring groups.
|
||||
//
|
||||
// WRAP (deterministic): groups place left-to-right with kDeckGroupGap between; a group that
|
||||
// does not fit the remaining width starts a new deck row (whole groups only, never split).
|
||||
// The first group of a row always places even if wider than the row (degenerate width).
|
||||
// deckHeight() exposes the resulting height so the shell can bottom-anchor the deck band and
|
||||
// give the ELASTIC HERO the rest (r11 band order).
|
||||
// Wrap is deterministic: groups place left-to-right with kDeckGroupGap between; a group
|
||||
// that does not fit the remaining width starts a new row (whole groups only, never
|
||||
// split); the first group of a row always places even if wider than the row.
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -31,7 +22,7 @@
|
||||
|
||||
namespace reasampler::instrument::ui {
|
||||
|
||||
// Fixed deck metrics (spec r11), exposed so the shell and tests agree.
|
||||
// Fixed deck metrics, exposed so the shell and tests agree.
|
||||
inline constexpr int kDeckCellW = 48; // one knob cell
|
||||
inline constexpr int kDeckCellH = 58;
|
||||
inline constexpr int kDeckKnobSize = 28; // knob diameter inside the cell
|
||||
@@ -55,9 +46,8 @@ struct DeckToggleDesc {
|
||||
};
|
||||
|
||||
// One fenced group, in deck order. `cellIds` are the knob cells left-to-right; an id of -1
|
||||
// is a RESERVED BLANK cell (geometry held, never hit — the AMP ENVELOPE Trigger face).
|
||||
// `captionWidth` is the px the shell reserves for the caption text (this module does not
|
||||
// measure text — the house constant-metrics pattern).
|
||||
// is a reserved blank cell (geometry held, never hit). `captionWidth` is the px the shell
|
||||
// reserves for the caption text (this module does not measure text).
|
||||
struct DeckGroupDesc {
|
||||
int id = 0; // shell group id (opaque here)
|
||||
int captionWidth = 60;
|
||||
@@ -96,21 +86,20 @@ struct DeckLayout {
|
||||
int height = 0; // rowCount * kDeckGroupH + (rowCount-1) * kDeckRowGap; 0 for no groups
|
||||
};
|
||||
|
||||
// The width of one group box: the wider of its caption row (caption + gap + toggle) and its
|
||||
// knob row (cells + gap + row toggle), plus the horizontal padding. Pure.
|
||||
// Width of one group box: the wider of its caption row (caption + gap + toggle) and its
|
||||
// knob row (cells + gap + row toggle), plus horizontal padding.
|
||||
int deckGroupWidth(const DeckGroupDesc& g);
|
||||
|
||||
// The number of deck rows the groups occupy at `availWidth` under the greedy whole-group
|
||||
// wrap (a group that does not fit the remaining row width starts a new row; the first group
|
||||
// of a row always places). 0 for an empty group list. Pure — the wrap is deterministic.
|
||||
// Number of deck rows the groups occupy at `availWidth` under the greedy whole-group wrap.
|
||||
// 0 for an empty list.
|
||||
int deckRowCount(const std::vector<DeckGroupDesc>& groups, int availWidth);
|
||||
|
||||
// The total deck height at `availWidth` (rows * kDeckGroupH + inter-row gaps). 0 for an
|
||||
// empty list. The shell bottom-anchors a band of exactly this height. Pure.
|
||||
// Total deck height at `availWidth` (rows * kDeckGroupH + inter-row gaps). The shell
|
||||
// bottom-anchors a band of exactly this height.
|
||||
int deckHeight(const std::vector<DeckGroupDesc>& groups, int availWidth);
|
||||
|
||||
// Lay the groups out from (left, top) within `availWidth`, wrapping per deckRowCount's rule.
|
||||
// Every rect is absolute. Pure — same inputs, same layout.
|
||||
// Lays the groups out from (left, top) within `availWidth`, wrapping per deckRowCount's
|
||||
// rule. Every rect is absolute.
|
||||
DeckLayout layoutDeck(const std::vector<DeckGroupDesc>& groups, int left, int top,
|
||||
int availWidth);
|
||||
|
||||
@@ -124,10 +113,9 @@ struct DeckHit {
|
||||
int segment = -1; // 0/1 for a toggle hit; -1 otherwise
|
||||
};
|
||||
|
||||
// The deck element a point lands on: a knob CELL (the whole 48x58 cell — friendlier than the
|
||||
// bare knob circle; the shell anchors the vertical drag wherever the grab lands), a caption-
|
||||
// toggle segment, or a row-toggle segment. Blank cells (id -1) and everything else miss.
|
||||
// Pure — the shell's routing entry point.
|
||||
// The deck element a point lands on: a knob cell (the whole cell, not just the knob
|
||||
// circle — the shell anchors the vertical drag wherever the grab lands), a caption-toggle
|
||||
// segment, or a row-toggle segment. Blank cells (id -1) and everything else miss.
|
||||
DeckHit hitTestDeck(const DeckLayout& layout, int x, int y);
|
||||
|
||||
} // namespace reasampler::instrument::ui
|
||||
|
||||
Reference in New Issue
Block a user