ui: the math editor's window, identity row and canvas are a .ui file
The second half of this plan row, and the half of that dialog which is template. src/ui/math-editor.ui holds the window (its size and modality), the box around it, the identity row -- the name and the unit -- and the body with the canvas in it. What stays in code is the drawing: the canvas is a GtkDrawingArea the file *declares* and the code draws, with the gestures that make it a graph editor, and the parameter form follows which node is selected. The palette and the buttons go next. The builder is held on `App` and cleared on the *next* opening rather than with the window: the window belongs to the builder's object list, so freeing the builder under a live window frees the window with it. That is the source form's pattern, and the probe's close-then-reopen path is what exercises it -- `reopened: dialog=ok, nodes=2`. The identity row is read back too, since a `.ui` can hold the widget but not the value: `dialog build: ... name='math3' unit='' ...`, the entries having been filled from the channel being edited. check_ui is at 12 ok, 0 failed.
This commit is contained in:
1 parent
90a17eb186
commit
1a02946656
7 files changed
+123
-36
No files matched your search
+10
-3
@@ -389,6 +389,12 @@ gboolean math_probe(gpointer user) {
|
||||
const std::size_t built = ed->nodes.size();
|
||||
const double gain_read = ed->nodes.empty() ? 0.0 : ed->nodes.back().gain;
|
||||
const double offset_read = ed->nodes.empty() ? 0.0 : ed->nodes.back().offset;
|
||||
// The identity row, which the file cannot hold values for: the entries were filled from the channel
|
||||
// being edited, so reading them back is what shows the row is the same one the code writes.
|
||||
const std::string name_read =
|
||||
ed->name != nullptr ? gtk_editable_get_text(GTK_EDITABLE(ed->name)) : "-";
|
||||
const std::string unit_read =
|
||||
ed->unit != nullptr ? gtk_editable_get_text(GTK_EDITABLE(ed->unit)) : "-";
|
||||
on_math_apply(nullptr, ed); // frees the dialog: nothing below may touch `ed`
|
||||
const std::size_t saved = a->math.empty()
|
||||
? 0u
|
||||
@@ -397,9 +403,10 @@ gboolean math_probe(gpointer user) {
|
||||
a->math.empty() ? -1 : a->math[static_cast<std::size_t>(index)].output;
|
||||
std::fprintf(stderr,
|
||||
"[math-probe] dialog build: nodes=%zu, output after add=%d (want %zu); "
|
||||
"reading back gain=%.2f offset=%.2f; saved nodes=%zu output=%d\n",
|
||||
built, output_after_add, built - 1, gain_read, offset_read, saved,
|
||||
output_saved);
|
||||
"reading back gain=%.2f offset=%.2f; name='%s' unit='%s'; "
|
||||
"saved nodes=%zu output=%d\n",
|
||||
built, output_after_add, built - 1, gain_read, offset_read, name_read.c_str(),
|
||||
unit_read.c_str(), saved, output_saved);
|
||||
}
|
||||
}
|
||||
// Closed and reopened: `gtk_window_destroy()` does not emit `close-request`, so a dialog closed
|
||||
|
||||
Reference in new issue
Block a user