summaryrefslogtreecommitdiff
path: root/gtk2_ardour/monitor_section.h
blob: b58203f52164148859183564d5ef8947be9ea443 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
    Copyright (C) 2010 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 <gtkmm/box.h>
#include <gtkmm/table.h>
#include <gtkmm/eventbox.h>

#include "gtkmm2ext/bindable_button.h"
#include "gtkmm2ext/bindings.h"

#include "ardour_button.h"
#include "ardour_knob.h"
#include "ardour_display.h"
#include "level_meter.h"
#include "route_ui.h"
#include "monitor_selector.h"

#include "plugin_selector.h"
#include "route_processor_selection.h"
#include "processor_box.h"

namespace Gtkmm2ext {
	class TearOff;
}

class MonitorSection : public RouteUI, public Gtk::EventBox
{
  public:
	MonitorSection (ARDOUR::Session*);
	~MonitorSection ();

	void set_session (ARDOUR::Session*);

	Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }

	std::string state_id() const;

	PluginSelector* plugin_selector() { return _plugin_selector; }

	private:
	Gtk::HBox hpacker;
	Gtk::VBox vpacker;
	Gtkmm2ext::TearOff* _tearoff;

	Gtk::HBox  channel_table_packer;
	Gtk::HBox  table_hpacker;
	Gtk::HBox  master_packer;
	Gtk::Table channel_table_header;
	Gtk::Table *channel_table;
	Gtk::ScrolledWindow channel_table_scroller;
	Gtk::Viewport channel_table_viewport;
	Glib::RefPtr<Gtk::SizeGroup> channel_size_group;

	struct ChannelButtonSet {
		ArdourButton cut;
		ArdourButton dim;
		ArdourButton solo;
		ArdourButton invert;

		ChannelButtonSet ();
	};

	typedef std::vector<ChannelButtonSet*> ChannelButtons;
	ChannelButtons _channel_buttons;

	ArdourKnob* gain_control;
	ArdourKnob* dim_control;
	ArdourKnob* solo_boost_control;
	ArdourKnob* solo_cut_control;

	ArdourDisplay*  gain_display;
	ArdourDisplay*  dim_display;
	ArdourDisplay*  solo_boost_display;
	ArdourDisplay*  solo_cut_display;

	std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
	Gtk::Menu output_menu;
	MonitorSelectorWindow *_output_selector;
	ArdourButton* output_button;

	void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
	void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
	void update_output_display ();
	void disconnect_output ();
	void edit_output_configuration ();

	void populate_buttons ();
	void map_state ();

	boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
	boost::shared_ptr<ARDOUR::Route> _route;

	enum MonitorActions {
		MonitorMono,
		MonitorCutAll,
		MonitorDimAll,
		ToggleExclusiveSolo,
		ToggleMuteOverridesSolo,
		SoloUseInPlace,
		SoloUseAFL,
		SoloUsePFL,
		ToggleMonitorProcessorBox
	};

	enum ChannelActions {
		CutChannel,
		DimChannel,
		SoloChannel,
		InvertChannel
	};

	static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
	static void register_actions ();

	static void action_proxy0 (enum MonitorActions);
	static void action_proxy1 (enum ChannelActions, uint32_t);

	void cut_channel (uint32_t);
	void dim_channel (uint32_t);
	void solo_channel (uint32_t);
	void invert_channel (uint32_t);
	void dim_all ();
	void cut_all ();
	void mono ();
	void toggle_exclusive_solo ();
	void set_button_names () {}
	void toggle_mute_overrides_solo ();
	void dim_level_changed ();
	void solo_boost_changed ();
	void gain_value_changed ();
	gint output_press (GdkEventButton *);
	gint output_release (GdkEventButton *);

	ArdourButton solo_in_place_button;
	ArdourButton afl_button;
	ArdourButton pfl_button;
	Gtk::VBox    solo_model_box;

	void solo_use_in_place ();
	void solo_use_afl ();
	void solo_use_pfl ();

	ArdourButton cut_all_button;
	ArdourButton dim_all_button;
	ArdourButton mono_button;
	ArdourButton rude_solo_button;
	ArdourButton rude_iso_button;
	ArdourButton rude_audition_button;
	ArdourButton exclusive_solo_button;
	ArdourButton solo_mute_override_button;
	ArdourButton toggle_processorbox_button;

	void do_blink (bool);
	void solo_blink (bool);
	void audition_blink (bool);
	bool cancel_solo (GdkEventButton*);
	bool cancel_isolate (GdkEventButton*);
	bool cancel_audition (GdkEventButton*);
	void update_solo_model ();
	void parameter_changed (std::string);
	void isolated_changed ();

	PBD::ScopedConnection config_connection;
	PBD::ScopedConnectionList control_connections;
	PBD::ScopedConnectionList output_changed_connections;

	bool _inhibit_solo_model_update;

	void assign_controllables ();

	void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);

	void update_processor_box ();

	void route_property_changed (const PBD::PropertyChange&) {}

	ProcessorBox* insert_box;
	PluginSelector* _plugin_selector;
	RouteProcessorSelection _rr_selection;
	void help_count_processors (boost::weak_ptr<ARDOUR::Processor> p, uint32_t* cnt) const;
	uint32_t count_processors ();

	void processors_changed (ARDOUR::RouteProcessorChange);
	Glib::RefPtr<Gtk::Action> proctoggle;
	bool _ui_initialized;

	static Gtkmm2ext::ActionMap myactions;
	static Gtkmm2ext::Bindings* bindings;

	static void load_bindings ();
	bool enter_handler (GdkEventCrossing*);
	bool leave_handler (GdkEventCrossing*);
};