2 Copyright (C) 2016 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include "pbd/convert.h"
21 #include "ardour/rc_configuration.h"
22 #include "ardour/vca.h"
25 #include "vca_master_strip.h"
26 #include "gui_thread.h"
30 using namespace ARDOUR;
31 using namespace ARDOUR_UI_UTILS;
32 using namespace Gtkmm2ext;
35 VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
41 gain_meter.set_controls (boost::shared_ptr<Route>(),
42 boost::shared_ptr<PeakMeter>(),
43 boost::shared_ptr<Amp>(),
46 solo_button.set_name ("solo button");
47 set_tooltip (solo_button, _("Solo slaves"));
48 solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::solo_release), false);
50 mute_button.set_name ("mute button");
51 set_tooltip (mute_button, _("Mute slaves"));
52 mute_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::mute_release), false);
54 hide_button.set_icon (ArdourIcon::CloseCross);
55 set_tooltip (&hide_button, _("Hide this VCA strip"));
57 width_button.set_icon (ArdourIcon::StripWidth);
58 set_tooltip (width_button, _("Click to toggle the width of this VCA strip."));
60 assign_button.set_text (_("-vca-"));
61 set_tooltip (assign_button, _("Click to assign a VCA Master to this VCA"));
63 width_button.signal_button_press_event().connect (sigc::mem_fun(*this, &VCAMasterStrip::width_button_pressed), false);
64 hide_button.signal_clicked.connect (sigc::mem_fun(*this, &VCAMasterStrip::hide_clicked));
66 width_hide_box.set_spacing (2);
67 width_hide_box.pack_start (width_button, false, true);
68 width_hide_box.pack_start (number_label, true, true);
69 width_hide_box.pack_end (hide_button, false, true);
71 solo_mute_box.set_spacing (2);
72 solo_mute_box.pack_start (mute_button, true, true);
73 solo_mute_box.pack_start (solo_button, true, true);
75 number_label.set_text (PBD::to_string (v->number(), std::dec));
76 number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
77 number_label.set_no_show_all ();
78 number_label.set_name ("tracknumber label");
79 number_label.set_fixed_colors (0x80808080, 0x80808080);
80 number_label.set_alignment (.5, .5);
81 number_label.set_fallthrough_to_parent (true);
83 name_button.set_text (_vca->name());
84 active_button.set_text ("active");
86 top_padding.set_size_request (-1, 16); /* must match height in GroupTabs::set_size_request() */
87 bottom_padding.set_size_request (-1, 50); /* this one is a hack. there's no trivial way to compute it */
89 global_vpacker.set_border_width (1);
90 global_vpacker.set_spacing (0);
92 global_vpacker.pack_start (top_padding, false, false);
93 global_vpacker.pack_start (width_hide_box, false, false);
94 global_vpacker.pack_start (active_button, false, false);
95 global_vpacker.pack_start (name_button, false, false);
96 global_vpacker.pack_start (vertical_padding, true, true);
97 global_vpacker.pack_start (solo_mute_box, false, false);
98 global_vpacker.pack_start (gain_meter, false, false);
99 global_vpacker.pack_start (assign_button, false, false);
100 global_vpacker.pack_start (bottom_padding, false, false);
102 global_frame.add (global_vpacker);
103 global_frame.set_shadow_type (Gtk::SHADOW_IN);
104 global_frame.set_name ("BaseFrame");
108 global_vpacker.show ();
109 global_frame.show ();
111 bottom_padding.show ();
112 vertical_padding.show ();
113 width_hide_box.show_all ();
114 active_button.show_all ();
115 name_button.show_all ();
116 gain_meter.show_all ();
117 solo_mute_box.show_all ();
118 assign_button.show ();
120 /* force setting of visible selected status */
123 set_selected (false);
126 _vca->SoloChange.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::solo_changed, this), gui_context());
127 _vca->MuteChange.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::mute_changed, this), gui_context());
131 VCAMasterStrip::name() const
137 VCAMasterStrip::hide_clicked ()
142 VCAMasterStrip::width_button_pressed (GdkEventButton* ev)
148 VCAMasterStrip::set_selected (bool yn)
150 AxisView::set_selected (yn);
153 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
154 global_frame.set_name ("MixerStripSelectedFrame");
156 global_frame.set_shadow_type (Gtk::SHADOW_IN);
157 global_frame.set_name ("MixerStripFrame");
160 global_frame.queue_draw ();
164 VCAMasterStrip::solo_release (GdkEventButton*)
166 _vca->set_solo (!_vca->soloed());
171 VCAMasterStrip::mute_release (GdkEventButton*)
173 _vca->set_mute (!_vca->muted());
178 VCAMasterStrip::set_solo_text ()
181 if (Config->get_solo_control_is_listen_control ()) {
182 switch (Config->get_listen_position()) {
183 case AfterFaderListen:
184 solo_button.set_text (_("AFL"));
187 solo_button.set_text (_("PFL"));
191 solo_button.set_text (_("Solo"));
194 if (Config->get_solo_control_is_listen_control ()) {
195 switch (Config->get_listen_position()) {
196 case AfterFaderListen:
197 solo_button.set_text (_("A"));
200 solo_button.set_text (_("P"));
204 solo_button.set_text (_("S"));
210 VCAMasterStrip::set_width (bool w)
215 mute_button.set_text (_("Mute"));
217 mute_button.set_text (_("m"));
224 VCAMasterStrip::mute_changed ()
227 mute_button.set_active_state (ExplicitActive);
229 mute_button.set_active_state (Gtkmm2ext::Off);
234 VCAMasterStrip::solo_changed ()
236 if (_vca->soloed()) {
237 solo_button.set_active_state (ExplicitActive);
239 solo_button.set_active_state (Gtkmm2ext::Off);