some changes to try to make the monitor section gain controls work as intended, and...
[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 "axis_view.h"
26 #include "level_meter.h"
27 #include "route_ui.h"
28
29 namespace Gtkmm2ext {
30         class TearOff;
31         class MotionFeedback;
32 }
33
34 class VolumeController;
35
36 class MonitorSection : public RouteUI
37 {
38   public:
39         MonitorSection (ARDOUR::Session*);
40         ~MonitorSection ();
41
42         void set_session (ARDOUR::Session*);
43         static void setup_knob_images ();
44
45         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
46
47   private:
48         Gtk::VBox vpacker;
49         Gtk::HBox hpacker;
50         Gtk::Table main_table;
51         Gtk::VBox upper_packer;
52         Gtk::VBox lower_packer;
53         Gtkmm2ext::TearOff* _tearoff;
54
55         struct ChannelButtonSet {
56             BindableToggleButton cut;
57             BindableToggleButton dim;
58             BindableToggleButton solo;
59             BindableToggleButton invert;
60
61             ChannelButtonSet ();
62         };
63
64         typedef std::vector<ChannelButtonSet*> ChannelButtons;
65         ChannelButtons _channel_buttons;
66
67         VolumeController* gain_control;
68         VolumeController* dim_control;
69         VolumeController* solo_boost_control;
70         VolumeController* solo_cut_control;
71
72         void populate_buttons ();
73         void set_button_names ();
74         void map_state ();
75
76         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
77         boost::shared_ptr<ARDOUR::Route> _route;
78
79         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
80         void register_actions ();
81
82         static Glib::RefPtr<Gdk::Pixbuf> big_knob_pixbuf;
83         static Glib::RefPtr<Gdk::Pixbuf> little_knob_pixbuf;
84
85         void cut_channel (uint32_t);
86         void dim_channel (uint32_t);
87         void solo_channel (uint32_t);
88         void invert_channel (uint32_t);
89         void dim_all ();
90         void cut_all ();
91         void mono ();
92         void toggle_exclusive_solo ();
93         void toggle_mute_overrides_solo ();
94         void dim_level_changed ();
95         void solo_boost_changed ();
96         void gain_value_changed ();
97
98         Gtk::RadioButtonGroup solo_model_group;
99         Gtk::RadioButton solo_in_place_button;
100         Gtk::RadioButton afl_button;
101         Gtk::RadioButton pfl_button;
102         Gtk::HBox        solo_model_box;
103
104         void solo_use_in_place ();
105         void solo_use_afl ();
106         void solo_use_pfl ();
107
108         BindableToggleButton cut_all_button;
109         BindableToggleButton dim_all_button;
110         BindableToggleButton mono_button;
111         BindableToggleButton rude_solo_button;
112         BindableToggleButton rude_iso_button;
113         BindableToggleButton rude_audition_button;
114         BindableToggleButton exclusive_solo_button;
115         BindableToggleButton solo_mute_override_button;
116
117         void do_blink (bool);
118         void solo_blink (bool);
119         void audition_blink (bool);
120         bool cancel_solo (GdkEventButton*);
121         bool cancel_isolate (GdkEventButton*);
122         bool cancel_audition (GdkEventButton*);
123         void update_solo_model ();
124         void parameter_changed (std::string);
125         void isolated_changed ();
126
127         PBD::ScopedConnection config_connection;
128         PBD::ScopedConnectionList control_connections;
129
130         void assign_controllables ();
131 };