+void LogicSignal::modify_trigger()
+{
+ auto trigger = _session.session()->trigger();
+ auto new_trigger = _session.device_manager().context()->create_trigger("pulseview");
+
+ if (trigger) {
+ for (auto stage : trigger->stages()) {
+ const auto &matches = stage->matches();
+ if (std::none_of(begin(matches), end(matches),
+ [&](shared_ptr<TriggerMatch> match) {
+ return match->channel() != _channel; }))
+ continue;
+
+ auto new_stage = new_trigger->add_stage();
+ for (auto match : stage->matches()) {
+ if (match->channel() == _channel)
+ continue;
+ new_stage->add_match(match->channel(), match->type());
+ }
+ }
+ }
+
+ if (_trigger_match)
+ new_trigger->add_stage()->add_match(_channel, _trigger_match);
+
+ _session.session()->set_trigger(
+ new_trigger->stages().empty() ? nullptr : new_trigger);
+}
+