2 * Copyright (C) 2005-2007 Taybin Rutkin <taybin@taybin.com>
3 * Copyright (C) 2005-2018 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
5 * Copyright (C) 2007-2009 David Robillard <d@drobilla.net>
6 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
7 * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
8 * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __ardour_mixer_ui_h__
26 #define __ardour_mixer_ui_h__
30 #include <gtkmm/box.h>
31 #include <gtkmm/scrolledwindow.h>
32 #include <gtkmm/eventbox.h>
33 #include <gtkmm/label.h>
34 #include <gtkmm/comboboxtext.h>
35 #include <gtkmm/button.h>
36 #include <gtkmm/frame.h>
37 #include <gtkmm/menu.h>
38 #include <gtkmm/treeview.h>
39 #include <gtkmm/treestore.h>
40 #include <gtkmm/liststore.h>
42 #include "pbd/stateful.h"
43 #include "pbd/signals.h"
45 #include "ardour/ardour.h"
46 #include "ardour/types.h"
47 #include "ardour/session_handle.h"
48 #include "ardour/plugin.h"
49 #include "ardour/plugin_manager.h"
51 #include <gtkmm2ext/bindings.h>
52 #include "gtkmm2ext/dndtreeview.h"
53 #include "gtkmm2ext/treeutils.h"
55 #include "widgets/pane.h"
56 #include "widgets/tabbable.h"
58 #include "axis_provider.h"
60 #include "monitor_section.h"
61 #include "route_processor_selection.h"
76 class PluginTreeStore : public Gtk::TreeStore
79 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
80 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
84 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
85 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
86 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
89 class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
92 static Mixer_UI* instance();
95 Gtk::Window* use_own_window (bool and_fill_it);
98 void set_session (ARDOUR::Session *);
100 PluginSelector* plugin_selector();
102 void set_strip_width (Width, bool save = false);
103 Width get_strip_width () const { return _strip_width; }
105 XMLNode& get_state ();
106 int set_state (const XMLNode&, int /* version */);
108 void save_plugin_order_file ();
110 void show_strip (MixerStrip *);
111 void hide_strip (MixerStrip *);
113 void maximise_mixer_space();
114 void restore_mixer_space();
116 MonitorSection& monitor_section() { return _monitor_section; }
118 void deselect_all_strip_processors();
119 void delete_processors();
122 void select_next_strip ();
123 void select_prev_strip ();
125 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
126 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
127 void show_spill (boost::shared_ptr<ARDOUR::Stripable>);
128 bool showing_spill_for (boost::shared_ptr<ARDOUR::Stripable>) const;
130 sigc::signal1<void,boost::shared_ptr<ARDOUR::Stripable> > show_spill_change;
132 RouteProcessorSelection& selection() { return _selection; }
134 void show_editor_window () const;
136 void register_actions ();
138 void load_bindings ();
139 Gtkmm2ext::Bindings* bindings;
141 void toggle_mixer_list ();
142 void showhide_mixer_list (bool yn);
144 void toggle_monitor_section ();
145 void showhide_monitor_section (bool);
148 void showhide_vcas (bool on);
151 void toggle_mixbuses ();
152 void showhide_mixbusses (bool on);
155 bool screenshot (std::string const&);
158 void set_axis_targets_for_operation ();
159 ARDOUR::AutomationControlSet selected_gaincontrols ();
163 static Mixer_UI* _instance;
165 Gtk::HBox global_hpacker;
166 Gtk::VBox global_vpacker;
167 Gtk::ScrolledWindow scroller;
168 Gtk::EventBox scroller_base;
169 Gtk::HBox scroller_hpacker;
170 Gtk::VBox mixer_scroller_vpacker;
171 Gtk::VBox list_vpacker;
172 Gtk::Label group_display_button_label;
173 Gtk::ScrolledWindow track_display_scroller;
174 Gtk::ScrolledWindow group_display_scroller;
175 Gtk::ScrolledWindow favorite_plugins_scroller;
176 Gtk::VBox group_display_vbox;
177 Gtk::Frame track_display_frame;
178 Gtk::Frame group_display_frame;
179 Gtk::Frame favorite_plugins_frame;
180 Gtk::VBox favorite_plugins_vbox;
181 Gtk::ComboBoxText favorite_plugins_tag_combo;
182 ArdourWidgets::VPane rhs_pane1;
183 ArdourWidgets::VPane rhs_pane2;
184 ArdourWidgets::HPane inner_pane;
185 Gtk::VBox strip_group_box;
186 Gtk::HBox strip_packer;
187 Gtk::ScrolledWindow vca_scroller;
188 Gtk::HBox vca_hpacker;
189 Gtk::VBox vca_vpacker;
190 Gtk::EventBox vca_label_bar;
191 Gtk::Label vca_label;
192 Gtk::EventBox vca_scroller_base;
193 Gtk::HBox out_packer;
194 ArdourWidgets::HPane list_hpane;
195 Gtk::Button add_button; // should really be an ArdourButton
196 Gtk::Button add_vca_button;
198 MixerGroupTabs* _group_tabs;
200 bool on_scroll_event (GdkEventScroll*);
201 bool on_vca_scroll_event (GdkEventScroll*);
203 std::list<MixerStrip *> strips;
205 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
206 bool strip_scroller_button_release (GdkEventButton*);
207 bool masters_scroller_button_release (GdkEventButton*);
209 void scroll_right ();
210 void vca_scroll_left ();
211 void vca_scroll_right ();
212 void toggle_midi_input_active (bool flip_others);
214 void move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable>);
215 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
217 void add_stripables (ARDOUR::StripableList&);
219 void add_routes (ARDOUR::RouteList&);
220 void remove_strip (MixerStrip *);
222 void add_masters (ARDOUR::VCAList&);
223 void remove_master (VCAMasterStrip*);
224 void new_masters_created ();
226 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
227 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
229 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
230 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
232 gint start_updating ();
233 gint stop_updating ();
235 void session_going_away ();
237 sigc::connection fast_screen_update_connection;
238 void fast_update_strips ();
240 void track_name_changed (MixerStrip *);
242 void redisplay_track_list ();
243 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
244 bool no_track_list_redisplay;
245 bool track_display_button_press (GdkEventButton*);
246 void strip_width_changed ();
248 void track_list_delete (const Gtk::TreeModel::Path&);
249 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
251 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
252 bool plugin_row_button_press (GdkEventButton*);
253 void popup_note_context_menu (GdkEventButton*);
254 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
256 enum ProcessorPosition {
263 void add_selected_processor (ProcessorPosition);
264 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
265 void remove_selected_from_favorites ();
266 void delete_selected_preset ();
267 ARDOUR::PluginPresetPtr selected_plugin ();
269 void initial_track_display ();
271 void set_all_strips_visibility (bool yn);
272 void set_all_audio_midi_visibility (int, bool);
273 void track_visibility_changed (std::string const & path);
274 void update_track_visibility ();
276 void hide_all_routes ();
277 void show_all_routes ();
278 void show_all_audiobus ();
279 void hide_all_audiobus ();
280 void show_all_audiotracks();
281 void hide_all_audiotracks ();
282 void show_all_miditracks();
283 void hide_all_miditracks ();
285 bool in_group_row_change;
287 void group_selected (gint row, gint col, GdkEvent *ev);
288 void group_unselected (gint row, gint col, GdkEvent *ev);
289 void group_display_active_clicked();
290 void new_route_group ();
291 void remove_selected_route_group ();
292 void activate_all_route_groups ();
293 void disable_all_route_groups ();
294 void add_route_group (ARDOUR::RouteGroup *);
295 void route_groups_changed ();
296 void route_group_name_edit (const std::string&, const std::string&);
297 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
298 void route_group_row_deleted (Gtk::TreeModel::Path const &);
300 Gtk::Menu *track_menu;
301 void track_column_click (gint);
302 void build_track_menu ();
304 MonitorSection _monitor_section;
305 PluginSelector *_plugin_selector;
307 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
308 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
310 /* various treeviews */
312 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
313 StripableDisplayModelColumns () {
319 Gtk::TreeModelColumn<bool> visible;
320 Gtk::TreeModelColumn<std::string> text;
321 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
322 Gtk::TreeModelColumn<AxisView*> strip;
325 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
326 GroupDisplayModelColumns() {
331 Gtk::TreeModelColumn<bool> visible;
332 Gtk::TreeModelColumn<std::string> text;
333 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
336 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
337 PluginsDisplayModelColumns() {
341 Gtk::TreeModelColumn<std::string> name;
342 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
345 ARDOUR::PluginInfoList favorite_order;
346 std::map<std::string, bool> favorite_ui_state;
348 StripableDisplayModelColumns stripable_columns;
349 GroupDisplayModelColumns group_columns;
350 PluginsDisplayModelColumns favorite_plugins_columns;
352 Gtk::TreeView track_display;
353 Gtk::TreeView group_display;
354 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
356 Glib::RefPtr<Gtk::ListStore> track_model;
357 Glib::RefPtr<Gtk::ListStore> group_model;
358 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
360 bool group_display_button_press (GdkEventButton*);
361 void group_display_selection_changed ();
363 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
364 bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
367 double _spill_scroll_position;
369 void presentation_info_changed (PBD::PropertyChange const &);
370 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
371 void sync_presentation_info_from_treeview ();
375 void parameter_changed (std::string const &);
376 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
378 void setup_track_display ();
379 void new_track_or_bus ();
381 static const int32_t default_width = 478;
382 static const int32_t default_height = 765;
384 /** true if we are rebuilding the route group list, or clearing
385 * it during a session teardown.
387 bool _in_group_rebuild_or_clear;
388 bool _route_deletion_in_progress;
390 void update_title ();
391 MixerStrip* strip_by_x (int x);
393 friend class MixerGroupTabs;
395 void monitor_section_going_away ();
396 void monitor_section_attached ();
397 void monitor_section_detached ();
399 void store_current_favorite_order();
400 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
402 void plugin_list_changed ();
404 void refill_favorite_plugins ();
405 void refill_tag_combo ();
407 void tag_combo_changed ();
409 void sync_treeview_from_favorite_order ();
410 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
411 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
413 /// true if we are in fullscreen mode
416 bool _strip_selection_change_without_scroll;
418 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
422 RouteProcessorSelection _selection;
423 AxisViewSelection _axis_targets;
425 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
426 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
428 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
431 void rec_enable_action ();
432 void step_gain_up_action ();
433 void step_gain_down_action ();
434 void unity_gain_action ();
436 void copy_processors ();
437 void cut_processors ();
438 void paste_processors ();
439 void select_all_processors ();
440 void toggle_processors ();
444 #endif /* __ardour_mixer_ui_h__ */