add session-scope selection ops for Stripables
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 4 Jul 2016 16:44:42 +0000 (12:44 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 4 Jul 2016 16:45:53 +0000 (12:45 -0400)
libs/ardour/ardour/session.h
libs/ardour/presentation_info.cc
libs/ardour/session.cc

index 6c3d869013a0cabf8aa457af44835a5f96cf86e3..61c575e0b22fa85b1533840a3decb837dcd95653 100644 (file)
@@ -302,6 +302,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        };
 
        void notify_presentation_info_change ();
+       void clear_stripable_selection ();
+       void toggle_stripable_selection (boost::shared_ptr<Stripable>);
+       void add_stripable_selection (boost::shared_ptr<Stripable>);
+       void set_stripable_selection (boost::shared_ptr<Stripable>);
 
        template<class T> void foreach_route (T *obj, void (T::*func)(Route&), bool sort = true);
        template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>), bool sort = true);
index fe094dae6bb667d5a41311b2d690fe2d9a66cb4a..7115539178a3ba48e26a09503465f5be1799d163 100644 (file)
@@ -38,6 +38,7 @@ using std::string;
 
 string PresentationInfo::state_node_name = X_("PresentationInfo");
 PBD::Signal0<void> PresentationInfo::Change;
+PBD::Signal0<void> PresentationInfo::SelectionChange;
 
 namespace ARDOUR {
        namespace Properties {
index 2218ef5810e8904a430b78db0122692d08cdd358..94051b0f9deaf04777d261d0541256df22083c52 100644 (file)
@@ -7004,3 +7004,55 @@ Session::auto_connect_thread_run ()
        }
        pthread_mutex_unlock (&_auto_connect_mutex);
 }
+
+void
+Session::clear_stripable_selection ()
+{
+       StripableList sl;
+       get_stripables (sl);
+
+       for (StripableList::iterator si = sl.begin(); si != sl.end(); ++si) {
+               (*si)->presentation_info().set_selected (false);
+       }
+
+}
+
+void
+Session::toggle_stripable_selection (boost::shared_ptr<Stripable> s)
+{
+       s->presentation_info().set_selected (!s->presentation_info().selected());
+}
+
+void
+Session::add_stripable_selection (boost::shared_ptr<Stripable> s)
+{
+       if (!s->presentation_info().selected ()) {
+               s->presentation_info().set_selected (true);
+       }
+}
+
+void
+Session::set_stripable_selection (boost::shared_ptr<Stripable> s)
+{
+       StripableList sl;
+       bool change = false;
+
+       get_stripables (sl);
+
+       for (StripableList::iterator si = sl.begin(); si != sl.end(); ++si) {
+               if ((*si)->presentation_info().selected()) {
+                       change = true;
+               }
+
+               (*si)->presentation_info().set_selected (false);
+       }
+
+       if (!s->presentation_info().selected()) {
+               change = true;
+               s->presentation_info().set_selected (true);
+       }
+
+       if (change) {
+               // PresentationInfo::SelectionChange (); /* EMIT SIGNAL */
+       }
+}