Selection::get_stripables() needs to recurse into an Automatable's child Automatables when looking for for an Automation Control

It also needs renaming (to come)
This commit is contained in:
Paul Davis 2017-05-10 08:52:33 +01:00
parent 86149840a1
commit bcbdd858fa
4 changed files with 43 additions and 2 deletions

View File

@ -55,10 +55,27 @@ public:
boost::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id);
boost::shared_ptr<AutomationControl> automation_control (PBD::ID const & id) const;
/* derived classes need to provide some way to search their own child
automatable's for a control. normally, we'd just make the method
above virtual, and let them override it. But that wouldn't
differentiate the "check children" and "just your own" cases.
We could theoretically just overload the above method with an extra
"bool recurse = default", but the rules of name hiding for C++ mean
that making a method virtual will hide other overloaded versions of
the same name. This means that virtual automation_control (PBD::ID
const &) would hide automation_control (Evoral::Parameter const &
id).
So, skip around all that with a different name.
*/
virtual boost::shared_ptr<AutomationControl> automation_control_recurse (PBD::ID const & id) const {
return automation_control (id);
}
boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) {
return automation_control (id, false);
}
boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id, bool create_if_missing);
boost::shared_ptr<const AutomationControl> automation_control (const Evoral::Parameter& id) const;

View File

@ -220,6 +220,8 @@ public:
RoutePinWindowProxy * pinmgr_proxy () const { return _pinmgr_proxy; }
void set_pingmgr_proxy (RoutePinWindowProxy* wp) { _pinmgr_proxy = wp ; }
boost::shared_ptr<AutomationControl> automation_control_recurse (PBD::ID const & id) const;
/* special processors */
boost::shared_ptr<InternalSend> monitor_send() const { return _monitor_send; }

View File

@ -5450,3 +5450,23 @@ Route::clear_all_solo_state ()
{
_solo_control->clear_all_solo_state ();
}
boost::shared_ptr<AutomationControl>
Route::automation_control_recurse (PBD::ID const & id) const
{
boost::shared_ptr<AutomationControl> ac = Automatable::automation_control (id);
if (ac) {
return ac;
}
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if ((ac = (*i)->automation_control (id))) {
return ac;
}
}
return boost::shared_ptr<AutomationControl> ();
}

View File

@ -217,9 +217,11 @@ CoreSelection::get_stripables (StripableAutomationControls& sc) const
boost::shared_ptr<AutomationControl> c;
if (!s) {
/* some global automation control, not owned by a Stripable */
c = session.automation_control_by_id ((*x).controllable);
} else {
c = s->automation_control ((*x).controllable);
/* automation control owned by a Stripable or one of its children */
c = s->automation_control_recurse ((*x).controllable);
}
if (s || c) {