update VCA assign buttons to show status for VCA strips
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 4 Mar 2016 21:44:46 +0000 (16:44 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:39 +0000 (15:30 -0400)
gtk2_ardour/vca_master_strip.cc
gtk2_ardour/vca_master_strip.h

index 595174d059d004f4d9f2ab19b736d9952f896d4c..c0ce5ab2f7f257e0118247d8258fbfde9426d154 100644 (file)
@@ -60,7 +60,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        width_button.set_icon (ArdourIcon::StripWidth);
        set_tooltip (width_button, _("Click to toggle the width of this VCA strip."));
 
-       assign_button.set_text (_("-vca-"));
+       assign_button.set_name (X_("vca assign"));
        set_tooltip (assign_button, _("Click to assign a VCA Master to this VCA"));
        assign_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::vca_button_release), false);
 
@@ -126,9 +126,40 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        _selected = true;
        set_selected (false);
        set_width (true);
+       update_vca_display ();
 
        _vca->SoloChange.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::solo_changed, this), gui_context());
        _vca->MuteChange.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::mute_changed, this), gui_context());
+
+       _vca->control()->VCAStatusChange.connect (vca_connections,
+                                                 invalidator (*this),
+                                                 boost::bind (&VCAMasterStrip::update_vca_display, this),
+                                                 gui_context());
+}
+
+void
+VCAMasterStrip::update_vca_display ()
+{
+       VCAList vcas (_session->vca_manager().vcas());
+       string label;
+
+       for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
+               if (_vca->control()->slaved_to (*v)) {
+                       if (!label.empty()) {
+                               label += ' ';
+                       }
+                       label += PBD::to_string ((*v)->number(), std::dec);
+               }
+       }
+
+       if (label.empty()) {
+               label = _("-vca-");
+               assign_button.set_active_state (Gtkmm2ext::Off);
+       } else {
+               assign_button.set_active_state (Gtkmm2ext::ExplicitActive);
+       }
+
+       assign_button.set_text (label);
 }
 
 string
index a058f45824b6967fa80a5bc9b807c570e846e719..097ddcdf41b8fccbd4c41440b3c21e8e74a2a76f 100644 (file)
@@ -77,7 +77,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
        void vca_menu_toggle (Gtk::CheckMenuItem* menuitem, uint32_t n);
        void vca_unassign ();
        bool vca_button_release (GdkEventButton*);
-
+       void update_vca_display ();
 };