]> sigrok.org Git - pulseview.git/commitdiff
Use the TriggerMarker class to visualize the time of SR_DF_TRIGGER.
authorTilman Sauerbeck <redacted>
Sat, 7 Nov 2015 10:40:02 +0000 (11:40 +0100)
committerTilman Sauerbeck <redacted>
Sun, 8 Nov 2015 17:23:41 +0000 (18:23 +0100)
This allows us to remove the name-based immovable hack from Flag.
Note that this also means that the trigger marker no longer has
a name at all.

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

index 380ef3273091b1f4d8d29f1bc68a5dd296e581da..779ea2eec24cd8d5088b2675f9ede6978c682ba1 100644 (file)
@@ -108,15 +108,5 @@ void Flag::on_text_changed(const QString &text)
        view_.time_item_appearance_changed(true, false);
 }
 
-void Flag::drag_by(const QPoint &delta)
-{
-       // Treat trigger markers as immovable
-       if (text_ == "T")
-               return;
-
-       TimeMarker::drag_by(delta);
-}
-
-
 } // namespace view
 } // namespace pv
index af4c7b9d15012ee89e691dfee9eeea13c1c20c90..bc82934e161e5829d5d025f515931c5817a60268 100644 (file)
@@ -68,8 +68,6 @@ public:
 
        void delete_pressed();
 
-       void drag_by(const QPoint &delta);
-
 private Q_SLOTS:
        void on_delete();
 
index 7f9caa4cb50e69fb63f50e621d5dad01adbebc99..15dd05812637d054287b605fc919374e7c150edd 100644 (file)
@@ -48,6 +48,7 @@
 #include "ruler.hpp"
 #include "signal.hpp"
 #include "tracegroup.hpp"
+#include "triggermarker.hpp"
 #include "view.hpp"
 #include "viewport.hpp"
 
@@ -114,6 +115,7 @@ View::View(Session &session, QWidget *parent) :
        show_cursors_(false),
        cursors_(new CursorPair(*this)),
        next_flag_text_('A'),
+       trigger_marker_(nullptr),
        hover_point_(-1, -1)
 {
        connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
@@ -207,6 +209,10 @@ vector< shared_ptr<TimeItem> > View::time_items() const
        items.push_back(cursors_);
        items.push_back(cursors_->first());
        items.push_back(cursors_->second());
+
+       if (trigger_marker_)
+               items.push_back(trigger_marker_);
+
        return items;
 }
 
@@ -466,10 +472,6 @@ void View::add_flag(const Timestamp& time)
        next_flag_text_ = (next_flag_text_ >= 'Z') ? 'A' :
                (next_flag_text_ + 1);
 
-       // Skip 'T' (for trigger) as it's treated special
-       if (next_flag_text_ == 'T')
-               next_flag_text_ += 1;
-
        time_item_appearance_changed(true, true);
 }
 
@@ -526,12 +528,10 @@ void View::restack_all_trace_tree_items()
 
 void View::trigger_event(util::Timestamp location)
 {
-       char next_flag_text = next_flag_text_;
-
-       next_flag_text_ = 'T';
-       add_flag(location);
-
-       next_flag_text_ = next_flag_text;
+       if (trigger_marker_)
+               trigger_marker_->set_time(location);
+       else
+               trigger_marker_ = std::shared_ptr<TriggerMarker>(new TriggerMarker(*this, location));
 }
 
 void View::get_scroll_layout(double &length, Timestamp &offset) const
index 9bb42ef14ea6e239500482698c81f95994c94cc9..b64c09d2c019ab00ee3c56b0a8ef0732b1af2c92 100644 (file)
@@ -55,6 +55,7 @@ class Header;
 class Ruler;
 class Trace;
 class Viewport;
+class TriggerMarker;
 
 class View : public QAbstractScrollArea, public TraceTreeItemOwner {
        Q_OBJECT
@@ -383,6 +384,8 @@ private:
        std::list< std::shared_ptr<Flag> > flags_;
        char next_flag_text_;
 
+       std::shared_ptr<TriggerMarker> trigger_marker_;
+
        QPoint hover_point_;
 
        unsigned int sticky_events_;