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/paned.h>
32 #include <gtkmm/menu.h>
33 #include <gtkmm/treeview.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/visibility_tracker.h"
46 #include "gtkmm2ext/dndtreeview.h"
47 #include "gtkmm2ext/treeutils.h"
50 #include "mixer_actor.h"
62 class PluginTreeStore : public Gtk::TreeStore
65 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
66 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
70 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
71 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
72 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
75 class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor, public Gtkmm2ext::VisibilityTracker
78 static Mixer_UI* instance();
81 void set_session (ARDOUR::Session *);
82 void track_editor_selection ();
84 PluginSelector* plugin_selector();
86 void set_strip_width (Width, bool save = false);
87 Width get_strip_width () const { return _strip_width; }
89 void unselect_strip_in_display (MixerStrip*);
90 void select_strip_in_display (MixerStrip*);
92 XMLNode& get_state (void);
93 int set_state (const XMLNode& );
95 void show_mixer_list (bool yn);
96 void show_monitor_section (bool);
99 bool hide_window (GdkEventAny *ev);
100 void show_strip (MixerStrip *);
101 void hide_strip (MixerStrip *);
103 void maximise_mixer_space();
104 void restore_mixer_space();
106 void ensure_float (Gtk::Window&);
108 MonitorSection* monitor_section() const { return _monitor_section; }
110 void deselect_all_strip_processors();
111 void delete_processors();
116 void set_route_targets_for_operation ();
120 static Mixer_UI* _instance;
124 Gtk::HBox global_hpacker;
125 Gtk::VBox global_vpacker;
126 Gtk::ScrolledWindow scroller;
127 Gtk::EventBox scroller_base;
128 Gtk::HBox scroller_hpacker;
129 Gtk::VBox mixer_scroller_vpacker;
130 Gtk::VBox list_vpacker;
131 Gtk::Label group_display_button_label;
132 Gtk::Button group_display_button;
133 Gtk::ScrolledWindow track_display_scroller;
134 Gtk::ScrolledWindow group_display_scroller;
135 Gtk::ScrolledWindow favorite_plugins_scroller;
136 Gtk::VBox group_display_vbox;
137 Gtk::Frame track_display_frame;
138 Gtk::Frame group_display_frame;
139 Gtk::Frame favorite_plugins_frame;
140 Gtk::VPaned rhs_pane1;
141 Gtk::VPaned rhs_pane2;
142 Gtk::HBox strip_packer;
143 Gtk::HBox out_packer;
144 Gtk::HPaned list_hpane;
146 MixerGroupTabs* _group_tabs;
148 // for restoring window geometry.
149 int m_root_x, m_root_y, m_width, m_height;
151 void set_window_pos_and_size ();
152 void get_window_pos_and_size ();
154 bool on_key_press_event (GdkEventKey*);
155 bool on_key_release_event (GdkEventKey*);
156 bool on_scroll_event (GdkEventScroll*);
158 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
160 std::list<MixerStrip *> strips;
162 bool strip_scroller_button_release (GdkEventButton*);
164 void scroll_right ();
165 void toggle_midi_input_active (bool flip_others);
167 void add_strips (ARDOUR::RouteList&);
168 void remove_strip (MixerStrip *);
170 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>);
172 void hide_all_strips (bool with_select);
173 void unselect_all_strips();
174 void select_all_strips ();
175 void unselect_all_audiotrack_strips ();
176 void select_all_audiotrack_strips ();
177 void unselect_all_audiobus_strips ();
178 void select_all_audiobus_strips ();
180 void strip_select_op (bool audiotrack, bool select);
181 void select_strip_op (MixerStrip*, bool select);
183 gint start_updating ();
184 gint stop_updating ();
186 void session_going_away ();
188 sigc::connection fast_screen_update_connection;
189 void fast_update_strips ();
191 void track_name_changed (MixerStrip *);
193 void redisplay_track_list ();
194 bool no_track_list_redisplay;
195 bool track_display_button_press (GdkEventButton*);
196 void strip_width_changed ();
198 void track_list_delete (const Gtk::TreeModel::Path&);
199 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
201 void plugin_row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
202 bool plugin_row_button_press (GdkEventButton*);
203 void popup_note_context_menu (GdkEventButton*);
205 enum ProcessorPosition {
212 void add_selected_processor (ProcessorPosition);
213 void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
214 void remove_selected_from_favorites ();
216 void initial_track_display ();
217 void show_track_list_menu ();
219 void set_all_strips_visibility (bool yn);
220 void set_all_audio_midi_visibility (int, bool);
221 void track_visibility_changed (std::string const & path);
222 void update_track_visibility ();
224 void hide_all_routes ();
225 void show_all_routes ();
226 void show_all_audiobus ();
227 void hide_all_audiobus ();
228 void show_all_audiotracks();
229 void hide_all_audiotracks ();
230 void show_all_miditracks();
231 void hide_all_miditracks ();
233 bool in_group_row_change;
235 void group_selected (gint row, gint col, GdkEvent *ev);
236 void group_unselected (gint row, gint col, GdkEvent *ev);
237 void group_display_active_clicked();
238 void new_route_group ();
239 void remove_selected_route_group ();
240 void activate_all_route_groups ();
241 void disable_all_route_groups ();
242 void add_route_group (ARDOUR::RouteGroup *);
243 void route_groups_changed ();
244 void route_group_name_edit (const std::string&, const std::string&);
245 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
246 void route_group_row_deleted (Gtk::TreeModel::Path const &);
248 Gtk::Menu *track_menu;
249 void track_column_click (gint);
250 void build_track_menu ();
252 MonitorSection* _monitor_section;
253 PluginSelector *_plugin_selector;
255 void strip_property_changed (const PBD::PropertyChange&, MixerStrip *);
256 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
258 /* various treeviews */
260 struct TrackDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
261 TrackDisplayModelColumns () {
267 Gtk::TreeModelColumn<bool> visible;
268 Gtk::TreeModelColumn<std::string> text;
269 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
270 Gtk::TreeModelColumn<MixerStrip*> strip;
273 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
274 GroupDisplayModelColumns() {
279 Gtk::TreeModelColumn<bool> visible;
280 Gtk::TreeModelColumn<std::string> text;
281 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
284 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
285 PluginsDisplayModelColumns() {
289 Gtk::TreeModelColumn<std::string> name;
290 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
293 ARDOUR::PluginInfoList favorite_order;
294 std::map<std::string, bool> favorite_ui_state;
296 TrackDisplayModelColumns track_columns;
297 GroupDisplayModelColumns group_columns;
298 PluginsDisplayModelColumns favorite_plugins_columns;
300 Gtk::TreeView track_display;
301 Gtk::TreeView group_display;
302 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
304 Glib::RefPtr<Gtk::ListStore> track_model;
305 Glib::RefPtr<Gtk::ListStore> group_model;
306 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
308 bool group_display_button_press (GdkEventButton*);
309 void group_display_selection_changed ();
311 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
315 void sync_order_keys_from_treeview ();
316 void sync_treeview_from_order_keys ();
317 void reset_remote_control_ids ();
318 void reset_order_keys ();
322 void parameter_changed (std::string const &);
323 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
325 void setup_track_display ();
326 void new_track_or_bus ();
328 static const int32_t default_width = 478;
329 static const int32_t default_height = 765;
331 /** true if we are rebuilding the route group list, or clearing
332 it during a session teardown.
334 bool _in_group_rebuild_or_clear;
335 bool _route_deletion_in_progress;
337 void update_title ();
338 MixerStrip* strip_by_x (int x);
340 friend class MixerGroupTabs;
342 void follow_editor_selection ();
343 bool _following_editor_selection;
345 void monitor_section_going_away ();
347 void monitor_section_attached ();
348 void monitor_section_detached ();
350 void store_current_favorite_order();
351 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
352 void refill_favorite_plugins ();
353 void sync_treeview_from_favorite_order ();
355 /// true if we are in fullscreen mode
358 // true if mixer list is visible
359 bool _show_mixer_list;
362 #endif /* __ardour_mixer_ui_h__ */