ui: the layout editor's buttons keep their look in one place, closing that plan row
The row asked for these buttons in a .ui file and that is not possible: there is one per
row and one more than that per boundary, and a GtkBuilder instantiates a file's objects
once, so the file can hold neither the count nor a prototype for the code to copy. The
plan's note ("only the buttons are template") is wrong for the same reason, and the plan
document now says so.
What was real in the row was the duplication: the look was written out three times -- the
icon, the two CSS classes that make a small round on-screen-display control, the size,
the overlay append and the bookkeeping -- and is now one function,
`layout_overlay_button()`. Each loop keeps only what makes it different: its alignment,
its sensitivity, the data it carries and, for the resize handle, its drag gesture.
The layout probe is the check and its readings are byte-identical before and after, all
seven lines: `buttons=5 done=1 done_box=[680,4,72x42] close=[4] add=[0,832] resize=[(1:-)]`
and the row geometry through add-above, remove, add-at-end and Editor off.
This commit is contained in:
1 parent
148d1168d6
commit
c94bc4316c
3 files changed
+45
-25
No files matched your search
@@ -316,3 +316,11 @@ Part of [CLAUDE.md](../../CLAUDE.md). These are rules that cost a defect to lear
|
||||
the bare `FAIL` line is that mistake and nothing else. The house style for a dash in prose is the em dash,
|
||||
which is why no other `.ui` in `src/ui/` contains a double hyphen. It has cost two slices a debugging
|
||||
round for one character.
|
||||
|
||||
- **A `.ui` file instantiates its objects once, so anything whose *count* is data cannot live in one.** The
|
||||
layout editor's overlay buttons are one per row, plus one per boundary between them: a `GtkBuilder` would
|
||||
hand back the first and nothing for the rest, and there is no "prototype the code copies" in the format.
|
||||
They are therefore code, and what they share -- the icon, the two CSS classes that make a small round
|
||||
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.
|
||||
Reference in new issue
Block a user