first compiling, mostly working version of group controls changes
[ardour.git] / gtk2_ardour / mixer_strip.cc
index f3ae79dc1fcfbdf257c77bf15c3b81f540beb822..64b4494bac8e11f62b47a389b03e11f7bc12256c 100644 (file)
@@ -96,6 +96,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
        , mute_solo_table (1, 2)
        , bottom_button_table (1, 3)
        , meter_point_button (_("pre"))
+       , monitor_section_button (0)
        , midi_input_enable_button (0)
        , _comment_button (_("Comments"))
        , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
@@ -126,6 +127,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
        , mute_solo_table (1, 2)
        , bottom_button_table (1, 3)
        , meter_point_button (_("pre"))
+       , monitor_section_button (0)
        , midi_input_enable_button (0)
        , _comment_button (_("Comments"))
        , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
@@ -491,13 +493,25 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        }
 
        if (route()->is_master()) {
-               mute_solo_table.attach (*mute_button, 0, 2, 0, 1);
                solo_button->hide ();
                mute_button->show ();
                rec_mon_table.hide ();
                if (solo_iso_table.get_parent()) {
                        solo_iso_table.get_parent()->remove(solo_iso_table);
                }
+               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_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);
+                       monitor_section_button->show();
+                       monitor_section_button->unset_flags (Gtk::CAN_FOCUS);
+               }
+               parameter_changed ("use-monitor-bus");
        } else {
                bottom_button_table.attach (group_button, 1, 2, 0, 1);
                mute_solo_table.attach (*mute_button, 0, 1, 0, 1);
@@ -623,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 ();
@@ -669,6 +683,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        gpm.gain_automation_state_button.show();
 
        parameter_changed ("mixer-element-visibility");
+       map_frozen();
 
        show ();
 }
@@ -1252,7 +1267,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt
                                                << Gtkmm2ext::markup_escape_text ( pn.empty() ? connection_name : pn );
                                }
 
-                               if (connection_name.find("ardour:") == 0) {
+                               if (connection_name.find(RouteUI::program_port_prefix) == 0) {
                                        if (ardour_track_name.empty()) {
                                                // "ardour:Master/in 1" -> "ardour:Master/"
                                                string::size_type slash = connection_name.find("/");
@@ -1473,7 +1488,7 @@ MixerStrip::setup_comment_button ()
        }
 
        set_tooltip (
-               _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
+               _comment_button, _route->comment().empty() ? _("Click to add/edit comments") : _route->comment()
                );
 
 }
@@ -1599,8 +1614,13 @@ MixerStrip::build_route_ops_menu ()
                                selection.set (rtav);
                        }
 
-                       items.push_front (SeparatorElem());
-                       items.push_front (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
+                       if (!_route->is_master()) {
+                               items.push_back (SeparatorElem());
+                               items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes)));
+                       }
+       
+                       items.push_back (SeparatorElem());
+                       items.push_back (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
                }
        }
 }
@@ -1800,6 +1820,8 @@ MixerStrip::map_frozen ()
                        // XXX need some way, maybe, to retoggle redirect editors
                        break;
                }
+       } else {
+               processor_box.set_sensitive (true);
        }
 }
 
@@ -1928,6 +1950,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 ()
@@ -2068,6 +2102,9 @@ MixerStrip::set_button_names ()
                mute_button->set_text (_("Mute"));
                monitor_input_button->set_text (_("In"));
                monitor_disk_button->set_text (_("Disk"));
+               if (monitor_section_button) {
+                       monitor_section_button->set_text (_("Mon"));
+               }
 
                if (_route && _route->solo_safe()) {
                        solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive));
@@ -2094,6 +2131,9 @@ MixerStrip::set_button_names ()
                mute_button->set_text (S_("Mute|M"));
                monitor_input_button->set_text (S_("MonitorInput|I"));
                monitor_disk_button->set_text (S_("MonitorDisk|D"));
+               if (monitor_section_button) {
+                       monitor_section_button->set_text (S_("Mon|O"));
+               }
 
                if (_route && _route->solo_safe()) {
                        solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive));
@@ -2191,6 +2231,25 @@ MixerStrip::parameter_changed (string p)
        else if (p == "track-name-number") {
                name_changed ();
        }
+       else if (p == "use-monitor-bus") {
+               if (monitor_section_button) {
+                       if (mute_button->get_parent()) {
+                               mute_button->get_parent()->remove(*mute_button);
+                       }
+                       if (monitor_section_button->get_parent()) {
+                               monitor_section_button->get_parent()->remove(*monitor_section_button);
+                       }
+                       if (Config->get_use_monitor_bus ()) {
+                               mute_solo_table.attach (*mute_button, 0, 1, 0, 1);
+                               mute_solo_table.attach (*monitor_section_button, 1, 2, 0, 1);
+                               mute_button->show();
+                               monitor_section_button->show();
+                       } else {
+                               mute_solo_table.attach (*mute_button, 0, 2, 0, 1);
+                               mute_button->show();
+                       }
+               }
+       }
 }
 
 /** Called to decide whether the solo isolate / solo lock button visibility should