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__
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>
34 #include <gtkmm/liststore.h>
36 #include "pbd/stateful.h"
37 #include "pbd/signals.h"
39 #include "ardour/ardour.h"
40 #include "ardour/types.h"
41 #include "ardour/session_handle.h"
42 #include "ardour/plugin.h"
43 #include "ardour/plugin_manager.h"
46 #include "gtkmm2ext/dndtreeview.h"
47 #include "gtkmm2ext/treeutils.h"
49 #include "gtkmm2ext/tabbable.h"
52 #include "mixer_actor.h"
65 class PluginTreeStore : public Gtk::TreeStore
68 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
69 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
73 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
74 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
75 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
78 class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor
81 static Mixer_UI* instance();
84 Gtk::Window* use_own_window (bool and_fill_it);
87 void set_session (ARDOUR::Session *);
88 void track_editor_selection ();
90 PluginSelector* plugin_selector();
92 void set_strip_width (Width, bool save = false);
93 Width get_strip_width () const { return _strip_width; }
95 XMLNode& get_state ();
96 int set_state (const XMLNode&, int /* version */);
98 void show_mixer_list (bool yn);
99 void show_monitor_section (bool);
101 void show_strip (MixerStrip *);
102 void hide_strip (MixerStrip *);
104 void maximise_mixer_space();
105 void restore_mixer_space();
107 MonitorSection* monitor_section() const { return _monitor_section; }
109 void deselect_all_strip_processors();
110 void delete_processors();
111 void select_strip (MixerStrip&, bool add=false);
114 bool window_not_visible () const;
116 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
117 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
120 void set_route_targets_for_operation ();
124 static Mixer_UI* _instance;
126 Gtk::HBox global_hpacker;
127 Gtk::VBox global_vpacker;
128 Gtk::ScrolledWindow scroller;
129 Gtk::EventBox scroller_base;
130 Gtk::HBox scroller_hpacker;
131 Gtk::VBox mixer_scroller_vpacker;
132 Gtk::VBox list_vpacker;
133 Gtk::Label group_display_button_label;
134 Gtk::Button group_display_button;
135 Gtk::ScrolledWindow track_display_scroller;
136 Gtk::ScrolledWindow group_display_scroller;
137 Gtk::ScrolledWindow favorite_plugins_scroller;
138 Gtk::VBox group_display_vbox;
139 Gtk::Frame track_display_frame;
140 Gtk::Frame group_display_frame;
141 Gtk::Frame favorite_plugins_frame;
142 Gtk::VPaned rhs_pane1;
143 Gtk::VPaned rhs_pane2;
144 Gtk::HPaned inner_pane;
145 Gtk::HBox strip_packer;
146 Gtk::ScrolledWindow vca_scroller;
147 Gtk::HBox vca_packer;
148 Gtk::HBox out_packer;
149 Gtk::HPaned list_hpane;
151 MixerGroupTabs* _group_tabs;
153 bool on_scroll_event (GdkEventScroll*);
155 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
157 std::list<MixerStrip *> strips;
159 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
160 bool strip_scroller_button_release (GdkEventButton*);
162 void scroll_right ();
163 void toggle_midi_input_active (bool flip_others);
165 void add_strips (ARDOUR::RouteList&);
166 void remove_strip (MixerStrip *);
168 void add_masters (ARDOUR::VCAList&);
169 void remove_master (VCAMasterStrip*);
171 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>);
173 void hide_all_strips (bool with_select);
174 void unselect_all_strips();
175 void select_all_strips ();
176 void unselect_all_audiotrack_strips ();
177 void select_all_audiotrack_strips ();
178 void unselect_all_audiobus_strips ();
179 void select_all_audiobus_strips ();
181 void strip_select_op (bool audiotrack, bool select);
182 void select_strip_op (MixerStrip*, bool select);
184 gint start_updating ();
185 gint stop_updating ();
187 void session_going_away ();
189 sigc::connection fast_screen_update_connection;
190 void fast_update_strips ();
192 void track_name_changed (MixerStrip *);
194 void redisplay_track_list ();
195 bool no_track_list_redisplay;
196 bool track_display_button_press (GdkEventButton*);
197 void strip_width_changed ();
199 void track_list_delete (const Gtk::TreeModel::Path&);
200 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
202 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
203 bool plugin_row_button_press (GdkEventButton*);
204 void popup_note_context_menu (GdkEventButton*);
205 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
207 enum ProcessorPosition {
214 void add_selected_processor (ProcessorPosition);
215 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
216 void remove_selected_from_favorites ();
217 void delete_selected_preset ();
218 ARDOUR::PluginPresetPtr selected_plugin ();
220 void initial_track_display ();
221 void show_track_list_menu ();
223 void set_all_strips_visibility (bool yn);
224 void set_all_audio_midi_visibility (int, bool);
225 void track_visibility_changed (std::string const & path);
226 void update_track_visibility ();
228 void hide_all_routes ();
229 void show_all_routes ();
230 void show_all_audiobus ();
231 void hide_all_audiobus ();
232 void show_all_audiotracks();
233 void hide_all_audiotracks ();
234 void show_all_miditracks();
235 void hide_all_miditracks ();
237 bool in_group_row_change;
239 void group_selected (gint row, gint col, GdkEvent *ev);
240 void group_unselected (gint row, gint col, GdkEvent *ev);
241 void group_display_active_clicked();
242 void new_route_group ();
243 void remove_selected_route_group ();
244 void activate_all_route_groups ();
245 void disable_all_route_groups ();
246 void add_route_group (ARDOUR::RouteGroup *);
247 void route_groups_changed ();
248 void route_group_name_edit (const std::string&, const std::string&);
249 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
250 void route_group_row_deleted (Gtk::TreeModel::Path const &);
252 Gtk::Menu *track_menu;
253 void track_column_click (gint);
254 void build_track_menu ();
256 MonitorSection* _monitor_section;
257 PluginSelector *_plugin_selector;
259 void strip_property_changed (const PBD::PropertyChange&, MixerStrip *);
260 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
262 /* various treeviews */
264 struct TrackDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
265 TrackDisplayModelColumns () {
272 Gtk::TreeModelColumn<bool> visible;
273 Gtk::TreeModelColumn<std::string> text;
274 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
275 /* if route is non-null, this must be non-null */
276 Gtk::TreeModelColumn<MixerStrip*> strip;
277 /* if route is null, this may be non-null */
278 Gtk::TreeModelColumn<VCAMasterStrip*> vca;
281 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
282 GroupDisplayModelColumns() {
287 Gtk::TreeModelColumn<bool> visible;
288 Gtk::TreeModelColumn<std::string> text;
289 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
292 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
293 PluginsDisplayModelColumns() {
297 Gtk::TreeModelColumn<std::string> name;
298 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
301 ARDOUR::PluginInfoList favorite_order;
302 std::map<std::string, bool> favorite_ui_state;
304 TrackDisplayModelColumns track_columns;
305 GroupDisplayModelColumns group_columns;
306 PluginsDisplayModelColumns favorite_plugins_columns;
308 Gtk::TreeView track_display;
309 Gtk::TreeView group_display;
310 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
312 Glib::RefPtr<Gtk::ListStore> track_model;
313 Glib::RefPtr<Gtk::ListStore> group_model;
314 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
316 bool group_display_button_press (GdkEventButton*);
317 void group_display_selection_changed ();
319 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
323 void sync_presentation_info_from_treeview ();
324 void sync_treeview_from_presentation_info ();
328 void parameter_changed (std::string const &);
329 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
331 void setup_track_display ();
332 void new_track_or_bus ();
334 static const int32_t default_width = 478;
335 static const int32_t default_height = 765;
337 /** true if we are rebuilding the route group list, or clearing
338 it during a session teardown.
340 bool _in_group_rebuild_or_clear;
341 bool _route_deletion_in_progress;
343 void update_title ();
344 MixerStrip* strip_by_x (int x);
346 friend class MixerGroupTabs;
348 void follow_editor_selection ();
349 bool _following_editor_selection;
351 void monitor_section_going_away ();
353 void monitor_section_attached ();
354 void monitor_section_detached ();
356 void store_current_favorite_order();
357 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
358 void refill_favorite_plugins ();
359 void sync_treeview_from_favorite_order ();
360 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
361 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
363 /// true if we are in fullscreen mode
366 // true if mixer list is visible
367 bool _show_mixer_list;
370 #endif /* __ardour_mixer_ui_h__ */