]> sigrok.org Git - pulseview.git/commitdiff
View: Added time_markers
authorJoel Holdsworth <redacted>
Sat, 6 Dec 2014 23:14:51 +0000 (23:14 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:15 +0000 (18:06 +0100)
pv/view/cursorheader.cpp
pv/view/view.cpp
pv/view/view.hpp

index 3e2944e09269304a823db91b49fe6ecaef06f2da..1a656eb19f5edac14b7595c7db6569fa45de0822 100644 (file)
@@ -30,6 +30,7 @@
 #include <pv/widgets/popup.hpp>
 
 using std::shared_ptr;
+using std::vector;
 
 namespace pv {
 namespace view {
@@ -59,9 +60,9 @@ QSize CursorHeader::sizeHint() const
 
 void CursorHeader::clear_selection()
 {
-       CursorPair &cursors = view_.cursors();
-       cursors.first()->select(false);
-       cursors.second()->select(false);
+       const vector< shared_ptr<TimeItem> > items(view_.time_items());
+       for (auto &i : items)
+               i->select(false);
        update();
 }
 
index 03848478b2a8742bcc67e67baca2c46e35064a14..28408eee39db4723497d906ae8a21b02e901427d 100644 (file)
@@ -195,6 +195,14 @@ const Viewport* View::viewport() const
        return viewport_;
 }
 
+vector< shared_ptr<TimeItem> > View::time_items() const
+{
+       vector< shared_ptr<TimeItem> > items;
+       items.push_back(cursors_.first());
+       items.push_back(cursors_.second());
+       return items;
+}
+
 double View::scale() const
 {
        return scale_;
index 4561cec661f95c546dd979129460f2b089d74249..a23f284825d17534b6edcf11df3a2e302610d661 100644 (file)
@@ -90,6 +90,11 @@ public:
 
        const Viewport* viewport() const;
 
+       /**
+        * Gets a list of time markers.
+        */
+       std::vector< std::shared_ptr<TimeItem> > time_items() const;
+
        /**
         * Returns the view time scale in seconds per pixel.
         */