185720856b30c78c4a8b126e9445d1512a252377
[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 "axis_view.h"
27 #include "level_meter.h"
28 #include "route_ui.h"
29
30 namespace Gtkmm2ext {
31         class TearOff;
32         class MotionFeedback;
33 }
34
35 class VolumeController;
36
37 class MonitorSection : public RouteUI
38 {
39   public:
40         MonitorSection (ARDOUR::Session*);
41         ~MonitorSection ();
42
43         void set_session (ARDOUR::Session*);
44         static void setup_knob_images ();
45
46         Gtkmm2ext::TearOff& tearoff() const { return *_tearoff; }
47
48         std::string state_id() const;
49
50   private:
51         Gtk::VBox vpacker;
52         Gtk::HBox hpacker;
53         Gtk::VBox upper_packer;
54         Gtk::VBox lower_packer;
55         Gtkmm2ext::TearOff* _tearoff;
56
57         Gtk::HBox  channel_table_packer;
58         Gtk::HBox  table_hpacker;
59         Gtk::Table channel_table;
60         Gtk::Table channel_table_header;
61         Gtk::ScrolledWindow channel_table_scroller;
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         VolumeController* gain_control;
77         VolumeController* dim_control;
78         VolumeController* solo_boost_control;
79         VolumeController* solo_cut_control;
80
81         void populate_buttons ();
82         void map_state ();
83
84         boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
85         boost::shared_ptr<ARDOUR::Route> _route;
86
87         static Glib::RefPtr<Gtk::ActionGroup> monitor_actions;
88         void register_actions ();
89
90         static Glib::RefPtr<Gdk::Pixbuf> big_knob_pixbuf;
91         static Glib::RefPtr<Gdk::Pixbuf> little_knob_pixbuf;
92
93         void cut_channel (uint32_t);
94         void dim_channel (uint32_t);
95         void solo_channel (uint32_t);
96         void invert_channel (uint32_t);
97         void dim_all ();
98         void cut_all ();
99         void mono ();
100         void toggle_exclusive_solo ();
101         void set_button_names () {}
102         void toggle_mute_overrides_solo ();
103         void dim_level_changed ();
104         void solo_boost_changed ();
105         void gain_value_changed ();
106
107         ArdourButton solo_in_place_button;
108         ArdourButton afl_button;
109         ArdourButton 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         ArdourButton cut_all_button;
117         ArdourButton dim_all_button;
118         ArdourButton mono_button;
119         ArdourButton rude_solo_button;
120         ArdourButton rude_iso_button;
121         ArdourButton rude_audition_button;
122         ArdourButton exclusive_solo_button;
123         ArdourButton solo_mute_override_button;
124
125         void do_blink (bool);
126         void solo_blink (bool);
127         void audition_blink (bool);
128         bool cancel_solo (GdkEventButton*);
129         bool cancel_isolate (GdkEventButton*);
130         bool cancel_audition (GdkEventButton*);
131         void update_solo_model ();
132         void parameter_changed (std::string);
133         void isolated_changed ();
134
135         PBD::ScopedConnection config_connection;
136         PBD::ScopedConnectionList control_connections;
137
138         bool _inhibit_solo_model_update;
139         
140         void assign_controllables ();
141 };