X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_ui.cc;h=447f359187ad119d9da36ce2da2757df081d754f;hb=18f465393b29c98904a2140132131950963c36b1;hp=552439b99342af6b0e5f12b16af60e43b4325427;hpb=8f078d7fd40878d08ad4d048f0606a27901c7475;p=ardour.git diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 552439b993..447f359187 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -46,16 +46,13 @@ #include "route_time_axis.h" #include "group_tabs.h" -#include "ardour/route.h" -#include "ardour/event_type_map.h" -#include "ardour/session.h" -#include "ardour/audioengine.h" #include "ardour/audio_track.h" +#include "ardour/audioengine.h" +#include "ardour/filename_extensions.h" #include "ardour/midi_track.h" +#include "ardour/route.h" +#include "ardour/session.h" #include "ardour/template_utils.h" -#include "ardour/filename_extensions.h" -#include "ardour/directory_names.h" -#include "ardour/profile.h" #include "i18n.h" using namespace Gtk; @@ -123,20 +120,21 @@ RouteUI::init () rec_enable_button = manage (new ArdourButton); rec_enable_button->set_name ("record enable button"); + rec_enable_button->set_tweaks (ArdourButton::ImplicitUsesSolidColor); UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), ""); show_sends_button = manage (new ArdourButton); 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::led_default_elements)); - monitor_input_button->set_name ("monitor"); + monitor_input_button = manage (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::led_default_elements)); - monitor_disk_button->set_name ("monitor"); + + monitor_disk_button = manage (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"), ""); monitor_disk_button->set_no_show_all (true); @@ -145,8 +143,8 @@ RouteUI::init () _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context()); _session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context()); - _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context()); - Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context()); + _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()); 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); @@ -210,7 +208,7 @@ RouteUI::set_route (boost::shared_ptr rp) solo_button->set_controllable (_route->solo_control()); _route->active_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_active_changed, this), gui_context()); - _route->mute_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::mute_changed, this, _1), gui_context()); + _route->mute_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::mute_changed, this, _1), gui_context()); _route->solo_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->solo_safe_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); @@ -218,10 +216,10 @@ RouteUI::set_route (boost::shared_ptr rp) _route->solo_isolated_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->phase_invert_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_changed, this), gui_context()); - _route->PropertyChanged.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::property_changed, this, _1), gui_context()); + _route->PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::property_changed, this, _1), gui_context()); - _route->io_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::setup_invert_buttons, this), gui_context ()); - _route->gui_changed.connect (route_connections, invalidator (*this), ui_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); @@ -235,7 +233,7 @@ RouteUI::set_route (boost::shared_ptr rp) if (is_midi_track()) { midi_track()->StepEditStatusChange.connect (route_connections, invalidator (*this), - ui_bind (&RouteUI::step_edit_changed, this, _1), gui_context()); + boost::bind (&RouteUI::step_edit_changed, this, _1), gui_context()); } } @@ -265,6 +263,9 @@ RouteUI::set_route (boost::shared_ptr rp) boost::shared_ptr s = _showing_sends_to.lock (); bus_send_display_changed (s); + + update_mute_display (); + update_solo_display (); } void @@ -385,7 +386,8 @@ RouteUI::solo_press(GdkEventButton* ev) if (Keyboard::is_context_menu_event (ev)) { - if (!solo_isolated_led) { + if (! (solo_isolated_led && solo_isolated_led->is_visible()) || + ! (solo_safe_led && solo_safe_led->is_visible())) { if (solo_menu == 0) { build_solo_menu (); @@ -539,10 +541,11 @@ RouteUI::rec_enable_press(GdkEventButton* ev) if (is_midi_track()) { - /* cannot rec-enable while step-editing */ + /* rec-enable button exits from step editing */ if (midi_track()->step_editing()) { - return true; + midi_track()->set_step_editing (false); + return true; } } @@ -603,20 +606,20 @@ RouteUI::update_monitoring_display () MonitorState ms = t->monitoring_state(); if (t->monitoring_choice() & MonitorInput) { - monitor_input_button->set_active_state (Gtkmm2ext::Active); + monitor_input_button->set_active_state (Gtkmm2ext::ExplicitActive); } else { if (ms & MonitoringInput) { - monitor_input_button->set_active_state (Gtkmm2ext::Mid); + monitor_input_button->set_active_state (Gtkmm2ext::ImplicitActive); } else { monitor_input_button->unset_active_state (); } } if (t->monitoring_choice() & MonitorDisk) { - monitor_disk_button->set_active_state (Gtkmm2ext::Active); + monitor_disk_button->set_active_state (Gtkmm2ext::ExplicitActive); } else { if (ms & MonitoringDisk) { - monitor_disk_button->set_active_state (Gtkmm2ext::Mid); + monitor_disk_button->set_active_state (Gtkmm2ext::ImplicitActive); } else { monitor_disk_button->unset_active_state (); } @@ -624,7 +627,7 @@ RouteUI::update_monitoring_display () } bool -RouteUI::monitor_input_press(GdkEventButton* ev) +RouteUI::monitor_input_press(GdkEventButton*) { return true; } @@ -636,7 +639,7 @@ RouteUI::monitor_input_release(GdkEventButton* ev) } bool -RouteUI::monitor_disk_press (GdkEventButton* ev) +RouteUI::monitor_disk_press (GdkEventButton*) { return true; } @@ -739,7 +742,7 @@ RouteUI::step_edit_changed (bool yn) { if (yn) { if (rec_enable_button) { - rec_enable_button->set_active_state (Active); + rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive); } start_step_editing (); @@ -918,7 +921,7 @@ RouteUI::send_blink (bool onoff) } if (onoff) { - show_sends_button->set_active_state (Gtkmm2ext::Active); + show_sends_button->set_active_state (Gtkmm2ext::ExplicitActive); } else { show_sends_button->unset_active_state (); } @@ -928,27 +931,27 @@ Gtkmm2ext::ActiveState RouteUI::solo_active_state (boost::shared_ptr r) { if (r->is_master() || r->is_monitor()) { - return ActiveState (0); + return Gtkmm2ext::Off; } if (Config->get_solo_control_is_listen_control()) { if (r->listening_via_monitor()) { - return Active; + return Gtkmm2ext::ExplicitActive; } else { - return ActiveState (0); + return Gtkmm2ext::Off; } } if (r->soloed()) { if (!r->self_soloed()) { - return Mid; + return Gtkmm2ext::ImplicitActive; } else { - return Active; + return Gtkmm2ext::ExplicitActive; } } else { - return ActiveState(0); + return Gtkmm2ext::Off; } } @@ -956,13 +959,13 @@ Gtkmm2ext::ActiveState RouteUI::solo_isolate_active_state (boost::shared_ptr r) { if (r->is_master() || r->is_monitor()) { - return ActiveState (0); + return Gtkmm2ext::Off; } if (r->solo_isolated()) { - return Active; + return Gtkmm2ext::ExplicitActive; } else { - return ActiveState(0); + return Gtkmm2ext::Off; } } @@ -970,43 +973,19 @@ Gtkmm2ext::ActiveState RouteUI::solo_safe_active_state (boost::shared_ptr r) { if (r->is_master() || r->is_monitor()) { - return ActiveState (0); + return Gtkmm2ext::Off; } if (r->solo_safe()) { - return Active; + return Gtkmm2ext::ExplicitActive; } else { - return ActiveState (0); + return Gtkmm2ext::Off; } } void RouteUI::update_solo_display () { - bool x; - - if (Config->get_solo_control_is_listen_control()) { - - if ((bool) solo_button->active_state() != (x = _route->listening_via_monitor())) { - ++_i_am_the_modifier; - solo_button->set_active_state (Active); - --_i_am_the_modifier; - } - - } else { - - if ((bool) solo_button->active_state() != (x = _route->soloed())) { - ++_i_am_the_modifier; - if (x) { - solo_button->set_active_state (Active); - } else { - solo_button->unset_active_state(); - } - --_i_am_the_modifier; - } - - } - bool yn = _route->solo_safe (); if (solo_safe_check && solo_safe_check->get_active() != yn) { @@ -1023,7 +1002,7 @@ RouteUI::update_solo_display () if (solo_isolated_led) { if (_route->solo_isolated()) { - solo_isolated_led->set_active_state (Gtkmm2ext::Active); + solo_isolated_led->set_active_state (Gtkmm2ext::ExplicitActive); } else { solo_isolated_led->unset_active_state (); } @@ -1031,7 +1010,7 @@ RouteUI::update_solo_display () if (solo_safe_led) { if (_route->solo_safe()) { - solo_safe_led->set_active_state (Gtkmm2ext::Active); + solo_safe_led->set_active_state (Gtkmm2ext::ExplicitActive); } else { solo_safe_led->unset_active_state (); } @@ -1060,7 +1039,7 @@ RouteUI::mute_changed(void* /*src*/) ActiveState RouteUI::mute_active_state (Session* s, boost::shared_ptr r) { - if (r->is_master() || r->is_monitor()) { + if (r->is_monitor()) { return ActiveState(0); } @@ -1069,22 +1048,23 @@ RouteUI::mute_active_state (Session* s, boost::shared_ptr r) if (r->muted ()) { /* full mute */ - return Active; - } else if (s->soloing() && !r->soloed() && !r->solo_isolated()) { - return Mid; + return Gtkmm2ext::ExplicitActive; + } else if (!r->is_master() && s->soloing() && !r->soloed() && !r->solo_isolated()) { + /* master is NEVER muted by others */ + return Gtkmm2ext::ImplicitActive; } else { /* no mute at all */ - return ActiveState(0); + return Gtkmm2ext::Off; } } else { if (r->muted()) { /* full mute */ - return Active; + return Gtkmm2ext::ExplicitActive; } else { /* no mute at all */ - return ActiveState(0); + return Gtkmm2ext::Off; } } @@ -1125,12 +1105,12 @@ RouteUI::update_rec_display () if (_route->record_enabled()) { switch (_session->record_status ()) { case Session::Recording: - rec_enable_button->set_active_state (Active); + rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive); break; case Session::Disabled: case Session::Enabled: - rec_enable_button->set_active_state (Mid); + rec_enable_button->set_active_state (Gtkmm2ext::ImplicitActive); break; } @@ -1305,10 +1285,13 @@ RouteUI::solo_isolate_button_release (GdkEventButton* ev) } bool -RouteUI::solo_safe_button_release (GdkEventButton*) +RouteUI::solo_safe_button_release (GdkEventButton* ev) { - _route->set_solo_safe (!solo_safe_led->active_state(), this); - return true; + if (ev->button == 1) { + _route->set_solo_safe (!solo_safe_led->active_state(), this); + return true; + } + return false; } void @@ -1362,7 +1345,7 @@ RouteUI::set_color (const Gdk::Color & c) the time axis view and the mixer strip */ - gui_object_state().set (route_state_id(), X_("color"), buf); + gui_object_state().set_property (route_state_id(), X_("color"), buf); _route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ } @@ -1507,6 +1490,9 @@ RouteUI::route_rename () done = true; } break; + default: + done = true; + break; } } @@ -1643,14 +1629,14 @@ RouteUI::adjust_latency () void RouteUI::save_as_template () { - sys::path path; + std::string path; std::string safe_name; string name; path = ARDOUR::user_route_template_directory (); - if (g_mkdir_with_parents (path.to_string().c_str(), 0755)) { - error << string_compose (_("Cannot create route template directory %1"), path.to_string()) << endmsg; + if (g_mkdir_with_parents (path.c_str(), 0755)) { + error << string_compose (_("Cannot create route template directory %1"), path) << endmsg; return; } @@ -1672,9 +1658,9 @@ RouteUI::save_as_template () safe_name = legalize_for_path (name); safe_name += template_suffix; - path /= safe_name; + path = Glib::build_filename (path, safe_name); - _route->save_as_template (path.to_string(), name); + _route->save_as_template (path, name); } void @@ -1731,27 +1717,53 @@ void RouteUI::open_remote_control_id_dialog () { ArdourDialog dialog (_("Remote Control ID")); + SpinButton* spin = 0; - uint32_t const limit = _session->ntracks() + _session->nbusses () + 4; + dialog.get_vbox()->set_border_width (18); - HBox* hbox = manage (new HBox); - hbox->set_spacing (6); - hbox->pack_start (*manage (new Label (_("Remote control ID:")))); - SpinButton* spin = manage (new SpinButton); - spin->set_digits (0); - spin->set_increments (1, 10); - spin->set_range (0, limit); - spin->set_value (_route->remote_control_id()); - hbox->pack_start (*spin); - dialog.get_vbox()->pack_start (*hbox); - - dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL); - dialog.add_button (Stock::APPLY, RESPONSE_ACCEPT); + 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->remote_control_id()); + 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."), + Glib::Markup::escape_text (_route->name()), + _route->remote_control_id(), + (_route->is_master() ? _("the master bus") : _("the monitor bus")))); + } else { + l->set_markup (string_compose (_("The remote control ID of %6 is: %3\n\n\n" + "Remote Control IDs are currently determined by track/bus ordering in %1\n\n" + "%4Use the User Interaction tab of the Preferences window if you want to change this%5"), + (Config->get_remote_model() == MixerOrdered ? _("the mixer") : ("the editor")), + (is_track() ? _("track") : _("bus")), + _route->remote_control_id(), + "", + "", + Glib::Markup::escape_text (_route->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) { + if (r == RESPONSE_ACCEPT && spin) { _route->set_remote_control_id (spin->get_value_as_int ()); } } @@ -1760,7 +1772,7 @@ void RouteUI::setup_invert_buttons () { /* remove old invert buttons */ - for (list::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i) { + for (vector::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i) { _invert_button_box.remove (**i); } @@ -1775,27 +1787,33 @@ RouteUI::setup_invert_buttons () uint32_t const to_add = (N <= _max_invert_buttons) ? N : 1; for (uint32_t i = 0; i < to_add; ++i) { - BindableToggleButton* b = manage (new BindableToggleButton); - b->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::invert_toggled), i, b)); + ArdourButton* b = manage (new ArdourButton); + b->set_size_request(20,20); b->signal_button_press_event().connect (sigc::mem_fun (*this, &RouteUI::invert_press)); + b->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::invert_release), i)); - b->set_name (X_("MixerInvertButton")); + b->set_name (X_("invert button")); if (to_add == 1) { - b->add (*manage (new Label (X_("Ø")))); + if (N > 1) { + b->set_text (string_compose (X_("Ø (%1)"), N)); + } else { + b->set_text (X_("Ø")); + } } else { - b->add (*manage (new Label (string_compose (X_("Ø%1"), i + 1)))); + b->set_text (string_compose (X_("Ø%1"), i + 1)); } - if (N <= 4) { + 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)); } else { - UI::instance()->set_tip (*b, string_compose (_("Left-click to invert (phase reverse) all channels of this track. Right-click to show menu."), i + 1)); + UI::instance()->set_tip (*b, _("Click to show a menu of channels for inversion (phase reverse)")); } _invert_buttons.push_back (b); _invert_button_box.pack_start (*b); } + _invert_button_box.set_spacing (1); _invert_button_box.show_all (); } @@ -1806,53 +1824,69 @@ RouteUI::set_invert_button_state () uint32_t const N = _route->input()->n_ports().n_audio(); if (N > _max_invert_buttons) { - _invert_buttons.front()->set_active (_route->phase_invert().any()); - --_i_am_the_modifier; - return; - } - int j = 0; - for (list::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i, ++j) { - (*i)->set_active (_route->phase_invert (j)); + /* One button for many channels; explicit active if all channels are inverted, + implicit active if some are, off if none are. + */ + + ArdourButton* b = _invert_buttons.front (); + + if (_route->phase_invert().count() == _route->phase_invert().size()) { + b->set_active_state (Gtkmm2ext::ExplicitActive); + } else if (_route->phase_invert().any()) { + b->set_active_state (Gtkmm2ext::ImplicitActive); + } else { + b->set_active_state (Gtkmm2ext::Off); + } + + } else { + + /* One button per channel; just set active */ + + int j = 0; + for (vector::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i, ++j) { + (*i)->set_active (_route->phase_invert (j)); + } + } --_i_am_the_modifier; } -void -RouteUI::invert_toggled (uint32_t i, BindableToggleButton* b) -{ - if (_i_am_the_modifier) { - return; - } - - uint32_t const N = _route->input()->n_ports().n_audio(); - if (N <= _max_invert_buttons) { - _route->set_phase_invert (i, b->get_active ()); - } else { - boost::dynamic_bitset<> p (N); - if (b->get_active ()) { - p.set (); +bool +RouteUI::invert_release (GdkEventButton* ev, uint32_t i) +{ + if (ev->button == 1 && i < _invert_buttons.size()) { + uint32_t const N = _route->input()->n_ports().n_audio (); + if (N <= _max_invert_buttons) { + /* left-click inverts phase so long as we have a button per channel */ + _route->set_phase_invert (i, !_invert_buttons[i]->get_active()); + return true; } - _route->set_phase_invert (p); } + return false; } + bool RouteUI::invert_press (GdkEventButton* ev) { using namespace Menu_Helpers; - if (ev->button != 3) { + uint32_t const N = _route->input()->n_ports().n_audio(); + if (N <= _max_invert_buttons && ev->button != 3) { + /* If we have an invert button per channel, we only pop + up a menu on right-click; left click is handled + on release. + */ return true; } - + delete _invert_menu; _invert_menu = new Menu; _invert_menu->set_name ("ArdourContextMenu"); MenuList& items = _invert_menu->items (); - uint32_t const N = _route->input()->n_ports().n_audio(); for (uint32_t i = 0; i < N; ++i) { items.push_back (CheckMenuElem (string_compose (X_("Ø%1"), i + 1), sigc::bind (sigc::mem_fun (*this, &RouteUI::invert_menu_toggled), i))); CheckMenuItem* e = dynamic_cast (&items.back ()); @@ -1879,7 +1913,7 @@ RouteUI::invert_menu_toggled (uint32_t c) void RouteUI::set_invert_sensitive (bool yn) { - for (list::iterator b = _invert_buttons.begin(); b != _invert_buttons.end(); ++b) { + for (vector::iterator b = _invert_buttons.begin(); b != _invert_buttons.end(); ++b) { (*b)->set_sensitive (yn); } } @@ -1929,10 +1963,10 @@ void RouteUI::bus_send_display_changed (boost::shared_ptr send_to) { if (_route == send_to) { - show_sends_button->set_active_state (Gtkmm2ext::Active); + show_sends_button->set_active (true); send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun (*this, &RouteUI::send_blink)); } else { - show_sends_button->unset_active_state (); + show_sends_button->set_active (false); send_blink_connection.disconnect (); } }