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/comboboxtext.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/frame.h>
32 #include <gtkmm/menu.h>
33 #include <gtkmm/treeview.h>
34 #include <gtkmm/treestore.h>
35 #include <gtkmm/liststore.h>
37 #include "pbd/stateful.h"
38 #include "pbd/signals.h"
40 #include "ardour/ardour.h"
41 #include "ardour/types.h"
42 #include "ardour/session_handle.h"
43 #include "ardour/plugin.h"
44 #include "ardour/plugin_manager.h"
46 #include <gtkmm2ext/bindings.h>
47 #include "gtkmm2ext/dndtreeview.h"
48 #include "gtkmm2ext/treeutils.h"
50 #include "widgets/pane.h"
51 #include "widgets/tabbable.h"
53 #include "axis_provider.h"
55 #include "monitor_section.h"
56 #include "route_processor_selection.h"
71 class PluginTreeStore : public Gtk::TreeStore
74 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
75 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
79 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
80 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
81 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
84 class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
87 static Mixer_UI* instance();
90 Gtk::Window* use_own_window (bool and_fill_it);
93 void set_session (ARDOUR::Session *);
95 PluginSelector* plugin_selector();
97 void set_strip_width (Width, bool save = false);
98 Width get_strip_width () const { return _strip_width; }
100 XMLNode& get_state ();
101 int set_state (const XMLNode&, int /* version */);
103 void save_plugin_order_file ();
105 void show_strip (MixerStrip *);
106 void hide_strip (MixerStrip *);
108 void maximise_mixer_space();
109 void restore_mixer_space();
111 MonitorSection& monitor_section() { return _monitor_section; }
113 void deselect_all_strip_processors();
114 void delete_processors();
117 void select_next_strip ();
118 void select_prev_strip ();
120 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
121 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
122 void show_spill (boost::shared_ptr<ARDOUR::Stripable>);
123 bool showing_spill_for (boost::shared_ptr<ARDOUR::Stripable>) const;
125 sigc::signal1<void,boost::shared_ptr<ARDOUR::Stripable> > show_spill_change;
127 RouteProcessorSelection& selection() { return _selection; }
129 void show_editor_window () const;
131 void register_actions ();
133 void load_bindings ();
134 Gtkmm2ext::Bindings* bindings;
136 void toggle_mixer_list ();
137 void showhide_mixer_list (bool yn);
139 void toggle_monitor_section ();
140 void showhide_monitor_section (bool);
143 void showhide_vcas (bool on);
146 void toggle_mixbuses ();
147 void showhide_mixbusses (bool on);
151 void set_axis_targets_for_operation ();
152 ARDOUR::AutomationControlSet selected_gaincontrols ();
156 static Mixer_UI* _instance;
158 Gtk::HBox global_hpacker;
159 Gtk::VBox global_vpacker;
160 Gtk::ScrolledWindow scroller;
161 Gtk::EventBox scroller_base;
162 Gtk::HBox scroller_hpacker;
163 Gtk::VBox mixer_scroller_vpacker;
164 Gtk::VBox list_vpacker;
165 Gtk::Label group_display_button_label;
166 Gtk::ScrolledWindow track_display_scroller;
167 Gtk::ScrolledWindow group_display_scroller;
168 Gtk::ScrolledWindow favorite_plugins_scroller;
169 Gtk::VBox group_display_vbox;
170 Gtk::Frame track_display_frame;
171 Gtk::Frame group_display_frame;
172 Gtk::Frame favorite_plugins_frame;
173 Gtk::VBox favorite_plugins_vbox;
174 Gtk::ComboBoxText favorite_plugins_tag_combo;
175 ArdourWidgets::VPane rhs_pane1;
176 ArdourWidgets::VPane rhs_pane2;
177 ArdourWidgets::HPane inner_pane;
178 Gtk::HBox strip_packer;
179 Gtk::ScrolledWindow vca_scroller;
180 Gtk::HBox vca_hpacker;
181 Gtk::VBox vca_vpacker;
182 Gtk::EventBox vca_label_bar;
183 Gtk::Label vca_label;
184 Gtk::EventBox vca_scroller_base;
185 Gtk::HBox out_packer;
186 ArdourWidgets::HPane list_hpane;
187 Gtk::Button add_button; // should really be an ArdourButton
188 Gtk::Button add_vca_button;
190 MixerGroupTabs* _group_tabs;
192 bool on_scroll_event (GdkEventScroll*);
194 std::list<MixerStrip *> strips;
196 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
197 bool strip_scroller_button_release (GdkEventButton*);
198 bool masters_scroller_button_release (GdkEventButton*);
200 void scroll_right ();
201 void toggle_midi_input_active (bool flip_others);
203 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
205 void add_stripables (ARDOUR::StripableList&);
207 void add_routes (ARDOUR::RouteList&);
208 void remove_strip (MixerStrip *);
210 void add_masters (ARDOUR::VCAList&);
211 void remove_master (VCAMasterStrip*);
213 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
214 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
216 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
217 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
219 gint start_updating ();
220 gint stop_updating ();
222 void session_going_away ();
224 sigc::connection fast_screen_update_connection;
225 void fast_update_strips ();
227 void track_name_changed (MixerStrip *);
229 void redisplay_track_list ();
230 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
231 bool no_track_list_redisplay;
232 bool track_display_button_press (GdkEventButton*);
233 void strip_width_changed ();
235 void track_list_delete (const Gtk::TreeModel::Path&);
236 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
238 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
239 bool plugin_row_button_press (GdkEventButton*);
240 void popup_note_context_menu (GdkEventButton*);
241 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
243 enum ProcessorPosition {
250 void add_selected_processor (ProcessorPosition);
251 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
252 void remove_selected_from_favorites ();
253 void delete_selected_preset ();
254 ARDOUR::PluginPresetPtr selected_plugin ();
256 void initial_track_display ();
258 void set_all_strips_visibility (bool yn);
259 void set_all_audio_midi_visibility (int, bool);
260 void track_visibility_changed (std::string const & path);
261 void update_track_visibility ();
263 void hide_all_routes ();
264 void show_all_routes ();
265 void show_all_audiobus ();
266 void hide_all_audiobus ();
267 void show_all_audiotracks();
268 void hide_all_audiotracks ();
269 void show_all_miditracks();
270 void hide_all_miditracks ();
272 bool in_group_row_change;
274 void group_selected (gint row, gint col, GdkEvent *ev);
275 void group_unselected (gint row, gint col, GdkEvent *ev);
276 void group_display_active_clicked();
277 void new_route_group ();
278 void remove_selected_route_group ();
279 void activate_all_route_groups ();
280 void disable_all_route_groups ();
281 void add_route_group (ARDOUR::RouteGroup *);
282 void route_groups_changed ();
283 void route_group_name_edit (const std::string&, const std::string&);
284 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
285 void route_group_row_deleted (Gtk::TreeModel::Path const &);
287 Gtk::Menu *track_menu;
288 void track_column_click (gint);
289 void build_track_menu ();
291 MonitorSection _monitor_section;
292 PluginSelector *_plugin_selector;
294 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
295 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
297 /* various treeviews */
299 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
300 StripableDisplayModelColumns () {
306 Gtk::TreeModelColumn<bool> visible;
307 Gtk::TreeModelColumn<std::string> text;
308 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
309 Gtk::TreeModelColumn<AxisView*> strip;
312 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
313 GroupDisplayModelColumns() {
318 Gtk::TreeModelColumn<bool> visible;
319 Gtk::TreeModelColumn<std::string> text;
320 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
323 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
324 PluginsDisplayModelColumns() {
328 Gtk::TreeModelColumn<std::string> name;
329 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
332 ARDOUR::PluginInfoList favorite_order;
333 std::map<std::string, bool> favorite_ui_state;
335 StripableDisplayModelColumns stripable_columns;
336 GroupDisplayModelColumns group_columns;
337 PluginsDisplayModelColumns favorite_plugins_columns;
339 Gtk::TreeView track_display;
340 Gtk::TreeView group_display;
341 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
343 Glib::RefPtr<Gtk::ListStore> track_model;
344 Glib::RefPtr<Gtk::ListStore> group_model;
345 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
347 bool group_display_button_press (GdkEventButton*);
348 void group_display_selection_changed ();
350 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
351 bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
354 double _spill_scroll_position;
356 void presentation_info_changed (PBD::PropertyChange const &);
357 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
358 void sync_presentation_info_from_treeview ();
362 void parameter_changed (std::string const &);
363 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
365 void setup_track_display ();
366 void new_track_or_bus ();
368 static const int32_t default_width = 478;
369 static const int32_t default_height = 765;
371 /** true if we are rebuilding the route group list, or clearing
372 * it during a session teardown.
374 bool _in_group_rebuild_or_clear;
375 bool _route_deletion_in_progress;
377 void update_title ();
378 MixerStrip* strip_by_x (int x);
380 friend class MixerGroupTabs;
382 void monitor_section_going_away ();
383 void monitor_section_attached ();
384 void monitor_section_detached ();
386 void store_current_favorite_order();
387 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
389 void plugin_list_changed ();
391 void refill_favorite_plugins ();
392 void refill_tag_combo ();
394 void tag_combo_changed ();
396 void sync_treeview_from_favorite_order ();
397 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
398 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
400 /// true if we are in fullscreen mode
403 bool _strip_selection_change_without_scroll;
405 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
409 RouteProcessorSelection _selection;
410 AxisViewSelection _axis_targets;
412 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
413 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
415 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
418 void rec_enable_action ();
419 void step_gain_up_action ();
420 void step_gain_down_action ();
421 void unity_gain_action ();
423 void copy_processors ();
424 void cut_processors ();
425 void paste_processors ();
426 void select_all_processors ();
427 void toggle_processors ();
431 #endif /* __ardour_mixer_ui_h__ */