From c1592864e1cd80f5cfcaab3c5b061f586e107de6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 18 May 2016 23:44:09 -0400 Subject: a start at the group/master menu related structure --- gtk2_ardour/editor_route_groups.cc | 2 +- gtk2_ardour/group_tabs.cc | 121 +++++++++++++++++++++++++++++++++---- gtk2_ardour/group_tabs.h | 14 +++-- gtk2_ardour/mixer_ui.cc | 2 +- 4 files changed, 120 insertions(+), 19 deletions(-) diff --git a/gtk2_ardour/editor_route_groups.cc b/gtk2_ardour/editor_route_groups.cc index 85644359f6..f518cf8ef9 100644 --- a/gtk2_ardour/editor_route_groups.cc +++ b/gtk2_ardour/editor_route_groups.cc @@ -574,7 +574,7 @@ EditorRouteGroups::run_new_group_dialog () { RouteList rl; - return _editor->_group_tabs->run_new_group_dialog (rl); + return _editor->_group_tabs->run_new_group_dialog (rl, false); } /** Called when a model row is deleted, but also when the model is diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index e079aa1386..32b6569488 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -307,22 +307,45 @@ GroupTabs::get_menu (RouteGroup* g, bool TabArea) delete _menu; - Menu* new_from = new Menu; - MenuList& f = new_from->items (); - f.push_back (MenuElem (_("Selection..."), sigc::mem_fun (*this, &GroupTabs::new_from_selection))); - f.push_back (MenuElem (_("Record Enabled..."), sigc::mem_fun (*this, &GroupTabs::new_from_rec_enabled))); - f.push_back (MenuElem (_("Soloed..."), sigc::mem_fun (*this, &GroupTabs::new_from_soloed))); - _menu = new Menu; _menu->set_name ("ArdourContextMenu"); MenuList& items = _menu->items(); 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 Control Master ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_master)))); + items.push_back (MenuElem (_("Create New Group & Control Master ..."), hide_return (sigc::mem_fun(*this, &GroupTabs::create_and_add_group_with_master)))); } + Menu* new_from = new Menu; + { + MenuList& f = new_from->items (); + f.push_back (MenuElem (_("Selection..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_selection), false, false))); + f.push_back (MenuElem (_("Record Enabled..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_rec_enabled), false, false))); + f.push_back (MenuElem (_("Soloed..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_soloed), false, false))); + } items.push_back (MenuElem (_("Create New Group From"), *new_from)); + new_from = new Menu; + { + MenuList& f = new_from->items (); + f.push_back (MenuElem (_("Selection..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_selection), true, false))); + f.push_back (MenuElem (_("Record Enabled..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_rec_enabled), true, false))); + f.push_back (MenuElem (_("Soloed..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_soloed), true, false))); + } + items.push_back (MenuElem (_("Create New Master From"), *new_from)); + + new_from = new Menu; + { + MenuList& f = new_from->items (); + f.push_back (MenuElem (_("Selection..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_selection), true, true))); + f.push_back (MenuElem (_("Record Enabled..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_rec_enabled), true, true))); + f.push_back (MenuElem (_("Soloed..."), sigc::bind (sigc::mem_fun (*this, &GroupTabs::new_from_soloed), true, true))); + } + items.push_back (MenuElem (_("Create New Group & Master From"), *new_from)); + + Menu* vca_menu; + if (g) { 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))); @@ -335,6 +358,13 @@ GroupTabs::get_menu (RouteGroup* g, bool TabArea) } 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_selection_to_master), 0))); + f.push_back (MenuElem ("VCA 1", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_selection_to_master), 1))); + items.push_back (MenuElem (_("Assign Group to Control Master..."), *vca_menu)); } add_menu_items (_menu, g); @@ -342,24 +372,68 @@ GroupTabs::get_menu (RouteGroup* g, bool TabArea) 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()); + + vca_menu = new Menu; + { + MenuList& f (vca_menu->items()); + f.push_back (MenuElem ("New", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_selection_to_master), 0))); + f.push_back (MenuElem ("VCA 1", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_selection_to_master), 1))); + + } + + items.push_back (MenuElem (_("Assign Selection to Control Master..."), *vca_menu)); + + vca_menu = new Menu; + { + MenuList& f (vca_menu->items()); + f.push_back (MenuElem ("New", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_selection_to_master), 0))); + f.push_back (MenuElem ("VCA 1", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_recenabled_to_master), 1))); + + } + items.push_back (MenuElem (_("Assign Record Enabled to Control Master..."), *vca_menu)); + + vca_menu = new Menu; + { + MenuList& f (vca_menu->items()); + f.push_back (MenuElem ("New", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_selection_to_master), 0))); + f.push_back (MenuElem ("VCA 1", sigc::bind (sigc::mem_fun (*this, &GroupTabs::assign_soloed_to_master), 1))); + + } + items.push_back (MenuElem (_("Assign Soloed to Control Master..."))); return _menu; } void -GroupTabs::new_from_selection () +GroupTabs::assign_selection_to_master (uint32_t which) +{ +} + +void +GroupTabs::assign_recenabled_to_master (uint32_t which) +{ +} + +void +GroupTabs::assign_soloed_to_master (uint32_t which) +{ +} + +void +GroupTabs::new_from_selection (bool just_master, bool with_master) { RouteList rl = selected_routes (); if (rl.empty()) { return; } - run_new_group_dialog (rl); + run_new_group_dialog (rl, with_master); } void -GroupTabs::new_from_rec_enabled () +GroupTabs::new_from_rec_enabled (bool just_master, bool with_master) { boost::shared_ptr rl = _session->get_routes (); @@ -376,11 +450,11 @@ GroupTabs::new_from_rec_enabled () return; } - run_new_group_dialog (rec_enabled); + run_new_group_dialog (rec_enabled, with_master); } void -GroupTabs::new_from_soloed () +GroupTabs::new_from_soloed (bool just_master, bool with_master) { boost::shared_ptr rl = _session->get_routes (); @@ -396,11 +470,11 @@ GroupTabs::new_from_soloed () return; } - run_new_group_dialog (soloed); + run_new_group_dialog (soloed, with_master); } void -GroupTabs::run_new_group_dialog (RouteList const & rl) +GroupTabs::run_new_group_dialog (RouteList const & rl, bool with_master) { RouteGroup* g = new RouteGroup (*_session, ""); RouteGroupDialog d (g, true); @@ -430,6 +504,27 @@ GroupTabs::create_and_add_group () const return g; } +RouteGroup * +GroupTabs::create_and_add_master () const +{ + return 0; +} + +RouteGroup * +GroupTabs::create_and_add_group_with_master () const +{ + RouteGroup* g = new RouteGroup (*_session, ""); + RouteGroupDialog d (g, true); + + if (d.do_run ()) { + delete g; + return 0; + } + + _session->add_route_group (g); + return g; +} + void GroupTabs::edit_group (RouteGroup* g) { diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h index 325e3f7ee7..ff20cac32a 100644 --- a/gtk2_ardour/group_tabs.h +++ b/gtk2_ardour/group_tabs.h @@ -48,7 +48,7 @@ public: */ Gtk::Menu* get_menu (ARDOUR::RouteGroup* g, bool tabArea = false); - void run_new_group_dialog (ARDOUR::RouteList const &); + void run_new_group_dialog (ARDOUR::RouteList const &, bool with_master); static void set_group_color (ARDOUR::RouteGroup *, uint32_t); static std::string group_gui_id (ARDOUR::RouteGroup *); @@ -93,10 +93,12 @@ private: virtual void add_menu_items (Gtk::Menu *, ARDOUR::RouteGroup *) {} virtual ARDOUR::RouteList selected_routes () const = 0; - void new_from_selection (); - void new_from_rec_enabled (); - void new_from_soloed (); + void new_from_selection (bool just_master, bool with_master); + void new_from_rec_enabled (bool just_master, bool with_master); + void new_from_soloed (bool just_master, bool with_master); ARDOUR::RouteGroup* create_and_add_group () const; + ARDOUR::RouteGroup* create_and_add_master () const; + ARDOUR::RouteGroup* create_and_add_group_with_master () const; void collect (ARDOUR::RouteGroup *); void set_activation (ARDOUR::RouteGroup *, bool); void edit_group (ARDOUR::RouteGroup *); @@ -118,6 +120,10 @@ private: void route_added_to_route_group (ARDOUR::RouteGroup *, boost::weak_ptr); void route_removed_from_route_group (ARDOUR::RouteGroup *, boost::weak_ptr); + void assign_selection_to_master (uint32_t which); + void assign_recenabled_to_master (uint32_t which); + void assign_soloed_to_master (uint32_t which); + Gtk::Menu* _menu; std::list _tabs; ///< current list of tabs Tab* _dragging; ///< tab being dragged, or 0 diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index ab43772552..249f34f8ad 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -1535,7 +1535,7 @@ Mixer_UI::new_route_group () { RouteList rl; - _group_tabs->run_new_group_dialog (rl); + _group_tabs->run_new_group_dialog (rl, false); } void -- cgit v1.2.3