From: Joel Holdsworth Date: Wed, 15 May 2013 16:30:16 +0000 (+0100) Subject: Added View::selected_items X-Git-Tag: pulseview-0.2.0~344 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=949361337a82aa8765d72d8d475a79ace956945c;p=pulseview.git Added View::selected_items --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index eca6b8ea..ca575bec 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -159,6 +159,27 @@ void View::set_scale_offset(double scale, double offset) _viewport->update(); } +list > View::selected_items() const +{ + list > items; + + // List the selected signals + const vector< shared_ptr > sigs(_session.get_signals()); + BOOST_FOREACH (shared_ptr s, sigs) { + assert(s); + if (s->selected()) + items.push_back(s); + } + + // List the selected cursors + if (_cursors.first()->selected()) + items.push_back(_cursors.first()); + if (_cursors.second()->selected()) + items.push_back(_cursors.second()); + + return items; +} + bool View::cursors_shown() const { return _show_cursors; diff --git a/pv/view/view.h b/pv/view/view.h index 155c875b..99c12473 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -86,6 +88,8 @@ public: */ void set_scale_offset(double scale, double offset); + std::list > selected_items() const; + /** * Returns true if cursors are displayed. false otherwise. */