From 0e6764c4c8446d0a32014aae8d9d459daa240641 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 31 Jul 2023 13:53:42 -0600 Subject: [PATCH] improve and extend group selection logic --- libs/ardour/selection.cc | 43 +++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/libs/ardour/selection.cc b/libs/ardour/selection.cc index 27ed6421c7..376f05588b 100644 --- a/libs/ardour/selection.cc +++ b/libs/ardour/selection.cc @@ -623,8 +623,9 @@ CoreSelection::get_stripables_for_op (std::shared_ptr sl, std::sh void CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr target, bool (RouteGroup::*group_predicate)() const) const { + std::shared_ptr r (std::dynamic_pointer_cast (target)); + if (_stripables.empty()) { - std::shared_ptr r (std::dynamic_pointer_cast (target)); if (r) { RouteGroup* rg = r->route_group(); @@ -634,6 +635,10 @@ CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptris_selected()) { + /* Use full selection */ + + StripableAutomationControls sc; + get_stripables (sc); + + for (auto & s : sc) { + sl.push_back (s.stripable); + } + + } else { + + /* target not selected but might be part of a group */ + + if (r) { + RouteGroup* rg = r->route_group(); + + if (rg && rg->is_active() && (rg->*group_predicate)()) { + for (auto & r : *rg->route_list()) { + sl.push_back (r); + } + } else { + /* Target not selected, and not part of an + * active group that shares the relevant + * property, so use it and it alone + */ + sl.push_back (target); + } + } else { + /* Base is not a route, use it and it alone */ + sl.push_back (target); + } } } }