+
+void
+RouteUI::check_rec_enable_sensitivity ()
+{
+ if (_session->transport_rolling() && rec_enable_button->get_active() && Config->get_disable_disarm_during_roll()) {
+ rec_enable_button->set_sensitive (false);
+ } else {
+ rec_enable_button->set_sensitive (true);
+ }
+}
+
+void
+RouteUI::parameter_changed (string const & p)
+{
+ if (p == "disable-disarm-during-roll") {
+ check_rec_enable_sensitivity ();
+ } else if (p == "solo-control-is-listen-control") {
+ set_button_names ();
+ } else if (p == "listen-position") {
+ set_button_names ();
+ }
+}
+
+void
+RouteUI::step_gain_up ()
+{
+ _route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.1), this);
+}
+
+void
+RouteUI::page_gain_up ()
+{
+ _route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.5), this);
+}
+
+void
+RouteUI::step_gain_down ()
+{
+ _route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.1), this);
+}
+
+void
+RouteUI::page_gain_down ()
+{
+ _route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.5), this);
+}
+
+void
+RouteUI::open_remote_control_id_dialog ()
+{
+ ArdourDialog dialog (_("Remote Control ID"));
+
+ 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:"))));
+ 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);
+
+ dialog.show_all ();
+ int const r = dialog.run ();
+
+ if (r == RESPONSE_ACCEPT) {
+ _route->set_remote_control_id (spin->get_value_as_int ());
+ }
+}
+
+void
+RouteUI::setup_invert_buttons ()
+{
+ /* remove old invert buttons */
+ for (list<BindableToggleButton*>::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i) {
+ _invert_button_box.remove (**i);
+ }
+
+ _invert_buttons.clear ();
+
+ if (!_route || !_route->input()) {
+ return;
+ }
+
+ uint32_t const N = _route->input()->n_ports().n_audio ();
+
+ 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));
+ b->signal_button_press_event().connect (sigc::mem_fun (*this, &RouteUI::invert_press));
+
+ b->set_name (X_("MixerInvertButton"));
+ if (to_add == 1) {
+ b->add (*manage (new Label (X_("Ø"))));
+ } else {
+ b->add (*manage (new Label (string_compose (X_("Ø%1"), i + 1))));
+ }
+
+ if (N <= 4) {
+ 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));
+ }
+
+ _invert_buttons.push_back (b);
+ _invert_button_box.pack_start (*b);
+ }
+
+ _invert_button_box.show_all ();
+}
+
+void
+RouteUI::set_invert_button_state ()
+{
+ ++_i_am_the_modifier;
+
+ 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<BindableToggleButton*>::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 ();
+ }
+ _route->set_phase_invert (p);
+ }
+}
+
+bool
+RouteUI::invert_press (GdkEventButton* ev)
+{
+ using namespace Menu_Helpers;
+
+ if (ev->button != 3) {
+ 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<CheckMenuItem*> (&items.back ());
+ ++_i_am_the_modifier;
+ e->set_active (_route->phase_invert (i));
+ --_i_am_the_modifier;
+ }
+
+ _invert_menu->popup (0, ev->time);
+
+ return false;
+}
+
+void
+RouteUI::invert_menu_toggled (uint32_t c)
+{
+ if (_i_am_the_modifier) {
+ return;
+ }
+
+ _route->set_phase_invert (c, !_route->phase_invert (c));
+}