65023aa667bce03100f3ba9c16085d62f4049682
[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
23 #include "gtkmm2ext/bindable_button.h"
24
25 #include "ardour_button.h"
26 #include "ardour_knob.h"
27 #include "ardour_display.h"
28 #include "axis_view.h"
29 #include "level_meter.h"
30 #include "route_ui.h"
31
32 namespace Gtkmm2ext {
33         class TearOff;
34         class MotionFeedback;
35 }
36
37 class VolumeController;
38
39 class MonitorSection : public RouteUI
40 {
41         public:
42         MonitorSection (ARDOUR::Session*);
43         ~MonitorSection ();
44
45         void set_session (ARDOUR::Session*);
46
47         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
48
49         std::string state_id() const;
50
51         private:
52         Gtk::VBox vpacker;
53         Gtk::HBox hpacker;
54         Gtk::VBox upper_packer;
55         Gtk::VBox lower_packer;
56         Gtkmm2ext::TearOff* _tearoff;
57
58         Gtk::HBox  channel_table_packer;
59         Gtk::HBox  table_hpacker;
60         Gtk::Table channel_table;
61         Gtk::Table channel_table_header;
62         Gtk::ScrolledWindow channel_table_scroller;
63         Gtk::Viewport channel_table_viewport;
64         Glib::RefPtr<Gtk::SizeGroup> channel_size_group;
65
66         struct ChannelButtonSet {
67                 ArdourButton cut;
68                 ArdourButton dim;
69                 ArdourButton solo;
70                 ArdourButton invert;
71
72                 ChannelButtonSet ();
73         };
74
75         typedef std::vector<ChannelButtonSet*> ChannelButtons;
76         ChannelButtons _channel_buttons;
77
78         ArdourKnob* gain_control;
79         ArdourKnob* dim_control;
80         ArdourKnob* solo_boost_control;
81         ArdourKnob* solo_cut_control;
82
83         ArdourDisplay*  gain_display;
84         ArdourDisplay*  dim_display;
85         ArdourDisplay*  solo_boost_display;
86         ArdourDisplay*  solo_cut_display;
87
88         void populate_buttons ();
89         void map_state ();
90
91         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
92         boost::shared_ptr<ARDOUR::Route> _route;
93
94         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
95         void register_actions ();
96
97         void cut_channel (uint32_t);
98         void dim_channel (uint32_t);
99         void solo_channel (uint32_t);
100         void invert_channel (uint32_t);
101         void dim_all ();
102         void cut_all ();
103         void mono ();
104         void toggle_exclusive_solo ();
105         void set_button_names () {}
106         void toggle_mute_overrides_solo ();
107         void dim_level_changed ();
108         void solo_boost_changed ();
109         void gain_value_changed ();
110
111         ArdourButton solo_in_place_button;
112         ArdourButton afl_button;
113         ArdourButton pfl_button;
114         Gtk::HBox        solo_model_box;
115
116         void solo_use_in_place ();
117         void solo_use_afl ();
118         void solo_use_pfl ();
119
120         ArdourButton cut_all_button;
121         ArdourButton dim_all_button;
122         ArdourButton mono_button;
123         ArdourButton rude_solo_button;
124         ArdourButton rude_iso_button;
125         ArdourButton rude_audition_button;
126         ArdourButton exclusive_solo_button;
127         ArdourButton solo_mute_override_button;
128
129         void do_blink (bool);
130         void solo_blink (bool);
131         void audition_blink (bool);
132         bool cancel_solo (GdkEventButton*);
133         bool cancel_isolate (GdkEventButton*);
134         bool cancel_audition (GdkEventButton*);
135         void update_solo_model ();
136         void parameter_changed (std::string);
137         void isolated_changed ();
138
139         PBD::ScopedConnection config_connection;
140         PBD::ScopedConnectionList control_connections;
141
142         bool _inhibit_solo_model_update;
143
144         void assign_controllables ();
145 };