summaryrefslogtreecommitdiff
path: root/gtk2_ardour/processor_box.cc
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2018-11-01 17:42:42 -0700
committerLen Ovens <len@ovenwerks.net>2018-11-01 17:43:35 -0700
commitc04fc2efe2453c15725fb43b009dfd5fc3b82b0b (patch)
treec223333e7e8f75295c22e5d24e77b7b723c045b9 /gtk2_ardour/processor_box.cc
parent06ffebca762619d46266c3f59401176ef4ff5b6d (diff)
Allow strips to add or remove personal sends
in processor box context menu
Diffstat (limited to 'gtk2_ardour/processor_box.cc')
-rw-r--r--gtk2_ardour/processor_box.cc143
1 files changed, 140 insertions, 3 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 9e77f97c61..3b23f294a3 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -2047,6 +2047,9 @@ ProcessorBox::build_possible_aux_menu ()
/* don't allow sending to master or monitor or to self */
continue;
}
+ if ((*r)->is_listenbus ()) {
+ continue;
+ }
if (_route->internal_send_for (*r)) {
/* aux-send to target already exists */
continue;
@@ -2057,6 +2060,78 @@ ProcessorBox::build_possible_aux_menu ()
return menu;
}
+Gtk::Menu*
+ProcessorBox::build_possible_listener_menu ()
+{
+ boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
+
+ if (rl->empty()) {
+ /* No aux sends if there are no busses */
+ return 0;
+ }
+
+ if (_route->is_monitor () || _route->is_listenbus ()) {
+ return 0;
+ }
+
+ using namespace Menu_Helpers;
+ Menu* menu = manage (new Menu);
+ MenuList& items = menu->items();
+
+ for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
+ if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) {
+ /* don't allow sending to master or monitor or to self */
+ continue;
+ }
+ if (!(*r)->is_listenbus ()) {
+ continue;
+ }
+ if (_route->internal_send_for (*r)) {
+ /* aux-send to target already exists */
+ continue;
+ }
+ items.push_back (MenuElemNoMnemonic ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_choose_aux), boost::weak_ptr<Route>(*r))));
+ }
+
+ return menu;
+}
+
+Gtk::Menu*
+ProcessorBox::build_possible_remove_listener_menu ()
+{
+ boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
+
+ if (rl->empty()) {
+ /* No aux sends if there are no busses */
+ return 0;
+ }
+
+ if (_route->is_monitor () || _route->is_listenbus ()) {
+ return 0;
+ }
+
+ using namespace Menu_Helpers;
+ Menu* menu = manage (new Menu);
+ MenuList& items = menu->items();
+
+ for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
+ if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) {
+ /* don't allow sending to master or monitor or to self */
+ continue;
+ }
+ if (!(*r)->is_listenbus ()) {
+ continue;
+ }
+ if (!_route->internal_send_for (*r)) {
+ /* aux-send to target already exists */
+ continue;
+ }
+ items.push_back (MenuElemNoMnemonic ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_remove_aux), boost::weak_ptr<Route>(*r))));
+ }
+
+ return menu;
+}
+
void
ProcessorBox::show_processor_menu (int arg)
{
@@ -2089,8 +2164,36 @@ ProcessorBox::show_processor_menu (int arg)
}
}
- ActionManager::get_action (X_("ProcessorMenu"), "newinsert")->set_sensitive (!_route->is_monitor ());
- ActionManager::get_action (X_("ProcessorMenu"), "newsend")->set_sensitive (!_route->is_monitor ());
+ Gtk::MenuItem* listen_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/newlisten"));
+
+ if (listen_menu_item) {
+ Menu* m = build_possible_listener_menu();
+ if (m && !m->items().empty()) {
+ listen_menu_item->set_submenu (*m);
+ listen_menu_item->set_sensitive (true);
+ } else {
+ /* stupid gtkmm: we need to pass a null reference here */
+ gtk_menu_item_set_submenu (listen_menu_item->gobj(), 0);
+ listen_menu_item->set_sensitive (false);
+ }
+ }
+
+ Gtk::MenuItem* remove_listen_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/removelisten"));
+
+ if (remove_listen_menu_item) {
+ Menu* m = build_possible_remove_listener_menu();
+ if (m && !m->items().empty()) {
+ remove_listen_menu_item->set_submenu (*m);
+ remove_listen_menu_item->set_sensitive (true);
+ } else {
+ /* stupid gtkmm: we need to pass a null reference here */
+ gtk_menu_item_set_submenu (remove_listen_menu_item->gobj(), 0);
+ remove_listen_menu_item->set_sensitive (false);
+ }
+ }
+
+ ActionManager::get_action (X_("ProcessorMenu"), "newinsert")->set_sensitive (!_route->is_monitor () && !_route->is_listenbus ());
+ ActionManager::get_action (X_("ProcessorMenu"), "newsend")->set_sensitive (!_route->is_monitor () && !_route->is_listenbus ());
ProcessorEntry* single_selection = 0;
if (processor_display.selection().size() == 1) {
@@ -2615,7 +2718,29 @@ ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
return;
}
- _session->add_internal_send (target, _placement, _route);
+ if (target->is_listenbus ()) {
+ _route->add_personal_send (target);
+ } else {
+ _session->add_internal_send (target, _placement, _route);
+ }
+}
+
+void
+ProcessorBox::remove_aux (boost::weak_ptr<Route> wr)
+{
+ if (!_route) {
+ return;
+ }
+
+ boost::shared_ptr<Route> target = wr.lock();
+
+ if (!target) {
+ return;
+ }
+ boost::shared_ptr<Send> send = _route->internal_send_for (target);
+ boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (send);
+ _route->remove_processor (proc);
+
}
void
@@ -3654,6 +3779,8 @@ ProcessorBox::register_actions ()
ActionManager::engine_sensitive_actions.push_back (act);
myactions.register_action (processor_box_actions, X_("newaux"), _("New Aux Send ..."));
+ myactions.register_action (processor_box_actions, X_("newlisten"), _("New Monitor Send ..."));
+ myactions.register_action (processor_box_actions, X_("removelisten"), _("Remove Monitor Send ..."));
myactions.register_action (processor_box_actions, X_("controls"), _("Controls"));
myactions.register_action (processor_box_actions, X_("send_options"), _("Send Options"));
@@ -3798,6 +3925,16 @@ ProcessorBox::rb_choose_aux (boost::weak_ptr<Route> wr)
}
void
+ProcessorBox::rb_remove_aux (boost::weak_ptr<Route> wr)
+{
+ if (_current_processor_box == 0) {
+ return;
+ }
+
+ _current_processor_box->remove_aux (wr);
+}
+
+void
ProcessorBox::rb_clear ()
{
if (_current_processor_box == 0) {