feat: switching a signal off takes its traces off every plot
The switch in the signal list means "do not acquire this", and until now a trace of it
stayed on its plot drawing nothing: a slot that holds one of the four a plot has, reads
`--`, and blocks the drop that would fill it with something live.
`on_signal_switch()` now clears every slot that holds that signal, by the **signal name**
the slot remembers -- never the channel index, which is what the enable change renumbers --
and says what it did: `'sine' is off: 1 trace left the plots`. The follow-ups (a relayout,
the panels' chips, the layout save) happen once rather than per slot.
Re-enabling deliberately does not put the traces back: the arrangement is the user's, and
guessing where they were is worse than leaving them off. Say the word if you want that
direction too.
[enable-all-probe] reads it end to end -- it enables every signal, assigns the channels
across the rows, then switches one off *through its own acquire tick*:
[enable-all-probe] switched 'sine' off: traces_left=0 (want 0) notice=''sine' is off: 1 trace left the plots'
which is also why the notice shares the status line's warning styling from the previous
commit: the trace leaving the plots is something the user should see happen.
This commit is contained in:
1 parent
aaf544be1e
commit
8b3240cacb
6 files changed
+102
-1
No files matched your search
+21
@@ -2534,6 +2534,27 @@ void remove_trace(App& app, int row, int slot) {
|
||||
app.rows->assign(row, slot, std::string(), std::string(), 0);
|
||||
}
|
||||
|
||||
/// Takes a signal off every plot, and says how many traces went.
|
||||
///
|
||||
/// Switching a signal off means "do not acquire this", so a trace of it left on a plot draws nothing: a slot
|
||||
/// that reads `--`, takes the place a live signal could have had, and blocks the drop that would fill it. The
|
||||
/// slot is what is cleared, and the caller does the follow-ups once (a relayout, the panels, the layout save)
|
||||
/// rather than per slot.
|
||||
int remove_signal_from_plots(App& app, const std::string& name) {
|
||||
if (name.empty()) return 0;
|
||||
int removed = 0;
|
||||
for (int row = 0; row < app.rows->row_count(); ++row) {
|
||||
for (int slot = 0; slot < RowSet::kSlotsPerRow; ++slot) {
|
||||
// The slot remembers the *signal* (and its element), never the channel index -- the channel list is
|
||||
// renumbered on every enable change, which is what this is reacting to.
|
||||
if (app.rows->row(row).signal_name[static_cast<std::size_t>(slot)] != name) continue;
|
||||
remove_trace(app, row, slot);
|
||||
++removed;
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
void on_remove_clicked(GtkButton* button, gpointer user) {
|
||||
(void)user;
|
||||
auto* target = static_cast<RemoveTarget*>(g_object_get_data(G_OBJECT(button), "udpscope-remove"));
|
||||
|
||||
Reference in new issue
Block a user