rearrange group tabs menu
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 19 May 2016 17:11:10 +0000 (13:11 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:43 +0000 (15:30 -0400)
gtk2_ardour/group_tabs.cc
gtk2_ardour/group_tabs.h

index 180a0df00ff08f65914fd7c17728f38a1ccf016d..91e865069c74e97bb1142467872b45e6e5483298 100644 (file)
@@ -303,22 +303,11 @@ GroupTabs::click_to_tab (double c, list<Tab>::iterator* prev, list<Tab>::iterato
        return under;
 }
 
-Gtk::Menu*
-GroupTabs::get_menu (RouteGroup* g, bool TabArea)
+void
+GroupTabs::add_new_from_items (Menu_Helpers::MenuList& items)
 {
        using namespace Menu_Helpers;
-
-       delete _menu;
-
-       _menu = new Menu;
-       _menu->set_name ("ArdourContextMenu");
-       MenuList& items = _menu->items();
-       Menu* new_from;
-
-       if (!TabArea) {
-               items.push_back (MenuElem (_("Create New Group ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group))));
-               items.push_back (MenuElem (_("Create New Group with Control Master ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group_with_master))));
-       }
+       Menu *new_from;
 
        new_from = new Menu;
        {
@@ -337,10 +326,75 @@ GroupTabs::get_menu (RouteGroup* g, bool TabArea)
                f.push_back (MenuElem (_("Soloed..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_soloed), true)));
        }
        items.push_back (MenuElem (_("Create New Group with Master From..."), *new_from));
+}
+
+Gtk::Menu*
+GroupTabs::get_menu (RouteGroup* g, bool in_tab_area)
+{
+       using namespace Menu_Helpers;
+
+       delete _menu;
+
+       _menu = new Menu;
+       _menu->set_name ("ArdourContextMenu");
 
+       MenuList& items = _menu->items();
        Menu* vca_menu;
+
        const VCAList vcas = _session->vca_manager().vcas ();
 
+       if (!in_tab_area) {
+               items.push_back (MenuElem (_("Create New Group ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group))));
+               items.push_back (MenuElem (_("Create New Group with Control Master ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group_with_master))));
+
+               /* context menu is not for a group tab, show the "create new
+                  from" items here
+               */
+               add_new_from_items (items);
+       }
+
+       if (g) {
+               items.push_back (SeparatorElem());
+               items.push_back (MenuElem (_("Edit Group..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::edit_group), g)));
+               items.push_back (MenuElem (_("Collect Group"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::collect), g)));
+               items.push_back (MenuElem (_("Remove Group"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::remove_group), g)));
+
+               items.push_back (SeparatorElem());
+
+               vca_menu = 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)));
+
+               for (VCAList::const_iterator v = vcas.begin(); v != vcas.end(); ++v) {
+                       f.push_back (MenuElem (string_compose ("VCA %1", (*v)->number()), sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), (*v)->number(), g)));
+               }
+               items.push_back (MenuElem (_("Assign Group to Control Master..."), *vca_menu));
+
+
+               items.push_back (SeparatorElem());
+
+               if (g->has_subgroup()) {
+                       items.push_back (MenuElem (_("Remove Subgroup Bus"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::un_subgroup), g)));
+               } else {
+                       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());
+
+       }
+
+       add_menu_items (_menu, g);
+
+       if (in_tab_area) {
+               /* context menu is for a group tab, show the "create new
+                  from" items here
+               */
+               add_new_from_items (items);
+       }
+
+       items.push_back (SeparatorElem());
+
        vca_menu = new Menu;
        {
                MenuList& f (vca_menu->items());
@@ -374,37 +428,9 @@ GroupTabs::get_menu (RouteGroup* g, bool TabArea)
        }
        items.push_back (MenuElem (_("Assign Soloed to Control Master...")));
 
-       if (g) {
-               items.push_back (SeparatorElem());
-               items.push_back (MenuElem (_("Edit Group..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::edit_group), g)));
-               items.push_back (MenuElem (_("Collect Group"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::collect), g)));
-               items.push_back (MenuElem (_("Remove Group"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::remove_group), g)));
-               items.push_back (SeparatorElem());
-               if (g->has_subgroup()) {
-                       items.push_back (MenuElem (_("Remove Subgroup Bus"), sigc::bind (sigc::mem_fun (*this, &GroupTabs::un_subgroup), g)));
-               } else {
-                       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());
-
-               vca_menu = 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)));
-
-               for (VCAList::const_iterator v = vcas.begin(); v != vcas.end(); ++v) {
-                       f.push_back (MenuElem (string_compose ("VCA %1", (*v)->number()), sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_group_to_master), (*v)->number(), g)));
-               }
-               items.push_back (MenuElem (_("Assign Group to Control Master..."), *vca_menu));
-       }
-
-       add_menu_items (_menu, g);
-
        items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Enable All Groups"), sigc::mem_fun(*this, &GroupTabs::activate_all)));
        items.push_back (MenuElem (_("Disable All Groups"), sigc::mem_fun(*this, &GroupTabs::disable_all)));
-       items.push_back (SeparatorElem());
 
        return _menu;
 }
index 515c71ea72fea17bff8b0ea3411370ab943f1d39..cdd084484548f5112020545d315012cb5223815e 100644 (file)
@@ -93,6 +93,8 @@ private:
        virtual void add_menu_items (Gtk::Menu *, ARDOUR::RouteGroup *) {}
        virtual ARDOUR::RouteList selected_routes () const = 0;
 
+       void add_new_from_items (Gtk::Menu_Helpers::MenuList&);
+
        void new_from_selection (bool with_master);
        void new_from_rec_enabled (bool with_master);
        void new_from_soloed (bool with_master);