fixed event/live transition

This commit is contained in:
Martino Ferrari committed 2026-10-13 23:37:49 +02:00
1 parent bb99be5889
commit 881b52748e
9 files changed
+314 -2

No files matched your search

+36
View File
@@ -452,6 +452,30 @@ struct App {
std::vector<EventRecord> group;
/// True while a stored event is on screen instead of the live stream.
bool replaying = false;
/// What the live view was set to when a file view was opened over it, so that *Go live* can put it
/// back. A file view overwrites all of it and for good reasons -- the window is pinned to the
/// event's own span because that is what framing an event means, and the trigger goes off because a
/// file has no edge to wait for -- but none of those reasons survive the return to the stream, and
/// what the user set is theirs. Taken on the way *in*, and only when the view being left is the live
/// one, so a replay opened from inside a group does not snapshot the group's settings as "live".
///
/// The trigger's channel is kept by **name**: the index is a position in a channel list that a file
/// view rebuilds (a group renames its channels outright), so putting the index back would select a
/// different signal, or none.
struct LiveState {
bool valid = false;
double window_s = 0.0;
bool trigger_on = false;
TriggerConfig trigger;
std::string trigger_channel;
bool level_touched = false;
};
LiveState live_state;
/// Set by *Go live*, cleared by the tick that performs the restore, with the model generation it
/// has to see move first -- the stream's own channel list is what the stored trigger channel is
/// resolved against.
bool live_restore_pending = false;
unsigned live_restore_generation = 0;
/// Set when a latch frames a new snapshot, consumed at the *end* of that tick: the record needs the
/// rows bound to the event (for the thumbnail) and the bind happens after the display decision.
bool record_pending = false;
@@ -749,6 +773,16 @@ struct App {
/// position and their comparison selection.
GtkListBoxRow* dbg_events_row0 = nullptr;
int dbg_events_selected = 0;
/// What the *live* view was set to just before the probe opened an event: the time window, the
/// trigger's mode, its channel (by name, the only stable identity) and its level. Read back after
/// each way out of a file view, because a file view overwrites all four -- the window is pinned to
/// the event's own span and the trigger is switched off, since a file has no edge to wait for --
/// and going live has to put them back. The probe keeps its own expectation rather than asking
/// `App`: a reading taken from the mechanism under test asserts nothing.
double dbg_live_window = 0.0;
bool dbg_live_trigger_on = false;
std::string dbg_live_trigger_channel;
double dbg_live_level = 0.0;
/// Which step of the plot-context-menu probe runs next (`UDPSCOPE_PROBE_ROWMENU_MS`), and the
/// popover it is measuring.
int dbg_rowmenu_step = 0;
@@ -1335,6 +1369,8 @@ void update_capture_row(App& app);
bool record_event(App& app);
bool replay_event(App& app, const EventRecord& record);
bool go_live_again(App& app);
void snapshot_live_state(App& app);
void restore_live_state(App& app);
bool read_event_samples(const std::string& path, EventSamples* out, std::string* error);
std::vector<EventRecord> selected_events(App& app);
void update_group_buttons(App& app);