improve and extend group selection logic

This commit is contained in:
Paul Davis 2023-07-31 13:53:42 -06:00
parent fa38a14120
commit 0e6764c4c8

View File

@ -623,8 +623,9 @@ CoreSelection::get_stripables_for_op (std::shared_ptr<StripableList> sl, std::sh
void
CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr<Stripable> target, bool (RouteGroup::*group_predicate)() const) const
{
std::shared_ptr<Route> r (std::dynamic_pointer_cast<Route> (target));
if (_stripables.empty()) {
std::shared_ptr<Route> r (std::dynamic_pointer_cast<Route> (target));
if (r) {
RouteGroup* rg = r->route_group();
@ -634,6 +635,10 @@ CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr<Stripab
sl.push_back (r);
}
} else {
/* target is not member of an active group that
shares the relevant property, and nothing is
selected, so use it and it alone.
*/
sl.push_back (target);
}
@ -643,11 +648,39 @@ CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr<Stripab
}
} else {
StripableAutomationControls sc;
get_stripables (sc);
for (auto & s : sc) {
sl.push_back (s.stripable);
if (target->is_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);
}
}
}
}