Group the panel by what operations say they are about

A strip of groups over the adjust panel — Light, Colour, Detail — derived
from the attributes the operations declare. `adjust.slint` names none of
them: the strings arrive resolved and the panel only draws them, so a new
operation joins the right group by saying what it is and this file does not
change (FR-DEV-3a).

A group nothing carries is not offered, so a tab never opens onto nothing.
Geometry is left out because its one operation prefers an on-canvas widget
and is skipped by the row builder — a Geometry tab would be empty while
`GeometryPanel` holds the real controls. The strip appears only when there
is more than one group to choose between; a single tab is a control with one
option.

The selected group is underlined rather than filled. The accent means
*modified* everywhere else in this interface, and spending it on "which tab"
would blunt the one signal the panel has.

**The trap, and it nearly bit again.** `op_index` on a row counts over every
capability, not over the ones a filter kept — it is how a row routes back to
the core. Renumbering it while filtering would make a slider drive a
different operation, which looks like a rendering fault rather than a
routing one. `rows_filtered` keeps `enumerate` over the full list and only
`group_head` is a position within the emitted rows; a test moves a value
through a filtered row and checks it lands where it was asked to.

Six tests, including that a nonsense index falls back to showing everything
rather than to showing nothing.
This commit is contained in:
2026-08-22 10:22:47 +02:00
parent 7421837c8a
commit 924a837389
6 changed files with 344 additions and 15 deletions
+52
View File
@@ -630,6 +630,14 @@ export component TransferPanel inherits VerticalLayout {
export component AdjustPanel inherits Rectangle {
in property <[ParamRow]> rows;
/// The groups worth offering, derived from what the operations say they
/// are about. **This file names none of them** — the strings arrive
/// already resolved and the panel only has to draw them, which is what
/// keeps a new operation a zero-edit change here (FR-DEV-3a).
in property <[string]> tabs;
/// Index into `tabs`, or -1 for "everything".
in property <int> active-tab: -1;
callback tab-picked(int);
in property <bool> enabled: true;
/// The tone curve's sampled shape, evaluated in Rust by the same spline
/// the shader runs so the drawn line cannot disagree with the applied one.
@@ -677,6 +685,50 @@ export component AdjustPanel inherits Rectangle {
if !root.enabled: Caption { text: "No image"; }
// The group strip. Only when there is more than one group to choose
// between — a single tab is a control with one option, which is
// decoration.
if root.enabled && root.tabs.length > 1: HorizontalLayout {
spacing: Theme.gap-sm;
alignment: start;
all := TouchArea {
width: 34px;
height: Theme.touch-target;
mouse-cursor: pointer;
clicked => { root.tab-picked(-1); }
Label {
text: "All";
emphasised: root.active-tab == -1 || all.has-hover;
vertical-alignment: center;
}
}
for tab[i] in root.tabs: tab-area := TouchArea {
width: label.preferred-width + 8px;
height: Theme.touch-target;
mouse-cursor: pointer;
clicked => { root.tab-picked(i); }
label := Label {
text: tab;
emphasised: root.active-tab == i || tab-area.has-hover;
vertical-alignment: center;
}
// The selected group is underlined rather than filled: the
// accent means *modified* everywhere else in this interface,
// and spending it on "which tab" would blunt the one signal
// the panel has (ui-refinement.md, principle 2).
Rectangle {
y: parent.height - 2px;
height: 2px;
width: parent.width;
background: root.active-tab == i ? Theme.ink : transparent;
}
}
}
// No Flickable here any more. The histogram, the capture metadata and
// the geometry controls sat *above* this one and could not be scrolled
// away, so on a 280px column in portrait they ate the height the