From eb3f50e15c9f9ed1880c59fecd6f8b3edcc05820 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 May 2017 14:51:31 +0100 Subject: 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. --- libs/surfaces/push2/push2.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'libs/surfaces/push2/push2.cc') diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index 30b521686c..00c7ef43d2 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -107,8 +107,6 @@ Push2::Push2 (ARDOUR::Session& s) /* master cannot be removed, so no need to connect to going-away signal */ master = session->master_out (); - ControlProtocol::StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&Push2::stripable_selection_change, this, _1), this); - /* allocate graphics layouts, even though we're not using them yet */ _canvas = new Push2Canvas (*this, 960, 160); @@ -138,7 +136,6 @@ Push2::~Push2 () DEBUG_TRACE (DEBUG::Push2, "push2 control surface object being destroyed\n"); /* do this before stopping the event loop, so that we don't get any notifications */ - selection_connection.disconnect (); port_reg_connection.disconnect (); port_connection.disconnect (); @@ -200,10 +197,7 @@ Push2::begin_using_device () splash (); /* catch current selection, if any so that we can wire up the pads if appropriate */ - { - StripableNotificationListPtr sp (new StripableNotificationList (ControlProtocol::last_selected())); - stripable_selection_change (sp); - } + stripable_selection_changed (); request_pressure_mode (); @@ -1525,15 +1519,16 @@ Push2::current_layout () const } void -Push2::stripable_selection_change (StripableNotificationListPtr selected) +Push2::stripable_selection_changed () { boost::shared_ptr pad_port = boost::dynamic_pointer_cast(_async_in)->shadow_port(); boost::shared_ptr current_midi_track = current_pad_target.lock(); boost::shared_ptr new_pad_target; + StripableNotificationList const & selected (last_selected()); /* See if there's a MIDI track selected */ - for (StripableNotificationList::iterator si = selected->begin(); si != selected->end(); ++si) { + for (StripableNotificationList::const_iterator si = selected.begin(); si != selected.end(); ++si) { new_pad_target = boost::dynamic_pointer_cast ((*si).lock()); @@ -1582,6 +1577,10 @@ Push2::stripable_selection_change (StripableNotificationListPtr selected) } reset_pad_colors (); + + TrackMixLayout* tml = dynamic_cast (mix_layout); + assert (tml); + tml->set_stripable (first_selected_stripable()); } Push2::Button* -- cgit v1.2.3