badges: source badge shows the name only; drop the signals lock; the signals page proposes what can be added
The link state is the status bar's, so the Source badge loses its state text. The signals have no lock (the badges and signal pages are direct manipulation), and the signals page lists only unacquired signals and uncomputed math channels (plus the acquired ones while the badge bar has overflowed). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
dad424f1de
commit
b98a3478ff
10 files changed
+164
-148
No files matched your search
+18
-26
@@ -65,10 +65,9 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
const SignalInfo sig = all[index];
|
||||
const bool enabled = app.model->signal_enabled(index);
|
||||
const bool plotted = signal_plotted(app, sig.name);
|
||||
const bool unlocked = !app.signals_locked;
|
||||
|
||||
// Back to the list: a page reached from a list row has no other way home.
|
||||
GtkWidget* back = text_button("All signals", page);
|
||||
GtkWidget* back = text_button("Back to signals", page);
|
||||
gtk_widget_set_halign(back, GTK_ALIGN_START);
|
||||
gtk_widget_add_css_class(back, "flat");
|
||||
g_signal_connect(back, "clicked", G_CALLBACK(+[](GtkButton*, gpointer user) {
|
||||
@@ -96,8 +95,6 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
g_object_set_data(G_OBJECT(enable), "udpscope-signal", GSIZE_TO_POINTER(index));
|
||||
g_signal_connect(enable, "notify::active", G_CALLBACK(on_signal_switch), &app);
|
||||
gtk_widget_set_visible(enable, sig.math || app.waveform_name.empty());
|
||||
// The signal lock is the list's lock too: the page may not do what the locked list refuses.
|
||||
gtk_widget_set_sensitive(enable, unlocked);
|
||||
gtk_box_append(GTK_BOX(page), enable);
|
||||
|
||||
// Colour.
|
||||
@@ -110,7 +107,7 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
GtkWidget* colour_row = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
|
||||
gtk_box_append(GTK_BOX(colour_row), chip);
|
||||
GtkWidget* pick = text_button("Change colour...", colour_row);
|
||||
gtk_widget_set_sensitive(pick, plotted && unlocked);
|
||||
gtk_widget_set_sensitive(pick, plotted);
|
||||
gtk_widget_set_tooltip_text(pick, plotted ? "the colour this signal is plotted in"
|
||||
: "on no plot, so there is no trace to colour");
|
||||
tag(pick, index);
|
||||
@@ -119,7 +116,7 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
}),
|
||||
&app);
|
||||
GtkWidget* reset = text_button("Default colour", colour_row);
|
||||
gtk_widget_set_sensitive(reset, unlocked && app.rows->signal_colors().count(sig.name) != 0);
|
||||
gtk_widget_set_sensitive(reset, app.rows->signal_colors().count(sig.name) != 0);
|
||||
tag(reset, index);
|
||||
g_signal_connect(reset, "clicked", G_CALLBACK(+[](GtkButton* b, gpointer user) {
|
||||
outlive_the_rebuild(GTK_WIDGET(b));
|
||||
@@ -184,12 +181,10 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
GtkWidget* more = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
if (sig.math) {
|
||||
GtkWidget* edit = text_button("Edit graph...", more);
|
||||
gtk_widget_set_sensitive(edit, unlocked);
|
||||
tag(edit, index);
|
||||
g_signal_connect(edit, "clicked", G_CALLBACK(on_math_edit_clicked), &app);
|
||||
GtkWidget* del = text_button("Delete", more);
|
||||
gtk_widget_add_css_class(del, "destructive-action");
|
||||
gtk_widget_set_sensitive(del, unlocked);
|
||||
tag(del, index);
|
||||
g_signal_connect(del, "clicked", G_CALLBACK(on_math_delete_clicked), &app);
|
||||
} else {
|
||||
@@ -197,7 +192,6 @@ void fill(App& app, const std::string& name, GtkWidget* page) {
|
||||
tag(info, index);
|
||||
g_signal_connect(info, "clicked", G_CALLBACK(on_info_clicked), &app);
|
||||
GtkWidget* cal = text_button("Calibrate...", more);
|
||||
gtk_widget_set_sensitive(cal, unlocked);
|
||||
gtk_widget_set_tooltip_text(cal, "gain and offset, applied at ingest");
|
||||
tag(cal, index);
|
||||
g_signal_connect(cal, "clicked", G_CALLBACK(+[](GtkButton* b, gpointer user) {
|
||||
@@ -337,20 +331,6 @@ gboolean signal_page_probe(gpointer user) {
|
||||
plot_on_row0_disabled = gtk_widget_get_sensitive(gtk_widget_get_first_child(rows_box_on)) ? 0 : 1;
|
||||
}
|
||||
|
||||
// The signal lock: with it on, the page's acquire tick is insensitive after the sync (the lock change
|
||||
// re-runs it through rebuild_signal_panels); restored afterwards.
|
||||
int locked_enable_sensitive = -1;
|
||||
const bool was_locked = a.signals_locked;
|
||||
a.signals_locked = true;
|
||||
signal_pages_sync(a);
|
||||
page_it = a.signal_pages.find(name);
|
||||
if (page_it != a.signal_pages.end()) {
|
||||
GtkWidget* enable_now = find_descendant(page_it->second, [](GtkWidget* w) { return GTK_IS_CHECK_BUTTON(w); });
|
||||
if (enable_now != nullptr) locked_enable_sensitive = gtk_widget_get_sensitive(enable_now) ? 1 : 0;
|
||||
}
|
||||
a.signals_locked = was_locked;
|
||||
signal_pages_sync(a);
|
||||
|
||||
int removed = -1;
|
||||
page_it = a.signal_pages.find(name);
|
||||
GtkWidget* off = page_it == a.signal_pages.end()
|
||||
@@ -381,8 +361,15 @@ gboolean signal_page_probe(gpointer user) {
|
||||
slideover_open(a, "signals");
|
||||
const int back_to_list = slideover_page(a) == "signals" ? 1 : 0;
|
||||
|
||||
// Activating the signal's row in the list opens its page (the path a click takes).
|
||||
// Activating the signal's row in the list opens its page (the path a click takes). The list proposes what
|
||||
// can be added, so the signal has a row only while it is not acquired: switch it off for the leg and back
|
||||
// on after it. (With more than six acquired signals the rows list the acquired ones too.)
|
||||
slideover_close(a);
|
||||
const bool was_enabled = a.model->signal_enabled(index);
|
||||
if (was_enabled) {
|
||||
a.model->set_signal_enabled(index, false);
|
||||
rebuild_signal_panels(a);
|
||||
}
|
||||
int row_opens = -1;
|
||||
for (GtkWidget* r = gtk_widget_get_first_child(a.signal_list); r != nullptr; r = gtk_widget_get_next_sibling(r)) {
|
||||
if (GPOINTER_TO_SIZE(g_object_get_data(G_OBJECT(r), "udpscope-signal")) == index && GTK_IS_LIST_BOX_ROW(r)) {
|
||||
@@ -391,6 +378,11 @@ gboolean signal_page_probe(gpointer user) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (was_enabled) {
|
||||
slideover_close(a);
|
||||
a.model->set_signal_enabled(index, true);
|
||||
rebuild_signal_panels(a);
|
||||
}
|
||||
|
||||
// Pruning: a math channel's page, open, then the channel deleted; the sync must close the panel and drop
|
||||
// the page. Left at -1 when no channel can be added (nothing acquired to build it from).
|
||||
@@ -447,10 +439,10 @@ gboolean signal_page_probe(gpointer user) {
|
||||
}
|
||||
std::fprintf(stderr,
|
||||
"[signalpage] name=%s open=%d pages=%d enable_visible=%d plot_buttons=%d plot_on_row0=%d "
|
||||
"plot_on_row0_disabled=%d locked_enable_sensitive=%d "
|
||||
"plot_on_row0_disabled=%d "
|
||||
"removed=%d btn_row0=%d back_to_list=%d row_opens=%d pruned=%d other_page_kept=%d rows=%d\n",
|
||||
name.c_str(), open, pages, enable_visible, plot_buttons, plot_on_row0, plot_on_row0_disabled,
|
||||
locked_enable_sensitive, removed, btn_row0, back_to_list, row_opens, pruned,
|
||||
removed, btn_row0, back_to_list, row_opens, pruned,
|
||||
other_page_kept, a.rows->row_count());
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user