]> sigrok.org Git - pulseview.git/commitdiff
View: support multiple trigger markers in one acquisition.
authorTilman Sauerbeck <redacted>
Sun, 8 Nov 2015 20:30:13 +0000 (21:30 +0100)
committerTilman Sauerbeck <redacted>
Mon, 9 Nov 2015 17:26:47 +0000 (18:26 +0100)
Remove the previous acquisition's markers when a new acquisition
is started, and add a new one everytime we receive the SR_DF_TRIGGER
packet.

pv/view/view.cpp
pv/view/view.hpp

index 15dd05812637d054287b605fc919374e7c150edd..6a342915972312b96e29e731fd75fed59191df6e 100644 (file)
@@ -115,7 +115,7 @@ View::View(Session &session, QWidget *parent) :
        show_cursors_(false),
        cursors_(new CursorPair(*this)),
        next_flag_text_('A'),
-       trigger_marker_(nullptr),
+       trigger_markers_(),
        hover_point_(-1, -1)
 {
        connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
@@ -210,8 +210,8 @@ vector< shared_ptr<TimeItem> > View::time_items() const
        items.push_back(cursors_->first());
        items.push_back(cursors_->second());
 
-       if (trigger_marker_)
-               items.push_back(trigger_marker_);
+       for (auto trigger_marker : trigger_markers_)
+               items.push_back(trigger_marker);
 
        return items;
 }
@@ -528,10 +528,8 @@ void View::restack_all_trace_tree_items()
 
 void View::trigger_event(util::Timestamp location)
 {
-       if (trigger_marker_)
-               trigger_marker_->set_time(location);
-       else
-               trigger_marker_ = std::shared_ptr<TriggerMarker>(new TriggerMarker(*this, location));
+       trigger_markers_.push_back(shared_ptr<TriggerMarker>(
+               new TriggerMarker(*this, location)));
 }
 
 void View::get_scroll_layout(double &length, Timestamp &offset) const
@@ -1021,9 +1019,12 @@ void View::signals_changed()
 
 void View::capture_state_updated(int state)
 {
-       if (state == Session::Running)
+       if (state == Session::Running) {
                set_time_unit(util::TimeUnit::Samples);
 
+               trigger_markers_.clear();
+       }
+
        if (state == Session::Stopped) {
                // After acquisition has stopped we need to re-calculate the ticks once
                // as it's otherwise done when the user pans or zooms, which is too late
index b64c09d2c019ab00ee3c56b0a8ef0732b1af2c92..66d31a225bf7b28806da3b28e87465ce5349daa7 100644 (file)
@@ -384,7 +384,7 @@ private:
        std::list< std::shared_ptr<Flag> > flags_;
        char next_flag_text_;
 
-       std::shared_ptr<TriggerMarker> trigger_marker_;
+       std::vector< std::shared_ptr<TriggerMarker> > trigger_markers_;
 
        QPoint hover_point_;