summaryrefslogtreecommitdiff
path: root/gtk2_ardour/vca_master_strip.cc
blob: bccc1ab68e0f00191574d165aa6f23350c9b1d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
    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"

#include "ardour/vca.h"

#include "tooltips.h"
#include "vca_master_strip.h"

#include "i18n.h"

using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace Gtkmm2ext;
using std::string;

VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
	: AxisView (s)
	, _vca (v)
	, gain_meter (s, 250)
{
	gain_meter.set_controls (boost::shared_ptr<Route>(),
	                         boost::shared_ptr<PeakMeter>(),
	                         boost::shared_ptr<Amp>(),
	                         _vca->control());

	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());
	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);

	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 ();
	active_button.show_all ();
	name_button.show_all ();
	gain_meter.show_all ();
}

string
VCAMasterStrip::name() const
{
	return _vca->name();
}

void
VCAMasterStrip::hide_clicked ()
{
}

bool
VCAMasterStrip::width_button_pressed (GdkEventButton* ev)
{
	return false;
}