mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
coreselection: fix thinko
The core selection can be (a) stripables (b) automation controls (c) possibly a combination of both Any given selection op might pass (a) or (b) or (c), so we need to handle the case where (a) is null.
This commit is contained in:
parent
c2bf45a033
commit
3f1486fa12
1 changed files with 40 additions and 37 deletions
|
|
@ -47,52 +47,55 @@ CoreSelection::do_select (std::shared_ptr<Stripable> s, std::shared_ptr<Automati
|
||||||
* then hidden
|
* then hidden
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (s->is_hidden()) {
|
if (s) {
|
||||||
return false;
|
if (s->is_hidden()) {
|
||||||
}
|
|
||||||
|
|
||||||
/* monitor is never selectable */
|
|
||||||
|
|
||||||
if (s->is_monitor() || s->is_surround_master ()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(r = std::dynamic_pointer_cast<Route> (s)) && routes_only) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r) {
|
|
||||||
|
|
||||||
/* no selection of inactive routes, though they can be selected
|
|
||||||
* and made inactive.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!r->active()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c && with_group) {
|
/* monitor is never selectable */
|
||||||
|
|
||||||
|
if (s->is_monitor() || s->is_surround_master ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!not_allowed_in_group || !r->route_group() || r->route_group() != not_allowed_in_group) {
|
if (!(r = std::dynamic_pointer_cast<Route> (s)) && routes_only) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (r->route_group() && r->route_group()->is_select() && r->route_group()->is_active()) {
|
if (r) {
|
||||||
for (auto & ri : *(r->route_group()->route_list())) {
|
|
||||||
if (ri != r) {
|
/* no selection of inactive routes, though they can be selected
|
||||||
sl.push_back (ri);
|
* and made inactive.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!r->active()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c && with_group) {
|
||||||
|
|
||||||
|
if (!not_allowed_in_group || !r->route_group() || r->route_group() != not_allowed_in_group) {
|
||||||
|
|
||||||
|
RouteGroup* group = r->route_group();
|
||||||
|
|
||||||
|
if (group && group->is_select() && group->is_active()) {
|
||||||
|
for (auto & ri : *(group->route_list())) {
|
||||||
|
if (ri != r) {
|
||||||
|
sl.push_back (ri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* it is important to make the "primary" stripable being selected the last in this
|
||||||
|
* list
|
||||||
|
*/
|
||||||
|
|
||||||
|
sl.push_back (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* it is important to make the "primary" stripable being selected the last in this
|
|
||||||
* list
|
|
||||||
*/
|
|
||||||
|
|
||||||
sl.push_back (s);
|
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case SelectionAdd:
|
case SelectionAdd:
|
||||||
changed = add (sl, c);
|
changed = add (sl, c);
|
||||||
|
|
@ -260,7 +263,7 @@ CoreSelection::select_prev_stripable (bool mixer_order, bool routes_only)
|
||||||
bool
|
bool
|
||||||
CoreSelection::toggle (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
CoreSelection::toggle (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
||||||
{
|
{
|
||||||
assert (sl.size() == 1 || !c);
|
assert (sl.size() <= 1 || !c);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
StripableList sl2;
|
StripableList sl2;
|
||||||
|
|
||||||
|
|
@ -288,7 +291,7 @@ CoreSelection::toggle (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
||||||
bool
|
bool
|
||||||
CoreSelection::set (StripableList& sl, std::shared_ptr<AutomationControl> c, std::vector<std::shared_ptr<Stripable> > & removed)
|
CoreSelection::set (StripableList& sl, std::shared_ptr<AutomationControl> c, std::vector<std::shared_ptr<Stripable> > & removed)
|
||||||
{
|
{
|
||||||
assert (sl.size() == 1 || !c);
|
assert (sl.size() <= 1 || !c);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
|
|
@ -331,7 +334,7 @@ CoreSelection::set (StripableList& sl, std::shared_ptr<AutomationControl> c, std
|
||||||
bool
|
bool
|
||||||
CoreSelection::add (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
CoreSelection::add (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
||||||
{
|
{
|
||||||
assert (sl.size() == 1 || !c);
|
assert (sl.size() <= 1 || !c);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
|
|
@ -362,7 +365,7 @@ CoreSelection::add (StripableList& sl, std::shared_ptr<AutomationControl> c)
|
||||||
bool
|
bool
|
||||||
CoreSelection::remove (StripableList & sl, std::shared_ptr<AutomationControl> c)
|
CoreSelection::remove (StripableList & sl, std::shared_ptr<AutomationControl> c)
|
||||||
{
|
{
|
||||||
assert (sl.size() == 1 || !c);
|
assert (sl.size() <= 1 || !c);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue