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/treestore.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"
45 #include <gtkmm2ext/bindings.h>
46 #include "gtkmm2ext/dndtreeview.h"
47 #include "gtkmm2ext/treeutils.h"
49 #include "widgets/pane.h"
50 #include "widgets/tabbable.h"
52 #include "axis_provider.h"
54 #include "route_processor_selection.h"
69 class PluginTreeStore : public Gtk::TreeStore
72 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
73 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
77 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
78 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
79 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
82 class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
85 static Mixer_UI* instance();
88 Gtk::Window* use_own_window (bool and_fill_it);
91 void set_session (ARDOUR::Session *);
93 PluginSelector* plugin_selector();
95 void set_strip_width (Width, bool save = false);
96 Width get_strip_width () const { return _strip_width; }
98 XMLNode& get_state ();
99 int set_state (const XMLNode&, int /* version */);
101 void show_mixer_list (bool yn);
102 void show_monitor_section (bool);
104 void show_strip (MixerStrip *);
105 void hide_strip (MixerStrip *);
107 void maximise_mixer_space();
108 void restore_mixer_space();
110 MonitorSection* monitor_section() const { return _monitor_section; }
112 void deselect_all_strip_processors();
113 void delete_processors();
115 void select_all_tracks ();
117 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
118 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
119 void show_spill (boost::shared_ptr<ARDOUR::Stripable>);
120 bool showing_spill_for (boost::shared_ptr<ARDOUR::Stripable>) const;
122 sigc::signal1<void,boost::shared_ptr<ARDOUR::Stripable> > show_spill_change;
124 RouteProcessorSelection& selection() { return _selection; }
126 void show_editor_window () const;
128 void register_actions ();
130 void load_bindings ();
131 Gtkmm2ext::Bindings* bindings;
134 void set_axis_targets_for_operation ();
135 ARDOUR::AutomationControlSet selected_gaincontrols ();
139 static Mixer_UI* _instance;
141 Gtk::HBox global_hpacker;
142 Gtk::VBox global_vpacker;
143 Gtk::ScrolledWindow scroller;
144 Gtk::EventBox scroller_base;
145 Gtk::HBox scroller_hpacker;
146 Gtk::VBox mixer_scroller_vpacker;
147 Gtk::VBox list_vpacker;
148 Gtk::Label group_display_button_label;
149 Gtk::Button group_display_button;
150 Gtk::ScrolledWindow track_display_scroller;
151 Gtk::ScrolledWindow group_display_scroller;
152 Gtk::ScrolledWindow favorite_plugins_scroller;
153 Gtk::VBox group_display_vbox;
154 Gtk::Frame track_display_frame;
155 Gtk::Frame group_display_frame;
156 Gtk::Frame favorite_plugins_frame;
157 ArdourWidgets::VPane rhs_pane1;
158 ArdourWidgets::VPane rhs_pane2;
159 ArdourWidgets::HPane inner_pane;
160 Gtk::HBox strip_packer;
161 Gtk::ScrolledWindow vca_scroller;
162 Gtk::HBox vca_hpacker;
163 Gtk::VBox vca_vpacker;
164 Gtk::EventBox vca_label_bar;
165 Gtk::Label vca_label;
166 Gtk::EventBox vca_scroller_base;
167 Gtk::HBox out_packer;
168 ArdourWidgets::HPane list_hpane;
170 MixerGroupTabs* _group_tabs;
172 bool on_scroll_event (GdkEventScroll*);
174 std::list<MixerStrip *> strips;
176 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
177 bool strip_scroller_button_release (GdkEventButton*);
178 bool masters_scroller_button_release (GdkEventButton*);
180 void scroll_right ();
181 void toggle_midi_input_active (bool flip_others);
183 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
185 void add_stripables (ARDOUR::StripableList&);
187 void add_routes (ARDOUR::RouteList&);
188 void remove_strip (MixerStrip *);
190 void add_masters (ARDOUR::VCAList&);
191 void remove_master (VCAMasterStrip*);
193 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
194 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
196 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
197 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
199 gint start_updating ();
200 gint stop_updating ();
202 void session_going_away ();
204 sigc::connection fast_screen_update_connection;
205 void fast_update_strips ();
207 void track_name_changed (MixerStrip *);
209 void redisplay_track_list ();
210 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
211 bool no_track_list_redisplay;
212 bool track_display_button_press (GdkEventButton*);
213 void strip_width_changed ();
215 void track_list_delete (const Gtk::TreeModel::Path&);
216 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
218 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
219 bool plugin_row_button_press (GdkEventButton*);
220 void popup_note_context_menu (GdkEventButton*);
221 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
223 enum ProcessorPosition {
230 void add_selected_processor (ProcessorPosition);
231 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
232 void remove_selected_from_favorites ();
233 void delete_selected_preset ();
234 ARDOUR::PluginPresetPtr selected_plugin ();
236 void initial_track_display ();
238 void set_all_strips_visibility (bool yn);
239 void set_all_audio_midi_visibility (int, bool);
240 void track_visibility_changed (std::string const & path);
241 void update_track_visibility ();
243 void hide_all_routes ();
244 void show_all_routes ();
245 void show_all_audiobus ();
246 void hide_all_audiobus ();
247 void show_all_audiotracks();
248 void hide_all_audiotracks ();
249 void show_all_miditracks();
250 void hide_all_miditracks ();
252 bool in_group_row_change;
254 void group_selected (gint row, gint col, GdkEvent *ev);
255 void group_unselected (gint row, gint col, GdkEvent *ev);
256 void group_display_active_clicked();
257 void new_route_group ();
258 void remove_selected_route_group ();
259 void activate_all_route_groups ();
260 void disable_all_route_groups ();
261 void add_route_group (ARDOUR::RouteGroup *);
262 void route_groups_changed ();
263 void route_group_name_edit (const std::string&, const std::string&);
264 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
265 void route_group_row_deleted (Gtk::TreeModel::Path const &);
267 Gtk::Menu *track_menu;
268 void track_column_click (gint);
269 void build_track_menu ();
271 MonitorSection* _monitor_section;
272 PluginSelector *_plugin_selector;
274 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
275 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
277 /* various treeviews */
279 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
280 StripableDisplayModelColumns () {
286 Gtk::TreeModelColumn<bool> visible;
287 Gtk::TreeModelColumn<std::string> text;
288 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
289 Gtk::TreeModelColumn<AxisView*> strip;
292 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
293 GroupDisplayModelColumns() {
298 Gtk::TreeModelColumn<bool> visible;
299 Gtk::TreeModelColumn<std::string> text;
300 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
303 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
304 PluginsDisplayModelColumns() {
308 Gtk::TreeModelColumn<std::string> name;
309 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
312 ARDOUR::PluginInfoList favorite_order;
313 std::map<std::string, bool> favorite_ui_state;
315 StripableDisplayModelColumns stripable_columns;
316 GroupDisplayModelColumns group_columns;
317 PluginsDisplayModelColumns favorite_plugins_columns;
319 Gtk::TreeView track_display;
320 Gtk::TreeView group_display;
321 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
323 Glib::RefPtr<Gtk::ListStore> track_model;
324 Glib::RefPtr<Gtk::ListStore> group_model;
325 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
327 bool group_display_button_press (GdkEventButton*);
328 void group_display_selection_changed ();
330 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
331 bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
335 void presentation_info_changed (PBD::PropertyChange const &);
336 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
337 void sync_presentation_info_from_treeview ();
341 void parameter_changed (std::string const &);
342 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
344 void setup_track_display ();
345 void new_track_or_bus ();
347 static const int32_t default_width = 478;
348 static const int32_t default_height = 765;
350 /** true if we are rebuilding the route group list, or clearing
351 * it during a session teardown.
353 bool _in_group_rebuild_or_clear;
354 bool _route_deletion_in_progress;
356 void update_title ();
357 MixerStrip* strip_by_x (int x);
359 friend class MixerGroupTabs;
361 void monitor_section_going_away ();
363 void monitor_section_attached ();
364 void monitor_section_detached ();
366 void store_current_favorite_order();
367 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
368 void refill_favorite_plugins ();
369 void sync_treeview_from_favorite_order ();
370 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
371 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
373 /// true if we are in fullscreen mode
376 // true if mixer list is visible
377 bool _show_mixer_list;
379 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
383 Gtkmm2ext::ActionMap myactions;
384 RouteProcessorSelection _selection;
385 AxisViewSelection _axis_targets;
387 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
388 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
390 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
393 void rec_enable_action ();
394 void step_gain_up_action ();
395 void step_gain_down_action ();
396 void unity_gain_action ();
398 void copy_processors ();
399 void cut_processors ();
400 void paste_processors ();
401 void select_all_processors ();
402 void toggle_processors ();
406 #endif /* __ardour_mixer_ui_h__ */