From aeae859c4673c3a2f1ffd6047d591e440f61f004 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 26 Mar 2017 15:01:00 +0200 Subject: [PATCH] make it possible to drop a group from a VCA --- gtk2_ardour/group_tabs.cc | 37 ++++++++++++++++++++++++++++++------- gtk2_ardour/group_tabs.h | 1 + 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index ef01293575..1a1b0d5328 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -356,15 +356,18 @@ GroupTabs::get_menu (RouteGroup* g, bool in_tab_area) items.push_back (SeparatorElem()); - vca_menu = manage (new Menu); - MenuList& f (vca_menu->items()); - f.push_back (MenuElem ("New", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), 0, g, true))); + if (g->has_control_master()) { + items.push_back (MenuElem (_("Drop Group from VCA..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::unassign_group_to_master), g->group_master_number(), g))); + } else { + vca_menu = manage (new Menu); + MenuList& f (vca_menu->items()); + f.push_back (MenuElem ("New", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), 0, g, true))); - for (VCAList::const_iterator v = vcas.begin(); v != vcas.end(); ++v) { - f.push_back (MenuElem ((*v)->name().empty() ? string_compose ("VCA %1", (*v)->number()) : (*v)->name(), sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), (*v)->number(), g, true))); + for (VCAList::const_iterator v = vcas.begin(); v != vcas.end(); ++v) { + f.push_back (MenuElem ((*v)->name().empty() ? string_compose ("VCA %1", (*v)->number()) : (*v)->name(), sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), (*v)->number(), g, true))); + } + items.push_back (MenuElem (_("Assign Group to VCA..."), *vca_menu)); } - items.push_back (MenuElem (_("Assign Group to VCA..."), *vca_menu)); - items.push_back (SeparatorElem()); @@ -466,6 +469,26 @@ GroupTabs::assign_group_to_master (uint32_t which, RouteGroup* group, bool renam } } +void +GroupTabs::unassign_group_to_master (uint32_t which, RouteGroup* group) const +{ + if (!_session || !group) { + return; + } + + boost::shared_ptr master = _session->vca_manager().vca_by_number (which); + + if (!master) { + /* should never happen; if it does, basically something deeply + odd happened, no reason to tell user because there's no + sensible explanation. + */ + return; + } + + group->unassign_master (master); +} + void GroupTabs::assign_some_to_master (uint32_t which, RouteList rl) { diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h index c635cff825..c1cd2fcd76 100644 --- a/gtk2_ardour/group_tabs.h +++ b/gtk2_ardour/group_tabs.h @@ -128,6 +128,7 @@ private: void route_removed_from_route_group (ARDOUR::RouteGroup *, boost::weak_ptr); void assign_group_to_master (uint32_t which, ARDOUR::RouteGroup*, bool rename_master) const; + void unassign_group_to_master (uint32_t which, ARDOUR::RouteGroup*) const; void assign_selection_to_master (uint32_t which); void assign_recenabled_to_master (uint32_t which); void assign_soloed_to_master (uint32_t which);