From: Joel Holdsworth Date: Sat, 6 Dec 2014 23:14:51 +0000 (+0000) Subject: View: Added time_markers X-Git-Tag: pulseview-0.3.0~384 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2496bf451ebd50b9ab67a1af9b979761c0fbad49;p=pulseview.git View: Added time_markers --- diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp index 3e2944e0..1a656eb1 100644 --- a/pv/view/cursorheader.cpp +++ b/pv/view/cursorheader.cpp @@ -30,6 +30,7 @@ #include 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 > items(view_.time_items()); + for (auto &i : items) + i->select(false); update(); } diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 03848478..28408eee 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -195,6 +195,14 @@ const Viewport* View::viewport() const return viewport_; } +vector< shared_ptr > View::time_items() const +{ + vector< shared_ptr > items; + items.push_back(cursors_.first()); + items.push_back(cursors_.second()); + return items; +} + double View::scale() const { return scale_; diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 4561cec6..a23f2848 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -90,6 +90,11 @@ public: const Viewport* viewport() const; + /** + * Gets a list of time markers. + */ + std::vector< std::shared_ptr > time_items() const; + /** * Returns the view time scale in seconds per pixel. */