]> sigrok.org Git - pulseview.git/commitdiff
TimeItem: Added mandatory set_time virtual method
authorJoel Holdsworth <redacted>
Mon, 8 Dec 2014 22:36:54 +0000 (22:36 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:16 +0000 (18:06 +0100)
pv/view/cursorpair.cpp
pv/view/cursorpair.hpp
pv/view/timeitem.hpp

index 8a0ecbf20b14c618ed587645f90b91a24cd69805..48109db8f92c9bac2e97240a37d7629d42b51b18 100644 (file)
@@ -59,6 +59,12 @@ shared_ptr<Cursor> CursorPair::second() const
        return second_;
 }
 
+void CursorPair::set_time(double time) {
+       const double delta = second_->time() - first_->time();
+       first_->set_time(time);
+       second_->set_time(time + delta);
+}
+
 QPoint CursorPair::point() const
 {
        return first_->point();
index 78780916504cda37434c641b9c0da6c001745a46..2c4d5c1c70be67a37a176b38fa41e21811a8a24c 100644 (file)
@@ -60,6 +60,11 @@ public:
         */
        std::shared_ptr<Cursor> second() const;
 
+       /**
+        * Sets the time of the marker.
+        */
+       void set_time(double time);
+
        QPoint point() const;
 
        pv::widgets::Popup* create_popup(QWidget *parent);
index e47f1a6bf1564e39425728e35872733d7e592215..eb313a7ec6825d379d011c1ec12a358cf8b86254 100644 (file)
@@ -39,6 +39,12 @@ protected:
         */
        TimeItem(View &view);
 
+public:
+       /**
+        * Sets the time of the marker.
+        */
+       virtual void set_time(double time) = 0;
+
 protected:
        View &view_;
 };