Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / vca_master_strip.cc
index 40b2a081030cfb549f92e8feccbf85e919e67760..574655427ee83a92491bb6069f792e489cd045f5 100644 (file)
@@ -1,20 +1,22 @@
 /*
-    Copyright (C) 2016 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2017-2018 Ben Loftis <ben@harrisonconsoles.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <gtkmm/stock.h>
 
 
 #include "gtkmm2ext/doi.h"
 #include "gtkmm2ext/keyboard.h"
+#include "widgets/tooltips.h"
 
 #include "ardour_dialog.h"
 #include "floating_text_entry.h"
 #include "gui_thread.h"
 #include "mixer_ui.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 #include "vca_master_strip.h"
@@ -40,7 +42,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace Gtkmm2ext;
 using namespace Gtk;
 using namespace PBD;
@@ -59,7 +61,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        /* set color for the VCA, if not already done. */
 
        if (!_vca->presentation_info().color_set()) {
-               _vca->presentation_info().set_color (gdk_color_to_rgba (unique_random_color()));
+               _vca->presentation_info().set_color (ARDOUR_UI_UTILS::gdk_color_to_rgba (unique_random_color()));
        }
 
        control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (v));
@@ -78,7 +80,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        set_tooltip (mute_button, _("Mute slaves"));
        mute_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::mute_release), false);
 
-       hide_button.set_icon (ArdourIcon::CloseCross);
+       hide_button.set_icon (ArdourIcon::HideEye);
        set_tooltip (&hide_button, _("Hide this VCA strip"));
 
        hide_button.signal_clicked.connect (sigc::mem_fun(*this, &VCAMasterStrip::hide_clicked));
@@ -87,6 +89,9 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        solo_mute_box.pack_start (mute_button, true, true);
        solo_mute_box.pack_start (solo_button, true, true);
 
+       mute_button.set_controllable (_vca->mute_control());
+       solo_button.set_controllable (_vca->solo_control());
+
        number_label.set_text (PBD::to_string (v->number()));
        number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
        number_label.set_no_show_all ();
@@ -94,7 +99,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        number_label.set_alignment (.5, .5);
        number_label.set_fallthrough_to_parent (true);
        number_label.set_inactive_color (_vca->presentation_info().color ());
-       number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press));
+       number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press), false);
 
        update_bottom_padding ();
 
@@ -109,16 +114,17 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        set_tooltip (vertical_button, _("Click to show slaves only")); /* tooltip updated dynamically */
 
        global_vpacker.set_border_width (0);
-       global_vpacker.set_spacing (2);
+       global_vpacker.set_spacing (0);
        gain_meter.set_spacing(4);
 
-       global_vpacker.pack_start (number_label, false, false);
-       global_vpacker.pack_start (hide_button, false, false);
-       global_vpacker.pack_start (vertical_button, true, true);
-       global_vpacker.pack_start (solo_mute_box, false, false);
-       global_vpacker.pack_start (gain_meter, false, false);
-       global_vpacker.pack_start (control_slave_ui, false, false);
-       global_vpacker.pack_start (bottom_padding, false, false);
+       global_vpacker.pack_start (number_label, false, false, 1);
+       global_vpacker.pack_start (hide_button, false, false, 1);
+       global_vpacker.pack_start (vertical_button, true, true, 1);
+       global_vpacker.pack_start (solo_mute_box, false, false, 1);
+       global_vpacker.pack_start (gain_meter, false, false, 1);
+       global_vpacker.pack_start (control_slave_ui, false, false, 1);
+       global_vpacker.pack_start (gain_meter.gain_automation_state_button, false, false, 1);
+       global_vpacker.pack_start (bottom_padding, false, false, 0);
 
        global_frame.add (global_vpacker);
        global_frame.set_shadow_type (Gtk::SHADOW_IN);
@@ -128,14 +134,13 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
 
        global_vpacker.show ();
        global_frame.show ();
-       top_padding.show ();
-       bottom_padding.show ();
        vertical_button.show ();
        hide_button.show ();
        number_label.show ();
        gain_meter.show ();
        solo_mute_box.show_all ();
        control_slave_ui.show ();
+       gain_meter.gain_automation_state_button.show ();
 
        /* force setting of visible selected status */
 
@@ -156,6 +161,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        _vca->solo_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::solo_changed, this), gui_context());
        _vca->mute_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::mute_changed, this), gui_context());
 
+       _session->MonitorBusAddedOrRemoved.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::set_button_names, this), gui_context());
 
        s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
        Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
@@ -184,13 +190,17 @@ VCAMasterStrip::self_delete ()
        }
        /* Drop reference immediately, delete self when idle */
        _vca.reset ();
+       gain_meter.set_controls (boost::shared_ptr<Route>(),
+                                boost::shared_ptr<PeakMeter>(),
+                                boost::shared_ptr<Amp>(),
+                                boost::shared_ptr<GainControl>());
        delete_when_idle (this);
 }
 
 void
 VCAMasterStrip::parameter_changed (std::string const & p)
 {
-       if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
+       if (p == "solo-control-is-listen-control" || p == "listen-position") {
                set_button_names ();
        } else if (p == "mixer-element-visibility") {
                update_bottom_padding ();
@@ -222,11 +232,9 @@ VCAMasterStrip::update_bottom_padding ()
 {
        std::string viz = UIConfiguration::instance().get_mixer_strip_visibility ();
 
-       ArdourButton meter_point_button (_("pre"));
        ArdourButton output_button (_("Output"));
        ArdourButton comment_button (_("Comments"));
 
-       meter_point_button.set_name ("mixer strip button");
        output_button.set_name ("mixer strip button");
        comment_button.set_name ("generic button");
 
@@ -236,13 +244,7 @@ VCAMasterStrip::update_bottom_padding ()
                control_slave_ui.show ();
        }
 
-       int h = 1;
-       if (1) {
-               Gtk::Window window (WINDOW_TOPLEVEL);
-               window.add (meter_point_button);
-               Gtk::Requisition requisition(meter_point_button.size_request ());
-               h += requisition.height;
-       }
+       int h = 0;
        if (viz.find ("Output") != std::string::npos) {
                Gtk::Window window (WINDOW_TOPLEVEL);
                window.add (output_button);
@@ -255,7 +257,13 @@ VCAMasterStrip::update_bottom_padding ()
                Gtk::Requisition requisition(comment_button.size_request ());
                h += requisition.height + 2;
        }
-       bottom_padding.set_size_request (-1, h);
+       if (h <= 0) {
+               bottom_padding.set_size_request (-1, 1);
+               bottom_padding.hide ();
+       } else {
+               bottom_padding.set_size_request (-1, h);
+               bottom_padding.show ();
+       }
 }
 
 string
@@ -401,8 +409,9 @@ VCAMasterStrip::number_button_press (GdkEventButton* ev)
                        build_context_menu ();
                }
                context_menu->popup (1, ev->time);
+               return true;
        }
-       return true;
+       return false;
 }
 
 void
@@ -518,7 +527,7 @@ VCAMasterStrip::drop_all_slaves ()
 Gdk::Color
 VCAMasterStrip::color () const
 {
-       return gdk_color_from_rgba (_vca->presentation_info().color ());
+       return ARDOUR_UI_UTILS::gdk_color_from_rgba (_vca->presentation_info().color ());
 }
 
 string