Use a C++ bool constant
[ardour.git] / gtk2_ardour / monitor_section.h
1 /*
2     Copyright (C) 2010 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #include <gtkmm/box.h>
21 #include <gtkmm/table.h>
22 #include <gtkmm/eventbox.h>
23
24 #include "gtkmm2ext/bindable_button.h"
25 #include "gtkmm2ext/bindings.h"
26
27 #include "ardour_button.h"
28 #include "ardour_knob.h"
29 #include "ardour_display.h"
30 #include "level_meter.h"
31 #include "route_ui.h"
32 #include "monitor_selector.h"
33
34 #include "plugin_selector.h"
35 #include "route_processor_selection.h"
36 #include "processor_box.h"
37
38 namespace Gtkmm2ext {
39         class TearOff;
40 }
41
42 class MonitorSection : public RouteUI, public Gtk::EventBox
43 {
44   public:
45         MonitorSection (ARDOUR::Session*);
46         ~MonitorSection ();
47
48         void set_session (ARDOUR::Session*);
49
50         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
51
52         std::string state_id() const;
53
54         PluginSelector* plugin_selector() { return _plugin_selector; }
55
56         private:
57         Gtk::HBox hpacker;
58         Gtk::VBox vpacker;
59         Gtkmm2ext::TearOff* _tearoff;
60
61         Gtk::HBox  channel_table_packer;
62         Gtk::HBox  table_hpacker;
63         Gtk::HBox  master_packer;
64         Gtk::Table channel_table;
65         Gtk::Table channel_table_header;
66         Gtk::ScrolledWindow channel_table_scroller;
67         Gtk::Viewport channel_table_viewport;
68         Glib::RefPtr<Gtk::SizeGroup> channel_size_group;
69
70         struct ChannelButtonSet {
71                 ArdourButton cut;
72                 ArdourButton dim;
73                 ArdourButton solo;
74                 ArdourButton invert;
75
76                 ChannelButtonSet ();
77         };
78
79         typedef std::vector<ChannelButtonSet*> ChannelButtons;
80         ChannelButtons _channel_buttons;
81
82         ArdourKnob* gain_control;
83         ArdourKnob* dim_control;
84         ArdourKnob* solo_boost_control;
85         ArdourKnob* solo_cut_control;
86
87         ArdourDisplay*  gain_display;
88         ArdourDisplay*  dim_display;
89         ArdourDisplay*  solo_boost_display;
90         ArdourDisplay*  solo_cut_display;
91
92         std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
93         Gtk::Menu output_menu;
94         MonitorSelectorWindow *_output_selector;
95         ArdourButton* output_button;
96
97         void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
98         void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
99         void update_output_display ();
100         void disconnect_output ();
101         void edit_output_configuration ();
102
103         void populate_buttons ();
104         void map_state ();
105
106         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
107         boost::shared_ptr<ARDOUR::Route> _route;
108
109         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
110         void register_actions ();
111         void connect_actions ();
112
113         void cut_channel (uint32_t);
114         void dim_channel (uint32_t);
115         void solo_channel (uint32_t);
116         void invert_channel (uint32_t);
117         void dim_all ();
118         void cut_all ();
119         void mono ();
120         void toggle_exclusive_solo ();
121         void set_button_names () {}
122         void toggle_mute_overrides_solo ();
123         void dim_level_changed ();
124         void solo_boost_changed ();
125         void gain_value_changed ();
126         gint output_press (GdkEventButton *);
127         gint output_release (GdkEventButton *);
128
129         ArdourButton solo_in_place_button;
130         ArdourButton afl_button;
131         ArdourButton pfl_button;
132         Gtk::VBox    solo_model_box;
133
134         void solo_use_in_place ();
135         void solo_use_afl ();
136         void solo_use_pfl ();
137
138         ArdourButton cut_all_button;
139         ArdourButton dim_all_button;
140         ArdourButton mono_button;
141         ArdourButton rude_solo_button;
142         ArdourButton rude_iso_button;
143         ArdourButton rude_audition_button;
144         ArdourButton exclusive_solo_button;
145         ArdourButton solo_mute_override_button;
146         ArdourButton toggle_processorbox_button;
147
148         void do_blink (bool);
149         void solo_blink (bool);
150         void audition_blink (bool);
151         bool cancel_solo (GdkEventButton*);
152         bool cancel_isolate (GdkEventButton*);
153         bool cancel_audition (GdkEventButton*);
154         void update_solo_model ();
155         void parameter_changed (std::string);
156         void isolated_changed ();
157
158         PBD::ScopedConnection config_connection;
159         PBD::ScopedConnectionList control_connections;
160         PBD::ScopedConnection _output_changed_connection;
161
162         bool _inhibit_solo_model_update;
163
164         void assign_controllables ();
165
166         void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
167
168         void update_processor_box ();
169
170         void route_property_changed (const PBD::PropertyChange&) {}
171
172         ProcessorBox* insert_box;
173         PluginSelector* _plugin_selector;
174         RouteProcessorSelection _rr_selection;
175         void help_count_processors (boost::weak_ptr<ARDOUR::Processor> p, uint32_t* cnt) const;
176         uint32_t count_processors ();
177
178         void processors_changed (ARDOUR::RouteProcessorChange);
179         Glib::RefPtr<Gtk::Action> proctoggle;
180         bool _ui_initialized;
181
182   private:
183         Gtkmm2ext::ActionMap myactions;
184         Gtkmm2ext::Bindings* bindings;
185
186         void load_bindings ();
187         bool enter_handler (GdkEventCrossing*);
188         bool leave_handler (GdkEventCrossing*);
189 };