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/menu.h>
32 #include <gtkmm/treeview.h>
33 #include <gtkmm/liststore.h>
35 #include "pbd/stateful.h"
36 #include "pbd/signals.h"
38 #include "ardour/ardour.h"
39 #include "ardour/types.h"
40 #include "ardour/session_handle.h"
41 #include "ardour/plugin.h"
42 #include "ardour/plugin_manager.h"
44 #include "gtkmm2ext/dndtreeview.h"
45 #include <gtkmm2ext/pane.h>
46 #include "gtkmm2ext/treeutils.h"
48 #include "gtkmm2ext/tabbable.h"
51 #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>);
118 void show_vca_slaves (boost::shared_ptr<ARDOUR::VCA>);
119 bool showing_vca_slaves_for (boost::shared_ptr<ARDOUR::VCA>) const;
121 sigc::signal1<void,boost::shared_ptr<ARDOUR::VCA> > show_vca_change;
124 void set_route_targets_for_operation ();
128 static Mixer_UI* _instance;
130 Gtk::HBox global_hpacker;
131 Gtk::VBox global_vpacker;
132 Gtk::ScrolledWindow scroller;
133 Gtk::EventBox scroller_base;
134 Gtk::HBox scroller_hpacker;
135 Gtk::VBox mixer_scroller_vpacker;
136 Gtk::VBox list_vpacker;
137 Gtk::Label group_display_button_label;
138 Gtk::Button group_display_button;
139 Gtk::ScrolledWindow track_display_scroller;
140 Gtk::ScrolledWindow group_display_scroller;
141 Gtk::ScrolledWindow favorite_plugins_scroller;
142 Gtk::VBox group_display_vbox;
143 Gtk::Frame track_display_frame;
144 Gtk::Frame group_display_frame;
145 Gtk::Frame favorite_plugins_frame;
146 Gtkmm2ext::VPane rhs_pane1;
147 Gtkmm2ext::VPane rhs_pane2;
148 Gtkmm2ext::HPane inner_pane;
149 Gtk::HBox strip_packer;
150 Gtk::ScrolledWindow vca_scroller;
151 Gtk::HBox vca_packer;
152 Gtk::EventBox vca_scroller_base;
153 Gtk::HBox out_packer;
154 Gtkmm2ext::HPane list_hpane;
156 MixerGroupTabs* _group_tabs;
158 bool on_scroll_event (GdkEventScroll*);
160 std::list<MixerStrip *> strips;
162 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
163 bool strip_scroller_button_release (GdkEventButton*);
164 bool masters_scroller_button_release (GdkEventButton*);
166 void scroll_right ();
167 void toggle_midi_input_active (bool flip_others);
169 void add_stripables (ARDOUR::StripableList&);
171 void add_routes (ARDOUR::RouteList&);
172 void remove_strip (MixerStrip *);
174 void add_masters (ARDOUR::VCAList&);
175 void remove_master (VCAMasterStrip*);
177 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>);
179 void hide_all_strips (bool with_select);
180 void unselect_all_strips();
181 void select_all_strips ();
182 void unselect_all_audiotrack_strips ();
183 void select_all_audiotrack_strips ();
184 void unselect_all_audiobus_strips ();
185 void select_all_audiobus_strips ();
187 void strip_select_op (bool audiotrack, bool select);
188 void select_strip_op (MixerStrip*, bool select);
190 gint start_updating ();
191 gint stop_updating ();
193 void session_going_away ();
195 sigc::connection fast_screen_update_connection;
196 void fast_update_strips ();
198 void track_name_changed (MixerStrip *);
200 void redisplay_track_list ();
201 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
202 bool no_track_list_redisplay;
203 bool track_display_button_press (GdkEventButton*);
204 void strip_width_changed ();
206 void track_list_delete (const Gtk::TreeModel::Path&);
207 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
209 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
210 bool plugin_row_button_press (GdkEventButton*);
211 void popup_note_context_menu (GdkEventButton*);
212 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
214 enum ProcessorPosition {
221 void add_selected_processor (ProcessorPosition);
222 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
223 void remove_selected_from_favorites ();
224 void delete_selected_preset ();
225 ARDOUR::PluginPresetPtr selected_plugin ();
227 void initial_track_display ();
228 void show_track_list_menu ();
230 void set_all_strips_visibility (bool yn);
231 void set_all_audio_midi_visibility (int, bool);
232 void track_visibility_changed (std::string const & path);
233 void update_track_visibility ();
235 void hide_all_routes ();
236 void show_all_routes ();
237 void show_all_audiobus ();
238 void hide_all_audiobus ();
239 void show_all_audiotracks();
240 void hide_all_audiotracks ();
241 void show_all_miditracks();
242 void hide_all_miditracks ();
244 bool in_group_row_change;
246 void group_selected (gint row, gint col, GdkEvent *ev);
247 void group_unselected (gint row, gint col, GdkEvent *ev);
248 void group_display_active_clicked();
249 void new_route_group ();
250 void remove_selected_route_group ();
251 void activate_all_route_groups ();
252 void disable_all_route_groups ();
253 void add_route_group (ARDOUR::RouteGroup *);
254 void route_groups_changed ();
255 void route_group_name_edit (const std::string&, const std::string&);
256 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
257 void route_group_row_deleted (Gtk::TreeModel::Path const &);
259 Gtk::Menu *track_menu;
260 void track_column_click (gint);
261 void build_track_menu ();
263 MonitorSection* _monitor_section;
264 PluginSelector *_plugin_selector;
266 void strip_property_changed (const PBD::PropertyChange&, MixerStrip *);
267 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
269 /* various treeviews */
271 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
272 StripableDisplayModelColumns () {
278 Gtk::TreeModelColumn<bool> visible;
279 Gtk::TreeModelColumn<std::string> text;
280 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
281 Gtk::TreeModelColumn<AxisView*> strip;
284 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
285 GroupDisplayModelColumns() {
290 Gtk::TreeModelColumn<bool> visible;
291 Gtk::TreeModelColumn<std::string> text;
292 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
295 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
296 PluginsDisplayModelColumns() {
300 Gtk::TreeModelColumn<std::string> name;
301 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
304 ARDOUR::PluginInfoList favorite_order;
305 std::map<std::string, bool> favorite_ui_state;
307 StripableDisplayModelColumns stripable_columns;
308 GroupDisplayModelColumns group_columns;
309 PluginsDisplayModelColumns favorite_plugins_columns;
311 Gtk::TreeView track_display;
312 Gtk::TreeView group_display;
313 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
315 Glib::RefPtr<Gtk::ListStore> track_model;
316 Glib::RefPtr<Gtk::ListStore> group_model;
317 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
319 bool group_display_button_press (GdkEventButton*);
320 void group_display_selection_changed ();
322 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
326 void sync_presentation_info_from_treeview ();
327 void sync_treeview_from_presentation_info ();
331 void parameter_changed (std::string const &);
332 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
334 void setup_track_display ();
335 void new_track_or_bus ();
337 static const int32_t default_width = 478;
338 static const int32_t default_height = 765;
340 /** true if we are rebuilding the route group list, or clearing
341 it during a session teardown.
343 bool _in_group_rebuild_or_clear;
344 bool _route_deletion_in_progress;
346 void update_title ();
347 MixerStrip* strip_by_x (int x);
349 friend class MixerGroupTabs;
351 void follow_editor_selection ();
352 bool _following_editor_selection;
354 void monitor_section_going_away ();
356 void monitor_section_attached ();
357 void monitor_section_detached ();
359 void store_current_favorite_order();
360 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
361 void refill_favorite_plugins ();
362 void sync_treeview_from_favorite_order ();
363 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
364 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
366 /// true if we are in fullscreen mode
369 // true if mixer list is visible
370 bool _show_mixer_list;
372 mutable boost::weak_ptr<ARDOUR::VCA> spilled_vca;
377 #endif /* __ardour_mixer_ui_h__ */