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"
77 class PluginTreeStore : public Gtk::TreeStore
80 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
81 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
85 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
86 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
87 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
90 class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
93 static Mixer_UI* instance();
96 Gtk::Window* use_own_window (bool and_fill_it);
99 void set_session (ARDOUR::Session *);
101 PluginSelector* plugin_selector();
103 void set_strip_width (Width, bool save = false);
104 Width get_strip_width () const { return _strip_width; }
106 XMLNode& get_state ();
107 int set_state (const XMLNode&, int /* version */);
109 void save_plugin_order_file ();
111 void show_strip (MixerStrip *);
112 void hide_strip (MixerStrip *);
114 void maximise_mixer_space();
115 void restore_mixer_space();
117 MonitorSection& monitor_section() { return _monitor_section; }
119 void deselect_all_strip_processors();
120 void delete_processors();
123 void select_next_strip ();
124 void select_prev_strip ();
126 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
127 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
128 void show_spill (boost::shared_ptr<ARDOUR::Stripable>);
129 bool showing_spill_for (boost::shared_ptr<ARDOUR::Stripable>) const;
131 sigc::signal1<void,boost::shared_ptr<ARDOUR::Stripable> > show_spill_change;
133 RouteProcessorSelection& selection() { return _selection; }
135 void show_editor_window () const;
137 void register_actions ();
139 void load_bindings ();
140 Gtkmm2ext::Bindings* bindings;
142 void toggle_mixer_list ();
143 void showhide_mixer_list (bool yn);
145 void toggle_monitor_section ();
146 void showhide_monitor_section (bool);
148 void toggle_foldback_strip ();
149 void showhide_foldback_strip (bool);
152 void showhide_vcas (bool on);
155 void toggle_mixbuses ();
156 void showhide_mixbusses (bool on);
159 bool screenshot (std::string const&);
161 void toggle_monitor_action (ARDOUR::MonitorChoice monitor_choice, bool group_override = false, bool all = false);
164 void set_axis_targets_for_operation ();
165 ARDOUR::AutomationControlSet selected_gaincontrols ();
169 static Mixer_UI* _instance;
171 Gtk::HBox global_hpacker;
172 Gtk::VBox global_vpacker;
173 Gtk::ScrolledWindow scroller;
174 Gtk::EventBox scroller_base;
175 Gtk::HBox scroller_hpacker;
176 Gtk::VBox mixer_scroller_vpacker;
177 Gtk::VBox list_vpacker;
178 Gtk::Label group_display_button_label;
179 Gtk::ScrolledWindow track_display_scroller;
180 Gtk::ScrolledWindow group_display_scroller;
181 Gtk::ScrolledWindow favorite_plugins_scroller;
182 Gtk::VBox group_display_vbox;
183 Gtk::Frame track_display_frame;
184 Gtk::Frame group_display_frame;
185 Gtk::Frame favorite_plugins_frame;
186 Gtk::VBox favorite_plugins_vbox;
187 Gtk::ComboBoxText favorite_plugins_tag_combo;
188 ArdourWidgets::VPane rhs_pane1;
189 ArdourWidgets::VPane rhs_pane2;
190 ArdourWidgets::HPane inner_pane;
191 Gtk::VBox strip_group_box;
192 Gtk::HBox strip_packer;
193 Gtk::ScrolledWindow vca_scroller;
194 Gtk::HBox vca_hpacker;
195 Gtk::VBox vca_vpacker;
196 Gtk::EventBox vca_label_bar;
197 Gtk::Label vca_label;
198 Gtk::EventBox vca_scroller_base;
199 Gtk::HBox out_packer;
200 ArdourWidgets::HPane list_hpane;
201 Gtk::Button add_button; // should really be an ArdourButton
202 Gtk::Button add_vca_button;
204 MixerGroupTabs* _group_tabs;
206 bool on_scroll_event (GdkEventScroll*);
207 bool on_vca_scroll_event (GdkEventScroll*);
209 std::list<MixerStrip *> strips;
211 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
212 bool strip_scroller_button_release (GdkEventButton*);
213 bool masters_scroller_button_release (GdkEventButton*);
215 void scroll_right ();
216 void vca_scroll_left ();
217 void vca_scroll_right ();
218 void toggle_midi_input_active (bool flip_others);
220 void move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable>);
221 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
223 void add_stripables (ARDOUR::StripableList&);
225 void add_routes (ARDOUR::RouteList&);
226 void remove_strip (MixerStrip *);
227 void remove_foldback (FoldbackStrip *);
228 void add_masters (ARDOUR::VCAList&);
229 void remove_master (VCAMasterStrip*);
230 void new_masters_created ();
232 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
233 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
235 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
236 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
238 gint start_updating ();
239 gint stop_updating ();
241 void session_going_away ();
243 sigc::connection fast_screen_update_connection;
244 void fast_update_strips ();
246 void track_name_changed (MixerStrip *);
248 void redisplay_track_list ();
249 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
250 bool no_track_list_redisplay;
251 bool track_display_button_press (GdkEventButton*);
252 void strip_width_changed ();
254 void track_list_delete (const Gtk::TreeModel::Path&);
255 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
257 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
258 bool plugin_row_button_press (GdkEventButton*);
259 void popup_note_context_menu (GdkEventButton*);
260 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
262 enum ProcessorPosition {
269 void add_selected_processor (ProcessorPosition);
270 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
271 void remove_selected_from_favorites ();
272 void delete_selected_preset ();
273 ARDOUR::PluginPresetPtr selected_plugin ();
275 void initial_track_display ();
277 void set_all_strips_visibility (bool yn);
278 void set_all_audio_midi_visibility (int, bool);
279 void track_visibility_changed (std::string const & path);
280 void update_track_visibility ();
282 void hide_all_routes ();
283 void show_all_routes ();
284 void show_all_audiobus ();
285 void hide_all_audiobus ();
286 void show_all_audiotracks();
287 void hide_all_audiotracks ();
288 void show_all_miditracks();
289 void hide_all_miditracks ();
291 bool in_group_row_change;
293 void group_selected (gint row, gint col, GdkEvent *ev);
294 void group_unselected (gint row, gint col, GdkEvent *ev);
295 void group_display_active_clicked();
296 void new_route_group ();
297 void remove_selected_route_group ();
298 void activate_all_route_groups ();
299 void disable_all_route_groups ();
300 void add_route_group (ARDOUR::RouteGroup *);
301 void route_groups_changed ();
302 void route_group_name_edit (const std::string&, const std::string&);
303 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
304 void route_group_row_deleted (Gtk::TreeModel::Path const &);
306 Gtk::Menu *track_menu;
307 void track_column_click (gint);
308 void build_track_menu ();
310 MonitorSection _monitor_section;
311 PluginSelector *_plugin_selector;
312 FoldbackStrip * foldback_strip;
313 bool _show_foldback_strip;
315 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
316 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
318 /* various treeviews */
320 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
321 StripableDisplayModelColumns () {
327 Gtk::TreeModelColumn<bool> visible;
328 Gtk::TreeModelColumn<std::string> text;
329 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
330 Gtk::TreeModelColumn<AxisView*> strip;
333 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
334 GroupDisplayModelColumns() {
339 Gtk::TreeModelColumn<bool> visible;
340 Gtk::TreeModelColumn<std::string> text;
341 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
344 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
345 PluginsDisplayModelColumns() {
349 Gtk::TreeModelColumn<std::string> name;
350 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
353 ARDOUR::PluginInfoList favorite_order;
354 std::map<std::string, bool> favorite_ui_state;
356 StripableDisplayModelColumns stripable_columns;
357 GroupDisplayModelColumns group_columns;
358 PluginsDisplayModelColumns favorite_plugins_columns;
360 Gtk::TreeView track_display;
361 Gtk::TreeView group_display;
362 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
364 Glib::RefPtr<Gtk::ListStore> track_model;
365 Glib::RefPtr<Gtk::ListStore> group_model;
366 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
368 bool group_display_button_press (GdkEventButton*);
369 void group_display_selection_changed ();
371 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
372 bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
375 double _spill_scroll_position;
377 void presentation_info_changed (PBD::PropertyChange const &);
378 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
379 void sync_presentation_info_from_treeview ();
383 void parameter_changed (std::string const &);
384 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
386 void setup_track_display ();
387 void new_track_or_bus ();
389 static const int32_t default_width = 478;
390 static const int32_t default_height = 765;
392 /** true if we are rebuilding the route group list, or clearing
393 * it during a session teardown.
395 bool _in_group_rebuild_or_clear;
396 bool _route_deletion_in_progress;
398 void update_title ();
399 MixerStrip* strip_by_x (int x);
401 friend class MixerGroupTabs;
403 void monitor_section_going_away ();
404 void monitor_section_attached ();
405 void monitor_section_detached ();
407 void store_current_favorite_order();
408 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
410 void plugin_list_changed ();
412 void refill_favorite_plugins ();
413 void refill_tag_combo ();
415 void tag_combo_changed ();
417 void sync_treeview_from_favorite_order ();
418 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
419 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
421 /// true if we are in fullscreen mode
424 bool _strip_selection_change_without_scroll;
426 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
430 RouteProcessorSelection _selection;
431 AxisViewSelection _axis_targets;
433 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
434 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
436 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
439 void rec_enable_action ();
440 void step_gain_up_action ();
441 void step_gain_down_action ();
442 void unity_gain_action ();
444 void copy_processors ();
445 void cut_processors ();
446 void paste_processors ();
447 void select_all_processors ();
448 void toggle_processors ();
452 #endif /* __ardour_mixer_ui_h__ */