save tearoff state; restore monitor section state reasonably well; fixup access contr...
[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
43         Gtk::Widget& pack_widget () const;
44         void fast_update ();
45         static void setup_knob_images ();
46
47         Gtkmm2ext::TearOff* tearoff() const { return _tearoff; }
48
49   private:
50         Gtk::VBox vpacker;
51         Gtk::HBox hpacker;
52         Gtk::Table main_table;
53         Gtk::VBox upper_packer;
54         Gtk::VBox lower_packer;
55         Gtk::VBox table_knob_packer;
56         Gtk::HBox knob_packer;
57         LevelMeter meter;
58         Gtkmm2ext::TearOff* _tearoff;
59
60         struct ChannelButtonSet { 
61             BindableToggleButton cut;
62             BindableToggleButton dim;
63             BindableToggleButton solo;
64             BindableToggleButton invert;
65
66             ChannelButtonSet ();
67         };
68
69         typedef std::vector<ChannelButtonSet*> ChannelButtons;
70         ChannelButtons _channel_buttons;
71
72         Gtk::Adjustment   gain_adjustment;
73         VolumeController* gain_control;
74         Gtk::Adjustment   dim_adjustment;
75         VolumeController* dim_control;
76         Gtk::Adjustment   solo_boost_adjustment;
77         VolumeController* solo_boost_control;
78
79         void populate_buttons ();
80         void set_button_names ();
81         void map_state ();
82
83         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
84         boost::shared_ptr<ARDOUR::Route> _route;
85
86         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
87         void register_actions ();
88
89         static Glib::RefPtr<Gdk::Pixbuf> big_knob_pixbuf;
90         static Glib::RefPtr<Gdk::Pixbuf> little_knob_pixbuf;
91
92         void cut_channel (uint32_t);
93         void dim_channel (uint32_t);
94         void solo_channel (uint32_t);
95         void invert_channel (uint32_t);
96         void dim_all ();
97         void cut_all ();
98         void mono ();
99         void dim_level_changed ();
100         void solo_boost_changed ();
101         void gain_value_changed ();
102
103         bool nonlinear_gain_printer (Gtk::SpinButton*);
104         bool linear_gain_printer (Gtk::SpinButton*);
105
106         Gtk::RadioButtonGroup solo_model_group;
107         Gtk::RadioButton solo_in_place_button;
108         Gtk::RadioButton afl_button;
109         Gtk::RadioButton pfl_button;
110         Gtk::HBox        solo_model_box;
111
112         void solo_use_in_place ();
113         void solo_use_afl ();
114         void solo_use_pfl ();
115
116         BindableToggleButton cut_all_button;
117         BindableToggleButton dim_all_button;
118         BindableToggleButton mono_button;
119         BindableToggleButton rude_solo_button;
120
121         void solo_blink (bool);
122         bool cancel_solo (GdkEventButton*);
123 };