docs: item 10 is done, and the three GTK facts it cost are written down
todo.md's item 10 is closed with what moved, what stayed in code and why, the reading each slice added, and the three GTK facts in invariants-gtk-and-chrome.md. The plan's table is marked complete, with the note that the header bar went last and in one change -- pack_start appends after whatever a file packed, so staging it by group would have reordered the bar in an intermediate commit. Two facts added to the invariants: a code-added header-bar child lands after the file's, so going first means the file declares a slot (which is what header-bar.ui does for the time-window control); and <child type="end"> is added leftwards-from-the-right, so a header bar's end group reads the reverse of the file.
This commit is contained in:
1 parent
28d80f2e90
commit
afb9680fd7
3 files changed
+21
-9
No files matched your search
@@ -324,3 +324,14 @@ Part of [CLAUDE.md](../../CLAUDE.md). These are rules that cost a defect to lear
|
||||
on-screen-display control, and the size -- is one function (`layout_overlay_button()`) rather than three
|
||||
copies. The same reason keeps the math editor's palette and parameter rows in code: their count follows the
|
||||
model, not the file. `.ui` files are for the frame, and the frame is what has no count.
|
||||
|
||||
- **A code-added child of a header bar lands *after* the file's, so going first means using a slot.**
|
||||
`gtk_header_bar_pack_start()` appends to the start group and there is no prepend. The time-window control is
|
||||
code -- its menu's rows come from the buffer's limits -- and belongs at the bar's head, so `header-bar.ui`
|
||||
declares an empty `window_control_slot` box as its first start child and the code appends the control into
|
||||
it. Packing the control straight onto the bar would have put it to the right of everything the file packed,
|
||||
and `[udpscope] header:` (`window_button_w=130 bar_w=756`) is the reading that shows such a move.
|
||||
- **`<child type="end">` is added leftwards-from-the-right, in document order.** A header bar's end group
|
||||
reads the *reverse* of the file: `header-bar.ui` declares menu, sidebar, math, measures, cursors and the
|
||||
screen shows cursors, measures, math, sidebar, menu. The three comments this replaced each had it wrong
|
||||
once, which is why the order is the file's now and a byte-for-byte diff of the probe is the check.
|
||||
@@ -74,6 +74,12 @@ needs a probe that proves it *loads* and that its contents match whatever drives
|
||||
| `src/ui/ui_layout.cpp` (~20 kB) | the layout editor's overlay buttons, which are positioned by code | only the buttons are template |
|
||||
| `build_toolbar` (`src/ui.cpp`, ~212 lines) | the header bar's layout, with every button still wired in code | delicate: the `[udpscope] header:` probe reads its geometry |
|
||||
|
||||
**Every row of the table above is done or accounted for.** The header bar went last and in one change, because
|
||||
`gtk_header_bar_pack_start()` appends after whatever a file has already packed -- staging it by group would
|
||||
have reordered the bar in an intermediate commit. Its frame is `src/ui/header-bar.ui`; the overflow menu's
|
||||
rows, the window control and every handler stayed in code, and the probe's header readings are byte-identical
|
||||
before and after.
|
||||
|
||||
**The layout editor's buttons are not a `.ui` row, and the note above is wrong about them.** Their count *is*
|
||||
the row count (one per row, one per boundary), and `GtkBuilder` instantiates a file's objects once, so a file
|
||||
can hold neither the number nor a prototype for the code to copy. What was real in that row was the
|
||||
|
||||
@@ -24,12 +24,7 @@
|
||||
- defaults
|
||||
- other parameters
|
||||
|
||||
10. [ ] move the interface into `.ui` resources, and to current GTK4/libadwaita widgets while doing it:
|
||||
- the shortcut overview is **done** (`src/ui/shortcuts.ui`, with the mouse gestures drawn as icons, and `[help]`'s `ui=` against `tables=` as the guard)
|
||||
- the preferences are **done** (`src/ui/preferences.ui`: `AdwPreferencesDialog` with `AdwEntryRow`/`AdwSpinRow`/`AdwSwitchRow`/`AdwComboRow`, applying as they change, no Apply button)
|
||||
- the help window's chrome is **done** (`src/ui/help.ui`: `AdwWindow` + header bar + `AdwNavigationSplitView`)
|
||||
- the host form is **done** (`src/ui/source-form.ui`); the source chooser's own window is next
|
||||
- the main window's skeleton is **done** (`src/ui/main-window.ui`: the window, the two panes, the plot column and the status line, the sidebar's scroller); the panels inside it are the next slices
|
||||
- the side panels are being extracted one per commit on that pattern: the cursors panel is **done** (`src/ui/cursors-panel.ui`), and the measurements panel, the trigger panel, the signals panel, the math panel, the events pane, the layout editor's buttons and the header bar are queued in the plan
|
||||
- still in code, in the plan's own order: the source chooser's window (its host form is done), the measurements panel, the trigger panel, the signals panel, the math panel and the node editor's chrome, the events pane, the layout editor's overlay buttons, and the header bar — eight slices, each with its own row in the plan's table
|
||||
- plan, conventions and acceptance for each slice: `docs/superpowers/plans/2026-10-11-ui-files-and-gtk4-practice.md`
|
||||
- [x] (10) ~~move the interface into `.ui` resources, and to current GTK4/libadwaita widgets while doing it~~ **done**: one slice per commit, 14 `.ui` files under `src/ui/`, every one of them in `udpscope-ui.gresource.xml` and checked by `make test-ui`, which type-checks each property and child against the GIR and refuses a file the xml does not list. Moved: the shortcut overview, the preferences, the help window's chrome, the host form, the main window's skeleton, the cursors panel, the source chooser's window (an `AdwViewStack` under an `AdwViewSwitcherBar` in place of the notebook), the measurements panel, the trigger panel, the signals panel, the math panel, the math editor's window with its identity row, canvas and action row, the events pane, and the header bar.
|
||||
- what stays in code, and why: the *rows* (one per signal, measurement, event, channel or node, rebuilt from the model); the math editor's palette and parameter form (the palette is the operation table, the form follows the selection); and the layout editor's overlay buttons, whose *count* is the row count -- a `GtkBuilder` instantiates a file's objects once, so a file can hold neither the number nor a prototype for the code to copy. That row was closed by factoring the look its three loops shared into one function instead.
|
||||
- the reading each slice added: `[sidebar-probe]`, `[prefs-probe] mnemonics=`, `[sources] chooser ui:`, `measures pane:`'s `switch_on`/`reset_sensitive`, `trigger panel:`'s `controls_inside`, `signals panel:`, `math panel:`, `[math-probe] dialog build:`'s `name=`/`unit=`, `events pane:`'s `nested`, and the header bar through the unchanged `[udpscope] header:` geometry -- each of them reading the frame back rather than asserting it.
|
||||
- the three GTK facts these slices cost, all in `docs/claude/invariants-gtk-and-chrome.md`: an expander's child is not in the widget-parent chain; a `.ui` file instantiates its objects once; and a code-added header-bar child lands after the file's, which is why the window control goes into a slot the file declares.
|
||||
Reference in new issue
Block a user