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/push2/push2.cc | |
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/push2/push2.cc')
-rw-r--r-- | libs/surfaces/push2/push2.cc | 17 |
1 files changed, 8 insertions, 9 deletions
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<MidiPort> pad_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_async_in)->shadow_port(); boost::shared_ptr<MidiTrack> current_midi_track = current_pad_target.lock(); boost::shared_ptr<MidiTrack> 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<MidiTrack> ((*si).lock()); @@ -1582,6 +1577,10 @@ Push2::stripable_selection_change (StripableNotificationListPtr selected) } reset_pad_colors (); + + TrackMixLayout* tml = dynamic_cast<TrackMixLayout*> (mix_layout); + assert (tml); + tml->set_stripable (first_selected_stripable()); } Push2::Button* |