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/bindings.h>
45 #include "gtkmm2ext/dndtreeview.h"
46 #include <gtkmm2ext/pane.h>
47 #include "gtkmm2ext/tabbable.h"
48 #include "gtkmm2ext/treeutils.h"
50 #include "axis_provider.h"
52 #include "route_processor_selection.h"
67 class PluginTreeStore : public Gtk::TreeStore
70 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
71 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
75 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
76 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
77 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
80 class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
83 static Mixer_UI* instance();
86 Gtk::Window* use_own_window (bool and_fill_it);
89 void set_session (ARDOUR::Session *);
91 PluginSelector* plugin_selector();
93 void set_strip_width (Width, bool save = false);
94 Width get_strip_width () const { return _strip_width; }
96 XMLNode& get_state ();
97 int set_state (const XMLNode&, int /* version */);
99 void show_mixer_list (bool yn);
100 void show_monitor_section (bool);
102 void show_strip (MixerStrip *);
103 void hide_strip (MixerStrip *);
105 void maximise_mixer_space();
106 void restore_mixer_space();
108 MonitorSection* monitor_section() const { return _monitor_section; }
110 void deselect_all_strip_processors();
111 void delete_processors();
114 void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>);
115 void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
116 void show_spill (boost::shared_ptr<ARDOUR::Stripable>);
117 bool showing_spill_for (boost::shared_ptr<ARDOUR::Stripable>) const;
119 sigc::signal1<void,boost::shared_ptr<ARDOUR::Stripable> > show_spill_change;
121 RouteProcessorSelection& selection() { return _selection; }
123 void show_editor_window () const;
125 void register_actions ();
127 void load_bindings ();
128 Gtkmm2ext::Bindings* bindings;
131 void set_axis_targets_for_operation ();
135 static Mixer_UI* _instance;
137 Gtk::HBox global_hpacker;
138 Gtk::VBox global_vpacker;
139 Gtk::ScrolledWindow scroller;
140 Gtk::EventBox scroller_base;
141 Gtk::HBox scroller_hpacker;
142 Gtk::VBox mixer_scroller_vpacker;
143 Gtk::VBox list_vpacker;
144 Gtk::Label group_display_button_label;
145 Gtk::Button group_display_button;
146 Gtk::ScrolledWindow track_display_scroller;
147 Gtk::ScrolledWindow group_display_scroller;
148 Gtk::ScrolledWindow favorite_plugins_scroller;
149 Gtk::VBox group_display_vbox;
150 Gtk::Frame track_display_frame;
151 Gtk::Frame group_display_frame;
152 Gtk::Frame favorite_plugins_frame;
153 Gtkmm2ext::VPane rhs_pane1;
154 Gtkmm2ext::VPane rhs_pane2;
155 Gtkmm2ext::HPane inner_pane;
156 Gtk::HBox strip_packer;
157 Gtk::ScrolledWindow vca_scroller;
158 Gtk::HBox vca_hpacker;
159 Gtk::VBox vca_vpacker;
160 Gtk::EventBox vca_label_bar;
161 Gtk::Label vca_label;
162 Gtk::EventBox vca_scroller_base;
163 Gtk::HBox out_packer;
164 Gtkmm2ext::HPane list_hpane;
166 MixerGroupTabs* _group_tabs;
168 bool on_scroll_event (GdkEventScroll*);
170 std::list<MixerStrip *> strips;
172 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
173 bool strip_scroller_button_release (GdkEventButton*);
174 bool masters_scroller_button_release (GdkEventButton*);
176 void scroll_right ();
177 void toggle_midi_input_active (bool flip_others);
179 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
181 void add_stripables (ARDOUR::StripableList&);
183 void add_routes (ARDOUR::RouteList&);
184 void remove_strip (MixerStrip *);
186 void add_masters (ARDOUR::VCAList&);
187 void remove_master (VCAMasterStrip*);
189 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
190 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
192 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
193 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
195 gint start_updating ();
196 gint stop_updating ();
198 void session_going_away ();
200 sigc::connection fast_screen_update_connection;
201 void fast_update_strips ();
203 void track_name_changed (MixerStrip *);
205 void redisplay_track_list ();
206 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
207 bool no_track_list_redisplay;
208 bool track_display_button_press (GdkEventButton*);
209 void strip_width_changed ();
211 void track_list_delete (const Gtk::TreeModel::Path&);
212 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
214 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
215 bool plugin_row_button_press (GdkEventButton*);
216 void popup_note_context_menu (GdkEventButton*);
217 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
219 enum ProcessorPosition {
226 void add_selected_processor (ProcessorPosition);
227 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
228 void remove_selected_from_favorites ();
229 void delete_selected_preset ();
230 ARDOUR::PluginPresetPtr selected_plugin ();
232 void initial_track_display ();
234 void set_all_strips_visibility (bool yn);
235 void set_all_audio_midi_visibility (int, bool);
236 void track_visibility_changed (std::string const & path);
237 void update_track_visibility ();
239 void hide_all_routes ();
240 void show_all_routes ();
241 void show_all_audiobus ();
242 void hide_all_audiobus ();
243 void show_all_audiotracks();
244 void hide_all_audiotracks ();
245 void show_all_miditracks();
246 void hide_all_miditracks ();
248 bool in_group_row_change;
250 void group_selected (gint row, gint col, GdkEvent *ev);
251 void group_unselected (gint row, gint col, GdkEvent *ev);
252 void group_display_active_clicked();
253 void new_route_group ();
254 void remove_selected_route_group ();
255 void activate_all_route_groups ();
256 void disable_all_route_groups ();
257 void add_route_group (ARDOUR::RouteGroup *);
258 void route_groups_changed ();
259 void route_group_name_edit (const std::string&, const std::string&);
260 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
261 void route_group_row_deleted (Gtk::TreeModel::Path const &);
263 Gtk::Menu *track_menu;
264 void track_column_click (gint);
265 void build_track_menu ();
267 MonitorSection* _monitor_section;
268 PluginSelector *_plugin_selector;
270 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
271 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
273 /* various treeviews */
275 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
276 StripableDisplayModelColumns () {
282 Gtk::TreeModelColumn<bool> visible;
283 Gtk::TreeModelColumn<std::string> text;
284 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
285 Gtk::TreeModelColumn<AxisView*> strip;
288 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
289 GroupDisplayModelColumns() {
294 Gtk::TreeModelColumn<bool> visible;
295 Gtk::TreeModelColumn<std::string> text;
296 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
299 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
300 PluginsDisplayModelColumns() {
304 Gtk::TreeModelColumn<std::string> name;
305 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
308 ARDOUR::PluginInfoList favorite_order;
309 std::map<std::string, bool> favorite_ui_state;
311 StripableDisplayModelColumns stripable_columns;
312 GroupDisplayModelColumns group_columns;
313 PluginsDisplayModelColumns favorite_plugins_columns;
315 Gtk::TreeView track_display;
316 Gtk::TreeView group_display;
317 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
319 Glib::RefPtr<Gtk::ListStore> track_model;
320 Glib::RefPtr<Gtk::ListStore> group_model;
321 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
323 bool group_display_button_press (GdkEventButton*);
324 void group_display_selection_changed ();
326 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
330 void presentation_info_changed (PBD::PropertyChange const &);
331 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
332 void sync_presentation_info_from_treeview ();
336 void parameter_changed (std::string const &);
337 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
339 void setup_track_display ();
340 void new_track_or_bus ();
342 static const int32_t default_width = 478;
343 static const int32_t default_height = 765;
345 /** true if we are rebuilding the route group list, or clearing
346 it during a session teardown.
348 bool _in_group_rebuild_or_clear;
349 bool _route_deletion_in_progress;
351 void update_title ();
352 MixerStrip* strip_by_x (int x);
354 friend class MixerGroupTabs;
356 void monitor_section_going_away ();
358 void monitor_section_attached ();
359 void monitor_section_detached ();
361 void store_current_favorite_order();
362 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
363 void refill_favorite_plugins ();
364 void sync_treeview_from_favorite_order ();
365 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
366 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
368 /// true if we are in fullscreen mode
371 // true if mixer list is visible
372 bool _show_mixer_list;
374 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
378 Gtkmm2ext::ActionMap myactions;
379 RouteProcessorSelection _selection;
380 AxisViewSelection _axis_targets;
382 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
383 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
385 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
388 void rec_enable_action ();
389 void step_gain_up_action ();
390 void step_gain_down_action ();
391 void unity_gain_action ();
393 void copy_processors ();
394 void cut_processors ();
395 void paste_processors ();
396 void select_all_processors ();
397 void toggle_processors ();
401 #endif /* __ardour_mixer_ui_h__ */