X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fprocessor_box.cc;h=aa8f285a43efc41d519b3dd4cdd0fee7807395c8;hb=7022456b4fc49bbef6a0f308f6f6557d659eff52;hp=daab501daabb1622354919ef8bc1f2b45dbb36b7;hpb=36c233fe6ce570ce85224626ce7aba4a2607537f;p=ardour.git diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index daab501daa..aa8f285a43 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -21,6 +21,10 @@ #include "gtk2ardour-config.h" #endif +#ifdef COMPILER_MSVC +#define rintf(x) round((x) + 0.5) +#endif + #include #include #include @@ -45,7 +49,9 @@ #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" @@ -297,12 +303,17 @@ ProcessorEntry::setup_tooltip () if (_processor) { boost::shared_ptr pi = boost::dynamic_pointer_cast (_processor); if (pi) { + std::string postfix = ""; + uint32_t replicated; + if ((replicated = pi->get_count()) > 1) { + postfix = string_compose(_("\nThis mono plugin has been replicated %1 times."), replicated); + } if (pi->plugin()->has_editor()) { ARDOUR_UI::instance()->set_tip (_button, - string_compose (_("%1\nDouble-click to show GUI.\nAlt+double-click to show generic GUI."), name (Wide))); + string_compose (_("%1\nDouble-click to show GUI.\nAlt+double-click to show generic GUI.%2"), name (Wide), postfix)); } else { ARDOUR_UI::instance()->set_tip (_button, - string_compose (_("%1\nDouble-click to show generic GUI."), name (Wide))); + string_compose (_("%1\nDouble-click to show generic GUI.%2"), name (Wide), postfix)); } return; } @@ -341,6 +352,13 @@ ProcessorEntry::name (Width w) const } } else { + boost::shared_ptr pi; + uint32_t replicated; + if ((pi = boost::dynamic_pointer_cast (_processor)) != 0 + && (replicated = pi->get_count()) > 1) + { + name_display += string_compose(_("(%1x1) "), replicated); + } switch (w) { case Wide: @@ -428,7 +446,7 @@ ProcessorEntry::build_controls_menu () for (list::iterator i = _controls.begin(); i != _controls.end(); ++i) { items.push_back (CheckMenuElem ((*i)->name ())); - CheckMenuItem* c = dynamic_cast (&items.back ()); + Gtk::CheckMenuItem* c = dynamic_cast (&items.back ()); c->set_active ((*i)->visible ()); c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ProcessorEntry::toggle_control_visibility), *i)); } @@ -443,6 +461,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"))); + Gtk::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) @@ -706,9 +752,6 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_clip (cr); - cairo_set_line_width (cr, 5.0); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - Gtk::Allocation a = get_allocation(); double const width = a.get_width(); double const height = a.get_height(); @@ -719,8 +762,6 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); - const double y0 = _input ? height-.5 : .5; - if (_ports.n_total() > 1) { for (uint32_t i = 0; i < _ports.n_total(); ++i) { if (i < _ports.n_midi()) { @@ -734,10 +775,9 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_G_FLT(audio_port_color), UINT_RGBA_B_FLT(audio_port_color)); } - const float x = rintf(width * (.2f + .6f * i / (_ports.n_total() - 1.f))) + .5f; - cairo_move_to (cr, x, y0); - cairo_close_path(cr); - cairo_stroke(cr); + const float x = rintf(width * (.2f + .6f * i / (_ports.n_total() - 1.f))); + cairo_rectangle (cr, x-1, 0, 3, height); + cairo_fill(cr); } } else if (_ports.n_total() == 1) { if (_ports.n_midi() == 1) { @@ -751,8 +791,9 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_G_FLT(audio_port_color), UINT_RGBA_B_FLT(audio_port_color)); } - cairo_move_to (cr, rintf(width * .5) + .5f, y0); - cairo_close_path(cr); + const float x = rintf(width * .5); + cairo_rectangle (cr, x-1, 0, 3, height); + cairo_fill(cr); cairo_stroke(cr); } @@ -797,7 +838,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_B_FLT(midi_port_color)); if (midi_sources > 0 && midi_sinks > 0 && sinks > 1 && sources > 1) { for (uint32_t i = 0 ; i < midi_sources; ++i) { - const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f; + const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f; const float si_x0 = rintf(width * (.2f + .6f * i / (sources - 1.f))) + .5f; cairo_move_to (cr, si_x, height); cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); @@ -808,6 +849,13 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_move_to (cr, si_x, height); cairo_line_to (cr, si_x, 0); cairo_stroke (cr); + } else if (midi_sources == 1 && midi_sinks == 1) { + /* unusual cases -- removed synth, midi-track w/audio plugins */ + const float si_x = rintf(width * (sinks > 1 ? .2f : .5f)) + .5f; + const float si_x0 = rintf(width * (sources > 1 ? .2f : .5f)) + .5f; + cairo_move_to (cr, si_x, height); + cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); + cairo_stroke (cr); } /* AUDIO */ @@ -819,8 +867,10 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_B_FLT(audio_port_color)); if (_splitting) { + assert(audio_sources < 2); assert(audio_sinks > 1); - const float si_x0 = rintf(width * .5f) + .5f; + /* assume there is only ever one MIDI port */ + const float si_x0 = rintf(width * (midi_sources > 0 ? .8f : .5f)) + .5f; for (uint32_t i = midi_sinks; i < sinks; ++i) { const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f; cairo_move_to (cr, si_x, height); @@ -1084,6 +1134,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()); @@ -1395,7 +1459,8 @@ ProcessorBox::choose_insert () void ProcessorBox::choose_send () { - boost::shared_ptr send (new Send (*_session, _route->pannable(), _route->mute_master())); + boost::shared_ptr sendpan(new Pannable (*_session)); + boost::shared_ptr send (new Send (*_session, sendpan, _route->mute_master())); /* make an educated guess at the initial number of outputs for the send */ ChanCount outs = (_session->master_out()) @@ -2044,8 +2109,9 @@ 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, _route->pannable(), _route->mute_master(), + InternalSend* s = new InternalSend (*_session, sendpan, _route->mute_master(), boost::shared_ptr(), Delivery::Aux); IOProcessor::prepare_for_reset (n, s->name()); @@ -2059,8 +2125,10 @@ 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, _route->pannable(), _route->mute_master()); + + Send* s = new Send (*_session, _route->pannable(), _route->mute_master()); IOProcessor::prepare_for_reset (n, s->name()); @@ -2393,6 +2461,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));