diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-07-04 12:44:42 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-07-04 12:45:53 -0400 |
commit | 57ee61772b6c44e7731619c5c74e45bb860ac4aa (patch) | |
tree | bd517f71f0709195b0ad4b8f3179a661cc060a12 /libs | |
parent | 5c32fc3babdd3ed7d715b6aeb24a72f3a0f550a0 (diff) |
add session-scope selection ops for Stripables
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/presentation_info.cc | 1 | ||||
-rw-r--r-- | libs/ardour/session.cc | 52 |
3 files changed, 57 insertions, 0 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 6c3d869013..61c575e0b2 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -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); diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc index fe094dae6b..7115539178 100644 --- a/libs/ardour/presentation_info.cc +++ b/libs/ardour/presentation_info.cc @@ -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 { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2218ef5810..94051b0f9d 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -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 */ + } +} |