Skip Subgroup menu-options when not available (no MIDI subgroups)

This commit is contained in:
Robin Gareus 2019-04-11 02:08:36 +02:00
parent 01024e2b4c
commit 54d8bcca57
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -377,15 +377,35 @@ GroupTabs::get_menu (RouteGroup* g, bool in_tab_area)
items.push_back (SeparatorElem());
if (g->has_subgroup()) {
bool can_subgroup = true;
boost::shared_ptr<RouteList> rl = g->route_list();
for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
#ifdef MIXBUS
if ((*i)->mixbus ()) {
can_subgroup = false;
break;
}
#endif
if ((*i)->output()->n_ports().n_midi() != 0) {
can_subgroup = false;
break;
}
}
if (g->has_subgroup ()) {
items.push_back (MenuElem (_("Remove Subgroup Bus"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::un_subgroup), g)));
} else {
} else if (can_subgroup) {
items.push_back (MenuElem (_("Add New Subgroup Bus"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::subgroup), g, false, PreFader)));
}
items.push_back (MenuElem (_("Add New Aux Bus (pre-fader)"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::subgroup), g, true, PreFader)));
items.push_back (MenuElem (_("Add New Aux Bus (post-fader)"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::subgroup), g, true, PostFader)));
items.push_back (SeparatorElem());
if (can_subgroup) {
items.push_back (MenuElem (_("Add New Aux Bus (pre-fader)"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::subgroup), g, true, PreFader)));
items.push_back (MenuElem (_("Add New Aux Bus (post-fader)"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::subgroup), g, true, PostFader)));
}
if (can_subgroup || g->has_subgroup ()) {
items.push_back (SeparatorElem());
}
}
add_menu_items (_menu, g);