Fly my pretties!
[ardour.git] / gtk2_ardour / mixer_strip.h
1 /*
2     Copyright (C) 2000 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     $Id$
19 */
20
21 #ifndef __ardour_mixer_strip__
22 #define __ardour_mixer_strip__
23
24 #include <vector>
25
26 #include <cmath>
27 #include <gtkmm.h>
28 #include <gtkmm2ext/auto_spin.h>
29 #include <gtkmm2ext/slider_controller.h>
30 #include <gtkmm2ext/click_box.h>
31
32 #include <ardour/types.h>
33 #include <ardour/ardour.h>
34 #include <ardour/io.h>
35 #include <ardour/insert.h>
36 #include <ardour/stateful.h>
37 #include <ardour/redirect.h>
38
39 #include <pbd/fastlog.h>
40
41 #include "route_ui.h"
42 #include "io_selector.h"
43 #include "gain_meter.h"
44 #include "panner_ui.h"
45 #include "enums.h"
46 #include "redirect_box.h"
47
48 class MotionController;
49
50
51 namespace Gtkmm2ext {
52         class SliderController;
53 }
54
55 namespace ARDOUR {
56         class Route;
57         class Send;
58         class Insert;
59         class Session;
60         class PortInsert;
61         class Connection;
62         class Plugin;
63 }
64
65 class Mixer_UI;
66
67 class MixerStrip : public RouteUI, public Gtk::EventBox
68 {
69   public:
70         MixerStrip (Mixer_UI&, ARDOUR::Session&, ARDOUR::Route &, bool in_mixer = true);
71         ~MixerStrip ();
72
73         void set_width (Width);
74         Width get_width() const { return _width; }
75
76         void update ();
77         void fast_update ();
78         void set_embedded (bool);
79
80   protected:
81         friend class Mixer_UI;
82         void set_packed (bool yn);
83         bool packed () { return _packed; }
84
85         void set_selected(bool yn);
86         void set_stuff_from_route ();
87
88   private:
89         Mixer_UI& _mixer;
90
91         bool  _embedded;
92         bool  _packed;
93         Width _width;
94
95         Gtk::Button         hide_button;
96         Gtk::Button         width_button;
97         Gtk::HBox           width_hide_box;
98
99         void hide_clicked();
100         void width_clicked ();
101
102         Gtk::Frame          global_frame;
103         Gtk::VBox           global_vpacker;
104
105         RedirectBox pre_redirect_box;
106         RedirectBox post_redirect_box;
107         GainMeter   gpm;
108         PannerUI    panners;
109         
110         Gtk::Table button_table;
111
112         Gtk::Button diskstream_button;
113         Gtk::Label  diskstream_label;
114
115         Gtk::Button input_button;
116         Gtk::Label  input_label;
117         Gtk::Button output_button;
118         Gtk::Label  output_label;
119
120         Gtk::Button gain_automation_style_button;
121         Gtk::ToggleButton gain_automation_state_button;
122
123         Gtk::Button pan_automation_style_button;
124         Gtk::ToggleButton pan_automation_state_button;
125
126         Gtk::Menu gain_astate_menu;
127         Gtk::Menu gain_astyle_menu;
128         Gtk::Menu pan_astate_menu;
129         Gtk::Menu pan_astyle_menu;
130
131         Gtk::ToggleButton polarity_button;
132
133         sigc::connection newplug_connection;
134     
135         gint    mark_update_safe ();
136         guint32 mode_switch_in_progress;
137         
138         Gtk::Button   name_button;
139
140         Gtk::Window*  comment_window;
141         Gtk::Text     comment_area;
142         Gtk::Button   comment_button;
143
144         void setup_comment_editor ();
145         void comment_button_clicked ();
146
147         Gtk::Button   group_button;
148         Gtk::Label    group_label;
149         Gtk::Menu    *group_menu;
150
151         gint input_press (GdkEventButton *);
152         gint output_press (GdkEventButton *);
153
154         Gtk::Menu  input_menu;
155         void add_connection_to_input_menu (ARDOUR::Connection *);
156
157         Gtk::Menu output_menu;
158         void add_connection_to_output_menu (ARDOUR::Connection *);
159         
160         void stream_input_chosen (ARDOUR::DiskStream*);
161         void select_stream_input ();
162         void connection_input_chosen (ARDOUR::Connection *);
163         void connection_output_chosen (ARDOUR::Connection *);
164
165         void edit_input_configuration ();
166         void edit_output_configuration ();
167
168         void diskstream_changed (void *src);
169
170         Gtk::Menu *send_action_menu;
171         void build_send_action_menu ();
172
173         void new_send ();
174         void show_send_controls ();
175
176
177         gint gain_automation_style_button_event (GdkEventButton *);
178         gint gain_automation_state_button_event (GdkEventButton *);
179         gint pan_automation_style_button_event (GdkEventButton *);
180         gint pan_automation_state_button_event (GdkEventButton *);
181
182         void input_changed (ARDOUR::IOChange, void *);
183         void output_changed (ARDOUR::IOChange, void *);
184         void gain_automation_state_changed();
185         void pan_automation_state_changed();
186         void gain_automation_style_changed();
187         void pan_automation_style_changed();
188
189         sigc::connection panstate_connection;
190         sigc::connection panstyle_connection;
191         void connect_to_pan ();
192
193         std::string astate_string (ARDOUR::AutoState);
194         std::string short_astate_string (ARDOUR::AutoState);
195         std::string _astate_string (ARDOUR::AutoState, bool);
196
197         std::string astyle_string (ARDOUR::AutoStyle);
198         std::string short_astyle_string (ARDOUR::AutoStyle);
199         std::string _astyle_string (ARDOUR::AutoStyle, bool);
200
201         void update_diskstream_display ();
202         void update_input_display ();
203         void update_output_display ();
204
205         void set_automated_controls_sensitivity (bool yn);
206
207         Gtk::Menu *route_ops_menu;
208         void build_route_ops_menu ();
209         gint name_button_button_release (GdkEventButton*);
210         void list_route_operations ();
211
212         gint comment_key_release_handler (GdkEventKey*);
213         void comment_changed (void *src);
214         void comment_edited ();
215         bool ignore_comment_edit;
216
217         void set_mix_group (ARDOUR::RouteGroup *);
218         void add_mix_group_to_menu (ARDOUR::RouteGroup *);
219         gint select_mix_group (GdkEventButton *);
220         void mix_group_changed (void *);
221
222         void polarity_toggled ();
223
224         IOSelectorWindow *input_selector;
225         IOSelectorWindow *output_selector;
226
227         Gtk::Style *passthru_style;
228
229         void route_gui_changed (string, void*);
230         void show_route_color ();
231         void show_passthru_color ();
232
233         void route_active_changed ();
234
235         /* speed control (for tracks only) */
236
237         Gtk::Adjustment    speed_adjustment;
238         Gtkmm2ext::ClickBox speed_spinner;
239         Gtk::Label         speed_label;
240         Gtk::Frame         speed_frame;
241
242         void speed_adjustment_changed ();
243         void speed_changed ();
244         void name_changed (void *src);
245         void update_speed_display ();
246         void map_frozen ();
247         void hide_redirect_editor (ARDOUR::Redirect* redirect);
248
249         sigc::connection gain_watching;
250         sigc::connection pan_watching;
251         bool ignore_speed_adjustment;
252
253         string solo_button_name () const { return "MixerSoloButton"; }
254         string safe_solo_button_name () const { return "MixerSafeSoloButton"; }
255 };
256
257 #endif /* __ardour_mixer_strip__ */