ui: the math editor's action row is the file's, closing that plan row

The row is the file's -- the box and its two buttons, the second carrying the
suggested-action class -- and what is code is what they do and what the second one says:
"Save" edits an existing channel and "Add" makes a new one, which the file cannot know.

With it the editor's frame is whole: the window, the identity row, the body with the
canvas in it, and the buttons that end it. The parameter form and the palette stay in
code, and for the reason the canvas's *drawing* does -- the form follows which node is
selected and the palette is the operation table itself.

The probe clicks the apply button rather than calling its handler, so
`dialog build: ... name='math3' unit=''; saved nodes=2 output=1` is that button having
worked from the file, and `after close: dialog=cleared` / `reopened: dialog=ok, nodes=2`
are the lifetime around it. check_ui: 12 ok, 0 failed.
This commit is contained in:
Martino Ferrari committed 2026-10-12 15:59:23 +02:00
1 parent 1a02946656
commit c86d2117fb
2 files changed
+33 -11

No files matched your search

+11 -8
View File
@@ -2186,8 +2186,17 @@ void open_math_dialog(App& app, int edit) {
gtk_box_append(GTK_BOX(form), buttons);
gtk_box_append(GTK_BOX(body), form); // the form is the body's second child; the canvas is the file's
GtkWidget* actions = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
GtkWidget* cancel = gtk_button_new_with_label("Cancel");
// The action row is the file's; what is code is what the buttons *do*, and what the second one says:
// "Save" edits an existing channel and "Add" makes a new one, which the file cannot know.
GtkWidget* actions = GTK_WIDGET(gtk_builder_get_object(ui, "math_actions"));
GtkWidget* cancel = GTK_WIDGET(gtk_builder_get_object(ui, "math_cancel"));
GtkWidget* apply = GTK_WIDGET(gtk_builder_get_object(ui, "math_apply"));
if (actions == nullptr || cancel == nullptr || apply == nullptr) {
std::fprintf(stderr, "[math] editor: math-editor.ui is missing its action row\n");
delete d;
return;
}
gtk_button_set_label(GTK_BUTTON(apply), edit >= 0 ? "Save" : "Add");
// Named so the headless probe can click the *button* rather than call its handler: the defect
// this guards was in the connection, which a direct call cannot see.
g_object_set_data(G_OBJECT(window), "udpscope-math-cancel", cancel);
@@ -2196,13 +2205,7 @@ void open_math_dialog(App& app, int edit) {
// later open then took the "already open" branch and presented it -- "I cannot edit a math
// channel again". The same trap the other three windows in this file document.
g_signal_connect_swapped(cancel, "clicked", G_CALLBACK(gtk_window_close), window);
GtkWidget* apply = gtk_button_new_with_label(edit >= 0 ? "Save" : "Add");
gtk_widget_add_css_class(apply, "suggested-action");
g_signal_connect(apply, "clicked", G_CALLBACK(on_math_apply), d);
gtk_widget_set_halign(actions, GTK_ALIGN_END);
gtk_box_append(GTK_BOX(actions), cancel);
gtk_box_append(GTK_BOX(actions), apply);
gtk_box_append(GTK_BOX(outer), actions);
app.math_dialog = window;
d->apply = apply;
+22 -3
View File
@@ -5,9 +5,10 @@
The math channel editor's window and its identity row: the name the channel is called, and the unit its
readouts carry.
The canvas below them is *declared* here but *drawn* by code (`GtkDrawingArea`), and the palette, the
parameter form and the buttons around it are code as well, because the form follows the selection: that is
the half of this dialog which is not template. The row here is the half that is.
The canvas below them is *declared* here but *drawn* by code (`GtkDrawingArea`); the parameter form beside
it and the palette are code as well, because the form follows which node is selected and the palette is the
operation table itself — neither is data a file should hold. What is here is the frame: the window, the
identity row, the body with the canvas in it, and the two buttons that end the dialog.
The window's title is not here: it says which mode the editor is in ("Edit math channel" against "New math
channel"), which the code that opens it knows and a file cannot.
@@ -61,5 +62,23 @@
</child>
</object>
</child>
<child>
<object class="GtkBox" id="math_actions">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="math_cancel">
<property name="label" translatable="yes">Cancel</property>
</object>
</child>
<child>
<object class="GtkButton" id="math_apply">
<property name="label" translatable="yes">Add</property>
<property name="css-classes">suggested-action</property>
</object>
</child>
</object>
</child>
</object>
</interface>