diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-05-12 14:51:31 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-05-12 14:51:39 +0100 |
commit | eb3f50e15c9f9ed1880c59fecd6f8b3edcc05820 (patch) | |
tree | 5acd3346a7a7d63f0f8d1375f60979ecb4579a1f /libs/surfaces/control_protocol | |
parent | efc2660fec0d01c4c47d3fffcc5443025b33afc0 (diff) |
change the way ControlProtocols (control surfaces) are notified and handle Stripable selection changes
The Editor continues to notify them, but via a direct call to ControlProtocolManager, not a signal.
The CP Manager calls the ControlProtocol static method to set up static data structures holding
selection info for all surfaces and then notifies each surface/protocol that selection has changed.
Diffstat (limited to 'libs/surfaces/control_protocol')
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol.cc | 12 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/control_protocol.h | 14 |
2 files changed, 4 insertions, 22 deletions
diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index edcc06b23a..c2589d24e3 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -56,14 +56,10 @@ PBD::Signal1<void,boost::shared_ptr<ARDOUR::Stripable> > ControlProtocol::Toggle PBD::Signal1<void,boost::shared_ptr<ARDOUR::Stripable> > ControlProtocol::RemoveStripableFromSelection; PBD::Signal0<void> ControlProtocol::ClearStripableSelection; -PBD::Signal1<void,StripableNotificationListPtr> ControlProtocol::StripableSelectionChanged; - Glib::Threads::Mutex ControlProtocol::special_stripable_mutex; boost::weak_ptr<Stripable> ControlProtocol::_first_selected_stripable; boost::weak_ptr<Stripable> ControlProtocol::_leftmost_mixer_stripable; StripableNotificationList ControlProtocol::_last_selected; -bool ControlProtocol::selection_connected = false; -PBD::ScopedConnection ControlProtocol::selection_connection; const std::string ControlProtocol::state_node_name ("Protocol"); @@ -72,12 +68,6 @@ ControlProtocol::ControlProtocol (Session& s, string str) , _name (str) , _active (false) { - if (!selection_connected) { - /* this is all static, connect it only once (and early), for all ControlProtocols */ - - StripableSelectionChanged.connect_same_thread (selection_connection, boost::bind (&ControlProtocol::stripable_selection_changed, _1)); - selection_connected = true; - } } ControlProtocol::~ControlProtocol () @@ -374,7 +364,7 @@ ControlProtocol::set_first_selected_stripable (boost::shared_ptr<Stripable> s) } void -ControlProtocol::stripable_selection_changed (StripableNotificationListPtr sp) +ControlProtocol::notify_stripable_selection_changed (StripableNotificationListPtr sp) { bool had_selection = !_last_selected.empty(); diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 987a8bcac4..ff5cd314fa 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -57,6 +57,8 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope virtual void midi_connectivity_established () {} + virtual void stripable_selection_changed () = 0; + PBD::Signal0<void> ActiveChanged; /* signals that a control protocol can emit and other (presumably graphical) @@ -85,13 +87,6 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope static PBD::Signal1<void,boost::shared_ptr<ARDOUR::Stripable> > RemoveStripableFromSelection; static PBD::Signal0<void> ClearStripableSelection; - /* signals that one UI (e.g. the GUI) can emit to get all other UI's to - respond. Typically this will always be GUI->"others" - the GUI pays - no attention to these signals. - */ - - static PBD::Signal1<void,StripableNotificationListPtr> StripableSelectionChanged; - static boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable (); static void set_first_selected_stripable (boost::shared_ptr<ARDOUR::Stripable>); @@ -146,6 +141,7 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope static const std::string state_node_name; static StripableNotificationList const & last_selected() { return _last_selected; } + static void notify_stripable_selection_changed (StripableNotificationListPtr); protected: std::vector<boost::shared_ptr<ARDOUR::Route> > route_table; @@ -158,14 +154,10 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope LIBCONTROLCP_LOCAL ControlProtocol (const ControlProtocol&); /* noncopyable */ bool _active; - static Glib::Threads::Mutex special_stripable_mutex; static boost::weak_ptr<ARDOUR::Stripable> _leftmost_mixer_stripable; static boost::weak_ptr<ARDOUR::Stripable> _first_selected_stripable; static StripableNotificationList _last_selected; - static void stripable_selection_changed (StripableNotificationListPtr); - static bool selection_connected; - static PBD::ScopedConnection selection_connection; }; extern "C" { |