monitoring section on diet (75% original width)
[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 #include "monitor_selector.h"
32
33 namespace Gtkmm2ext {
34         class TearOff;
35         class MotionFeedback;
36 }
37
38 class VolumeController;
39
40 class MonitorSection : public RouteUI
41 {
42         public:
43         MonitorSection (ARDOUR::Session*);
44         ~MonitorSection ();
45
46         void set_session (ARDOUR::Session*);
47
48         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
49
50         std::string state_id() const;
51
52         private:
53         Gtk::HBox hpacker;
54         Gtkmm2ext::TearOff* _tearoff;
55
56         Gtk::HBox  channel_table_packer;
57         Gtk::HBox  table_hpacker;
58         Gtk::Table channel_table;
59         Gtk::Table channel_table_header;
60         Gtk::ScrolledWindow channel_table_scroller;
61         Gtk::Viewport channel_table_viewport;
62         Glib::RefPtr<Gtk::SizeGroup> channel_size_group;
63
64         struct ChannelButtonSet {
65                 ArdourButton cut;
66                 ArdourButton dim;
67                 ArdourButton solo;
68                 ArdourButton invert;
69
70                 ChannelButtonSet ();
71         };
72
73         typedef std::vector<ChannelButtonSet*> ChannelButtons;
74         ChannelButtons _channel_buttons;
75
76         ArdourKnob* gain_control;
77         ArdourKnob* dim_control;
78         ArdourKnob* solo_boost_control;
79         ArdourKnob* solo_cut_control;
80
81         ArdourDisplay*  gain_display;
82         ArdourDisplay*  dim_display;
83         ArdourDisplay*  solo_boost_display;
84         ArdourDisplay*  solo_cut_display;
85
86         std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
87         Gtk::Menu output_menu;
88         MonitorSelectorWindow *_output_selector;
89         ArdourButton* output_button;
90
91         void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
92         void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
93         void update_output_display ();
94         void disconnect_output ();
95         void edit_output_configuration ();
96
97         void populate_buttons ();
98         void map_state ();
99
100         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
101         boost::shared_ptr<ARDOUR::Route> _route;
102
103         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
104         void register_actions ();
105
106         void cut_channel (uint32_t);
107         void dim_channel (uint32_t);
108         void solo_channel (uint32_t);
109         void invert_channel (uint32_t);
110         void dim_all ();
111         void cut_all ();
112         void mono ();
113         void toggle_exclusive_solo ();
114         void set_button_names () {}
115         void toggle_mute_overrides_solo ();
116         void dim_level_changed ();
117         void solo_boost_changed ();
118         void gain_value_changed ();
119         gint output_press (GdkEventButton *);
120         gint output_release (GdkEventButton *);
121
122         ArdourButton solo_in_place_button;
123         ArdourButton afl_button;
124         ArdourButton pfl_button;
125         Gtk::VBox    solo_model_box;
126
127         void solo_use_in_place ();
128         void solo_use_afl ();
129         void solo_use_pfl ();
130
131         ArdourButton cut_all_button;
132         ArdourButton dim_all_button;
133         ArdourButton mono_button;
134         ArdourButton rude_solo_button;
135         ArdourButton rude_iso_button;
136         ArdourButton rude_audition_button;
137         ArdourButton exclusive_solo_button;
138         ArdourButton solo_mute_override_button;
139
140         void do_blink (bool);
141         void solo_blink (bool);
142         void audition_blink (bool);
143         bool cancel_solo (GdkEventButton*);
144         bool cancel_isolate (GdkEventButton*);
145         bool cancel_audition (GdkEventButton*);
146         void update_solo_model ();
147         void parameter_changed (std::string);
148         void isolated_changed ();
149
150         PBD::ScopedConnection config_connection;
151         PBD::ScopedConnectionList control_connections;
152         PBD::ScopedConnection _output_changed_connection;
153
154         bool _inhibit_solo_model_update;
155
156         void assign_controllables ();
157         void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
158 };