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:
1 parent
1a02946656
commit
c86d2117fb
2 files changed
+33
-11
No files matched your search
+11
-8
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user