...use shared backend function instead
[ardour.git] / gtk2_ardour / mixer_strip.cc
index df7621b8eae199720e022f0fb4c38ea8b61b4bcf..8bdeb5a631497fda20f4cb6ed2176c3b528b412a 100644 (file)
@@ -501,8 +501,10 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
                }
                if (monitor_section_button == 0) {
                        Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMonitorSection");
+                       _session->MonitorChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::monitor_changed, this), gui_context());
+
                        monitor_section_button = manage (new ArdourButton);
-                       monitor_section_button->set_name ("master monitor section button");
+                       monitor_changed ();
                        monitor_section_button->set_related_action (act);
                        set_tooltip (monitor_section_button, _("Show/Hide Monitoring Section"));
                        mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1);
@@ -635,7 +637,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        update_mute_display ();
        update_solo_display ();
        name_changed ();
-       comment_changed (0);
+       comment_changed ();
        route_group_changed ();
 
        connect_to_pan ();
@@ -872,15 +874,17 @@ MixerStrip::output_press (GdkEventButton *ev)
                        citems.pop_back ();
                }
 
-               citems.push_back (SeparatorElem());
+               if (!ARDOUR::Profile->get_mixbus()) {
+                       citems.push_back (SeparatorElem());
 
-               for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
-                       citems.push_back (
-                               MenuElem (
-                                       string_compose (_("Add %1 port"), (*i).to_i18n_string()),
-                                       sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_output_port), *i)
-                                       )
-                               );
+                       for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
+                               citems.push_back (
+                                               MenuElem (
+                                                       string_compose (_("Add %1 port"), (*i).to_i18n_string()),
+                                                       sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_output_port), *i)
+                                                       )
+                                               );
+                       }
                }
 
                citems.push_back (SeparatorElem());
@@ -1353,13 +1357,16 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
                set_tooltip (&output_button, tooltip_cstr);
        }
 
+       delete [] tooltip_cstr;
+
        if (each_io_has_one_connection) {
                if (total_connection_count == ardour_connection_count) {
                        // all connections are to the same track in ardour
                        // "ardour:Master/" -> "Master"
                        string::size_type slash = ardour_track_name.find("/");
                        if (slash != string::npos) {
-                               label << ardour_track_name.substr(7, slash - 7);
+                               const size_t ppps = RouteUI::program_port_prefix.size (); // "ardour:"
+                               label << ardour_track_name.substr (ppps, slash - ppps);
                                have_label = true;
                        }
                }
@@ -1585,8 +1592,20 @@ MixerStrip::build_route_ops_menu ()
        i->set_sensitive(! _session->transport_rolling());
        i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
 
-       items.push_back (SeparatorElem());
+       if (!Profile->get_mixbus ()) {
+               items.push_back (SeparatorElem());
+               items.push_back (CheckMenuElem (_("Strict I/O")));
+               i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
+               i->set_active (_route->strict_io());
+               i->signal_activate().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*_route, &Route::set_strict_io), !_route->strict_io())));
+       }
 
+       if (1 /* TODO IFF >= 1 plugin-insert */) {
+               items.push_back (SeparatorElem());
+               items.push_back (MenuElem (_("Pin Connections..."), sigc::mem_fun (*this, &RouteUI::manage_pins)));
+       }
+
+       items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
 
        items.push_back (SeparatorElem());
@@ -1594,10 +1613,8 @@ MixerStrip::build_route_ops_menu ()
        denormal_menu_item = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
        denormal_menu_item->set_active (_route->denormal_protection());
 
-       if (!Profile->get_sae()) {
-               items.push_back (SeparatorElem());
-               items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
-       }
+       items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
 
        if (_route) {
                /* note that this relies on selection being shared across editor and
@@ -1948,6 +1965,18 @@ MixerStrip::meter_point_string (MeterPoint mp)
        return string();
 }
 
+/** Called when the monitor-section state */
+void
+MixerStrip::monitor_changed ()
+{
+       assert (monitor_section_button);
+       if (_session->monitor_active()) {
+               monitor_section_button->set_name ("master monitor section button active");
+       } else {
+               monitor_section_button->set_name ("master monitor section button normal");
+       }
+}
+
 /** Called when the metering point has changed */
 void
 MixerStrip::meter_changed ()
@@ -2024,7 +2053,7 @@ MixerStrip::show_send (boost::shared_ptr<Send> send)
        send->set_metering (true);
        _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
 
-       gain_meter().set_controls (_route, send->meter(), send->amp());
+       gain_meter().set_controls (_route, send->meter(), send->amp(), send->gain_control());
        gain_meter().setup_meters ();
 
        uint32_t const in = _current_delivery->pans_required();
@@ -2063,7 +2092,7 @@ MixerStrip::revert_to_default_display ()
 
        set_current_delivery (_route->main_outs ());
 
-       gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
+       gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp(), _route->gain_control());
        gain_meter().setup_meters ();
 
        panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());