ui: the math panel's frame is a .ui file

The first half of this plan row. src/ui/math-panel.ui holds the panel: the box and its
margins, the heading row with the title and the add button, and the list the channel rows
go in. The rows stay in code -- each is a channel with its name, unit, expression, colour
and its own edit and remove buttons -- so the file holds the frame, as in the measurements
and signals panels beside it.

Read back by a dump line that also reads the file's own text:
`math panel: head=2 buttons=1 list=1 title='Math channels'`, where buttons=0 is a lost
`+` and title='-' a lost label. `[math-probe]` still drives the add and opens the editor,
so the rows landing in the file's list is read as well as the frame.

The other half is the node editor's chrome, which is where least of that file is template:
the canvas is a GtkDrawingArea that is drawn rather than declared, and the gestures, the
parameter fields and the palette are code. That is its own change.
This commit is contained in:
Martino Ferrari committed 2026-10-12 15:53:35 +02:00
1 parent c37fbdde21
commit 90a17eb186
5 files changed
+92 -19

No files matched your search

+18
View File
@@ -5423,6 +5423,24 @@ int run_ui(int argc, char** argv, const Config& cfg, ScopeModel& model, Acquisit
}
std::printf("[udpscope] signals panel: labels=%d list=%d\n", labels, lists);
}
{
// The math panel's frame, read from the window: the head row with the title and the add button, and the
// list. `buttons=0` is a `.ui` that lost the `+` -- otherwise a panel that cannot add anything, with
// nothing else complaining -- and the title is read out to show the file's own text arrived.
GtkWidget* panel = app.math_list != nullptr ? gtk_widget_get_parent(app.math_list) : nullptr;
GtkWidget* head = panel != nullptr ? gtk_widget_get_first_child(panel) : nullptr;
GtkWidget* title = head != nullptr ? gtk_widget_get_first_child(head) : nullptr;
int head_children = 0;
int buttons = 0;
for (GtkWidget* c = head != nullptr ? gtk_widget_get_first_child(head) : nullptr; c != nullptr;
c = gtk_widget_get_next_sibling(c)) {
++head_children;
if (GTK_IS_BUTTON(c)) ++buttons;
}
std::printf("[udpscope] math panel: head=%d buttons=%d list=%d title='%s'\n", head_children,
buttons, app.math_list != nullptr ? 1 : 0,
GTK_IS_LABEL(title) ? gtk_label_get_text(GTK_LABEL(title)) : "-");
}
std::printf("[udpscope] panels: side=%dx%d (visible=%d) signals=%dx%d row_h=%d "
"(revealed=%d) trigger=%dx%d (revealed=%d) toggles=%d cursors=%d window=%.3fs "
"window_cap=%.1fs\n",