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"
46 #include "gtkmm2ext/visibility_tracker.h"
47 #include "gtkmm2ext/dndtreeview.h"
48 #include "gtkmm2ext/treeutils.h"
51 >>>>>>> the basics of tabbed
53 #include "mixer_actor.h"
66 class PluginTreeStore : public Gtk::TreeStore
69 static Glib::RefPtr<PluginTreeStore> create(const Gtk::TreeModelColumnRecord& columns) {
70 return Glib::RefPtr<PluginTreeStore> (new PluginTreeStore (columns));
74 PluginTreeStore (const Gtk::TreeModelColumnRecord& columns) : Gtk::TreeStore (columns) {}
75 virtual bool row_draggable_vfunc (const Gtk::TreeModel::Path&) const { return true; }
76 virtual bool row_drop_possible_vfunc (const Gtk::TreeModel::Path&, const Gtk::SelectionData&) const;
79 class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor, public Gtkmm2ext::VisibilityTracker
81 class Mixer_UI : public Gtk::VBox, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor
82 >>>>>>> the basics of tabbed
85 static Mixer_UI* instance();
88 Gtk::Window* own_window() const { return _parent_window; }
89 Gtk::Notebook* use_own_window();
91 bool visible() const { return _visible; }
93 void set_session (ARDOUR::Session *);
94 void track_editor_selection ();
96 PluginSelector* plugin_selector();
98 void set_strip_width (Width, bool save = false);
99 Width get_strip_width () const { return _strip_width; }
101 void unselect_strip_in_display (MixerStrip*);
102 void select_strip_in_display (MixerStrip*);
104 XMLNode& get_state (void);
105 int set_state (const XMLNode& );
107 void show_mixer_list (bool yn);
108 void show_monitor_section (bool);
111 bool hide_window (GdkEventAny *ev);
112 void show_strip (MixerStrip *);
113 void hide_strip (MixerStrip *);
115 void maximise_mixer_space();
116 void restore_mixer_space();
118 void ensure_float (Gtk::Window&);
120 MonitorSection* monitor_section() const { return _monitor_section; }
122 void deselect_all_strip_processors();
123 void delete_processors();
128 void set_route_targets_for_operation ();
132 static Mixer_UI* _instance;
134 Gtk::Window* _parent_window;
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 Gtk::VPaned rhs_pane1;
154 Gtk::VPaned rhs_pane2;
155 Gtk::HBox strip_packer;
156 Gtk::HBox out_packer;
157 Gtk::HPaned list_hpane;
159 MixerGroupTabs* _group_tabs;
161 // for restoring window geometry.
162 int m_root_x, m_root_y, m_width, m_height;
164 void set_window_pos_and_size ();
165 void get_window_pos_and_size ();
167 bool on_key_press_event (GdkEventKey*);
168 bool on_key_release_event (GdkEventKey*);
169 bool on_scroll_event (GdkEventScroll*);
171 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
173 std::list<MixerStrip *> strips;
175 bool strip_scroller_button_release (GdkEventButton*);
177 void scroll_right ();
178 void toggle_midi_input_active (bool flip_others);
180 void add_strips (ARDOUR::RouteList&);
181 void remove_strip (MixerStrip *);
183 MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>);
185 void hide_all_strips (bool with_select);
186 void unselect_all_strips();
187 void select_all_strips ();
188 void unselect_all_audiotrack_strips ();
189 void select_all_audiotrack_strips ();
190 void unselect_all_audiobus_strips ();
191 void select_all_audiobus_strips ();
193 void strip_select_op (bool audiotrack, bool select);
194 void select_strip_op (MixerStrip*, bool select);
196 gint start_updating ();
197 gint stop_updating ();
199 void session_going_away ();
201 sigc::connection fast_screen_update_connection;
202 void fast_update_strips ();
204 void track_name_changed (MixerStrip *);
206 void redisplay_track_list ();
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 ();
233 void show_track_list_menu ();
235 void set_all_strips_visibility (bool yn);
236 void set_all_audio_midi_visibility (int, bool);
237 void track_visibility_changed (std::string const & path);
238 void update_track_visibility ();
240 void hide_all_routes ();
241 void show_all_routes ();
242 void show_all_audiobus ();
243 void hide_all_audiobus ();
244 void show_all_audiotracks();
245 void hide_all_audiotracks ();
246 void show_all_miditracks();
247 void hide_all_miditracks ();
249 bool in_group_row_change;
251 void group_selected (gint row, gint col, GdkEvent *ev);
252 void group_unselected (gint row, gint col, GdkEvent *ev);
253 void group_display_active_clicked();
254 void new_route_group ();
255 void remove_selected_route_group ();
256 void activate_all_route_groups ();
257 void disable_all_route_groups ();
258 void add_route_group (ARDOUR::RouteGroup *);
259 void route_groups_changed ();
260 void route_group_name_edit (const std::string&, const std::string&);
261 void route_group_row_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter);
262 void route_group_row_deleted (Gtk::TreeModel::Path const &);
264 Gtk::Menu *track_menu;
265 void track_column_click (gint);
266 void build_track_menu ();
268 MonitorSection* _monitor_section;
269 PluginSelector *_plugin_selector;
271 void strip_property_changed (const PBD::PropertyChange&, MixerStrip *);
272 void route_group_property_changed (ARDOUR::RouteGroup *, const PBD::PropertyChange &);
274 /* various treeviews */
276 struct TrackDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
277 TrackDisplayModelColumns () {
283 Gtk::TreeModelColumn<bool> visible;
284 Gtk::TreeModelColumn<std::string> text;
285 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
286 Gtk::TreeModelColumn<MixerStrip*> strip;
289 struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
290 GroupDisplayModelColumns() {
295 Gtk::TreeModelColumn<bool> visible;
296 Gtk::TreeModelColumn<std::string> text;
297 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> group;
300 struct PluginsDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
301 PluginsDisplayModelColumns() {
305 Gtk::TreeModelColumn<std::string> name;
306 Gtk::TreeModelColumn<ARDOUR::PluginPresetPtr> plugin;
309 ARDOUR::PluginInfoList favorite_order;
310 std::map<std::string, bool> favorite_ui_state;
312 TrackDisplayModelColumns track_columns;
313 GroupDisplayModelColumns group_columns;
314 PluginsDisplayModelColumns favorite_plugins_columns;
316 Gtk::TreeView track_display;
317 Gtk::TreeView group_display;
318 Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr> favorite_plugins_display;
320 Glib::RefPtr<Gtk::ListStore> track_model;
321 Glib::RefPtr<Gtk::ListStore> group_model;
322 Glib::RefPtr<PluginTreeStore> favorite_plugins_model;
324 bool group_display_button_press (GdkEventButton*);
325 void group_display_selection_changed ();
327 bool strip_button_release_event (GdkEventButton*, MixerStrip*);
331 void sync_order_keys_from_treeview ();
332 void sync_treeview_from_order_keys ();
333 void reset_remote_control_ids ();
334 void reset_order_keys ();
338 void parameter_changed (std::string const &);
339 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
341 void setup_track_display ();
342 void new_track_or_bus ();
344 static const int32_t default_width = 478;
345 static const int32_t default_height = 765;
347 /** true if we are rebuilding the route group list, or clearing
348 it during a session teardown.
350 bool _in_group_rebuild_or_clear;
351 bool _route_deletion_in_progress;
353 void update_title ();
354 MixerStrip* strip_by_x (int x);
356 friend class MixerGroupTabs;
358 void follow_editor_selection ();
359 bool _following_editor_selection;
361 void monitor_section_going_away ();
364 void monitor_section_attached ();
365 void monitor_section_detached ();
367 void store_current_favorite_order();
368 void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs);
369 void refill_favorite_plugins ();
370 void sync_treeview_from_favorite_order ();
371 void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
372 void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path);
375 void create_own_window ();
377 >>>>>>> the basics of tabbed
378 /// true if we are in fullscreen mode
381 // true if mixer list is visible
382 bool _show_mixer_list;
385 #endif /* __ardour_mixer_ui_h__ */