lots of tricks & tweaks related to the monitor section and All That It Uses
[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 }
32
33 class VolumeController;
34
35 class MonitorSection : public RouteUI
36 {
37   public:
38         MonitorSection (ARDOUR::Session*);
39         ~MonitorSection ();
40
41         void set_session (ARDOUR::Session*);
42         static void setup_knob_images ();
43
44         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
45
46   private:
47         Gtk::VBox vpacker;
48         Gtk::HBox hpacker;
49         Gtk::Table main_table;
50         Gtk::VBox upper_packer;
51         Gtk::VBox lower_packer;
52         Gtkmm2ext::TearOff* _tearoff;
53
54         struct ChannelButtonSet { 
55             BindableToggleButton cut;
56             BindableToggleButton dim;
57             BindableToggleButton solo;
58             BindableToggleButton invert;
59
60             ChannelButtonSet ();
61         };
62
63         typedef std::vector<ChannelButtonSet*> ChannelButtons;
64         ChannelButtons _channel_buttons;
65
66         Gtk::Adjustment   gain_adjustment;
67         VolumeController* gain_control;
68         Gtk::Adjustment   dim_adjustment;
69         VolumeController* dim_control;
70         Gtk::Adjustment   solo_boost_adjustment;
71         VolumeController* solo_boost_control;
72         Gtk::Adjustment   solo_cut_adjustment;
73         VolumeController* solo_cut_control;
74
75         void populate_buttons ();
76         void set_button_names ();
77         void map_state ();
78
79         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
80         boost::shared_ptr<ARDOUR::Route> _route;
81
82         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
83         void register_actions ();
84
85         static Glib::RefPtr<Gdk::Pixbuf> big_knob_pixbuf;
86         static Glib::RefPtr<Gdk::Pixbuf> little_knob_pixbuf;
87
88         void cut_channel (uint32_t);
89         void dim_channel (uint32_t);
90         void solo_channel (uint32_t);
91         void invert_channel (uint32_t);
92         void dim_all ();
93         void cut_all ();
94         void mono ();
95         void dim_level_changed ();
96         void solo_boost_changed ();
97         void gain_value_changed ();
98
99         bool nonlinear_gain_printer (Gtk::SpinButton*);
100         bool linear_gain_printer (Gtk::SpinButton*);
101
102         Gtk::RadioButtonGroup solo_model_group;
103         Gtk::RadioButton solo_in_place_button;
104         Gtk::RadioButton afl_button;
105         Gtk::RadioButton pfl_button;
106         Gtk::HBox        solo_model_box;
107
108         void solo_use_in_place ();
109         void solo_use_afl ();
110         void solo_use_pfl ();
111
112         BindableToggleButton cut_all_button;
113         BindableToggleButton dim_all_button;
114         BindableToggleButton mono_button;
115         BindableToggleButton rude_solo_button;
116
117         void solo_blink (bool);
118         bool cancel_solo (GdkEventButton*);
119 };