feat: the cursors panel is a UI file
src/ui/cursors-panel.ui holds the panel's shape -- the header with the mode dropdown and the reset button, and the grid the two cursor times are read in. What is not in it is the grid's contents, which follow the cursor mode and the rows and are rebuilt whenever either changes. Panels need a builder that outlives them, unlike the dialogs, which are rebuilt on every opening: a widget belongs to the builder that built it, so App::ui_builders holds each panel's for the life of the window. ui_load() is that, in ui_widgets.cpp. make test-ui also checks that udpscope-ui.gresource.xml lists every .ui file now. That was the third trap of this refactor -- a file on disk but not in the resource is a Gtk-ERROR at load, which aborts -- and it is a compile-time mistake that nothing else in the build could see. Verified by unlisting the new file and watching the check fail, then restoring it. [cursors-probe] reads as it did: all four modes, pane=1, the timings and the drag cases.
This commit is contained in:
1 parent
7a982da6c4
commit
ed82abd405
8 files changed
+118
-25
No files matched your search
@@ -399,6 +399,10 @@ struct App {
|
||||
plot::Figure* area_b_figure = nullptr;
|
||||
std::unique_ptr<RowSet> rows_b;
|
||||
GtkWidget* plot_split = nullptr;
|
||||
/// The builders of the panels inside the window. A widget belongs to the builder that built it, and a
|
||||
/// panel lives as long as the window, so these do too -- unlike the dialogs', which are replaced.
|
||||
std::vector<GtkBuilder*> ui_builders;
|
||||
|
||||
/// The main window's builder. Held because the window belongs to its object list: it is replaced on
|
||||
/// the next build rather than reused, and everything found by id comes out of it.
|
||||
GtkBuilder* window_ui = nullptr;
|
||||
@@ -1038,6 +1042,9 @@ GtkWidget* menu_button(const char* label, const char* accel);
|
||||
GtkWidget* menu_toggle(const char* label, const char* accel, bool active);
|
||||
GtkWidget* menu_separator();
|
||||
GtkWidget* labeled_box(const char* label, GtkWidget* child);
|
||||
/// Loads a UI file into the window's builders and returns the builder, so the caller can resolve the
|
||||
/// objects it needs by id. See `ui_widgets.cpp`.
|
||||
GtkBuilder* ui_load(App& app, const char* resource);
|
||||
LayoutState collect_layout(App& app);
|
||||
void on_config_row_activated(GtkListBox*, GtkListBoxRow* row, gpointer user);
|
||||
void on_config_forget_clicked(GtkButton* button, gpointer user);
|
||||
|
||||
Reference in new issue
Block a user