Wire the develop panels through globals, so a second copy is one line

Every panel in the develop column declared its inputs and its callbacks and
had `app.slint` bind each one to a property or a callback on the window root.
That is fine while a panel is drawn once. N9 draws them a second time, in the
portrait dock, and the wiring is what would have to be copied: `MaskPanel`
alone ran to forty lines of forwarding, and a callback added to one copy and
not the other compiles, renders, and simply does nothing on the layout nobody
was looking at.

So the wiring moved to Slint globals. A panel reads the global and calls the
global; Rust hooks the global instead of the window; and the instantiation in
the column is now the panel's name and a pair of braces — every one of the ten
children of the column, with no property that differs by placement left to
supply.

There is a global per panel family rather than one for all of them, and the
reason is an import cycle. Each panel's model struct — `ParamRow`, `MaskRow`,
`HistogramView` — is declared in the panel's own file, so a single global
holding `[MaskRow]` and `[ParamRow]` would have to live in a file importing
`masks.slint` and `adjust.slint` while both imported the global back, which
Slint rejects. Breaking that needs six model declarations relocated, which is a
change to the data model and not to the plumbing this is about. A global beside
the panel it serves also lets each name drop the prefix it was carrying only
because the window root is one flat namespace: `root.spot-radius` is
`Repair.radius`, and `root.peaking-on` is `Peaking.showing`.

`session.slint` is new and holds the two facts every family needs and none of
them owns: whether there is an open photograph to edit, and which mode the view
is in, with the three readings of the mode derived once instead of at each of
the dozen places that tested one. `ViewMode` moves there from `adjust.slint`,
where it was only ever a lodger.

Nothing on screen changes. What is not here: the tool rail and the status strip
still take their properties at the instantiation, because they are drawn once
and N9 does not copy them; the preset sheet's own state stays on the window,
because the library grid opens the same sheet and a global cannot bind the
window's state — which is why `Transfer.open-presets` is handled in
`presets.rs`, beside the summary it already had to compute.
This commit is contained in:
2026-09-07 20:01:01 +02:00
parent dd14243dba
commit 0a5eab0487
17 changed files with 1245 additions and 1341 deletions
+27 -14
View File
@@ -53,8 +53,18 @@ export component FocusMarks inherits Image {
image-rendering: ImageRendering.pixelated;
}
// TRACES: FR-CULL-3
export component FocusPanel inherits Rectangle {
/// TRACES: FR-CULL-3
/// The focus overlay: whether it can be drawn, whether it is, and how.
///
/// A global rather than four properties and three callbacks on the panel — see
/// `session.slint` for why the develop panels stopped taking their wiring
/// through the window root.
///
/// The overlay is one thing on one photograph, so every drawing of this panel
/// is a view of the same state: turning peaking on in the dock and finding the
/// column's copy still saying "Show focus peaking" would be two controls
/// disagreeing about one fact.
export global Peaking {
/// Whether this device could build the overlay at all.
///
/// A compute pass can fail to compile on a driver nobody here has, and the
@@ -76,7 +86,10 @@ export component FocusPanel inherits Rectangle {
callback toggled(bool);
callback sensitivity-picked(int);
callback colour-picked(int);
}
// TRACES: FR-CULL-3
export component FocusPanel inherits Rectangle {
background: Theme.surface;
// Both chip rows wrap at three rather than running four abreast. That was
@@ -96,39 +109,39 @@ export component FocusPanel inherits Rectangle {
PanelHeading { text: "FOCUS"; }
if !root.available: Caption {
if !Peaking.available: Caption {
text: "This device could not build the overlay.";
wrap: word-wrap;
}
if root.available: Button {
if Peaking.available: Button {
// The label states the action rather than the state, as the mask
// overlay's does: a photographer reads a button for what pressing
// it will do.
text: root.showing ? "Hide focus peaking" : "Show focus peaking";
active: root.showing;
clicked => { root.toggled(!root.showing); }
text: Peaking.showing ? "Hide focus peaking" : "Show focus peaking";
active: Peaking.showing;
clicked => { Peaking.toggled(!Peaking.showing); }
}
if root.available && root.showing: Segmented {
if Peaking.available && Peaking.showing: Segmented {
label: "Sensitivity";
hint: "lower on a noisy frame";
options: ["Low", "Medium", "High"];
selected: root.sensitivity;
selected: Peaking.sensitivity;
columns: 3;
picked(i) => { root.sensitivity-picked(i); }
picked(i) => { Peaking.sensitivity-picked(i); }
}
if root.available && root.showing: Segmented {
if Peaking.available && Peaking.showing: Segmented {
label: "Marks";
hint: "pick what the subject is not";
options: ["Red", "Yellow", "Cyan", "Magenta"];
selected: root.colour;
selected: Peaking.colour;
columns: 3;
picked(i) => { root.colour-picked(i); }
picked(i) => { Peaking.colour-picked(i); }
}
if root.available && root.showing: Caption {
if Peaking.available && Peaking.showing: Caption {
// Said once, here, rather than left to be discovered: the marks go
// away while a control is moving because a half-resolution draft
// frame cannot be measured for sharpness (see `FocusPeakPass`).