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 "route_processor_selection.h"
70 class PluginTreeStore : public Gtk::TreeStore
73 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
74 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
78 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
79 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
80 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
83 class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public AxisViewProvider
86 static Mixer_UI* instance();
89 Gtk::Window* use_own_window (bool and_fill_it);
92 void set_session (ARDOUR::Session *);
94 PluginSelector* plugin_selector();
96 void set_strip_width (Width, bool save = false);
97 Width get_strip_width () const { return _strip_width; }
99 XMLNode& get_state ();
100 int set_state (const XMLNode&, int /* version */);
102 void save_plugin_order_file ();
104 void show_mixer_list (bool yn);
105 void show_monitor_section (bool);
107 void show_strip (MixerStrip *);
108 void hide_strip (MixerStrip *);
110 void maximise_mixer_space();
111 void restore_mixer_space();
113 MonitorSection* monitor_section() const { return _monitor_section; }
115 void deselect_all_strip_processors();
116 void delete_processors();
118 void select_all_tracks ();
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;
137 void set_axis_targets_for_operation ();
138 ARDOUR::AutomationControlSet selected_gaincontrols ();
142 static Mixer_UI* _instance;
144 Gtk::HBox global_hpacker;
145 Gtk::VBox global_vpacker;
146 Gtk::ScrolledWindow scroller;
147 Gtk::EventBox scroller_base;
148 Gtk::HBox scroller_hpacker;
149 Gtk::VBox mixer_scroller_vpacker;
150 Gtk::VBox list_vpacker;
151 Gtk::Label group_display_button_label;
152 Gtk::ScrolledWindow track_display_scroller;
153 Gtk::ScrolledWindow group_display_scroller;
154 Gtk::ScrolledWindow favorite_plugins_scroller;
155 Gtk::VBox group_display_vbox;
156 Gtk::Frame track_display_frame;
157 Gtk::Frame group_display_frame;
158 Gtk::Frame favorite_plugins_frame;
159 Gtk::VBox favorite_plugins_vbox;
160 Gtk::ComboBoxText favorite_plugins_tag_combo;
161 ArdourWidgets::VPane rhs_pane1;
162 ArdourWidgets::VPane rhs_pane2;
163 ArdourWidgets::HPane inner_pane;
164 Gtk::HBox strip_packer;
165 Gtk::ScrolledWindow vca_scroller;
166 Gtk::HBox vca_hpacker;
167 Gtk::VBox vca_vpacker;
168 Gtk::EventBox vca_label_bar;
169 Gtk::Label vca_label;
170 Gtk::EventBox vca_scroller_base;
171 Gtk::HBox out_packer;
172 ArdourWidgets::HPane list_hpane;
173 Gtk::Button add_button; // should really be an ArdourButton
174 Gtk::Button add_vca_button;
176 MixerGroupTabs* _group_tabs;
178 bool on_scroll_event (GdkEventScroll*);
180 std::list<MixerStrip *> strips;
182 void scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>&, int, int, const Gtk::SelectionData&, guint, guint);
183 bool strip_scroller_button_release (GdkEventButton*);
184 bool masters_scroller_button_release (GdkEventButton*);
186 void scroll_right ();
187 void toggle_midi_input_active (bool flip_others);
189 void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);
191 void add_stripables (ARDOUR::StripableList&);
193 void add_routes (ARDOUR::RouteList&);
194 void remove_strip (MixerStrip *);
196 void add_masters (ARDOUR::VCAList&);
197 void remove_master (VCAMasterStrip*);
199 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
200 MixerStrip* strip_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
202 AxisView* axis_view_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
203 AxisView* axis_view_by_control (boost::shared_ptr<ARDOUR::AutomationControl>) const;
205 gint start_updating ();
206 gint stop_updating ();
208 void session_going_away ();
210 sigc::connection fast_screen_update_connection;
211 void fast_update_strips ();
213 void track_name_changed (MixerStrip *);
215 void redisplay_track_list ();
216 void spill_redisplay (boost::shared_ptr<ARDOUR::VCA>);
217 bool no_track_list_redisplay;
218 bool track_display_button_press (GdkEventButton*);
219 void strip_width_changed ();
221 void track_list_delete (const Gtk::TreeModel::Path&);
222 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
224 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
225 bool plugin_row_button_press (GdkEventButton*);
226 void popup_note_context_menu (GdkEventButton*);
227 void plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data);
229 enum ProcessorPosition {
236 void add_selected_processor (ProcessorPosition);
237 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
238 void remove_selected_from_favorites ();
239 void delete_selected_preset ();
240 ARDOUR::PluginPresetPtr selected_plugin ();
242 void initial_track_display ();
244 void set_all_strips_visibility (bool yn);
245 void set_all_audio_midi_visibility (int, bool);
246 void track_visibility_changed (std::string const & path);
247 void update_track_visibility ();
249 void hide_all_routes ();
250 void show_all_routes ();
251 void show_all_audiobus ();
252 void hide_all_audiobus ();
253 void show_all_audiotracks();
254 void hide_all_audiotracks ();
255 void show_all_miditracks();
256 void hide_all_miditracks ();
258 bool in_group_row_change;
260 void group_selected (gint row, gint col, GdkEvent *ev);
261 void group_unselected (gint row, gint col, GdkEvent *ev);
262 void group_display_active_clicked();
263 void new_route_group ();
264 void remove_selected_route_group ();
265 void activate_all_route_groups ();
266 void disable_all_route_groups ();
267 void add_route_group (ARDOUR::RouteGroup *);
268 void route_groups_changed ();
269 void route_group_name_edit (const std::string&, const std::string&);
270 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
271 void route_group_row_deleted (Gtk::TreeModel::Path const &);
273 Gtk::Menu *track_menu;
274 void track_column_click (gint);
275 void build_track_menu ();
277 MonitorSection* _monitor_section;
278 PluginSelector *_plugin_selector;
280 void stripable_property_changed (const PBD::PropertyChange& what_changed, boost::weak_ptr<ARDOUR::Stripable> ws);
281 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
283 /* various treeviews */
285 struct StripableDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
286 StripableDisplayModelColumns () {
292 Gtk::TreeModelColumn<bool> visible;
293 Gtk::TreeModelColumn<std::string> text;
294 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
295 Gtk::TreeModelColumn<AxisView*> strip;
298 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
299 GroupDisplayModelColumns() {
304 Gtk::TreeModelColumn<bool> visible;
305 Gtk::TreeModelColumn<std::string> text;
306 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
309 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
310 PluginsDisplayModelColumns() {
314 Gtk::TreeModelColumn<std::string> name;
315 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
318 ARDOUR::PluginInfoList favorite_order;
319 std::map<std::string, bool> favorite_ui_state;
321 StripableDisplayModelColumns stripable_columns;
322 GroupDisplayModelColumns group_columns;
323 PluginsDisplayModelColumns favorite_plugins_columns;
325 Gtk::TreeView track_display;
326 Gtk::TreeView group_display;
327 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
329 Glib::RefPtr<Gtk::ListStore> track_model;
330 Glib::RefPtr<Gtk::ListStore> group_model;
331 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
333 bool group_display_button_press (GdkEventButton*);
334 void group_display_selection_changed ();
336 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
337 bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
341 void presentation_info_changed (PBD::PropertyChange const &);
342 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
343 void sync_presentation_info_from_treeview ();
347 void parameter_changed (std::string const &);
348 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
350 void setup_track_display ();
351 void new_track_or_bus ();
353 static const int32_t default_width = 478;
354 static const int32_t default_height = 765;
356 /** true if we are rebuilding the route group list, or clearing
357 * it during a session teardown.
359 bool _in_group_rebuild_or_clear;
360 bool _route_deletion_in_progress;
362 void update_title ();
363 MixerStrip* strip_by_x (int x);
365 friend class MixerGroupTabs;
367 void monitor_section_going_away ();
369 void monitor_section_attached ();
370 void monitor_section_detached ();
372 void store_current_favorite_order();
373 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
375 void plugin_list_changed ();
377 void refill_favorite_plugins ();
378 void refill_tag_combo ();
380 void tag_combo_changed ();
382 void sync_treeview_from_favorite_order ();
383 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
384 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
386 /// true if we are in fullscreen mode
389 // true if mixer list is visible
390 bool _show_mixer_list;
392 bool _strip_selection_change_without_scroll;
394 mutable boost::weak_ptr<ARDOUR::Stripable> spilled_strip;
398 Gtkmm2ext::ActionMap myactions;
399 RouteProcessorSelection _selection;
400 AxisViewSelection _axis_targets;
402 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
403 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
405 template<class T> void control_action (boost::shared_ptr<T> (ARDOUR::Stripable::*get_control)() const);
408 void rec_enable_action ();
409 void step_gain_up_action ();
410 void step_gain_down_action ();
411 void unity_gain_action ();
413 void copy_processors ();
414 void cut_processors ();
415 void paste_processors ();
416 void select_all_processors ();
417 void toggle_processors ();
421 #endif /* __ardour_mixer_ui_h__ */