2 Copyright (C) 2000-2004 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.
21 #include "gtk2ardour-config.h"
26 #include <sigc++/bind.h>
28 #include <boost/foreach.hpp>
30 #include <glibmm/threads.h>
32 #include <gtkmm/accelmap.h>
33 #include <gtkmm/stock.h>
35 #include "pbd/convert.h"
36 #include "pbd/stacktrace.h"
37 #include "pbd/unwind.h"
39 #include "ardour/amp.h"
40 #include "ardour/debug.h"
41 #include "ardour/audio_track.h"
42 #include "ardour/midi_track.h"
43 #include "ardour/plugin_manager.h"
44 #include "ardour/route_group.h"
45 #include "ardour/selection.h"
46 #include "ardour/session.h"
47 #include "ardour/vca.h"
48 #include "ardour/vca_manager.h"
50 #include "gtkmm2ext/gtk_ui.h"
51 #include "gtkmm2ext/keyboard.h"
52 #include "gtkmm2ext/utils.h"
53 #include "gtkmm2ext/window_title.h"
54 #include "gtkmm2ext/doi.h"
56 #include "widgets/tearoff.h"
60 #include "mixer_strip.h"
61 #include "monitor_section.h"
62 #include "plugin_selector.h"
63 #include "public_editor.h"
64 #include "mouse_cursors.h"
65 #include "ardour_ui.h"
67 #include "route_sorter.h"
69 #include "gui_thread.h"
70 #include "mixer_group_tabs.h"
71 #include "route_sorter.h"
73 #include "ui_config.h"
74 #include "vca_master_strip.h"
78 using namespace ARDOUR;
79 using namespace ARDOUR_UI_UTILS;
83 using namespace Gtkmm2ext;
89 Mixer_UI* Mixer_UI::_instance = 0;
95 _instance = new Mixer_UI;
101 Mixer_UI::Mixer_UI ()
102 : Tabbable (_content, _("Mixer"))
103 , ActionMapOwner (X_("mixer"))
104 , no_track_list_redisplay (false)
105 , in_group_row_change (false)
107 , _monitor_section (0)
108 , _plugin_selector (0)
109 , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
110 , _spill_scroll_position (0)
111 , ignore_reorder (false)
112 , _in_group_rebuild_or_clear (false)
113 , _route_deletion_in_progress (false)
115 , _strip_selection_change_without_scroll (false)
116 , _selection (*this, *this)
120 _content.set_data ("ardour-bindings", bindings);
122 PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context());
124 scroller.set_can_default (true);
125 // set_default (scroller);
127 scroller_base.set_flags (Gtk::CAN_FOCUS);
128 scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
129 scroller_base.set_name ("MixerWindow");
130 scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
132 /* set up drag-n-drop */
133 vector<TargetEntry> target_table;
134 target_table.push_back (TargetEntry ("PluginFavoritePtr"));
135 scroller_base.drag_dest_set (target_table);
136 scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
138 /* create a button to add VCA strips ... will get packed in redisplay_track_list() */
139 Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
141 add_vca_button.add (*w);
142 add_vca_button.set_can_focus(false);
143 add_vca_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
145 /* create a button to add mixer strips */
146 w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
149 add_button.set_can_focus(false);
150 add_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
152 /* add as last item of strip packer */
153 strip_packer.pack_end (scroller_base, true, true);
154 strip_packer.pack_end (add_button, false, false);
157 /* create a drop-shadow at the end of the mixer strips */
158 mb_shadow.set_size_request( 4, -1 );
159 mb_shadow.set_name("EditorWindow");
161 strip_packer.pack_end (mb_shadow, false, false);
164 _group_tabs = new MixerGroupTabs (this);
165 VBox* b = manage (new VBox);
167 b->set_border_width (0);
168 b->pack_start (*_group_tabs, PACK_SHRINK);
169 b->pack_start (strip_packer);
171 b->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
174 scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
176 setup_track_display ();
178 group_model = ListStore::create (group_columns);
179 group_display.set_model (group_model);
180 group_display.append_column (_("Show"), group_columns.visible);
181 group_display.append_column (_("Group"), group_columns.text);
182 group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
183 group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
184 group_display.get_column (0)->set_expand(false);
185 group_display.get_column (1)->set_expand(true);
186 group_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
187 group_display.set_name ("EditGroupList");
188 group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
189 group_display.set_reorderable (true);
190 group_display.set_headers_visible (true);
191 group_display.set_rules_hint (true);
192 group_display.set_can_focus(false);
194 /* name is directly editable */
196 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
197 name_cell->property_editable() = true;
198 name_cell->signal_edited().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_name_edit));
200 /* use checkbox for the active column */
202 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (0));
203 active_cell->property_activatable() = true;
204 active_cell->property_radio() = false;
206 group_model->signal_row_changed().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_change));
207 /* We use this to notice drag-and-drop reorders of the group list */
208 group_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_deleted));
209 group_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::group_display_button_press), false);
211 group_display_scroller.add (group_display);
212 group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
215 group_display_vbox.pack_start (group_display_scroller, true, true);
217 group_display_frame.set_name ("BaseFrame");
218 group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
219 group_display_frame.add (group_display_vbox);
221 list<TargetEntry> target_list;
222 target_list.push_back (TargetEntry ("PluginPresetPtr"));
224 favorite_plugins_model = PluginTreeStore::create (favorite_plugins_columns);
225 favorite_plugins_display.set_model (favorite_plugins_model);
226 favorite_plugins_display.append_column (_("Favorite Plugins"), favorite_plugins_columns.name);
227 favorite_plugins_display.set_name ("EditGroupList");
228 favorite_plugins_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
229 favorite_plugins_display.set_reorderable (false);
230 favorite_plugins_display.set_headers_visible (true);
231 favorite_plugins_display.set_rules_hint (true);
232 favorite_plugins_display.set_can_focus (false);
233 favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr");
234 favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
235 favorite_plugins_display.add_drop_targets (target_list);
236 favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
237 favorite_plugins_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_button_press), false);
238 favorite_plugins_display.signal_drop.connect (sigc::mem_fun (*this, &Mixer_UI::plugin_drop));
239 favorite_plugins_display.signal_row_expanded().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
240 favorite_plugins_display.signal_row_collapsed().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
241 if (UIConfiguration::instance().get_use_tooltips()) {
242 favorite_plugins_display.set_tooltip_column (0);
244 favorite_plugins_model->signal_row_has_child_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::sync_treeview_favorite_ui_state));
246 favorite_plugins_scroller.add (favorite_plugins_display);
247 favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
249 favorite_plugins_frame.set_name ("BaseFrame");
250 favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN);
251 favorite_plugins_frame.add (favorite_plugins_vbox);
253 favorite_plugins_vbox.pack_start (favorite_plugins_scroller, true, true);
254 favorite_plugins_vbox.pack_start (favorite_plugins_tag_combo, false, false);
255 favorite_plugins_tag_combo.signal_changed().connect (sigc::mem_fun (*this, &Mixer_UI::tag_combo_changed));
257 rhs_pane1.add (favorite_plugins_frame);
258 rhs_pane1.add (track_display_frame);
260 rhs_pane2.add (rhs_pane1);
261 rhs_pane2.add (group_display_frame);
263 list_vpacker.pack_start (rhs_pane2, true, true);
265 vca_label_bar.set_size_request (-1, 16 + 1); /* must match height in GroupTabs::set_size_request() + 1 border px*/
266 vca_vpacker.pack_start (vca_label_bar, false, false);
268 vca_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
269 vca_scroller_base.set_name (X_("MixerWindow"));
270 vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false);
272 vca_scroller.add (vca_hpacker);
273 vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
274 vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
276 vca_vpacker.pack_start (vca_scroller, true, true);
278 inner_pane.add (scroller);
279 inner_pane.add (vca_vpacker);
281 global_hpacker.pack_start (inner_pane, true, true);
282 global_hpacker.pack_start (out_packer, false, false);
284 list_hpane.set_check_divider_position (true);
285 list_hpane.add (list_vpacker);
286 list_hpane.add (global_hpacker);
287 list_hpane.set_child_minsize (list_vpacker, 30);
289 XMLNode const * settings = ARDOUR_UI::instance()->mixer_settings();
292 if (!settings || !settings->get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) {
295 rhs_pane1.set_divider (0, fract);
297 if (!settings || !settings->get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) {
300 rhs_pane2.set_divider (0, fract);
302 if (!settings || !settings->get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) {
305 list_hpane.set_divider (0, fract);
307 if (!settings || !settings->get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) {
310 inner_pane.set_divider (0, fract);
312 rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
313 rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
314 list_hpane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
315 inner_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
317 _content.pack_start (list_hpane, true, true);
322 _content.set_name ("MixerWindow");
324 global_hpacker.show();
326 scroller_base.show();
327 scroller_hpacker.show();
328 mixer_scroller_vpacker.show();
330 group_display_button_label.show();
331 group_display_scroller.show();
332 favorite_plugins_scroller.show();
333 group_display_vbox.show();
334 group_display_frame.show();
335 favorite_plugins_frame.show();
343 vca_label_bar.show();
345 vca_scroller_base.show();
348 group_display.show();
349 favorite_plugins_display.show();
352 MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
353 VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
357 ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context());
359 #ifndef DEFER_PLUGIN_SELECTOR_LOAD
360 _plugin_selector = new PluginSelector (PluginManager::instance ());
362 #error implement deferred Plugin-Favorite list
365 PluginManager::instance ().PluginListChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
366 PluginManager::instance ().PluginStatusChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
367 ARDOUR::Plugin::PresetsChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
370 Mixer_UI::~Mixer_UI ()
372 if (_monitor_section) {
373 monitor_section_detached ();
374 delete _monitor_section;
376 delete _plugin_selector;
380 struct MixerStripSorter {
381 bool operator() (const MixerStrip* ms_a, const MixerStrip* ms_b)
383 boost::shared_ptr<ARDOUR::Stripable> const& a = ms_a->stripable ();
384 boost::shared_ptr<ARDOUR::Stripable> const& b = ms_b->stripable ();
385 return ARDOUR::Stripable::Sorter(true)(a, b);
397 Mixer_UI::tag_combo_changed ()
399 refill_favorite_plugins();
403 Mixer_UI::use_own_window (bool and_fill_it)
405 bool new_window = !own_window();
407 Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
409 if (win && new_window) {
410 win->set_name ("MixerWindow");
411 ARDOUR_UI::instance()->setup_toplevel_window (*win, _("Mixer"), this);
412 win->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win));
413 win->set_data ("ardour-bindings", bindings);
415 if (!win->get_focus()) {
416 /* set focus widget to something, anything */
417 win->set_focus (scroller);
425 Mixer_UI::show_window ()
427 Tabbable::show_window ();
429 /* show/hide group tabs as required */
430 parameter_changed ("show-group-tabs");
432 /* now reset each strips width so the right widgets are shown */
434 TreeModel::Children rows = track_model->children();
435 TreeModel::Children::iterator ri;
437 for (ri = rows.begin(); ri != rows.end(); ++ri) {
438 AxisView* av = (*ri)[stripable_columns.strip];
439 MixerStrip* ms = dynamic_cast<MixerStrip*> (av);
443 ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
444 /* Fix visibility of mixer strip stuff */
445 ms->parameter_changed (X_("mixer-element-visibility"));
448 /* force focus into main area */
449 scroller_base.grab_focus ();
453 Mixer_UI::remove_master (VCAMasterStrip* vms)
455 if (_session && _session->deletion_in_progress()) {
456 /* its all being taken care of */
460 TreeModel::Children rows = track_model->children();
461 TreeModel::Children::iterator ri;
463 for (ri = rows.begin(); ri != rows.end(); ++ri) {
464 if ((*ri)[stripable_columns.strip] == vms) {
465 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
466 track_model->erase (ri);
473 Mixer_UI::masters_scroller_button_release (GdkEventButton* ev)
475 using namespace Menu_Helpers;
477 if (Keyboard::is_context_menu_event (ev)) {
478 ARDOUR_UI::instance()->add_route ();
486 Mixer_UI::add_masters (VCAList& vlist)
490 for (VCAList::iterator v = vlist.begin(); v != vlist.end(); ++v) {
491 sl.push_back (boost::dynamic_pointer_cast<Stripable> (*v));
498 Mixer_UI::add_routes (RouteList& rlist)
502 for (RouteList::iterator r = rlist.begin(); r != rlist.end(); ++r) {
510 Mixer_UI::add_stripables (StripableList& slist)
512 Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
513 bool from_scratch = (track_model->children().size() == 0);
514 uint32_t nroutes = 0;
516 slist.sort (Stripable::Sorter());
518 for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
519 boost::shared_ptr<Stripable> s = (*it)[stripable_columns.stripable];
527 // XXX what does this special case do?
528 if (s->presentation_info().order() == (slist.front()->presentation_info().order() + slist.size())) {
537 PBD::Unwinder<bool> uw (no_track_list_redisplay, true);
539 track_display.set_model (Glib::RefPtr<ListStore>());
541 for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
543 boost::shared_ptr<Route> route;
544 boost::shared_ptr<VCA> vca;
546 if ((vca = boost::dynamic_pointer_cast<VCA> (*s))) {
548 VCAMasterStrip* vms = new VCAMasterStrip (_session, vca);
550 TreeModel::Row row = *(track_model->append());
552 row[stripable_columns.text] = vca->name();
553 row[stripable_columns.visible] = vms->marked_for_display ();
554 row[stripable_columns.strip] = vms;
555 row[stripable_columns.stripable] = vca;
557 vms->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::vca_button_release_event), vms));
559 } else if ((route = boost::dynamic_pointer_cast<Route> (*s))) {
561 if (route->is_auditioner()) {
565 if (route->is_monitor()) {
567 if (!_monitor_section) {
568 _monitor_section = new MonitorSection (_session);
570 XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
572 _monitor_section->tearoff().set_state (*mnode);
575 set_monitor_action_sensitivity(true);
578 out_packer.pack_end (_monitor_section->tearoff(), false, false);
579 _monitor_section->set_session (_session);
580 _monitor_section->tearoff().show_all ();
582 _monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
583 _monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
585 if (_monitor_section->tearoff().torn_off()) {
586 monitor_section_detached ();
588 monitor_section_attached ();
591 route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context());
593 /* no regular strip shown for control out */
598 strip = new MixerStrip (*this, _session, route);
599 strips.push_back (strip);
601 UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
603 if (strip->width_owner() != strip) {
604 strip->set_width_enum (_strip_width, this);
609 if (route->is_master()) {
611 out_packer.pack_start (*strip, false, false);
612 strip->set_packed (true);
616 TreeModel::Row row = *(track_model->insert (insert_iter));
618 row[stripable_columns.text] = route->name();
619 row[stripable_columns.visible] = strip->marked_for_display();
620 row[stripable_columns.stripable] = route;
621 row[stripable_columns.strip] = strip;
624 strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
625 strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
628 (*s)->presentation_info().PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
629 (*s)->PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
632 } catch (const std::exception& e) {
633 error << string_compose (_("Error adding GUI elements for new tracks/busses %1"), e.what()) << endmsg;
636 track_display.set_model (track_model);
638 /* catch up on selection state, which we left to the editor to set */
639 sync_treeview_from_presentation_info (PropertyChange (Properties::selected));
642 sync_presentation_info_from_treeview ();
645 redisplay_track_list ();
649 Mixer_UI::deselect_all_strip_processors ()
651 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
652 (*i)->deselect_all_processors();
657 Mixer_UI::select_none ()
659 _selection.clear_routes();
660 deselect_all_strip_processors();
664 Mixer_UI::select_next_strip ()
666 deselect_all_strip_processors();
667 _session->selection().select_next_stripable (true, false);
671 Mixer_UI::select_prev_strip ()
673 deselect_all_strip_processors();
674 _session->selection().select_prev_stripable (true, false);
678 Mixer_UI::delete_processors ()
680 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
681 (*i)->delete_processors();
687 Mixer_UI::remove_strip (MixerStrip* strip)
689 if (_session && _session->deletion_in_progress()) {
690 /* its all being taken care of */
694 TreeModel::Children rows = track_model->children();
695 TreeModel::Children::iterator ri;
696 list<MixerStrip *>::iterator i;
698 if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
702 PBD::Unwinder<bool> uwi (ignore_reorder, true);
704 for (ri = rows.begin(); ri != rows.end(); ++ri) {
705 if ((*ri)[stripable_columns.strip] == strip) {
706 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
707 track_model->erase (ri);
714 Mixer_UI::presentation_info_changed (PropertyChange const & what_changed)
716 if (what_changed.contains (Properties::selected)) {
717 _selection.presentation_info_changed (what_changed);
721 soh.add (Properties::selected);
722 soh.add (Properties::order);
723 soh.add (Properties::hidden);
725 if (what_changed.contains (soh)) {
726 sync_treeview_from_presentation_info (what_changed);
731 Mixer_UI::sync_presentation_info_from_treeview ()
733 if (ignore_reorder || !_session || _session->deletion_in_progress()) {
737 TreeModel::Children rows = track_model->children();
743 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync presentation info from treeview\n");
745 TreeModel::Children::iterator ri;
748 PresentationInfo::order_t master_key = _session->master_order_key ();
749 PresentationInfo::order_t order = 0;
751 PresentationInfo::ChangeSuspender cs;
753 for (ri = rows.begin(); ri != rows.end(); ++ri) {
754 bool visible = (*ri)[stripable_columns.visible];
755 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
757 #ifndef NDEBUG // these should not exist in the mixer's treeview
762 if (stripable->is_monitor() || stripable->is_auditioner()) {
766 if (stripable->is_master()) {
772 stripable->presentation_info().set_hidden (!visible);
774 // leave master where it is.
775 if (order == master_key) {
779 if (order != stripable->presentation_info().order()) {
780 stripable->set_presentation_order (order);
786 change |= _session->ensure_stripable_sort_order ();
789 DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
790 _session->set_dirty();
795 Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_changed)
797 if (!_session || _session->deletion_in_progress()) {
801 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from presentation info.\n");
803 /* we could get here after either a change in the Mixer or Editor sort
804 * order, but either way, the mixer order keys reflect the intended
805 * order for the GUI, so reorder the treeview model to match it.
808 vector<int> neworder;
809 TreeModel::Children rows = track_model->children();
810 uint32_t old_order = 0;
811 bool changed = false;
817 TreeOrderKeys sorted;
818 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
819 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
820 sorted.push_back (TreeOrderKey (old_order, stripable));
823 TreeOrderKeySorter cmp;
825 sort (sorted.begin(), sorted.end(), cmp);
826 neworder.assign (sorted.size(), 0);
830 for (TreeOrderKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
832 neworder[n] = sr->old_display_order;
834 if (sr->old_display_order != n) {
840 Unwinder<bool> uw (ignore_reorder, true);
841 track_model->reorder (neworder);
844 if (what_changed.contains (Properties::selected)) {
846 PresentationInfo::ChangeSuspender cs;
848 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
849 boost::shared_ptr<Stripable> stripable = (*i)->stripable();
850 if (stripable && stripable->is_selected()) {
853 _selection.remove (*i);
857 if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll () && !_strip_selection_change_without_scroll) {
858 move_stripable_into_view ((*_selection.axes.begin())->stripable());
861 TreeModel::Children rows = track_model->children();
862 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
863 AxisView* av = (*i)[stripable_columns.strip];
864 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
868 if (vms->vca() && vms->vca()->is_selected()) {
869 _selection.add (vms);
871 _selection.remove (vms);
876 redisplay_track_list ();
881 Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) const
883 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
884 if ((*i)->route() == r) {
893 Mixer_UI::strip_by_stripable (boost::shared_ptr<Stripable> s) const
895 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
896 if ((*i)->stripable() == s) {
905 Mixer_UI::axis_view_by_stripable (boost::shared_ptr<Stripable> s) const
907 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
908 if ((*i)->stripable() == s) {
913 TreeModel::Children rows = track_model->children();
914 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
915 AxisView* av = (*i)[stripable_columns.strip];
916 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
917 if (vms && vms->stripable () == s) {
926 Mixer_UI::axis_view_by_control (boost::shared_ptr<AutomationControl> c) const
928 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
929 if ((*i)->control() == c) {
938 Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
940 /* Selecting a mixer-strip may also select grouped-tracks, and
941 * presentation_info_changed() being emitted and
942 * _selection.axes.begin() is being moved into view. This may
943 * effectively move the track that was clicked-on out of view.
945 * So here only the track that is actually clicked-on is moved into
946 * view (in case it's partially visible)
948 PBD::Unwinder<bool> uw (_strip_selection_change_without_scroll, true);
949 move_stripable_into_view (strip->stripable());
951 if (ev->button == 1) {
952 if (_selection.selected (strip)) {
953 /* primary-click: toggle selection state of strip */
954 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
955 _selection.remove (strip, true);
956 } else if (_selection.axes.size() > 1) {
957 /* de-select others */
958 _selection.set (strip);
960 PublicEditor& pe = PublicEditor::instance();
961 TimeAxisView* tav = pe.time_axis_view_from_stripable (strip->stripable());
963 pe.set_selected_mixer_strip (*tav);
966 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
967 _selection.add (strip, true);
968 } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
970 /* extend selection */
972 vector<MixerStrip*> tmp;
973 bool accumulate = false;
974 bool found_another = false;
976 strips.sort (MixerStripSorter());
978 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
983 /* hit clicked strip, start accumulating till we hit the first
992 } else if (_selection.selected (ms)) {
993 /* hit selected strip. if currently accumulating others,
994 we're done. if not accumulating others, start doing so.
996 found_another = true;
1010 tmp.push_back (strip);
1012 if (found_another) {
1013 PresentationInfo::ChangeSuspender cs;
1014 for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
1015 _selection.add (*i, true);
1018 _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
1021 _selection.set (strip);
1030 Mixer_UI::vca_button_release_event (GdkEventButton *ev, VCAMasterStrip *strip)
1032 _selection.set (strip);
1037 Mixer_UI::set_session (Session* sess)
1039 SessionHandlePtr::set_session (sess);
1041 if (_plugin_selector) {
1042 _plugin_selector->set_session (_session);
1045 _group_tabs->set_session (sess);
1047 if (_monitor_section) {
1048 _monitor_section->set_session (_session);
1052 _selection.clear ();
1056 refill_favorite_plugins();
1059 XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
1060 set_state (*node, 0);
1064 initial_track_display ();
1066 _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_routes, this, _1), gui_context());
1067 _session->route_group_added.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_route_group, this, _1), gui_context());
1068 _session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1069 _session->route_groups_reordered.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1070 _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context());
1071 _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1072 _session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1074 _session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_masters, this, _1), gui_context());
1076 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context ());
1078 route_groups_changed ();
1084 /* catch up on selection state, etc. */
1087 sc.add (Properties::selected);
1088 _selection.presentation_info_changed (sc);
1094 Mixer_UI::session_going_away ()
1096 ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away);
1098 _in_group_rebuild_or_clear = true;
1099 group_model->clear ();
1100 _in_group_rebuild_or_clear = false;
1102 _selection.clear ();
1103 track_model->clear ();
1105 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1109 if (_monitor_section) {
1110 _monitor_section->tearoff().hide_visible ();
1113 monitor_section_detached ();
1119 SessionHandlePtr::session_going_away ();
1126 Mixer_UI::track_visibility_changed (std::string const & path)
1128 if (_session && _session->deletion_in_progress()) {
1134 if ((iter = track_model->get_iter (path))) {
1136 AxisView* av = (*iter)[stripable_columns.strip];
1137 bool visible = (*iter)[stripable_columns.visible];
1139 if (av->set_marked_for_display (!visible)) {
1140 update_track_visibility ();
1146 Mixer_UI::update_track_visibility ()
1148 TreeModel::Children rows = track_model->children();
1149 TreeModel::Children::iterator i;
1152 Unwinder<bool> uw (no_track_list_redisplay, true);
1154 for (i = rows.begin(); i != rows.end(); ++i) {
1155 AxisView* av = (*i)[stripable_columns.strip];
1156 (*i)[stripable_columns.visible] = av->marked_for_display ();
1159 /* force presentation catch up with visibility changes
1162 sync_presentation_info_from_treeview ();
1165 redisplay_track_list ();
1169 Mixer_UI::show_strip (MixerStrip* ms)
1171 TreeModel::Children rows = track_model->children();
1172 TreeModel::Children::iterator i;
1174 for (i = rows.begin(); i != rows.end(); ++i) {
1176 AxisView* av = (*i)[stripable_columns.strip];
1177 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1179 (*i)[stripable_columns.visible] = true;
1180 av->set_marked_for_display (true);
1181 update_track_visibility ();
1188 Mixer_UI::hide_strip (MixerStrip* ms)
1190 TreeModel::Children rows = track_model->children();
1191 TreeModel::Children::iterator i;
1193 for (i = rows.begin(); i != rows.end(); ++i) {
1195 AxisView* av = (*i)[stripable_columns.strip];
1196 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1198 (*i)[stripable_columns.visible] = false;
1199 av->set_marked_for_display (false);
1200 update_track_visibility ();
1207 Mixer_UI::start_updating ()
1209 fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips));
1214 Mixer_UI::stop_updating ()
1216 fast_screen_update_connection.disconnect();
1221 Mixer_UI::fast_update_strips ()
1223 if (_content.is_mapped () && _session) {
1224 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1225 (*i)->fast_update ();
1231 Mixer_UI::set_all_strips_visibility (bool yn)
1233 TreeModel::Children rows = track_model->children();
1234 TreeModel::Children::iterator i;
1237 Unwinder<bool> uw (no_track_list_redisplay, true);
1239 for (i = rows.begin(); i != rows.end(); ++i) {
1241 AxisView* av = (*i)[stripable_columns.strip];
1242 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1248 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1252 (*i)[stripable_columns.visible] = yn;
1256 redisplay_track_list ();
1261 Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn)
1263 TreeModel::Children rows = track_model->children();
1264 TreeModel::Children::iterator i;
1267 Unwinder<bool> uw (no_track_list_redisplay, true);
1269 for (i = rows.begin(); i != rows.end(); ++i) {
1271 AxisView* av = (*i)[stripable_columns.strip];
1272 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1278 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1282 boost::shared_ptr<AudioTrack> at = strip->audio_track();
1283 boost::shared_ptr<MidiTrack> mt = strip->midi_track();
1287 (*i)[stripable_columns.visible] = yn;
1291 if (at) { /* track */
1292 (*i)[stripable_columns.visible] = yn;
1297 if (!at && !mt) { /* bus */
1298 (*i)[stripable_columns.visible] = yn;
1303 if (mt) { /* midi-track */
1304 (*i)[stripable_columns.visible] = yn;
1311 redisplay_track_list ();
1315 Mixer_UI::hide_all_routes ()
1317 set_all_strips_visibility (false);
1321 Mixer_UI::show_all_routes ()
1323 set_all_strips_visibility (true);
1327 Mixer_UI::show_all_audiobus ()
1329 set_all_audio_midi_visibility (2, true);
1332 Mixer_UI::hide_all_audiobus ()
1334 set_all_audio_midi_visibility (2, false);
1338 Mixer_UI::show_all_audiotracks()
1340 set_all_audio_midi_visibility (1, true);
1343 Mixer_UI::hide_all_audiotracks ()
1345 set_all_audio_midi_visibility (1, false);
1349 Mixer_UI::show_all_miditracks()
1351 set_all_audio_midi_visibility (3, true);
1354 Mixer_UI::hide_all_miditracks ()
1356 set_all_audio_midi_visibility (3, false);
1360 Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
1362 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
1363 sync_presentation_info_from_treeview ();
1367 Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
1369 /* this happens as the second step of a DnD within the treeview as well
1370 as when a row/route is actually deleted.
1372 if it was a deletion then we have to force a redisplay because
1373 order keys may not have changed.
1376 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
1377 sync_presentation_info_from_treeview ();
1379 if (_route_deletion_in_progress) {
1380 redisplay_track_list ();
1385 Mixer_UI::spill_redisplay (boost::shared_ptr<VCA> vca)
1387 TreeModel::Children rows = track_model->children();
1388 std::list<boost::shared_ptr<VCA> > vcas;
1389 vcas.push_back (vca);
1391 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1392 AxisView* av = (*i)[stripable_columns.strip];
1393 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
1394 if (vms && vms->vca()->slaved_to (vca)) {
1395 vcas.push_back (vms->vca());
1399 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1401 AxisView* av = (*i)[stripable_columns.strip];
1402 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1403 bool const visible = (*i)[stripable_columns.visible];
1406 /* we're in the middle of changing a row, don't worry */
1410 if (!strip->route()) {
1411 /* non-route element */
1415 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1419 bool slaved = false;
1420 for (std::list<boost::shared_ptr<VCA> >::const_iterator m = vcas.begin(); m != vcas.end(); ++m) {
1421 if (strip->route()->slaved_to (*m)) {
1427 if (slaved && visible) {
1429 if (strip->packed()) {
1430 strip_packer.reorder_child (*strip, -1); /* put at end */
1432 strip_packer.pack_start (*strip, false, false);
1433 strip->set_packed (true);
1438 if (strip->packed()) {
1439 strip_packer.remove (*strip);
1440 strip->set_packed (false);
1447 Mixer_UI::redisplay_track_list ()
1449 if (no_track_list_redisplay) {
1453 boost::shared_ptr<Stripable> ss = spilled_strip.lock ();
1455 boost::shared_ptr<VCA> sv = boost::dynamic_pointer_cast<VCA> (ss);
1457 if (_spill_scroll_position <= 0 && scroller.get_hscrollbar()) {
1458 _spill_scroll_position = scroller.get_hscrollbar()->get_adjustment()->get_value();
1460 spill_redisplay (sv);
1465 TreeModel::Children rows = track_model->children();
1466 TreeModel::Children::iterator i;
1467 uint32_t n_masters = 0;
1469 container_clear (vca_hpacker);
1471 vca_hpacker.pack_end (vca_scroller_base, true, true);
1472 vca_hpacker.pack_end (add_vca_button, false, false);
1474 add_vca_button.show ();
1475 vca_scroller_base.show();
1477 for (i = rows.begin(); i != rows.end(); ++i) {
1479 AxisView* s = (*i)[stripable_columns.strip];
1480 bool const visible = (*i)[stripable_columns.visible];
1481 boost::shared_ptr<Stripable> stripable = (*i)[stripable_columns.stripable];
1484 /* we're in the middle of changing a row, don't worry */
1488 VCAMasterStrip* vms;
1490 if ((vms = dynamic_cast<VCAMasterStrip*> (s))) {
1492 vca_hpacker.pack_start (*vms, false, false);
1499 MixerStrip* strip = dynamic_cast<MixerStrip*> (s);
1507 if (strip->packed()) {
1508 strip_packer.reorder_child (*strip, -1); /* put at end */
1510 strip_packer.pack_start (*strip, false, false);
1511 strip->set_packed (true);
1516 if (stripable->is_master() || stripable->is_monitor()) {
1517 /* do nothing, these cannot be hidden */
1519 if (strip->packed()) {
1520 strip_packer.remove (*strip);
1521 strip->set_packed (false);
1527 /* update visibility of VCA assign buttons */
1529 if (n_masters == 0) {
1530 //show/hide the channelstrip VCA assign buttons on channelstrips:
1531 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1533 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleVCAPane");
1535 act->set_sensitive (false);
1538 //remove the VCA packer, but don't change our prior setting for show/hide:
1539 vca_vpacker.hide ();
1541 //show/hide the channelstrip VCA assign buttons on channelstrips:
1542 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1544 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleVCAPane");
1546 act->set_sensitive (true);
1548 //if we were showing VCAs before, show them now:
1549 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1551 showhide_vcas ( tact->get_active () );
1554 _group_tabs->set_dirty ();
1556 if (_spill_scroll_position > 0 && scroller.get_hscrollbar()) {
1557 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1558 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), _spill_scroll_position)));
1560 _spill_scroll_position = 0;
1565 Mixer_UI::strip_width_changed ()
1567 _group_tabs->set_dirty ();
1570 TreeModel::Children rows = track_model->children();
1571 TreeModel::Children::iterator i;
1574 for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
1575 AxisView* av = (*i)[stripable_columns.strip];
1576 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1582 bool visible = (*i)[stripable_columns.visible];
1585 strip->queue_draw();
1592 struct PresentationInfoMixerSorter
1594 bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
1595 if (a->is_master()) {
1596 /* master after everything else */
1598 } else if (b->is_master()) {
1599 /* everything else before master */
1602 return a->presentation_info().order () < b->presentation_info().order ();
1607 Mixer_UI::initial_track_display ()
1610 _session->get_stripables (sl);
1612 sl.sort (PresentationInfoMixerSorter());
1615 /* These are also used inside ::add_stripables() but we need
1616 * them here because we're going to clear the track_model also.
1618 Unwinder<bool> uw1 (no_track_list_redisplay, true);
1619 Unwinder<bool> uw2 (ignore_reorder, true);
1621 track_model->clear ();
1622 add_stripables (sl);
1625 sync_treeview_from_presentation_info (Properties::order);
1629 Mixer_UI::track_display_button_press (GdkEventButton* ev)
1631 if (Keyboard::is_context_menu_event (ev)) {
1632 if (track_menu == 0) {
1633 build_track_menu ();
1635 track_menu->popup (ev->button, ev->time);
1638 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 1)) {
1639 TreeModel::Path path;
1640 TreeViewColumn* column;
1642 if (track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1643 TreeIter iter = track_model->get_iter (path);
1644 if ((*iter)[stripable_columns.visible]) {
1645 boost::shared_ptr<ARDOUR::Stripable> s = (*iter)[stripable_columns.stripable];
1646 move_stripable_into_view (s);
1655 Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
1657 if (!scroller.get_hscrollbar()) {
1660 if (s->presentation_info().special () || s->presentation_info().flag_match (PresentationInfo::VCA)) {
1670 Gtk::Allocation alloc;
1671 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
1672 if ((*i)->route() == s) {
1675 (*i)->translate_coordinates (strip_packer, 0, 0, x0, y);
1676 alloc = (*i)->get_allocation ();
1684 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1686 if (x0 < adj->get_value()) {
1687 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
1688 } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
1689 int x1 = x0 + alloc.get_width() - adj->get_page_size();
1690 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
1695 Mixer_UI::build_track_menu ()
1697 using namespace Menu_Helpers;
1698 using namespace Gtk;
1700 track_menu = new Menu;
1701 track_menu->set_name ("ArdourContextMenu");
1702 MenuList& items = track_menu->items();
1704 items.push_back (MenuElem (_("Show All"), sigc::mem_fun(*this, &Mixer_UI::show_all_routes)));
1705 items.push_back (MenuElem (_("Hide All"), sigc::mem_fun(*this, &Mixer_UI::hide_all_routes)));
1706 items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiotracks)));
1707 items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiotracks)));
1708 items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::show_all_miditracks)));
1709 items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::hide_all_miditracks)));
1710 items.push_back (MenuElem (_("Show All Busses"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiobus)));
1711 items.push_back (MenuElem (_("Hide All Busses"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiobus)));
1716 Mixer_UI::stripable_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Stripable> ws)
1718 if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) {
1722 boost::shared_ptr<Stripable> s = ws.lock ();
1728 TreeModel::Children rows = track_model->children();
1729 TreeModel::Children::iterator i;
1731 for (i = rows.begin(); i != rows.end(); ++i) {
1732 boost::shared_ptr<Stripable> ss = (*i)[stripable_columns.stripable];
1736 if (what_changed.contains (ARDOUR::Properties::name)) {
1737 (*i)[stripable_columns.text] = s->name();
1740 if (what_changed.contains (ARDOUR::Properties::hidden)) {
1741 (*i)[stripable_columns.visible] = !s->presentation_info().hidden();
1742 redisplay_track_list ();
1749 if (s->is_master ()) {
1753 error << _("track display list item for renamed strip not found!") << endmsg;
1757 Mixer_UI::group_display_button_press (GdkEventButton* ev)
1759 TreeModel::Path path;
1760 TreeViewColumn* column;
1764 if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1765 if (ev->button == 3) {
1766 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1771 TreeIter iter = group_model->get_iter (path);
1773 if (ev->button == 3) {
1774 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1779 RouteGroup* group = (*iter)[group_columns.group];
1781 if (Keyboard::is_context_menu_event (ev)) {
1782 _group_tabs->get_menu(group)->popup (1, ev->time);
1786 switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
1788 if (Keyboard::is_edit_event (ev)) {
1790 // edit_route_group (group);
1792 group_display.queue_draw();
1801 bool visible = (*iter)[group_columns.visible];
1802 (*iter)[group_columns.visible] = !visible;
1804 group_display.queue_draw();
1817 Mixer_UI::activate_all_route_groups ()
1819 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
1823 Mixer_UI::disable_all_route_groups ()
1825 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
1829 Mixer_UI::route_groups_changed ()
1831 ENSURE_GUI_THREAD (*this, &Mixer_UI::route_groups_changed);
1833 _in_group_rebuild_or_clear = true;
1835 /* just rebuild the while thing */
1837 group_model->clear ();
1840 /* this is currently not used,
1841 * Mixer_UI::group_display_button_press() has a case for it,
1842 * and a commented edit_route_group() but that's n/a since 2011.
1844 * This code is left as reminder that
1845 * row[group_columns.group] = 0 has special meaning.
1849 row = *(group_model->append());
1850 row[group_columns.visible] = true;
1851 row[group_columns.text] = (_("-all-"));
1852 row[group_columns.group] = 0;
1856 _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
1858 _group_tabs->set_dirty ();
1859 _in_group_rebuild_or_clear = false;
1863 Mixer_UI::new_route_group ()
1865 _group_tabs->run_new_group_dialog (0, false);
1869 Mixer_UI::remove_selected_route_group ()
1871 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1872 TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
1878 TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
1881 /* selection mode is single, so rows.begin() is it */
1883 if ((iter = group_model->get_iter (*i))) {
1885 RouteGroup* rg = (*iter)[group_columns.group];
1888 _session->remove_route_group (*rg);
1894 Mixer_UI::route_group_property_changed (RouteGroup* group, const PropertyChange& change)
1896 if (in_group_row_change) {
1900 /* force an update of any mixer strips that are using this group,
1901 otherwise mix group names don't change in mixer strips
1904 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1905 if ((*i)->route_group() == group) {
1906 (*i)->route_group_changed();
1910 TreeModel::iterator i;
1911 TreeModel::Children rows = group_model->children();
1912 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1914 in_group_row_change = true;
1916 for (i = rows.begin(); i != rows.end(); ++i) {
1917 if ((*i)[group_columns.group] == group) {
1918 (*i)[group_columns.visible] = !group->is_hidden ();
1919 (*i)[group_columns.text] = group->name ();
1924 in_group_row_change = false;
1926 if (change.contains (Properties::name)) {
1927 _group_tabs->set_dirty ();
1930 for (list<MixerStrip*>::iterator j = strips.begin(); j != strips.end(); ++j) {
1931 if ((*j)->route_group() == group) {
1932 if (group->is_hidden ()) {
1942 Mixer_UI::toggle_mixer_list ()
1944 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMixerList");
1946 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1947 showhide_mixer_list (tact->get_active());
1952 Mixer_UI::showhide_mixer_list (bool yn)
1955 list_vpacker.show ();
1957 list_vpacker.hide ();
1962 Mixer_UI::toggle_monitor_section ()
1964 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMonitorSection");
1966 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1967 showhide_monitor_section (tact->get_active());
1973 Mixer_UI::showhide_monitor_section (bool yn)
1975 if (!monitor_section()) {
1978 if (monitor_section()->tearoff().torn_off()) {
1983 monitor_section()->tearoff().show();
1985 monitor_section()->tearoff().hide();
1990 Mixer_UI::toggle_vcas ()
1992 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleVCAPane");
1994 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1995 showhide_vcas (tact->get_active());
2000 Mixer_UI::showhide_vcas (bool yn)
2011 Mixer_UI::toggle_mixbuses ()
2013 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMixbusPane");
2015 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2016 showhide_mixbuses (tact->get_active());
2021 Mixer_UI::showhide_mixbuses (bool on)
2033 Mixer_UI::route_group_name_edit (const std::string& path, const std::string& new_text)
2038 if ((iter = group_model->get_iter (path))) {
2040 if ((group = (*iter)[group_columns.group]) == 0) {
2044 if (new_text != group->name()) {
2045 group->set_name (new_text);
2051 Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter)
2055 if (in_group_row_change) {
2059 if ((group = (*iter)[group_columns.group]) == 0) {
2063 std::string name = (*iter)[group_columns.text];
2065 if (name != group->name()) {
2066 group->set_name (name);
2069 bool hidden = !(*iter)[group_columns.visible];
2071 if (hidden != group->is_hidden ()) {
2072 group->set_hidden (hidden, this);
2076 /** Called when a group model row is deleted, but also when the model is
2077 * reordered by a user drag-and-drop; the latter is what we are
2078 * interested in here.
2081 Mixer_UI::route_group_row_deleted (Gtk::TreeModel::Path const &)
2083 if (_in_group_rebuild_or_clear) {
2087 /* Re-write the session's route group list so that the new order is preserved */
2089 list<RouteGroup*> new_list;
2091 Gtk::TreeModel::Children children = group_model->children();
2092 for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) {
2093 RouteGroup* g = (*i)[group_columns.group];
2095 new_list.push_back (g);
2099 _session->reorder_route_groups (new_list);
2104 Mixer_UI::add_route_group (RouteGroup* group)
2106 ENSURE_GUI_THREAD (*this, &Mixer_UI::add_route_group, group)
2109 in_group_row_change = true;
2111 TreeModel::Row row = *(group_model->append());
2112 row[group_columns.visible] = !group->is_hidden ();
2113 row[group_columns.group] = group;
2114 if (!group->name().empty()) {
2115 row[group_columns.text] = group->name();
2117 row[group_columns.text] = _("unnamed");
2121 group->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::route_group_property_changed, this, group, _1), gui_context());
2124 TreeViewColumn* col = group_display.get_column (0);
2125 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
2126 group_display.set_cursor (group_model->get_path (row), *col, *name_cell, true);
2129 _group_tabs->set_dirty ();
2131 in_group_row_change = false;
2135 Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
2137 using namespace Menu_Helpers;
2139 if (Keyboard::is_context_menu_event (ev)) {
2140 ARDOUR_UI::instance()->add_route ();
2148 Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint time)
2150 if (data.get_target() != "PluginFavoritePtr") {
2151 context->drag_finish (false, false, time);
2155 const void * d = data.get_data();
2156 const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>*>(d);
2158 PluginPresetList nfos;
2160 tv->get_object_drag_data (nfos, &source);
2162 Route::ProcessorList pl;
2165 for (list<PluginPresetPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
2166 PluginPresetPtr ppp = (*i);
2167 PluginInfoPtr pip = ppp->_pip;
2168 if (!pip->is_instrument ()) {
2171 ARDOUR_UI::instance()->session_add_midi_route (true, (RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order);
2175 context->drag_finish (ok, false, time);
2179 Mixer_UI::set_strip_width (Width w, bool save)
2183 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2184 (*i)->set_width_enum (w, save ? (*i)->width_owner() : this);
2189 struct PluginStateSorter {
2191 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2192 std::list<std::string>::const_iterator aiter = std::find(_user.begin(), _user.end(), (*a).unique_id);
2193 std::list<std::string>::const_iterator biter = std::find(_user.begin(), _user.end(), (*b).unique_id);
2194 if (aiter != _user.end() && biter != _user.end()) {
2195 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2197 if (aiter != _user.end()) {
2200 if (biter != _user.end()) {
2203 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2206 PluginStateSorter(std::list<std::string> user) : _user (user) {}
2208 std::list<std::string> _user;
2212 Mixer_UI::set_state (const XMLNode& node, int version)
2216 Tabbable::set_state (node, version);
2218 if (node.get_property ("narrow-strips", yn)) {
2220 set_strip_width (Narrow);
2222 set_strip_width (Wide);
2226 node.get_property ("show-mixer", _visible);
2228 if (node.get_property ("maximised", yn)) {
2229 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalMixer"));
2231 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2232 bool fs = tact && tact->get_active();
2234 ActionManager::do_action ("Common", "ToggleMaximalMixer");
2238 if (node.get_property ("show-mixer-list", yn)) {
2239 Glib::RefPtr<Action> act = myactions.find_action (X_("Mixer"), X_("ToggleMixerList"));
2241 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2244 /* do it twice to force the change */
2245 tact->set_active (!yn);
2246 tact->set_active (yn);
2249 if (node.get_property ("monitor-section-visible", yn)) {
2250 Glib::RefPtr<Action> act = myactions.find_action (X_("Mixer"), X_("ToggleMonitorSection"));
2252 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2255 /* do it twice to force the change */
2256 tact->set_active (!yn);
2257 tact->set_active (yn);
2260 if (node.get_property ("show-vca-pane", yn)) {
2261 Glib::RefPtr<Action> act = myactions.find_action (X_("Mixer"), X_("ToggleVCAPane"));
2263 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2266 /* do it twice to force the change */
2267 tact->set_active (!yn);
2268 tact->set_active (yn);
2272 if (node.get_property ("show-mixbus-pane", yn)) {
2273 Glib::RefPtr<Action> act = myactions.find_action (X_("Mixer"), X_("ToggleMixbusPane"));
2275 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2278 /* do it twice to force the change */
2279 tact->set_active (!yn);
2280 tact->set_active (yn);
2285 //check for the user's plugin_order file
2286 XMLNode plugin_order_new(X_("PO"));
2287 if (PluginManager::instance().load_plugin_order_file(plugin_order_new)) {
2288 store_current_favorite_order ();
2289 std::list<string> order;
2290 const XMLNodeList& kids = plugin_order_new.children("PluginInfo");
2291 XMLNodeConstIterator i;
2292 for (i = kids.begin(); i != kids.end(); ++i) {
2293 std::string unique_id;
2294 if ((*i)->get_property ("unique-id", unique_id)) {
2295 order.push_back (unique_id);
2296 if ((*i)->get_property ("expanded", yn)) {
2297 favorite_ui_state[unique_id] = yn;
2301 PluginStateSorter cmp (order);
2302 favorite_order.sort (cmp);
2303 sync_treeview_from_favorite_order ();
2306 //if there is no user file, then use an existing one from instant.xml
2307 //NOTE: if you are loading an old session, this might come from the session's instant.xml
2308 //Todo: in the next major version, we should probably stop doing the instant.xml check, and just use the new file
2309 XMLNode* plugin_order;
2310 if ((plugin_order = find_named_node (node, "PluginOrder")) != 0) {
2311 store_current_favorite_order ();
2312 std::list<string> order;
2313 const XMLNodeList& kids = plugin_order->children("PluginInfo");
2314 XMLNodeConstIterator i;
2315 for (i = kids.begin(); i != kids.end(); ++i) {
2316 std::string unique_id;
2317 if ((*i)->get_property ("unique-id", unique_id)) {
2318 order.push_back (unique_id);
2319 if ((*i)->get_property ("expanded", yn)) {
2320 favorite_ui_state[unique_id] = yn;
2325 PluginStateSorter cmp (order);
2326 favorite_order.sort (cmp);
2327 sync_treeview_from_favorite_order ();
2335 Mixer_UI::save_plugin_order_file ()
2337 //this writes the plugin order to the user's preference file ( plugin_metadata/plugin_order )
2339 //NOTE: this replaces the old code that stores info in instant.xml
2340 //why? because instant.xml prefers the per-session settings, and we want this to be a global pref
2342 store_current_favorite_order ();
2343 XMLNode plugin_order ("PluginOrder");
2345 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i, ++cnt) {
2346 XMLNode* p = new XMLNode ("PluginInfo");
2347 p->set_property ("sort", cnt);
2348 p->set_property ("unique-id", (*i)->unique_id);
2349 if (favorite_ui_state.find ((*i)->unique_id) != favorite_ui_state.end ()) {
2350 p->set_property ("expanded", favorite_ui_state[(*i)->unique_id]);
2352 plugin_order.add_child_nocopy (*p);
2354 PluginManager::instance().save_plugin_order_file( plugin_order );
2358 Mixer_UI::get_state ()
2360 XMLNode* node = new XMLNode (X_("Mixer"));
2362 node->add_child_nocopy (Tabbable::get_state());
2364 node->set_property (X_("mixer-rhs-pane1-pos"), rhs_pane1.get_divider());
2365 node->set_property (X_("mixer-rhs_pane2-pos"), rhs_pane2.get_divider());
2366 node->set_property (X_("mixer-list-hpane-pos"), list_hpane.get_divider());
2367 node->set_property (X_("mixer-inner-pane-pos"), inner_pane.get_divider());
2369 node->set_property ("narrow-strips", (_strip_width == Narrow));
2370 node->set_property ("show-mixer", _visible);
2371 node->set_property ("maximised", _maximised);
2373 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMixerList");
2374 assert (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2375 assert (tact); node->set_property ("show-mixer-list", tact->get_active ());
2377 act = myactions.find_action ("Mixer", "ToggleMonitorSection");
2378 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2379 assert (tact); node->set_property ("monitor-section-visible", tact->get_active ());
2381 act = myactions.find_action ("Mixer", "ToggleVCAPane");
2382 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2383 assert (tact); node->set_property ("show-vca-pane", tact->get_active ());
2386 act = myactions.find_action ("Mixer", "ToggleMixbusPane");
2387 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2388 assert (tact); node->set_property ("show-mixbus-pane", tact->get_active ());
2395 Mixer_UI::scroll_left ()
2397 if (!scroller.get_hscrollbar()) return;
2398 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2399 int sc_w = scroller.get_width();
2400 int sp_w = strip_packer.get_width();
2404 int lp = adj->get_value();
2406 using namespace Gtk::Box_Helpers;
2407 const BoxList& strips = strip_packer.children();
2408 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2409 if (i->get_widget() == & add_button) {
2413 if (i->get_widget() == &mb_shadow) {
2417 lm += i->get_widget()->get_width ();
2419 lm -= i->get_widget()->get_width ();
2423 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2427 Mixer_UI::scroll_right ()
2429 if (!scroller.get_hscrollbar()) return;
2430 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2431 int sc_w = scroller.get_width();
2432 int sp_w = strip_packer.get_width();
2436 int lp = adj->get_value();
2438 using namespace Gtk::Box_Helpers;
2439 const BoxList& strips = strip_packer.children();
2440 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2441 if (i->get_widget() == & add_button) {
2445 if (i->get_widget() == &mb_shadow) {
2449 lm += i->get_widget()->get_width ();
2454 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2458 Mixer_UI::on_scroll_event (GdkEventScroll* ev)
2460 switch (ev->direction) {
2461 case GDK_SCROLL_LEFT:
2465 if (ev->state & Keyboard::TertiaryModifier) {
2471 case GDK_SCROLL_RIGHT:
2475 case GDK_SCROLL_DOWN:
2476 if (ev->state & Keyboard::TertiaryModifier) {
2488 Mixer_UI::parameter_changed (string const & p)
2490 if (p == "show-group-tabs") {
2491 bool const s = _session->config.get_show_group_tabs ();
2493 _group_tabs->show ();
2495 _group_tabs->hide ();
2497 } else if (p == "default-narrow_ms") {
2498 bool const s = UIConfiguration::instance().get_default_narrow_ms ();
2499 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2500 (*i)->set_width_enum (s ? Narrow : Wide, this);
2506 Mixer_UI::set_route_group_activation (RouteGroup* g, bool a)
2508 g->set_active (a, this);
2512 Mixer_UI::plugin_selector()
2514 #ifdef DEFER_PLUGIN_SELECTOR_LOAD
2515 if (!_plugin_selector)
2516 _plugin_selector = new PluginSelector (PluginManager::instance());
2519 return _plugin_selector;
2523 Mixer_UI::setup_track_display ()
2525 track_model = ListStore::create (stripable_columns);
2526 track_display.set_model (track_model);
2527 track_display.append_column (_("Show"), stripable_columns.visible);
2528 track_display.append_column (_("Strips"), stripable_columns.text);
2529 track_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
2530 track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
2531 track_display.get_column (0)->set_expand(false);
2532 track_display.get_column (1)->set_expand(true);
2533 track_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
2534 track_display.set_name (X_("EditGroupList"));
2535 track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
2536 track_display.set_reorderable (true);
2537 track_display.set_headers_visible (true);
2538 track_display.set_can_focus(false);
2540 track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete));
2541 track_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_reorder));
2543 CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (0));
2544 track_list_visible_cell->property_activatable() = true;
2545 track_list_visible_cell->property_radio() = false;
2546 track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed));
2548 track_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::track_display_button_press), false);
2550 track_display_scroller.add (track_display);
2551 track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
2553 VBox* v = manage (new VBox);
2555 v->pack_start (track_display_scroller, true, true);
2557 track_display_frame.set_name("BaseFrame");
2558 track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
2559 track_display_frame.add (*v);
2561 track_display_scroller.show();
2562 track_display_frame.show();
2563 track_display.show();
2567 Mixer_UI::new_track_or_bus ()
2569 ARDOUR_UI::instance()->add_route ();
2573 Mixer_UI::update_title ()
2575 if (!own_window()) {
2582 if (_session->snap_name() != _session->name()) {
2583 n = _session->snap_name ();
2585 n = _session->name ();
2588 if (_session->dirty ()) {
2592 WindowTitle title (n);
2593 title += S_("Window|Mixer");
2594 title += Glib::get_application_name ();
2595 own_window()->set_title (title.get_string());
2599 WindowTitle title (S_("Window|Mixer"));
2600 title += Glib::get_application_name ();
2601 own_window()->set_title (title.get_string());
2606 Mixer_UI::strip_by_x (int x)
2608 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2611 (*i)->translate_coordinates (_content, 0, 0, x1, y);
2612 x2 = x1 + (*i)->get_width();
2614 if (x >= x1 && x <= x2) {
2623 Mixer_UI::set_axis_targets_for_operation ()
2625 _axis_targets.clear ();
2627 if (!_selection.empty()) {
2628 _axis_targets = _selection.axes;
2632 // removed "implicit" selections of strips, after discussion on IRC
2637 Mixer_UI::set_monitor_action_sensitivity (bool yn)
2639 Glib::RefPtr<Action> act;
2640 Glib::RefPtr<ToggleAction> tact;
2642 act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
2643 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2644 assert (tact); tact->set_active ( yn );
2646 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
2647 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2648 assert (tact); tact->set_sensitive ( yn );
2650 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
2651 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2652 assert (tact); tact->set_sensitive ( yn );
2654 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
2655 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2656 assert (tact); tact->set_sensitive ( yn );
2660 Mixer_UI::monitor_section_going_away ()
2662 /* Set sensitivity based on existence of the monitor bus */
2664 set_monitor_action_sensitivity(false);
2666 if (_monitor_section) {
2668 XMLNode* ui_node = Config->extra_xml(X_("UI"));
2669 /* immediate state save.
2671 * Tearoff settings are otherwise only stored during
2672 * save_ardour_state(). The mon-section may or may not
2673 * exist at that point.
2676 XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
2678 tearoff_node->remove_nodes_and_delete (X_("monitor-section"));
2679 XMLNode* t = new XMLNode (X_("monitor-section"));
2680 _monitor_section->tearoff().add_state (*t);
2681 tearoff_node->add_child_nocopy (*t);
2684 monitor_section_detached ();
2685 out_packer.remove (_monitor_section->tearoff());
2686 _monitor_section->set_session (0);
2687 delete _monitor_section;
2688 _monitor_section = 0;
2693 Mixer_UI::toggle_midi_input_active (bool flip_others)
2695 boost::shared_ptr<RouteList> rl (new RouteList);
2698 set_axis_targets_for_operation ();
2700 for (AxisViewSelection::iterator r = _axis_targets.begin(); r != _axis_targets.end(); ++r) {
2701 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> ((*r)->stripable());
2705 onoff = !mt->input_active();
2709 _session->set_exclusive_input_active (rl, onoff, flip_others);
2713 Mixer_UI::maximise_mixer_space ()
2715 if (!own_window()) {
2723 _window->fullscreen ();
2728 Mixer_UI::restore_mixer_space ()
2730 if (!own_window()) {
2738 own_window()->unfullscreen();
2743 Mixer_UI::monitor_section_attached ()
2745 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMonitorSection");
2746 assert (act); act->set_sensitive (true);
2748 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2750 showhide_monitor_section ( tact->get_active () );
2754 Mixer_UI::monitor_section_detached ()
2756 Glib::RefPtr<Action> act = myactions.find_action ("Mixer", "ToggleMonitorSection");
2757 act->set_sensitive (false);
2761 Mixer_UI::store_current_favorite_order ()
2763 typedef Gtk::TreeModel::Children type_children;
2764 type_children children = favorite_plugins_model->children();
2765 favorite_order.clear();
2766 for(type_children::iterator iter = children.begin(); iter != children.end(); ++iter)
2768 Gtk::TreeModel::Row row = *iter;
2769 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2770 favorite_order.push_back (ppp->_pip);
2771 std::string name = row[favorite_plugins_columns.name];
2772 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2777 Mixer_UI::save_favorite_ui_state (const TreeModel::iterator& iter, const TreeModel::Path& path)
2779 Gtk::TreeModel::Row row = *iter;
2780 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2782 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2786 Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs)
2788 PluginManager& manager (PluginManager::instance());
2789 for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
2791 /* not a Favorite? skip it */
2792 if (manager.get_status (*i) != PluginManager::Favorite) {
2796 /* Check the tag combo selection, and skip this plugin if it doesn't match the selected tag(s) */
2797 string test = favorite_plugins_tag_combo.get_active_text();
2798 if (test != _("Show All")) {
2799 vector<string> tags = manager.get_tags(*i);
2801 //does the selected tag match any of the tags in the plugin?
2802 vector<string>::iterator tt = find (tags.begin(), tags.end(), test);
2803 if (tt == tags.end()) {
2808 result.push_back (*i);
2812 struct PluginCustomSorter {
2814 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2815 PluginInfoList::const_iterator aiter = _user.begin();
2816 PluginInfoList::const_iterator biter = _user.begin();
2817 while (aiter != _user.end()) { if ((*aiter)->unique_id == a->unique_id) { break; } ++aiter; }
2818 while (biter != _user.end()) { if ((*biter)->unique_id == b->unique_id) { break; } ++biter; }
2820 if (aiter != _user.end() && biter != _user.end()) {
2821 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2823 if (aiter != _user.end()) {
2826 if (biter != _user.end()) {
2829 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2831 PluginCustomSorter(PluginInfoList user) : _user (user) {}
2833 PluginInfoList _user;
2837 Mixer_UI::refill_favorite_plugins ()
2839 PluginInfoList plugs;
2840 PluginManager& mgr (PluginManager::instance());
2843 refiller (plugs, mgr.lv2_plugin_info ());
2845 #ifdef WINDOWS_VST_SUPPORT
2846 refiller (plugs, mgr.windows_vst_plugin_info ());
2848 #ifdef LXVST_SUPPORT
2849 refiller (plugs, mgr.lxvst_plugin_info ());
2851 #ifdef MACVST_SUPPORT
2852 refiller (plugs, mgr.mac_vst_plugin_info ());
2854 #ifdef AUDIOUNIT_SUPPORT
2855 refiller (plugs, mgr.au_plugin_info ());
2857 refiller (plugs, mgr.ladspa_plugin_info ());
2858 refiller (plugs, mgr.lua_plugin_info ());
2860 store_current_favorite_order ();
2862 PluginCustomSorter cmp (favorite_order);
2865 favorite_order = plugs;
2867 sync_treeview_from_favorite_order ();
2871 Mixer_UI::plugin_list_changed ()
2873 refill_favorite_plugins();
2878 Mixer_UI::refill_tag_combo ()
2880 PluginManager& mgr (PluginManager::instance());
2882 std::vector<std::string> tags = mgr.get_all_tags (PluginManager::OnlyFavorites);
2884 favorite_plugins_tag_combo.clear();
2885 favorite_plugins_tag_combo.append_text (_("Show All"));
2887 for (vector<string>::iterator t = tags.begin (); t != tags.end (); ++t) {
2888 favorite_plugins_tag_combo.append_text (*t);
2891 favorite_plugins_tag_combo.set_active_text (_("Show All"));
2895 Mixer_UI::sync_treeview_favorite_ui_state (const TreeModel::Path& path, const TreeModel::iterator&)
2898 if (!(iter = favorite_plugins_model->get_iter (path))) {
2901 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
2905 PluginInfoPtr pip = ppp->_pip;
2906 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2907 if (favorite_ui_state[pip->unique_id]) {
2908 favorite_plugins_display.expand_row (path, true);
2914 Mixer_UI::sync_treeview_from_favorite_order ()
2916 favorite_plugins_model->clear ();
2917 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i) {
2918 PluginInfoPtr pip = (*i);
2920 TreeModel::Row newrow = *(favorite_plugins_model->append());
2921 newrow[favorite_plugins_columns.name] = (*i)->name;
2922 newrow[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip));
2927 vector<ARDOUR::Plugin::PresetRecord> presets = (*i)->get_presets (true);
2928 for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator j = presets.begin(); j != presets.end(); ++j) {
2929 Gtk::TreeModel::Row child_row = *(favorite_plugins_model->append (newrow.children()));
2930 child_row[favorite_plugins_columns.name] = (*j).label;
2931 child_row[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip, &(*j)));
2933 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2934 if (favorite_ui_state[pip->unique_id]) {
2935 favorite_plugins_display.expand_row (favorite_plugins_model->get_path(newrow), true);
2942 Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
2944 using namespace Gtk::Menu_Helpers;
2946 Gtk::Menu* m = manage (new Menu);
2947 MenuList& items = m->items ();
2949 if (_selection.axes.empty()) {
2950 items.push_back (MenuElem (_("No Track/Bus is selected.")));
2952 items.push_back (MenuElem (_("Add at the top"),
2953 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
2954 items.push_back (MenuElem (_("Add Pre-Fader"),
2955 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
2956 items.push_back (MenuElem (_("Add Post-Fader"),
2957 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
2958 items.push_back (MenuElem (_("Add at the end"),
2959 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
2962 items.push_back (SeparatorElem());
2964 items.push_back (MenuElem (_("Remove from favorites"), sigc::mem_fun (*this, &Mixer_UI::remove_selected_from_favorites)));
2966 ARDOUR::PluginPresetPtr ppp = selected_plugin();
2967 if (ppp && ppp->_preset.valid && ppp->_preset.user) {
2968 // we cannot currently delete AU presets
2969 if (!ppp->_pip || ppp->_pip->type != AudioUnit) {
2970 items.push_back (MenuElem (_("Delete Preset"), sigc::mem_fun (*this, &Mixer_UI::delete_selected_preset)));
2974 m->popup (ev->button, ev->time);
2978 Mixer_UI::plugin_row_button_press (GdkEventButton *ev)
2980 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) {
2981 TreeModel::Path path;
2982 TreeViewColumn* column;
2984 if (favorite_plugins_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
2985 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
2987 selection->unselect_all();
2988 selection->select(path);
2991 ARDOUR::PluginPresetPtr ppp = selected_plugin();
2993 popup_note_context_menu (ev);
3001 Mixer_UI::selected_plugin ()
3003 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
3005 return PluginPresetPtr();
3007 Gtk::TreeModel::iterator iter = selection->get_selected();
3009 return PluginPresetPtr();
3011 return (*iter)[favorite_plugins_columns.plugin];
3015 Mixer_UI::add_selected_processor (ProcessorPosition pos)
3017 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3019 add_favorite_processor (ppp, pos);
3024 Mixer_UI::delete_selected_preset ()
3029 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3030 if (!ppp || !ppp->_preset.valid || !ppp->_preset.user) {
3033 PluginPtr plugin = ppp->_pip->load (*_session);
3034 plugin->get_presets();
3035 plugin->remove_preset (ppp->_preset.label);
3039 Mixer_UI::remove_selected_from_favorites ()
3041 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3045 PluginManager::PluginStatusType status = PluginManager::Normal;
3046 PluginManager& manager (PluginManager::instance());
3048 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3049 manager.save_statuses ();
3053 Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
3056 if (!(iter = favorite_plugins_model->get_iter (path))) {
3059 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
3060 add_favorite_processor (ppp, AddPreFader); // TODO: preference?!
3064 Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos)
3066 if (!_session || _selection.axes.empty()) {
3070 PluginInfoPtr pip = ppp->_pip;
3071 for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) {
3072 boost::shared_ptr<ARDOUR::Route> rt = boost::dynamic_pointer_cast<ARDOUR::Route> ((*i)->stripable());
3078 PluginPtr p = pip->load (*_session);
3084 if (ppp->_preset.valid) {
3085 p->load_preset (ppp->_preset);
3088 Route::ProcessorStreams err;
3089 boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
3093 rt->add_processor_by_index (processor, 0, &err, Config->get_new_plugins_active ());
3096 rt->add_processor (processor, PreFader, &err, Config->get_new_plugins_active ());
3103 boost::shared_ptr<Processor> np = rt->nth_processor (idx);
3107 if (!np->display_to_user()) {
3110 if (boost::dynamic_pointer_cast<Amp> (np) && // Fader, not Trim
3111 boost::dynamic_pointer_cast<Amp> (np)->gain_control()->parameter().type() == GainAutomation) {
3116 rt->add_processor_by_index (processor, ++pos, &err, Config->get_new_plugins_active ());
3120 rt->add_processor_by_index (processor, -1, &err, Config->get_new_plugins_active ());
3127 PluginTreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, const Gtk::SelectionData& data) const
3129 if (data.get_target() != "GTK_TREE_MODEL_ROW") {
3133 // only allow to re-order top-level items
3135 if (TreePath::get_from_selection_data (data, src)) {
3136 if (src.up() && src.up()) {
3141 // don't allow to drop as child-rows.
3142 Gtk::TreeModel::Path _dest = dest; // un const
3143 const bool is_child = _dest.up (); // explicit bool for clang
3144 if (!is_child || _dest.empty ()) {
3151 Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
3153 if (data.get_target() != "PluginPresetPtr") {
3156 if (data.get_length() != sizeof (PluginPresetPtr)) {
3159 const void *d = data.get_data();
3160 const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
3162 PluginManager::PluginStatusType status = PluginManager::Favorite;
3163 PluginManager& manager (PluginManager::instance());
3165 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3166 manager.save_statuses ();
3170 Mixer_UI::do_vca_assign (boost::shared_ptr<VCA> vca)
3172 /* call protected MixerActor:: method */
3177 Mixer_UI::do_vca_unassign (boost::shared_ptr<VCA> vca)
3179 /* call protected MixerActor:: method */
3184 Mixer_UI::show_spill (boost::shared_ptr<Stripable> s)
3186 boost::shared_ptr<Stripable> ss = spilled_strip.lock();
3189 show_spill_change (s); /* EMIT SIGNAL */
3191 _group_tabs->hide ();
3193 _group_tabs->show ();
3195 redisplay_track_list ();
3200 Mixer_UI::showing_spill_for (boost::shared_ptr<Stripable> s) const
3202 return s == spilled_strip.lock();
3206 Mixer_UI::show_editor_window () const
3208 PublicEditor::instance().make_visible ();
3212 Mixer_UI::register_actions ()
3214 Glib::RefPtr<ActionGroup> group = myactions.create_action_group (X_("Mixer"));
3216 myactions.register_action (group, "show-editor", _("Show Editor"), sigc::mem_fun (*this, &Mixer_UI::show_editor_window));
3218 myactions.register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::solo_action));
3219 myactions.register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::mute_action));
3220 myactions.register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::rec_enable_action));
3221 myactions.register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_up_action));
3222 myactions.register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_down_action));
3223 myactions.register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::unity_gain_action));
3226 myactions.register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::copy_processors));
3227 myactions.register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::cut_processors));
3228 myactions.register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::paste_processors));
3229 myactions.register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::delete_processors));
3230 myactions.register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &Mixer_UI::select_all_processors));
3231 myactions.register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::toggle_processors));
3232 myactions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins));
3233 myactions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none));
3235 myactions.register_action (group, "select-next-stripable", _("Select Next Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_next_strip));
3236 myactions.register_action (group, "select-prev-stripable", _("Scroll Previous Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_prev_strip));
3238 myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left));
3239 myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the right"), sigc::mem_fun (*this, &Mixer_UI::scroll_right));
3241 myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
3242 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_midi_input_active), false));
3244 myactions.register_toggle_action (group, X_("ToggleMixerList"), _("Mixer: Show Mixer List"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixer_list));
3246 myactions.register_toggle_action (group, X_("ToggleVCAPane"), _("Mixer: Show VCAs"), sigc::mem_fun (*this, &Mixer_UI::toggle_vcas));
3249 myactions.register_toggle_action (group, X_("ToggleMixbusPane"), _("Mixer: Show Mixbuses"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixbus_pane));
3252 myactions.register_toggle_action (group, X_("ToggleMonitorSection"), _("Mixer: Show Monitor Section"), sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_section));
3256 Mixer_UI::load_bindings ()
3258 bindings = Bindings::get_bindings (X_("Mixer"), myactions);
3261 template<class T> void
3262 Mixer_UI::control_action (boost::shared_ptr<T> (Stripable::*get_control)() const)
3264 boost::shared_ptr<ControlList> cl (new ControlList);
3265 boost::shared_ptr<AutomationControl> ac;
3267 bool have_val = false;
3269 set_axis_targets_for_operation ();
3271 BOOST_FOREACH(AxisView* r, _axis_targets) {
3272 boost::shared_ptr<Stripable> s = r->stripable();
3274 ac = (s.get()->*get_control)();
3278 val = !ac->get_value();
3285 _session->set_controls (cl, val, Controllable::UseGroup);
3289 Mixer_UI::solo_action ()
3291 control_action (&Stripable::solo_control);
3295 Mixer_UI::mute_action ()
3297 control_action (&Stripable::mute_control);
3301 Mixer_UI::rec_enable_action ()
3303 control_action (&Stripable::rec_enable_control);
3306 AutomationControlSet
3307 Mixer_UI::selected_gaincontrols ()
3309 set_axis_targets_for_operation ();
3310 AutomationControlSet rv;
3311 BOOST_FOREACH(AxisView* r, _axis_targets) {
3312 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3314 boost::shared_ptr<GainControl> ac (ms->route()->gain_control());
3315 ControlList cl (ac->grouped_controls());
3316 for (ControlList::const_iterator c = cl.begin(); c != cl.end (); ++c) {
3326 Mixer_UI::step_gain_up_action ()
3328 AutomationControlSet acs = selected_gaincontrols ();
3329 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3330 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3332 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) + 0.1), Controllable::NoGroup);
3337 Mixer_UI::step_gain_down_action ()
3339 AutomationControlSet acs = selected_gaincontrols ();
3340 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3341 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3343 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) - 0.1), Controllable::NoGroup);
3348 Mixer_UI::unity_gain_action ()
3350 set_axis_targets_for_operation ();
3352 BOOST_FOREACH(AxisView* r, _axis_targets) {
3353 boost::shared_ptr<Stripable> s = r->stripable();
3355 boost::shared_ptr<AutomationControl> ac = s->gain_control();
3357 ac->set_value (1.0, Controllable::UseGroup);
3364 Mixer_UI::copy_processors ()
3366 set_axis_targets_for_operation ();
3368 BOOST_FOREACH(AxisView* r, _axis_targets) {
3369 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3371 ms->copy_processors ();
3376 Mixer_UI::cut_processors ()
3378 set_axis_targets_for_operation ();
3380 BOOST_FOREACH(AxisView* r, _axis_targets) {
3381 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3383 ms->cut_processors ();
3388 Mixer_UI::paste_processors ()
3390 set_axis_targets_for_operation ();
3392 BOOST_FOREACH(AxisView* r, _axis_targets) {
3393 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3395 ms->paste_processors ();
3400 Mixer_UI::select_all_processors ()
3402 set_axis_targets_for_operation ();
3404 BOOST_FOREACH(AxisView* r, _axis_targets) {
3405 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3407 ms->select_all_processors ();
3412 Mixer_UI::toggle_processors ()
3414 set_axis_targets_for_operation ();
3416 BOOST_FOREACH(AxisView* r, _axis_targets) {
3417 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3419 ms->toggle_processors ();
3424 Mixer_UI::ab_plugins ()
3426 set_axis_targets_for_operation ();
3428 BOOST_FOREACH(AxisView* r, _axis_targets) {
3429 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3437 Mixer_UI::vca_assign (boost::shared_ptr<VCA> vca)
3439 set_axis_targets_for_operation ();
3440 BOOST_FOREACH(AxisView* r, _axis_targets) {
3441 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3443 ms->vca_assign (vca);
3449 Mixer_UI::vca_unassign (boost::shared_ptr<VCA> vca)
3451 set_axis_targets_for_operation ();
3452 BOOST_FOREACH(AxisView* r, _axis_targets) {
3453 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3455 ms->vca_unassign (vca);