ui: compact cursor and measurement readouts at the top of the dock
Both views are written from the same variable at the same call site, so the dock cannot disagree with the full panels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a7a1609d48
commit
a0fc0762d5
7 files changed
+350
-22
No files matched your search
+23
-16
@@ -1353,6 +1353,22 @@ bool visible_samples(App& app, std::size_t channel, std::vector<double>& time,
|
||||
|
||||
|
||||
|
||||
/// The chip of a measurement's signal, in the colour every other view names that signal with (the row and
|
||||
/// the dock's line both). The signal list is the producer's to rebuild, so it is read under the mutex.
|
||||
std::string measure_chip_markup(App& app, const std::string& signal) {
|
||||
std::lock_guard<std::mutex> lock(app.model->mutex());
|
||||
const std::vector<SignalInfo>& signals = app.model->signals();
|
||||
int color_index = -1;
|
||||
for (std::size_t i = 0; i < signals.size(); ++i) {
|
||||
if (signals[i].name == signal) {
|
||||
color_index = signal_color_index(signals, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return chip_markup(color_index >= 0 ? app.rows->signal_color(signal, color_index)
|
||||
: RowSet::unplotted_color());
|
||||
}
|
||||
|
||||
/// How often the measurements pane is recomputed while the window is still moving: a readout,
|
||||
/// where the honest currency is the window's own settling, not the frame rate. Ten a second is
|
||||
/// past the point a number can be read, and it makes the cost independent of the framerate.
|
||||
@@ -1380,22 +1396,7 @@ GtkWidget* measures_row(App& app, std::size_t index, const Measure& m) {
|
||||
// The signal's own chip beside it, in the palette colour every other view names that signal
|
||||
// with, so the row says *what* is being measured as well as by which measurement.
|
||||
GtkWidget* sig_chip = gtk_label_new("");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(app.model->mutex());
|
||||
const std::vector<SignalInfo>& signals = app.model->signals();
|
||||
int color_index = -1;
|
||||
for (std::size_t i = 0; i < signals.size(); ++i) {
|
||||
if (signals[i].name == m.signal) {
|
||||
color_index = signal_color_index(signals, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtk_label_set_markup(GTK_LABEL(sig_chip),
|
||||
chip_markup(color_index >= 0
|
||||
? app.rows->signal_color(m.signal, color_index)
|
||||
: RowSet::unplotted_color())
|
||||
.c_str());
|
||||
}
|
||||
gtk_label_set_markup(GTK_LABEL(sig_chip), measure_chip_markup(app, m.signal).c_str());
|
||||
gtk_widget_set_tooltip_text(sig_chip, m.signal.c_str());
|
||||
gtk_box_append(GTK_BOX(box), sig_chip);
|
||||
GtkWidget* kind = gtk_label_new(measure_type_name(m.type));
|
||||
@@ -1618,6 +1619,7 @@ void rebuild_cursors_pane(App& app) {
|
||||
}
|
||||
}
|
||||
}
|
||||
dock_rebuild_cursors(app);
|
||||
}
|
||||
|
||||
|
||||
@@ -5161,12 +5163,17 @@ void on_activate(GtkApplication* application, gpointer user) {
|
||||
gtk_box_append(GTK_BOX(app->dock_page), app->cursors_panel);
|
||||
gtk_box_append(GTK_BOX(app->dock_page), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
|
||||
gtk_box_append(GTK_BOX(app->dock_page), measures_panel);
|
||||
// The compact readouts above the full panels (which move to slide-over pages later), with their own
|
||||
// separator: the first child of the dock.
|
||||
gtk_box_prepend(GTK_BOX(app->dock_page), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
|
||||
gtk_box_prepend(GTK_BOX(app->dock_page), build_readouts_dock(*app));
|
||||
|
||||
// The cursors start off, so their readout starts insensitive -- stated here by the one place that
|
||||
// knows the default, and the *body* and not the panel, because the panel's heading carries the
|
||||
// switch that turns it back on. The trigger's body is deliberately *not* disabled: a trigger is
|
||||
// configured before it is switched on, so its settings have to stay editable while it is off.
|
||||
gtk_widget_set_sensitive(app->cursors_body, FALSE);
|
||||
gtk_widget_set_sensitive(app->dock_cursor_grid, FALSE);
|
||||
// The arm controls are the one part of the trigger pane that needs trigger mode running: both of them,
|
||||
// and the compact line's visibility, are stated from the toggle by `sync_arm_buttons()`.
|
||||
sync_arm_buttons(*app);
|
||||
|
||||
Reference in new issue
Block a user