ui: compact events block in the dock
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b08494dd36
commit
baf1c73b21
5 files changed
+287
-5
No files matched your search
@@ -5576,6 +5576,49 @@ void report_live_restored(App& a, const char* what) {
|
||||
std::fflush(stderr);
|
||||
}
|
||||
|
||||
/// The dock's Events block against the pane's list. `same_titles` compares each dock row's title label
|
||||
/// with the pane row's, in order (both are rebuilt from the same list by `refresh_events_pane()`, and both
|
||||
/// are marked by `mark_events_on_screen()`); `on_screen` counts the dock rows with the filled marker, and
|
||||
/// `marked` is the index of the first one (-1 for none).
|
||||
static void report_dock_events(App& a, const char* what) {
|
||||
std::vector<std::string> dock_titles;
|
||||
std::vector<std::string> pane_titles;
|
||||
int on_screen = 0;
|
||||
int marked = -1;
|
||||
int members = 0;
|
||||
const auto titles = [&members](GtkWidget* list, std::vector<std::string>* out, int* filled, int* first) {
|
||||
if (list == nullptr) return;
|
||||
int i = 0;
|
||||
for (GtkWidget* row = gtk_widget_get_first_child(list); row != nullptr;
|
||||
row = gtk_widget_get_next_sibling(row), ++i) {
|
||||
if (g_object_get_data(G_OBJECT(row), "udpscope-event") == nullptr) continue;
|
||||
GtkWidget* name = GTK_WIDGET(g_object_get_data(G_OBJECT(row), "udpscope-event-title"));
|
||||
if (name == nullptr) continue;
|
||||
out->push_back(gtk_label_get_text(GTK_LABEL(name)));
|
||||
GtkWidget* marker = GTK_WIDGET(g_object_get_data(G_OBJECT(row), "udpscope-event-marker"));
|
||||
if (filled != nullptr && marker != nullptr &&
|
||||
std::strcmp(gtk_label_get_text(GTK_LABEL(marker)), "\xE2\x97\x8B") == 0) {
|
||||
++members;
|
||||
}
|
||||
if (filled != nullptr && marker != nullptr &&
|
||||
std::strcmp(gtk_label_get_text(GTK_LABEL(marker)), "\xE2\x97\x8F") == 0) {
|
||||
++*filled;
|
||||
if (first != nullptr && *first < 0) *first = i;
|
||||
}
|
||||
}
|
||||
};
|
||||
titles(a.dock_events_list, &dock_titles, &on_screen, &marked);
|
||||
titles(a.events_list, &pane_titles, nullptr, nullptr);
|
||||
std::fprintf(stderr,
|
||||
"[events] dock events: rows=%zu pane_rows=%zu same_titles=%d sensitive=%d dock_w=%d "
|
||||
"on_screen=%d marked=%d members=%d at=%s\n",
|
||||
dock_titles.size(), pane_titles.size(), dock_titles == pane_titles ? 1 : 0,
|
||||
a.dock_events_box != nullptr && gtk_widget_is_sensitive(a.dock_events_box) ? 1 : 0,
|
||||
a.dock_events_box != nullptr ? gtk_widget_get_width(a.dock_events_box) : -1, on_screen,
|
||||
marked, members, what);
|
||||
std::fflush(stderr);
|
||||
}
|
||||
|
||||
void events_probe_next(App& a, int step, guint delay_ms) {
|
||||
a.dbg_events_step = step;
|
||||
g_timeout_add(delay_ms, events_probe_step, &a);
|
||||
@@ -5762,6 +5805,24 @@ gboolean events_probe_step(gpointer user) {
|
||||
a->events_thumb != nullptr && gtk_widget_get_mapped(a->events_thumb) ? 1 : 0,
|
||||
rows_kept ? 1 : 0, selected_now, a->dbg_events_selected);
|
||||
std::fflush(stderr);
|
||||
report_dock_events(*a, "after pane replay");
|
||||
// One click on a dock row, the gesture: a *second* event when there is one, so the marker has to
|
||||
// move. Through `row-activated`, which is what a single click emits.
|
||||
{
|
||||
GtkListBox* dock = GTK_LIST_BOX(a->dock_events_list);
|
||||
GtkListBoxRow* row = gtk_list_box_get_row_at_index(dock, 1);
|
||||
if (row == nullptr) row = gtk_list_box_get_row_at_index(dock, 0);
|
||||
const bool real = row != nullptr && g_object_get_data(G_OBJECT(row), "udpscope-event") != nullptr;
|
||||
const std::string before = a->waveform_name;
|
||||
if (real) g_signal_emit_by_name(dock, "row-activated", row);
|
||||
// Already replaying (the pane's click above), so `replaying` alone cannot tell the click from the
|
||||
// state it found: `waveform_changed` says the click opened the row's own event (1 when it was a
|
||||
// second event, 0 when there was only the one to click again).
|
||||
std::fprintf(stderr, "[events] dock replay: clicked=%d replaying=%d waveform_changed=%d\n",
|
||||
real ? 1 : 0, a->replaying ? 1 : 0, before != a->waveform_name ? 1 : 0);
|
||||
std::fflush(stderr);
|
||||
report_dock_events(*a, "after dock click");
|
||||
}
|
||||
events_probe_next(*a, 2, 1200);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -5834,6 +5895,7 @@ gboolean events_group_probe_step(gpointer user) {
|
||||
// The live settings this leg will be read against, taken *here* rather than inherited from the
|
||||
// replay leg: a group is a second, independent way into a file view, and its way back has to put
|
||||
// back what was on screen when the button was pressed.
|
||||
report_dock_events(*a, "two events latched");
|
||||
capture_live_expectation(*a);
|
||||
if (a->events_compare != nullptr) g_signal_emit_by_name(a->events_compare, "clicked");
|
||||
// Read one step later: a rebuilt row's traces are bound by the next *frame*, so a reading taken in
|
||||
@@ -5853,6 +5915,7 @@ gboolean events_group_probe_step(gpointer user) {
|
||||
group_visible_traces(*a, 0), group_visible_traces(*a, 1), a->rows->time_window(),
|
||||
a->event_recording ? 1 : 0,
|
||||
a->events_revealer != nullptr && gtk_widget_get_visible(a->events_revealer) ? 1 : 0);
|
||||
report_dock_events(*a, "comparison up");
|
||||
events_group_probe_next(*a, 46, 400);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -5985,6 +6048,17 @@ gboolean events_group_probe_step(gpointer user) {
|
||||
|
||||
if (a->dbg_events_step == 61) {
|
||||
report_live_restored(*a, "after a group");
|
||||
// A single click on the *second* dock row now that the app is live again: a different event than the
|
||||
// last (there are several by now), so the filled marker has to move to that row.
|
||||
{
|
||||
GtkListBox* dock = GTK_LIST_BOX(a->dock_events_list);
|
||||
GtkListBoxRow* row = gtk_list_box_get_row_at_index(dock, 1);
|
||||
const bool real = row != nullptr && g_object_get_data(G_OBJECT(row), "udpscope-event") != nullptr;
|
||||
if (real) g_signal_emit_by_name(dock, "row-activated", row);
|
||||
std::fprintf(stderr, "[events] dock replay: clicked=%d replaying=%d (second click, live before)\n",
|
||||
real ? 1 : 0, a->replaying ? 1 : 0);
|
||||
report_dock_events(*a, "second dock click");
|
||||
}
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user