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 | |
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')
-rw-r--r-- | libs/surfaces/push2/push2.cc | 17 | ||||
-rw-r--r-- | libs/surfaces/push2/push2.h | 3 | ||||
-rw-r--r-- | libs/surfaces/push2/track_mix.cc | 12 | ||||
-rw-r--r-- | libs/surfaces/push2/track_mix.h | 2 |
4 files changed, 9 insertions, 25 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* diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index bb34f7c016..361801529a 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -569,8 +569,7 @@ class Push2 : public ARDOUR::ControlProtocol /* pad mapping */ - PBD::ScopedConnection selection_connection; - void stripable_selection_change (ARDOUR::StripableNotificationListPtr); + void stripable_selection_changed (); MusicalMode::Type _mode; int _scale_root; diff --git a/libs/surfaces/push2/track_mix.cc b/libs/surfaces/push2/track_mix.cc index aad94ec9da..a04ac0af24 100644 --- a/libs/surfaces/push2/track_mix.cc +++ b/libs/surfaces/push2/track_mix.cc @@ -160,8 +160,6 @@ TrackMixLayout::TrackMixLayout (Push2& p, Session & s, std::string const & name) minsec_text->set_font_description (fd2); minsec_text->set_color (p2.get_color (Push2::LightBackground)); minsec_text->set_position (Duple (10 + (4 * Push2Canvas::inter_button_spacing()), 90)); - - ControlProtocol::StripableSelectionChanged.connect (selection_connection, invalidator (*this), boost::bind (&TrackMixLayout::selection_changed, this), &p2); } TrackMixLayout::~TrackMixLayout () @@ -172,16 +170,6 @@ TrackMixLayout::~TrackMixLayout () } void -TrackMixLayout::selection_changed () -{ - boost::shared_ptr<Stripable> s = ControlProtocol::first_selected_stripable(); - - if (s) { - set_stripable (s); - } -} - -void TrackMixLayout::show () { Push2::ButtonID lower_buttons[] = { Push2::Lower1, Push2::Lower2, Push2::Lower3, Push2::Lower4, diff --git a/libs/surfaces/push2/track_mix.h b/libs/surfaces/push2/track_mix.h index 53c08ea219..ba6aa49a0a 100644 --- a/libs/surfaces/push2/track_mix.h +++ b/libs/surfaces/push2/track_mix.h @@ -85,8 +85,6 @@ class TrackMixLayout : public Push2Layout void stripable_property_change (PBD::PropertyChange const& what_changed); void simple_control_change (boost::shared_ptr<ARDOUR::AutomationControl> ac, Push2::ButtonID bid); - PBD::ScopedConnection selection_connection; - void selection_changed (); void show_state (); void drop_stripable (); |