X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Froute_ui.cc;h=1ce6114a3e7621ac5051286d1333a4cc25fc844d;hb=3c25d26e91d4703ba76c90d5175aa94e4ddd850b;hp=1175aa620a8aa21c0fb580d1dca40ca2cc87dce4;hpb=e0ff70cf86c01c42f98faf8b0eaf1a8ccf867946;p=ardour.git diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 1175aa620a..1ce6114a3e 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -17,6 +17,7 @@ */ +#include #include #include @@ -38,11 +39,13 @@ #include "ardour/vca.h" #include "ardour/vca_manager.h" #include "ardour/audio_track.h" +#include "ardour/audio_port.h" #include "ardour/audioengine.h" #include "ardour/filename_extensions.h" #include "ardour/midi_track.h" #include "ardour/monitor_control.h" #include "ardour/internal_send.h" +#include "ardour/panner_shell.h" #include "ardour/profile.h" #include "ardour/phase_control.h" #include "ardour/send.h" @@ -50,26 +53,28 @@ #include "ardour/session.h" #include "ardour/template_utils.h" +#include "ardour_button.h" +#include "ardour_dialog.h" #include "ardour_ui.h" +#include "automation_time_axis.h" #include "editor.h" -#include "route_ui.h" -#include "ardour_button.h" -#include "keyboard.h" -#include "utils.h" -#include "plugin_pin_dialog.h" -#include "prompter.h" +#include "group_tabs.h" +#include "gui_object.h" #include "gui_thread.h" -#include "ardour_dialog.h" +#include "keyboard.h" #include "latency_gui.h" #include "mixer_strip.h" -#include "automation_time_axis.h" +#include "plugin_pin_dialog.h" +#include "prompter.h" +#include "rgb_macros.h" #include "route_time_axis.h" -#include "group_tabs.h" +#include "route_ui.h" #include "timers.h" #include "ui_config.h" +#include "utils.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace Gtk; using namespace Gtkmm2ext; using namespace ARDOUR; @@ -83,7 +88,8 @@ boost::weak_ptr RouteUI::_showing_sends_to; std::string RouteUI::program_port_prefix; RouteUI::RouteUI (ARDOUR::Session* sess) - : AxisView(sess) + : monitor_input_button (0) + , monitor_disk_button (0) , mute_menu(0) , solo_menu(0) , sends_menu(0) @@ -100,13 +106,16 @@ RouteUI::RouteUI (ARDOUR::Session* sess) boost::to_lower (lpn); program_port_prefix = lpn + ":"; // e.g. "ardour:" } - if (sess) init (); + + if (sess) { + init (); + } } RouteUI::~RouteUI() { if (_route) { - gui_object_state().remove_node (route_state_id()); + ARDOUR_UI::instance()->gui_object_state->remove_node (route_state_id()); } _route.reset (); /* drop reference to route, so that it can be cleaned up */ @@ -119,6 +128,8 @@ RouteUI::~RouteUI() delete comment_window; delete input_selector; delete output_selector; + delete monitor_input_button; + delete monitor_disk_button; delete _invert_menu; send_blink_connection.disconnect (); @@ -150,7 +161,6 @@ RouteUI::init () multiple_mute_change = false; multiple_solo_change = false; _i_am_the_modifier = 0; - vca_button = 0; input_selector = 0; output_selector = 0; @@ -179,13 +189,13 @@ RouteUI::init () show_sends_button->set_name ("send alert button"); UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), ""); - monitor_input_button = manage (new ArdourButton (ArdourButton::default_elements)); + monitor_input_button = new ArdourButton (ArdourButton::default_elements); monitor_input_button->set_name ("monitor button"); monitor_input_button->set_text (_("In")); UI::instance()->set_tip (monitor_input_button, _("Monitor input"), ""); monitor_input_button->set_no_show_all (true); - monitor_disk_button = manage (new ArdourButton (ArdourButton::default_elements)); + monitor_disk_button = new ArdourButton (ArdourButton::default_elements); monitor_disk_button->set_name ("monitor button"); monitor_disk_button->set_text (_("Disk")); UI::instance()->set_tip (monitor_disk_button, _("Monitor playback"), ""); @@ -197,6 +207,7 @@ RouteUI::init () _session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteUI::parameter_changed, this, _1), gui_context()); Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteUI::parameter_changed, this, _1), gui_context()); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (this, &RouteUI::parameter_changed)); rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false); rec_enable_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_release), false); @@ -249,7 +260,7 @@ RouteUI::set_route (boost::shared_ptr rp) _route = rp; if (set_color_from_route()) { - set_color (unique_random_color()); + set_color (gdk_color_to_rgba (AxisView::unique_random_color ())); } if (self_destruct) { @@ -274,18 +285,21 @@ RouteUI::set_route (boost::shared_ptr rp) _route->solo_safe_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->solo_isolate_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->phase_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_changed, this), gui_context()); + _route->fan_out.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::fan_out, this, true, true), gui_context()); if (is_track()) { track()->FreezeChange.connect (*this, invalidator (*this), boost::bind (&RouteUI::map_frozen, this), gui_context()); +#ifdef XXX_OLD_DESTRUCTIVE_API_XXX track()->TrackModeChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::track_mode_changed, this), gui_context()); +#endif track_mode_changed(); } - _route->PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::property_changed, this, _1), gui_context()); + _route->PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_property_changed, this, _1), gui_context()); + _route->presentation_info().PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_gui_changed, this, _1), gui_context ()); _route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::setup_invert_buttons, this), gui_context ()); - _route->gui_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_gui_changed, this, _1), gui_context ()); if (_session->writable() && is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast(_route); @@ -343,6 +357,7 @@ RouteUI::set_route (boost::shared_ptr rp) check_rec_enable_sensitivity (); maybe_add_route_print_mgr (); route_color_changed(); + route_gui_changed (PropertyChange (Properties::selected)); } void @@ -414,8 +429,7 @@ RouteUI::mute_press (GdkEventButton* ev) _mute_release->routes = copy; } - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (copy, &Route::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (copy, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::UseGroup); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { @@ -443,8 +457,7 @@ RouteUI::mute_press (GdkEventButton* ev) _mute_release->routes = rl; } - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (rl, &Route::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup); } } else { @@ -458,8 +471,7 @@ RouteUI::mute_press (GdkEventButton* ev) _mute_release->routes = rl; } - _session->set_control (_route->mute_control(), _route->muted_by_self() ? 0.0 : 1.0, Controllable::UseGroup); - + _route->mute_control()->set_value (!_route->muted_by_self(), Controllable::UseGroup); } } } @@ -471,8 +483,7 @@ bool RouteUI::mute_release (GdkEventButton* /*ev*/) { if (_mute_release){ - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_mute_release->routes, &Route::mute_control), _mute_release->active, Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (_mute_release->routes, &Stripable::mute_control), _mute_release->active, Controllable::UseGroup); delete _mute_release; _mute_release = 0; } @@ -571,8 +582,7 @@ RouteUI::solo_press(GdkEventButton* ev) _solo_release->routes = _session->get_routes (); } - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_session->get_routes(), &Route::solo_control), !_route->solo_control()->get_value(), Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_control), !_route->solo_control()->get_value(), Controllable::UseGroup); } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) { @@ -596,9 +606,7 @@ RouteUI::solo_press(GdkEventButton* ev) /* ??? we need a just_one_listen() method */ } else { DisplaySuspender ds; - boost::shared_ptr cl (new ControlList); - cl->push_back (_route->solo_control()); - _session->set_controls (cl, 1.0, Controllable::NoGroup); + _route->solo_control()->set_value (1.0, Controllable::NoGroup); } } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { @@ -643,9 +651,7 @@ RouteUI::solo_press(GdkEventButton* ev) _solo_release->routes = rl; } - DisplaySuspender ds; - - _session->set_controls (route_list_to_control_list (rl, &Route::solo_control), !_route->self_soloed(), Controllable::InverseGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::solo_control), !_route->self_soloed(), Controllable::InverseGroup); } delete _solo_release; @@ -662,8 +668,7 @@ RouteUI::solo_press(GdkEventButton* ev) _solo_release->routes = rl; } - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (rl, &Route::solo_control), !_route->self_soloed(), Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::solo_control), !_route->self_soloed(), Controllable::UseGroup); } } } @@ -679,8 +684,7 @@ RouteUI::solo_release (GdkEventButton* /*ev*/) if (_solo_release->exclusive) { } else { - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_solo_release->routes, &Route::solo_control), _solo_release->active ? 1.0 : 0.0, Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (_solo_release->routes, &Stripable::solo_control), _solo_release->active ? 1.0 : 0.0, Controllable::UseGroup); } delete _solo_release; @@ -726,8 +730,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_session->get_routes(), &Track::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::NoGroup); + _session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::NoGroup); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { @@ -742,8 +745,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) rl.reset (new RouteList); rl->push_back (_route); - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (rl, &Track::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::InverseGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::InverseGroup); } } else if (Keyboard::is_context_menu_event (ev)) { @@ -753,7 +755,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) } else { boost::shared_ptr trk = track(); - _session->set_control (trk->rec_enable_control(), !trk->rec_enable_control()->get_value(), Controllable::UseGroup); + trk->rec_enable_control()->set_value (!trk->rec_enable_control()->get_value(), Controllable::UseGroup); } } @@ -864,8 +866,7 @@ RouteUI::monitor_release (GdkEventButton* ev, MonitorChoice monitor_choice) rl->push_back (route()); } - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (rl, &Route::monitoring_control), (double) mc, Controllable::UseGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::UseGroup); return false; } @@ -896,8 +897,8 @@ RouteUI::build_record_menu () step_edit_item->set_active (midi_track()->step_editing()); } if (rec_safe_item) { - rec_safe_item->set_sensitive (!_route->record_enabled()); - rec_safe_item->set_active (_route->record_safe()); + rec_safe_item->set_sensitive (!_route->rec_enable_control()->get_value()); + rec_safe_item->set_active (_route->rec_safe_control()->get_value()); } } @@ -914,13 +915,21 @@ RouteUI::toggle_step_edit () void RouteUI::toggle_rec_safe () { - if (_route->record_enabled()) { + boost::shared_ptr rs = _route->rec_safe_control(); + + if (!rs) { return; } - DisplaySuspender ds; - boost::shared_ptr rl (new RouteList); - rl->push_back (_route); - _session->set_record_safe (rl, rec_safe_item->get_active (), Session::rt_cleanup); + + /* This check is made inside the control too, but dong it here can't + * hurt. + */ + + if (_route->rec_enable_control()->get_value()) { + return; + } + + rs->set_value (rec_safe_item->get_active (), Controllable::UseGroup); } void @@ -1114,15 +1123,22 @@ RouteUI::send_blink (bool onoff) } Gtkmm2ext::ActiveState -RouteUI::solo_active_state (boost::shared_ptr r) +RouteUI::solo_active_state (boost::shared_ptr s) { - if (!r->can_solo()) { + boost::shared_ptr sc = s->solo_control(); + + if (!sc) { return Gtkmm2ext::Off; } - if (r->self_soloed()) { + if (!sc->can_solo()) { + return Gtkmm2ext::Off; + } + + + if (sc->self_soloed()) { return Gtkmm2ext::ExplicitActive; - } else if (r->soloed_by_others()) { + } else if (sc->soloed_by_others()) { return Gtkmm2ext::ImplicitActive; } else { return Gtkmm2ext::Off; @@ -1130,13 +1146,19 @@ RouteUI::solo_active_state (boost::shared_ptr r) } Gtkmm2ext::ActiveState -RouteUI::solo_isolate_active_state (boost::shared_ptr r) +RouteUI::solo_isolate_active_state (boost::shared_ptr s) { - if (r->is_master() || r->is_monitor()) { + boost::shared_ptr sc = s->solo_isolate_control(); + + if (!sc) { + return Gtkmm2ext::Off; + } + + if (s->is_master() || s->is_monitor()) { return Gtkmm2ext::Off; } - if (r->solo_isolate_control()->solo_isolated()) { + if (sc->solo_isolated()) { return Gtkmm2ext::ExplicitActive; } else { return Gtkmm2ext::Off; @@ -1144,13 +1166,19 @@ RouteUI::solo_isolate_active_state (boost::shared_ptr r) } Gtkmm2ext::ActiveState -RouteUI::solo_safe_active_state (boost::shared_ptr r) +RouteUI::solo_safe_active_state (boost::shared_ptr s) { - if (r->is_master() || r->is_monitor()) { + boost::shared_ptr sc = s->solo_safe_control(); + + if (!sc) { return Gtkmm2ext::Off; } - if (r->solo_safe_control()->solo_safe()) { + if (s->is_master() || s->is_monitor()) { + return Gtkmm2ext::Off; + } + + if (sc->solo_safe()) { return Gtkmm2ext::ExplicitActive; } else { return Gtkmm2ext::Off; @@ -1172,28 +1200,28 @@ RouteUI::update_solo_display () solo_isolated_check->set_active (yn); } - set_button_names (); + set_button_names (); - if (solo_isolated_led) { - if (_route->solo_isolate_control()->solo_isolated()) { + if (solo_isolated_led) { + if (_route->solo_isolate_control()->solo_isolated()) { solo_isolated_led->set_active_state (Gtkmm2ext::ExplicitActive); } else { solo_isolated_led->unset_active_state (); } - } + } - if (solo_safe_led) { - if (_route->solo_safe_control()->solo_safe()) { + if (solo_safe_led) { + if (_route->solo_safe_control()->solo_safe()) { solo_safe_led->set_active_state (Gtkmm2ext::ExplicitActive); } else { solo_safe_led->unset_active_state (); } - } + } solo_button->set_active_state (solo_active_state (_route)); - /* some changes to solo status can affect mute display, so catch up - */ + /* some changes to solo status can affect mute display, so catch up + */ update_mute_display (); } @@ -1205,18 +1233,24 @@ RouteUI::solo_changed_so_update_mute () } ActiveState -RouteUI::mute_active_state (Session* s, boost::shared_ptr r) +RouteUI::mute_active_state (Session*, boost::shared_ptr s) { - if (r->is_monitor()) { - return ActiveState(0); + boost::shared_ptr mc = s->mute_control(); + + if (s->is_monitor()) { + return Gtkmm2ext::Off; + } + + if (!mc) { + return Gtkmm2ext::Off; } if (Config->get_show_solo_mutes() && !Config->get_solo_control_is_listen_control ()) { - if (r->mute_control()->muted_by_self ()) { + if (mc->muted_by_self ()) { /* full mute */ return Gtkmm2ext::ExplicitActive; - } else if (r->muted_by_others_soloing () || r->muted_by_masters ()) { + } else if (mc->muted_by_others_soloing () || mc->muted_by_masters ()) { /* this will reflect both solo mutes AND master mutes */ return Gtkmm2ext::ImplicitActive; } else { @@ -1226,10 +1260,10 @@ RouteUI::mute_active_state (Session* s, boost::shared_ptr r) } else { - if (r->mute_control()->muted_by_self()) { + if (mc->muted_by_self()) { /* full mute */ return Gtkmm2ext::ExplicitActive; - } else if (r->muted_by_masters ()) { + } else if (mc->muted_by_masters ()) { /* this shows only master mutes, not mute-by-others-soloing */ return Gtkmm2ext::ImplicitActive; } else { @@ -1251,47 +1285,17 @@ RouteUI::update_mute_display () mute_button->set_active_state (mute_active_state (_session, _route)); } -void -RouteUI::update_vca_display () -{ - if (!vca_button) { - return; - } - - VCAList vcas (_session->vca_manager().vcas()); - string label; - - for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { - if (_route->slaved_to (*v)) { - if (!label.empty()) { - label += ' '; - } - label += PBD::to_string ((*v)->number(), std::dec); - } - } - - if (label.empty()) { - label = _("-vca-"); - vca_button->set_active_state (Gtkmm2ext::Off); - } else { - vca_button->set_active_state (Gtkmm2ext::ExplicitActive); - } - - vca_button->set_text (label); -} void RouteUI::route_rec_enable_changed () { - blink_rec_display(true); //this lets the button change "immediately" rather than wait for the next blink - update_monitoring_display (); + blink_rec_display (true); //this lets the button change "immediately" rather than wait for the next blink } void RouteUI::session_rec_enable_changed () { - blink_rec_display(true); //this lets the button change "immediately" rather than wait for the next blink - update_monitoring_display (); + blink_rec_display (true); //this lets the button change "immediately" rather than wait for the next blink } void @@ -1475,12 +1479,10 @@ RouteUI::solo_isolate_button_release (GdkEventButton* ev) if (model) { /* disable isolate for all routes */ - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_session->get_routes(), &Route::solo_isolate_control), 0.0, Controllable::NoGroup); + _session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_isolate_control), 0.0, Controllable::NoGroup); } else { /* enable isolate for all routes */ - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (_session->get_routes(), &Route::solo_isolate_control), 1.0, Controllable::NoGroup); + _session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_isolate_control), 1.0, Controllable::NoGroup); } } else { @@ -1491,8 +1493,7 @@ RouteUI::solo_isolate_button_release (GdkEventButton* ev) boost::shared_ptr rl (new RouteList); rl->push_back (_route); - DisplaySuspender ds; - _session->set_controls (route_list_to_control_list (rl, &Route::solo_isolate_control), view ? 0.0 : 1.0, Controllable::NoGroup); + _session->set_controls (route_list_to_control_list (rl, &Stripable::solo_isolate_control), view ? 0.0 : 1.0, Controllable::NoGroup); } } } @@ -1563,10 +1564,11 @@ void RouteUI::choose_color () { bool picked; - Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &_color); + Gdk::Color c (gdk_color_from_rgba (_route->presentation_info().color())); + Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &c); if (picked) { - set_color(color); + set_color (gdk_color_to_rgba (color)); } } @@ -1574,22 +1576,9 @@ RouteUI::choose_color () * the route is in a group which shares its color with its routes. */ void -RouteUI::set_color (const Gdk::Color & c) +RouteUI::set_color (uint32_t c) { - /* leave _color alone in the group case so that tracks can retain their - * own pre-group colors. - */ - - char buf[64]; - _color = c; - snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue()); - - /* note: we use the route state ID here so that color is the same for both - the time axis view and the mixer strip - */ - - gui_object_state().set_property (route_state_id(), X_("color"), buf); - _route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ + _route->presentation_info().set_color (c); } /** @return GUI state ID for things that are common to the route in all its representations */ @@ -1602,21 +1591,11 @@ RouteUI::route_state_id () const int RouteUI::set_color_from_route () { - const string str = gui_object_state().get_string (route_state_id(), X_("color")); - - if (str.empty()) { - return 1; + if (_route->presentation_info().color_set()) { + return 0; /* nothing to do */ } - int r, g, b; - - sscanf (str.c_str(), "%d:%d:%d", &r, &g, &b); - - _color.set_red (r); - _color.set_green (g); - _color.set_blue (b); - - return 0; + return 1; /* pick a color */ } /** @return true if this name should be used for the route, otherwise false */ @@ -1684,14 +1663,6 @@ RouteUI::route_rename () } -void -RouteUI::property_changed (const PropertyChange& what_changed) -{ - if (what_changed.contains (ARDOUR::Properties::name)) { - name_label.set_text (_route->name()); - } -} - void RouteUI::toggle_comment_editor () { @@ -1856,12 +1827,6 @@ RouteUI::has_audio_outputs () const return (_route->n_outputs().n_audio() > 0); } -string -RouteUI::name() const -{ - return _route->name(); -} - void RouteUI::map_frozen () { @@ -1959,7 +1924,7 @@ RouteUI::check_rec_enable_sensitivity () } else { rec_enable_button->set_sensitive (true); } - if (_route && _route->record_safe ()) { + if (_route && _route->rec_safe_control () && _route->rec_safe_control()->get_value()) { rec_enable_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive)); } else { rec_enable_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive)); @@ -1976,6 +1941,8 @@ RouteUI::parameter_changed (string const & p) check_rec_enable_sensitivity (); } else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") { set_button_names (); + } else if (p == "session-monitoring") { + update_monitoring_display (); } else if (p == "auto-input") { update_monitoring_display (); } else if (p == "blink-rec-arm") { @@ -2013,61 +1980,6 @@ RouteUI::page_gain_down () _route->gain_control()->set_value (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.5), Controllable::UseGroup); } -void -RouteUI::open_remote_control_id_dialog () -{ - ArdourDialog dialog (_("Remote Control ID")); - SpinButton* spin = 0; - - dialog.get_vbox()->set_border_width (18); - - if (Config->get_remote_model() == UserOrdered) { - uint32_t const limit = _session->ntracks() + _session->nbusses () + 4; - - HBox* hbox = manage (new HBox); - hbox->set_spacing (6); - hbox->pack_start (*manage (new Label (_("Remote control ID:")))); - spin = manage (new SpinButton); - spin->set_digits (0); - spin->set_increments (1, 10); - spin->set_range (0, limit); - spin->set_value (_route->presentation_info().group_order()); - hbox->pack_start (*spin); - dialog.get_vbox()->pack_start (*hbox); - - dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL); - dialog.add_button (Stock::APPLY, RESPONSE_ACCEPT); - } else { - Label* l = manage (new Label()); - if (_route->is_master() || _route->is_monitor()) { - l->set_markup (string_compose (_("The remote control ID of %1 is: %2\n\n\n" - "The remote control ID of %3 cannot be changed."), - Gtkmm2ext::markup_escape_text (_route->name()), - _route->presentation_info().group_order(), - (_route->is_master() ? _("the master bus") : _("the monitor bus")))); - } else { - l->set_markup (string_compose (_("The remote control ID of %5 is: %2\n\n\n" - "Remote Control IDs are currently determined by track/bus ordering in %6.\n\n" - "%3Use the User Interaction tab of the Preferences window if you want to change this%4"), - (is_track() ? _("track") : _("bus")), - _route->presentation_info().group_order(), - "", - "", - Gtkmm2ext::markup_escape_text (_route->name()), - PROGRAM_NAME)); - } - dialog.get_vbox()->pack_start (*l); - dialog.add_button (Stock::OK, RESPONSE_CANCEL); - } - - dialog.show_all (); - int const r = dialog.run (); - - if (r == RESPONSE_ACCEPT && spin) { - _route->set_presentation_group_order_explicit (spin->get_value_as_int ()); - } -} - void RouteUI::setup_invert_buttons () { @@ -2103,9 +2015,9 @@ RouteUI::setup_invert_buttons () } if (N <= _max_invert_buttons) { - UI::instance()->set_tip (*b, string_compose (_("Left-click to invert (phase reverse) channel %1 of this track. Right-click to show menu."), i + 1)); + UI::instance()->set_tip (*b, string_compose (_("Left-click to invert polarity of channel %1 of this track. Right-click to show menu."), i + 1)); } else { - UI::instance()->set_tip (*b, _("Click to show a menu of channels for inversion (phase reverse)")); + UI::instance()->set_tip (*b, _("Click to show a menu of channels to invert polarity")); } _invert_buttons.push_back (b); @@ -2224,9 +2136,9 @@ RouteUI::request_redraw () /** The Route's gui_changed signal has been emitted */ void -RouteUI::route_gui_changed (string what_changed) +RouteUI::route_gui_changed (PropertyChange const& what_changed) { - if (what_changed == "color") { + if (what_changed.contains (Properties::color)) { if (set_color_from_route () == 0) { route_color_changed (); } @@ -2252,18 +2164,55 @@ RouteUI::track_mode_changed (void) /** @return the color that this route should use; it maybe its own, or it maybe that of its route group. */ + Gdk::Color -RouteUI::color () const +RouteUI::route_color () const { + Gdk::Color c; RouteGroup* g = _route->route_group (); + string p; if (g && g->is_color()) { - Gdk::Color c; set_color_from_rgba (c, GroupTabs::group_color (g)); - return c; + } else { + + /* deal with older 4.x color, which was stored in the GUI object state */ + + string p = ARDOUR_UI::instance()->gui_object_state->get_string (route_state_id(), X_("color")); + + if (!p.empty()) { + + /* old v4.x or earlier session. Use this information */ + + int red, green, blue; + char colon; + + stringstream ss (p); + + /* old color format version was: + + 16bit value for red:16 bit value for green:16 bit value for blue + + decode to rgb .. + */ + + ss >> red; + ss >> colon; + ss >> green; + ss >> colon; + ss >> blue; + + red >>= 2; + green >>= 2; + blue >>= 2; + + _route->presentation_info().set_color (RGBA_TO_UINT (red, green, blue, 255)); + } + + set_color_from_rgba (c, _route->presentation_info().color()); } - return _color; + return c; } void @@ -2341,6 +2290,7 @@ RoutePinWindowProxy::route_going_away () _window = 0; WM::Manager::instance().remove (this); going_away_connection.disconnect(); + delete this; } void @@ -2378,3 +2328,111 @@ RouteUI::manage_pins () proxy->present(); } } + +void +RouteUI::fan_out (bool to_busses, bool group) +{ + DisplaySuspender ds; + boost::shared_ptr route = _route; + boost::shared_ptr pi = boost::dynamic_pointer_cast (route->the_instrument ()); + assert (pi); + + const uint32_t n_outputs = pi->output_streams ().n_audio (); + if (route->n_outputs ().n_audio () != n_outputs) { + MessageDialog msg (string_compose ( + _("The Plugin's number of audio outputs ports (%1) does not match the Tracks's number of audio outputs (%2). Cannot fan out."), + n_outputs, route->n_outputs ().n_audio ())); + msg.run (); + return; + } + +#define BUSNAME pd.group_name + "(" + route->name () + ")" + + /* count busses and channels/bus */ + boost::shared_ptr plugin = pi->plugin (); + std::map busnames; + for (uint32_t p = 0; p < n_outputs; ++p) { + const Plugin::IOPortDescription& pd (plugin->describe_io_port (DataType::AUDIO, false, p)); + std::string bn = BUSNAME; + busnames[bn]++; + } + + if (busnames.size () < 2) { + MessageDialog msg (_("Instrument has only 1 output bus. Nothing to fan out.")); + msg.run (); + return; + } + + uint32_t outputs = 2; + if (_session->master_out ()) { + outputs = std::max (outputs, _session->master_out ()->n_inputs ().n_audio ()); + } + + route->output ()->disconnect (this); + route->panner_shell ()->set_bypassed (true); + + RouteList to_group; + for (uint32_t p = 0; p < n_outputs; ++p) { + const Plugin::IOPortDescription& pd (plugin->describe_io_port (DataType::AUDIO, false, p)); + std::string bn = BUSNAME; + boost::shared_ptr r = _session->route_by_name (bn); + if (!r) { + if (to_busses) { + RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order); + r = rl.front (); + assert (r); + } else { + list > tl = + _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal); + r = tl.front (); + assert (r); + + boost::shared_ptr cl (new ControlList); + cl->push_back (r->monitoring_control ()); + _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup); + } + r->input ()->disconnect (this); + } + to_group.push_back (r); + route->output ()->audio (p)->connect (r->input ()->audio (pd.group_channel).get()); + } +#undef BUSNAME + + if (group) { + RouteGroup* rg = NULL; + const std::list& rgs (_session->route_groups ()); + for (std::list::const_iterator i = rgs.begin (); i != rgs.end (); ++i) { + if ((*i)->name () == pi->name ()) { + rg = *i; + break; + } + } + if (!rg) { + rg = new RouteGroup (*_session, pi->name ()); + _session->add_route_group (rg); + rg->set_gain (false); + } + + GroupTabs::set_group_color (rg, route->presentation_info().color()); + for (RouteList::const_iterator i = to_group.begin(); i != to_group.end(); ++i) { + rg->add (*i); + } + } +} + +bool +RouteUI::mark_hidden (bool yn) +{ + if (yn != _route->presentation_info().hidden()) { + _route->presentation_info().set_hidden (yn); + return true; // things changed + } + return false; +} + +boost::shared_ptr +RouteUI::stripable () const +{ + return _route; +} +