ardour/gtk2_ardour/vca_master_strip.cc

137 lines
4.0 KiB
C++
Raw Normal View History

2016-01-24 21:27:25 -05:00
/*
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.
*/
#include "pbd/convert.h"
2016-01-25 12:51:10 -05:00
#include "ardour/vca.h"
#include "tooltips.h"
2016-01-24 21:27:25 -05:00
#include "vca_master_strip.h"
#include "i18n.h"
2016-01-24 21:27:25 -05:00
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace Gtkmm2ext;
2016-01-25 12:51:10 -05:00
using std::string;
2016-01-24 21:27:25 -05:00
2016-01-25 12:51:10 -05:00
VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
2016-01-24 21:27:25 -05:00
: AxisView (s)
, _vca (v)
2016-01-24 21:27:25 -05:00
, gain_meter (s, 250)
{
2016-01-25 12:51:10 -05:00
gain_meter.set_controls (boost::shared_ptr<Route>(),
boost::shared_ptr<PeakMeter>(),
boost::shared_ptr<Amp>(),
_vca->control());
2016-01-25 12:51:10 -05:00
hide_button.set_icon (ArdourIcon::CloseCross);
set_tooltip (&hide_button, _("Hide this VCA strip"));
width_button.set_icon (ArdourIcon::StripWidth);
set_tooltip (width_button, _("Click to toggle the width of this VCA strip."));
width_button.signal_button_press_event().connect (sigc::mem_fun(*this, &VCAMasterStrip::width_button_pressed), false);
hide_button.signal_clicked.connect (sigc::mem_fun(*this, &VCAMasterStrip::hide_clicked));
width_hide_box.set_spacing (2);
width_hide_box.pack_start (width_button, false, true);
width_hide_box.pack_start (number_label, true, true);
width_hide_box.pack_end (hide_button, false, true);
number_label.set_text (PBD::to_string (v->number(), std::dec));
number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
number_label.set_no_show_all ();
number_label.set_name ("tracknumber label");
number_label.set_fixed_colors (0x80808080, 0x80808080);
number_label.set_alignment (.5, .5);
number_label.set_fallthrough_to_parent (true);
name_button.set_text (_vca->name());
2016-01-24 21:27:25 -05:00
active_button.set_text ("active");
top_padding.set_size_request (-1, 16); /* must match height in GroupTabs::set_size_request() */
bottom_padding.set_size_request (-1, 50); /* this one is a hack. there's no trivial way to compute it */
global_vpacker.set_border_width (1);
global_vpacker.set_spacing (0);
global_vpacker.pack_start (top_padding, false, false);
global_vpacker.pack_start (width_hide_box, false, false);
global_vpacker.pack_start (active_button, false, false);
global_vpacker.pack_start (name_button, false, false);
global_vpacker.pack_start (vertical_padding, true, true);
global_vpacker.pack_start (gain_meter, false, false);
global_vpacker.pack_start (bottom_padding, false, false);
2016-01-24 21:27:25 -05:00
global_frame.add (global_vpacker);
global_frame.set_shadow_type (Gtk::SHADOW_IN);
global_frame.set_name ("BaseFrame");
add (global_frame);
global_vpacker.show ();
global_frame.show ();
top_padding.show ();
bottom_padding.show ();
vertical_padding.show ();
width_hide_box.show_all ();
2016-01-24 21:27:25 -05:00
active_button.show_all ();
name_button.show_all ();
gain_meter.show_all ();
2016-03-03 13:28:42 -05:00
/* force setting of visible selected status */
_selected = true;
set_selected (false);
2016-01-24 21:27:25 -05:00
}
2016-01-25 12:51:10 -05:00
string
VCAMasterStrip::name() const
{
return _vca->name();
2016-01-25 12:51:10 -05:00
}
void
VCAMasterStrip::hide_clicked ()
{
}
bool
VCAMasterStrip::width_button_pressed (GdkEventButton* ev)
{
return false;
}
2016-03-03 13:28:42 -05:00
void
VCAMasterStrip::set_selected (bool yn)
{
AxisView::set_selected (yn);
if (_selected) {
global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
global_frame.set_name ("MixerStripSelectedFrame");
} else {
global_frame.set_shadow_type (Gtk::SHADOW_IN);
global_frame.set_name ("MixerStripFrame");
}
global_frame.queue_draw ();
}