the missing flush call for plugins
[ardour2.git] / gtk2_ardour / mixer_ui.h
blob6cc21aadd31ee876c43cf1f8c109a84c56dc0766
1 /*
2 Copyright (C) 2000 Paul Davis
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.
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.
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.
20 #ifndef __ardour_mixer_ui_h__
21 #define __ardour_mixer_ui_h__
23 #include <list>
25 #include <gtkmm/box.h>
26 #include <gtkmm/scrolledwindow.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/button.h>
30 #include <gtkmm/frame.h>
31 #include <gtkmm/paned.h>
32 #include <gtkmm/menu.h>
33 #include <gtkmm/treeview.h>
35 #include <pbd/stateful.h>
37 #include <ardour/ardour.h>
38 #include <ardour/io.h>
40 #include "route_redirect_selection.h"
41 #include "enums.h"
43 namespace ARDOUR {
44 class Route;
45 class RouteGroup;
46 class Session;
47 class AudioDiskstream;
50 class MixerStrip;
51 class PluginSelector;
53 class Mixer_UI : public Gtk::Window
55 public:
56 Mixer_UI ();
57 ~Mixer_UI();
59 void connect_to_session (ARDOUR::Session *);
61 PluginSelector& plugin_selector() { return *_plugin_selector; }
63 void set_strip_width (Width);
64 Width get_strip_width () const { return _strip_width; }
66 void unselect_strip_in_display (MixerStrip*);
67 void select_strip_in_display (MixerStrip*);
69 XMLNode& get_state (void);
70 int set_state (const XMLNode& );
72 void show_window ();
73 bool hide_window (GdkEventAny *ev);
74 void show_strip (MixerStrip *);
75 void hide_strip (MixerStrip *);
77 void ensure_float (Gtk::Window&);
78 void toggle_auto_rebinding ();
79 void set_auto_rebinding(bool);
81 RouteRedirectSelection& selection() { return _selection; }
83 static const char* get_order_key();
85 private:
86 ARDOUR::Session *session;
88 bool _visible;
90 Gtk::HBox global_hpacker;
91 Gtk::VBox global_vpacker;
92 Gtk::ScrolledWindow scroller;
93 Gtk::EventBox scroller_base;
94 Gtk::HBox scroller_hpacker;
95 Gtk::VBox mixer_scroller_vpacker;
96 Gtk::VBox list_vpacker;
97 Gtk::Label group_display_button_label;
98 Gtk::Button group_display_button;
99 Gtk::ScrolledWindow track_display_scroller;
100 Gtk::ScrolledWindow group_display_scroller;
101 Gtk::VBox group_display_vbox;
102 Gtk::Frame track_display_frame;
103 Gtk::Frame group_display_frame;
104 Gtk::VPaned rhs_pane1;
105 Gtk::HBox strip_packer;
106 Gtk::HBox out_packer;
107 Gtk::HPaned list_hpane;
109 // for restoring window geometry.
110 int m_root_x, m_root_y, m_width, m_height;
112 void set_window_pos_and_size ();
113 void get_window_pos_and_size ();
115 bool on_key_press_event (GdkEventKey*);
116 bool on_scroll_event (GdkEventScroll*);
118 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
120 list<MixerStrip *> strips;
122 bool strip_scroller_button_release (GdkEventButton*);
123 void scroll_left ();
124 void scroll_right ();
126 void add_strip (ARDOUR::Session::RouteList&);
127 void remove_strip (MixerStrip *);
129 void hide_all_strips (bool with_select);
130 void unselect_all_strips();
131 void select_all_strips ();
132 void unselect_all_audiotrack_strips ();
133 void select_all_audiotrack_strips ();
134 void unselect_all_audiobus_strips ();
135 void select_all_audiobus_strips ();
137 void auto_rebind_midi_controls ();
138 bool auto_rebinding;
140 void strip_select_op (bool audiotrack, bool select);
141 void select_strip_op (MixerStrip*, bool select);
143 void follow_strip_selection ();
145 gint start_updating ();
146 gint stop_updating ();
148 void disconnect_from_session ();
150 sigc::connection fast_screen_update_connection;
151 void fast_update_strips ();
153 void track_name_changed (MixerStrip *);
155 void redisplay_track_list ();
156 bool no_track_list_redisplay;
157 bool track_display_button_press (GdkEventButton*);
158 #ifdef GTKOSX
159 void queue_draw_all_strips ();
160 #endif
162 void track_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
163 void track_list_delete (const Gtk::TreeModel::Path&);
164 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
166 void initial_track_display ();
167 void show_track_list_menu ();
169 void set_all_strips_visibility (bool yn);
170 void set_all_audio_visibility (int tracks, bool yn);
172 void hide_all_routes ();
173 void show_all_routes ();
174 void show_all_audiobus ();
175 void hide_all_audiobus ();
176 void show_all_audiotracks();
177 void hide_all_audiotracks ();
178 void show_tracks_with_regions_at_playhead ();
180 Gtk::Menu* mix_group_context_menu;
181 bool in_group_row_change;
183 void group_selected (gint row, gint col, GdkEvent *ev);
184 void group_unselected (gint row, gint col, GdkEvent *ev);
185 void group_display_active_clicked();
186 void new_mix_group ();
187 void remove_selected_mix_group ();
188 void build_mix_group_context_menu ();
189 void activate_all_mix_groups ();
190 void disable_all_mix_groups ();
191 void show_all_mix_groups ();
192 void hide_all_mix_groups ();
193 void add_mix_group (ARDOUR::RouteGroup *);
194 void mix_groups_changed ();
195 void mix_group_name_edit (const Glib::ustring&, const Glib::ustring&);
196 void mix_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
198 Gtk::Menu *track_menu;
199 void track_column_click (gint);
200 void build_track_menu ();
202 PluginSelector *_plugin_selector;
204 void strip_name_changed (void *src, MixerStrip *);
206 void group_flags_changed (void *src, ARDOUR::RouteGroup *);
208 /* various treeviews */
210 struct TrackDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
211 TrackDisplayModelColumns () {
212 add (text);
213 add (visible);
214 add (route);
215 add (strip);
217 Gtk::TreeModelColumn<bool> visible;
218 Gtk::TreeModelColumn<Glib::ustring> text;
219 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
220 Gtk::TreeModelColumn<MixerStrip*> strip;
223 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
224 GroupDisplayModelColumns() {
225 add (active);
226 add (visible);
227 add (text);
228 add (group);
230 Gtk::TreeModelColumn<bool> active;
231 Gtk::TreeModelColumn<bool> visible;
232 Gtk::TreeModelColumn<Glib::ustring> text;
233 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
236 TrackDisplayModelColumns track_columns;
237 GroupDisplayModelColumns group_columns;
239 Gtk::TreeView track_display;
240 Gtk::TreeView group_display;
242 Glib::RefPtr<Gtk::ListStore> track_model;
243 Glib::RefPtr<Gtk::ListStore> group_model;
245 bool group_display_button_press (GdkEventButton*);
246 void group_display_selection_changed ();
248 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
250 RouteRedirectSelection _selection;
252 Width _strip_width;
254 void sync_order_keys (const char *src);
255 bool strip_redisplay_does_not_reset_order_keys;
256 bool strip_redisplay_does_not_sync_order_keys;
258 static const int32_t default_width = 478;
259 static const int32_t default_height = 765;
262 #endif /* __ardour_mixer_ui_h__ */