save/restore monitor processor state; key handling in torn off monitor section window
[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         Gtk::Widget& pack_widget () const;
42         void fast_update ();
43         static void setup_knob_images ();
44
45   private:
46         Gtk::VBox vpacker;
47         Gtk::HBox hpacker;
48         Gtk::Table main_table;
49         Gtk::VBox upper_packer;
50         Gtk::VBox lower_packer;
51         Gtk::VBox table_knob_packer;
52         Gtk::HBox knob_packer;
53         LevelMeter meter;
54         Gtkmm2ext::TearOff* _tearoff;
55
56         Gtk::Adjustment   gain_adjustment;
57         VolumeController* gain_control;
58         Gtk::Adjustment   dim_adjustment;
59         VolumeController* dim_control;
60         Gtk::Adjustment   solo_boost_adjustment;
61         VolumeController* solo_boost_control;
62
63         void populate_buttons ();
64         void set_button_names ();
65         void map_state ();
66
67         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
68         boost::shared_ptr<ARDOUR::Route> _route;
69
70         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
71         void register_actions ();
72
73         static Glib::RefPtr<Gdk::Pixbuf> big_knob_pixbuf;
74         static Glib::RefPtr<Gdk::Pixbuf> little_knob_pixbuf;
75
76         void cut_channel (uint32_t);
77         void dim_channel (uint32_t);
78         void solo_channel (uint32_t);
79         void invert_channel (uint32_t);
80         void dim_all ();
81         void cut_all ();
82         void mono ();
83         void dim_level_changed ();
84         void solo_boost_changed ();
85         void gain_value_changed ();
86
87         bool nonlinear_gain_printer (Gtk::SpinButton*);
88         bool linear_gain_printer (Gtk::SpinButton*);
89
90         Gtk::RadioButtonGroup solo_model_group;
91         Gtk::RadioButton solo_in_place_button;
92         Gtk::RadioButton afl_button;
93         Gtk::RadioButton pfl_button;
94         Gtk::HBox        solo_model_box;
95
96         void solo_use_in_place ();
97         void solo_use_afl ();
98         void solo_use_pfl ();
99
100         BindableToggleButton cut_all_button;
101         BindableToggleButton dim_all_button;
102         BindableToggleButton mono_button;
103         BindableToggleButton rude_solo_button;
104
105         void solo_blink (bool);
106         bool cancel_solo (GdkEventButton*);
107
108         bool tearoff_key_press_event (GdkEventKey*);
109 };