ui: the readouts strip hides when there are no cursors or measurements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
61d0925144
commit
5653a3a66b
5 files changed
+63
-25
No files matched your search
+26
-6
@@ -4339,9 +4339,10 @@ static int dock_width_fits(App& a, int* dock_w, int* side_w) {
|
||||
|
||||
/// The readouts strip against the dock it mirrors: `same_text=1` when every strip label's text equals the
|
||||
/// dock's (the cursors' `who` and delta cells, the measurements' values) and the counts agree. The strip is
|
||||
/// shown whenever the dock is not beside the plot, so `expected` is `!dock_shown || collapsed` (`dock_shown`
|
||||
/// is `show-sidebar`, `collapsed` the split view's, both read in the same frame as `visible`), `visible_ok`
|
||||
/// is `visible == expected`, and `h` is the strip's fixed 26 whenever it is visible.
|
||||
/// shown whenever the dock is not beside the plot and there is something to read, so `expected` is
|
||||
/// `(!dock_shown || collapsed) && (cursors on || a measurement)` (`dock_shown` is `show-sidebar`, `collapsed`
|
||||
/// the split view's, both read in the same frame as `visible`), `visible_ok` is `visible == expected`, and
|
||||
/// `h` is the strip's fixed 26 whenever it is visible.
|
||||
/// `sens_same` is the strip's cursor chips sharing the dock grid's sensitivity.
|
||||
static void strip_report(App& a, const char* tag, const char* what) {
|
||||
const auto text = [](GtkWidget* w) { return std::string(gtk_label_get_text(GTK_LABEL(w))); };
|
||||
@@ -4365,19 +4366,35 @@ static void strip_report(App& a, const char* tag, const char* what) {
|
||||
const bool collapsed =
|
||||
a.side_view != nullptr &&
|
||||
adw_overlay_split_view_get_collapsed(ADW_OVERLAY_SPLIT_VIEW(a.side_view)) != FALSE;
|
||||
const bool expected = !dock_shown || collapsed;
|
||||
// And with something to read: the cursors on, or a measurement (`sync_readouts_strip()`).
|
||||
const bool has_content =
|
||||
(a.cursors_toggle != nullptr &&
|
||||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(a.cursors_toggle))) ||
|
||||
!a.measures.empty();
|
||||
const bool expected = (!dock_shown || collapsed) && has_content;
|
||||
const bool sens_same =
|
||||
a.strip_cursor_box != nullptr && a.dock_cursor_grid != nullptr &&
|
||||
gtk_widget_get_sensitive(a.strip_cursor_box) == gtk_widget_get_sensitive(a.dock_cursor_grid);
|
||||
// `groups=<cursors><measures><separator>`: which sections of the strip are shown, each against its own
|
||||
// feature (cursors on, a measurement present, both); `groups_ok=1` when all three agree.
|
||||
const bool cur_on = a.cursors_toggle != nullptr &&
|
||||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(a.cursors_toggle));
|
||||
const bool mea_on = !a.measures.empty();
|
||||
const bool g_cur = a.strip_cursor_group != nullptr && gtk_widget_get_visible(a.strip_cursor_group);
|
||||
const bool g_mea = a.strip_measure_group != nullptr && gtk_widget_get_visible(a.strip_measure_group);
|
||||
const bool g_sep = a.strip_sep != nullptr && gtk_widget_get_visible(a.strip_sep);
|
||||
const bool groups_ok = g_cur == cur_on && g_mea == mea_on && g_sep == (cur_on && mea_on);
|
||||
std::fprintf(stderr,
|
||||
"[%s-probe] %-14s strip: visible=%d expected=%d visible_ok=%d dock_shown=%d cursors=%zu "
|
||||
"measures=%zu same_text=%d h=%d sens_same=%d collapsed=%d window=%d\n",
|
||||
"measures=%zu same_text=%d h=%d sens_same=%d collapsed=%d window=%d groups=%d%d%d "
|
||||
"groups_ok=%d\n",
|
||||
tag, what, visible ? 1 : 0, expected ? 1 : 0, visible == expected ? 1 : 0,
|
||||
dock_shown ? 1 : 0, a.strip_cursor_deltas.size(),
|
||||
a.strip_measure_labels.size(), same, a.readouts_strip != nullptr
|
||||
? gtk_widget_get_height(a.readouts_strip) : -1,
|
||||
sens_same ? 1 : 0, collapsed ? 1 : 0,
|
||||
a.window != nullptr ? gtk_widget_get_width(a.window) : -1);
|
||||
a.window != nullptr ? gtk_widget_get_width(a.window) : -1,
|
||||
g_cur ? 1 : 0, g_mea ? 1 : 0, g_sep ? 1 : 0, groups_ok ? 1 : 0);
|
||||
}
|
||||
|
||||
/// Puts the dock away through the wish the tick re-asserts and reads the strip with it hidden
|
||||
@@ -4761,6 +4778,9 @@ gboolean measures_probe_step(gpointer user) {
|
||||
std::fprintf(stderr, "[measures-probe] no acquired signal to measure\n");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
// The "neither" state: no measurement yet and (from a fresh config) the cursors off, so the strip is
|
||||
// hidden -- `visible=0 expected=0 groups=000`. (The other readings need a state with something in it.)
|
||||
strip_report(*a, "measures", "start");
|
||||
for (int i = 0; i < measure_type_count(); ++i) {
|
||||
Measure m;
|
||||
m.signal = signal;
|
||||
|
||||
Reference in new issue
Block a user