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
+29
View File
@@ -519,6 +519,20 @@ pub(crate) fn sync_rows(
// and flips of an image that no longer has them.
sync_framing(window, session);
// TRACES: FR-DEV-3a
// The groups, derived from what the operations say they are about. This
// side resolves the labels; nothing here or in `adjust.slint` names an
// operation or a group.
let (tabs, active_tab) = match session.borrow().as_ref() {
Some(s) => (
s.tabs().into_iter().map(|(_, name)| name.into()).collect(),
s.active_tab(),
),
None => (Vec::<slint::SharedString>::new(), -1),
};
window.set_adjust_tabs(slint::ModelRc::new(slint::VecModel::from(tabs)));
window.set_adjust_active_tab(active_tab);
let current = match session.borrow().as_ref() {
Some(s) => s.rows(),
None => Vec::new(),
@@ -1740,6 +1754,21 @@ pub fn run(paths: Vec<PathBuf>) -> Result<()> {
// The local-adjustment panel. Wired as a block rather than inline because
// it is a dozen callbacks that all say the same three things, and they
// read better beside each other than scattered through this function.
{
// Choosing a group re-filters the panel and nothing else — no edit,
// no render. It is navigation.
let weak = window.as_weak();
let session = session.clone();
let rows = rows.clone();
window.on_adjust_tab_picked(move |index| {
let Some(w) = weak.upgrade() else { return };
if let Some(s) = session.borrow_mut().as_mut() {
s.set_active_tab(index);
}
sync_rows(&w, &rows, &session);
});
}
masks_ui::wire(&window, &session, &rows, &redraw, gpu.clone());
{