From e45151b89c64912077c03fc979f1581780ac9e27 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 13 Jan 2014 23:21:30 +0100 Subject: first stab at send+route panner link --- gtk2_ardour/ardour.menus.in | 1 + gtk2_ardour/processor_box.cc | 54 ++++++++++++++++++++++++++++++++++++++------ gtk2_ardour/processor_box.h | 2 ++ 3 files changed, 50 insertions(+), 7 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index a354df603d..b6328963bb 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -551,6 +551,7 @@ + diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 98bb3f13cd..c2421dcabf 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -45,8 +45,8 @@ #include "ardour/audioengine.h" #include "ardour/internal_return.h" #include "ardour/internal_send.h" +#include "ardour/panner_shell.h" #include "ardour/plugin_insert.h" -#include "ardour/pannable.h" #include "ardour/port_insert.h" #include "ardour/profile.h" #include "ardour/return.h" @@ -456,6 +456,34 @@ ProcessorEntry::toggle_control_visibility (Control* c) _parent->update_gui_object_state (this); } +Menu * +ProcessorEntry::build_send_options_menu () +{ + using namespace Menu_Helpers; + Menu* menu = manage (new Menu); + MenuList& items = menu->items (); + + boost::shared_ptr send = boost::dynamic_pointer_cast (_processor); + if (send) { + + items.push_back (CheckMenuElem (_("Link panner controls"))); + CheckMenuItem* c = dynamic_cast (&items.back ()); + c->set_active (send->panner_shell()->is_linked_to_route()); + c->signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::toggle_panner_link)); + + } + return menu; +} + +void +ProcessorEntry::toggle_panner_link () +{ + boost::shared_ptr send = boost::dynamic_pointer_cast (_processor); + if (send) { + send->panner_shell()->set_linked_to_route(!send->panner_shell()->is_linked_to_route()); + } +} + ProcessorEntry::Control::Control (boost::shared_ptr c, string const & n) : _control (c) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) @@ -1092,6 +1120,20 @@ ProcessorBox::show_processor_menu (int arg) } } + Gtk::MenuItem* send_menu_item = dynamic_cast(ActionManager::get_widget("/ProcessorMenu/send_options")); + if (send_menu_item) { + if (single_selection) { + Menu* m = single_selection->build_send_options_menu (); + if (m && !m->items().empty()) { + send_menu_item->set_submenu (*m); + send_menu_item->set_sensitive (true); + } else { + gtk_menu_item_set_submenu (send_menu_item->gobj(), 0); + send_menu_item->set_sensitive (false); + } + } + } + /* Sensitise actions as approprioate */ cut_action->set_sensitive (can_cut()); @@ -1403,8 +1445,7 @@ ProcessorBox::choose_insert () void ProcessorBox::choose_send () { - boost::shared_ptr sendpan(new Pannable (*_session)); - boost::shared_ptr send (new Send (*_session, sendpan, _route->mute_master())); + boost::shared_ptr send (new Send (*_session, _route->pannable(), _route->mute_master())); /* make an educated guess at the initial number of outputs for the send */ ChanCount outs = (_session->master_out()) @@ -2053,9 +2094,8 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr continue; } - boost::shared_ptr sendpan(new Pannable (*_session)); XMLNode n (**niter); - InternalSend* s = new InternalSend (*_session, sendpan, _route->mute_master(), + InternalSend* s = new InternalSend (*_session, _route->pannable(), _route->mute_master(), boost::shared_ptr(), Delivery::Aux); IOProcessor::prepare_for_reset (n, s->name()); @@ -2069,9 +2109,8 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr } else if (type->value() == "send") { - boost::shared_ptr sendpan(new Pannable (*_session)); XMLNode n (**niter); - Send* s = new Send (*_session, sendpan, _route->mute_master()); + Send* s = new Send (*_session, _route->pannable(), _route->mute_master()); IOProcessor::prepare_for_reset (n, s->name()); @@ -2404,6 +2443,7 @@ ProcessorBox::register_actions () ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ...")); ActionManager::register_action (popup_act_grp, X_("controls"), _("Controls")); + ActionManager::register_action (popup_act_grp, X_("send_options"), _("Send Options")); ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear (all)"), sigc::ptr_fun (ProcessorBox::rb_clear)); diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index a66a6c4a56..021e557d36 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -138,6 +138,7 @@ public: void set_control_state (XMLNode const *); std::string state_id () const; Gtk::Menu* build_controls_menu (); + Gtk::Menu* build_send_options_menu (); protected: ArdourButton _button; @@ -205,6 +206,7 @@ private: std::list _controls; void toggle_control_visibility (Control *); + void toggle_panner_link (); class PortIcon : public Gtk::DrawingArea { public: -- cgit v1.2.3