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 , no_track_list_redisplay (false)
104 , in_group_row_change (false)
106 , _monitor_section (0)
107 , _plugin_selector (0)
108 , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
109 , _spill_scroll_position (0)
110 , ignore_reorder (false)
111 , _in_group_rebuild_or_clear (false)
112 , _route_deletion_in_progress (false)
114 , _strip_selection_change_without_scroll (false)
115 , _selection (*this, *this)
119 _content.set_data ("ardour-bindings", bindings);
121 PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context());
123 scroller.set_can_default (true);
124 // set_default (scroller);
126 scroller_base.set_flags (Gtk::CAN_FOCUS);
127 scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
128 scroller_base.set_name ("MixerWindow");
129 scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
131 /* set up drag-n-drop */
132 vector<TargetEntry> target_table;
133 target_table.push_back (TargetEntry ("PluginFavoritePtr"));
134 scroller_base.drag_dest_set (target_table);
135 scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
137 /* create a button to add VCA strips ... will get packed in redisplay_track_list() */
138 Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
140 add_vca_button.add (*w);
141 add_vca_button.set_can_focus(false);
142 add_vca_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
144 /* create a button to add mixer strips */
145 w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
148 add_button.set_can_focus(false);
149 add_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
151 /* add as last item of strip packer */
152 strip_packer.pack_end (scroller_base, true, true);
153 strip_packer.pack_end (add_button, false, false);
156 /* create a drop-shadow at the end of the mixer strips */
157 mb_shadow.set_size_request( 4, -1 );
158 mb_shadow.set_name("EditorWindow");
160 strip_packer.pack_end (mb_shadow, false, false);
163 _group_tabs = new MixerGroupTabs (this);
164 VBox* b = manage (new VBox);
166 b->set_border_width (0);
167 b->pack_start (*_group_tabs, PACK_SHRINK);
168 b->pack_start (strip_packer);
170 b->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
173 scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
175 setup_track_display ();
177 group_model = ListStore::create (group_columns);
178 group_display.set_model (group_model);
179 group_display.append_column (_("Show"), group_columns.visible);
180 group_display.append_column (_("Group"), group_columns.text);
181 group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
182 group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
183 group_display.get_column (0)->set_expand(false);
184 group_display.get_column (1)->set_expand(true);
185 group_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
186 group_display.set_name ("EditGroupList");
187 group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
188 group_display.set_reorderable (true);
189 group_display.set_headers_visible (true);
190 group_display.set_rules_hint (true);
191 group_display.set_can_focus(false);
193 /* name is directly editable */
195 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
196 name_cell->property_editable() = true;
197 name_cell->signal_edited().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_name_edit));
199 /* use checkbox for the active column */
201 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (0));
202 active_cell->property_activatable() = true;
203 active_cell->property_radio() = false;
205 group_model->signal_row_changed().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_change));
206 /* We use this to notice drag-and-drop reorders of the group list */
207 group_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_deleted));
208 group_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::group_display_button_press), false);
210 group_display_scroller.add (group_display);
211 group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
214 group_display_vbox.pack_start (group_display_scroller, true, true);
216 group_display_frame.set_name ("BaseFrame");
217 group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
218 group_display_frame.add (group_display_vbox);
220 list<TargetEntry> target_list;
221 target_list.push_back (TargetEntry ("PluginPresetPtr"));
223 favorite_plugins_model = PluginTreeStore::create (favorite_plugins_columns);
224 favorite_plugins_display.set_model (favorite_plugins_model);
225 favorite_plugins_display.append_column (_("Favorite Plugins"), favorite_plugins_columns.name);
226 favorite_plugins_display.set_name ("EditGroupList");
227 favorite_plugins_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
228 favorite_plugins_display.set_reorderable (false);
229 favorite_plugins_display.set_headers_visible (true);
230 favorite_plugins_display.set_rules_hint (true);
231 favorite_plugins_display.set_can_focus (false);
232 favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr");
233 favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
234 favorite_plugins_display.add_drop_targets (target_list);
235 favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
236 favorite_plugins_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_button_press), false);
237 favorite_plugins_display.signal_drop.connect (sigc::mem_fun (*this, &Mixer_UI::plugin_drop));
238 favorite_plugins_display.signal_row_expanded().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
239 favorite_plugins_display.signal_row_collapsed().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
240 if (UIConfiguration::instance().get_use_tooltips()) {
241 favorite_plugins_display.set_tooltip_column (0);
243 favorite_plugins_model->signal_row_has_child_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::sync_treeview_favorite_ui_state));
245 favorite_plugins_scroller.add (favorite_plugins_display);
246 favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
248 favorite_plugins_frame.set_name ("BaseFrame");
249 favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN);
250 favorite_plugins_frame.add (favorite_plugins_vbox);
252 favorite_plugins_vbox.pack_start (favorite_plugins_scroller, true, true);
253 favorite_plugins_vbox.pack_start (favorite_plugins_tag_combo, false, false);
254 favorite_plugins_tag_combo.signal_changed().connect (sigc::mem_fun (*this, &Mixer_UI::tag_combo_changed));
256 rhs_pane1.add (favorite_plugins_frame);
257 rhs_pane1.add (track_display_frame);
259 rhs_pane2.add (rhs_pane1);
260 rhs_pane2.add (group_display_frame);
262 list_vpacker.pack_start (rhs_pane2, true, true);
264 vca_label_bar.set_size_request (-1, 16 + 1); /* must match height in GroupTabs::set_size_request() + 1 border px*/
265 vca_vpacker.pack_start (vca_label_bar, false, false);
267 vca_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
268 vca_scroller_base.set_name (X_("MixerWindow"));
269 vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false);
271 vca_scroller.add (vca_hpacker);
272 vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
273 vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
275 vca_vpacker.pack_start (vca_scroller, true, true);
277 inner_pane.add (scroller);
278 inner_pane.add (vca_vpacker);
280 global_hpacker.pack_start (inner_pane, true, true);
281 global_hpacker.pack_start (out_packer, false, false);
283 list_hpane.set_check_divider_position (true);
284 list_hpane.add (list_vpacker);
285 list_hpane.add (global_hpacker);
286 list_hpane.set_child_minsize (list_vpacker, 30);
288 XMLNode const * settings = ARDOUR_UI::instance()->mixer_settings();
291 if (!settings || !settings->get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) {
294 rhs_pane1.set_divider (0, fract);
296 if (!settings || !settings->get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) {
299 rhs_pane2.set_divider (0, fract);
301 if (!settings || !settings->get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) {
304 list_hpane.set_divider (0, fract);
306 if (!settings || !settings->get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) {
309 inner_pane.set_divider (0, fract);
311 rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
312 rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
313 list_hpane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
314 inner_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
316 _content.pack_start (list_hpane, true, true);
321 _content.set_name ("MixerWindow");
323 global_hpacker.show();
325 scroller_base.show();
326 scroller_hpacker.show();
327 mixer_scroller_vpacker.show();
329 group_display_button_label.show();
330 group_display_scroller.show();
331 favorite_plugins_scroller.show();
332 group_display_vbox.show();
333 group_display_frame.show();
334 favorite_plugins_frame.show();
342 vca_label_bar.show();
344 vca_scroller_base.show();
347 group_display.show();
348 favorite_plugins_display.show();
351 MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
352 VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
356 ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context());
358 #ifndef DEFER_PLUGIN_SELECTOR_LOAD
359 _plugin_selector = new PluginSelector (PluginManager::instance ());
361 #error implement deferred Plugin-Favorite list
364 PluginManager::instance ().PluginListChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
365 PluginManager::instance ().PluginStatusChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
366 ARDOUR::Plugin::PresetsChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
369 Mixer_UI::~Mixer_UI ()
371 if (_monitor_section) {
372 monitor_section_detached ();
373 delete _monitor_section;
375 delete _plugin_selector;
379 struct MixerStripSorter {
380 bool operator() (const MixerStrip* ms_a, const MixerStrip* ms_b)
382 boost::shared_ptr<ARDOUR::Stripable> const& a = ms_a->stripable ();
383 boost::shared_ptr<ARDOUR::Stripable> const& b = ms_b->stripable ();
384 return ARDOUR::Stripable::Sorter(true)(a, b);
396 Mixer_UI::tag_combo_changed ()
398 refill_favorite_plugins();
402 Mixer_UI::use_own_window (bool and_fill_it)
404 bool new_window = !own_window();
406 Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
408 if (win && new_window) {
409 win->set_name ("MixerWindow");
410 ARDOUR_UI::instance()->setup_toplevel_window (*win, _("Mixer"), this);
411 win->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win));
412 win->set_data ("ardour-bindings", bindings);
414 if (!win->get_focus()) {
415 /* set focus widget to something, anything */
416 win->set_focus (scroller);
424 Mixer_UI::show_window ()
426 Tabbable::show_window ();
428 /* show/hide group tabs as required */
429 parameter_changed ("show-group-tabs");
431 /* now reset each strips width so the right widgets are shown */
433 TreeModel::Children rows = track_model->children();
434 TreeModel::Children::iterator ri;
436 for (ri = rows.begin(); ri != rows.end(); ++ri) {
437 AxisView* av = (*ri)[stripable_columns.strip];
438 MixerStrip* ms = dynamic_cast<MixerStrip*> (av);
442 ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
443 /* Fix visibility of mixer strip stuff */
444 ms->parameter_changed (X_("mixer-element-visibility"));
447 /* force focus into main area */
448 scroller_base.grab_focus ();
452 Mixer_UI::remove_master (VCAMasterStrip* vms)
454 if (_session && _session->deletion_in_progress()) {
455 /* its all being taken care of */
459 TreeModel::Children rows = track_model->children();
460 TreeModel::Children::iterator ri;
462 for (ri = rows.begin(); ri != rows.end(); ++ri) {
463 if ((*ri)[stripable_columns.strip] == vms) {
464 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
465 track_model->erase (ri);
472 Mixer_UI::masters_scroller_button_release (GdkEventButton* ev)
474 using namespace Menu_Helpers;
476 if (Keyboard::is_context_menu_event (ev)) {
477 ARDOUR_UI::instance()->add_route ();
485 Mixer_UI::add_masters (VCAList& vlist)
489 for (VCAList::iterator v = vlist.begin(); v != vlist.end(); ++v) {
490 sl.push_back (boost::dynamic_pointer_cast<Stripable> (*v));
497 Mixer_UI::add_routes (RouteList& rlist)
501 for (RouteList::iterator r = rlist.begin(); r != rlist.end(); ++r) {
509 Mixer_UI::add_stripables (StripableList& slist)
511 Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
512 bool from_scratch = (track_model->children().size() == 0);
513 uint32_t nroutes = 0;
515 slist.sort (Stripable::Sorter());
517 for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
518 boost::shared_ptr<Stripable> s = (*it)[stripable_columns.stripable];
526 // XXX what does this special case do?
527 if (s->presentation_info().order() == (slist.front()->presentation_info().order() + slist.size())) {
536 PBD::Unwinder<bool> uw (no_track_list_redisplay, true);
538 track_display.set_model (Glib::RefPtr<ListStore>());
540 for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
542 boost::shared_ptr<Route> route;
543 boost::shared_ptr<VCA> vca;
545 if ((vca = boost::dynamic_pointer_cast<VCA> (*s))) {
547 VCAMasterStrip* vms = new VCAMasterStrip (_session, vca);
549 TreeModel::Row row = *(track_model->append());
551 row[stripable_columns.text] = vca->name();
552 row[stripable_columns.visible] = vms->marked_for_display ();
553 row[stripable_columns.strip] = vms;
554 row[stripable_columns.stripable] = vca;
556 vms->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::vca_button_release_event), vms));
558 } else if ((route = boost::dynamic_pointer_cast<Route> (*s))) {
560 if (route->is_auditioner()) {
564 if (route->is_monitor()) {
566 if (!_monitor_section) {
567 _monitor_section = new MonitorSection (_session);
569 XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
571 _monitor_section->tearoff().set_state (*mnode);
574 set_monitor_action_sensitivity(true);
577 out_packer.pack_end (_monitor_section->tearoff(), false, false);
578 _monitor_section->set_session (_session);
579 _monitor_section->tearoff().show_all ();
581 _monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
582 _monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
584 if (_monitor_section->tearoff().torn_off()) {
585 monitor_section_detached ();
587 monitor_section_attached ();
590 route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context());
592 /* no regular strip shown for control out */
597 strip = new MixerStrip (*this, _session, route);
598 strips.push_back (strip);
600 UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
602 if (strip->width_owner() != strip) {
603 strip->set_width_enum (_strip_width, this);
608 if (route->is_master()) {
610 out_packer.pack_start (*strip, false, false);
611 strip->set_packed (true);
615 TreeModel::Row row = *(track_model->insert (insert_iter));
617 row[stripable_columns.text] = route->name();
618 row[stripable_columns.visible] = strip->marked_for_display();
619 row[stripable_columns.stripable] = route;
620 row[stripable_columns.strip] = strip;
623 strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
624 strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
627 (*s)->presentation_info().PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
628 (*s)->PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
631 } catch (const std::exception& e) {
632 error << string_compose (_("Error adding GUI elements for new tracks/busses %1"), e.what()) << endmsg;
635 track_display.set_model (track_model);
637 /* catch up on selection state, which we left to the editor to set */
638 sync_treeview_from_presentation_info (PropertyChange (Properties::selected));
641 sync_presentation_info_from_treeview ();
644 redisplay_track_list ();
648 Mixer_UI::deselect_all_strip_processors ()
650 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
651 (*i)->deselect_all_processors();
656 Mixer_UI::select_none ()
658 _selection.clear_routes();
659 deselect_all_strip_processors();
663 Mixer_UI::select_next_strip ()
665 deselect_all_strip_processors();
666 _session->selection().select_next_stripable (true, false);
670 Mixer_UI::select_prev_strip ()
672 deselect_all_strip_processors();
673 _session->selection().select_prev_stripable (true, false);
677 Mixer_UI::delete_processors ()
679 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
680 (*i)->delete_processors();
686 Mixer_UI::remove_strip (MixerStrip* strip)
688 if (_session && _session->deletion_in_progress()) {
689 /* its all being taken care of */
693 TreeModel::Children rows = track_model->children();
694 TreeModel::Children::iterator ri;
695 list<MixerStrip *>::iterator i;
697 if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
701 PBD::Unwinder<bool> uwi (ignore_reorder, true);
703 for (ri = rows.begin(); ri != rows.end(); ++ri) {
704 if ((*ri)[stripable_columns.strip] == strip) {
705 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
706 track_model->erase (ri);
713 Mixer_UI::presentation_info_changed (PropertyChange const & what_changed)
715 if (what_changed.contains (Properties::selected)) {
716 _selection.presentation_info_changed (what_changed);
720 soh.add (Properties::selected);
721 soh.add (Properties::order);
722 soh.add (Properties::hidden);
724 if (what_changed.contains (soh)) {
725 sync_treeview_from_presentation_info (what_changed);
730 Mixer_UI::sync_presentation_info_from_treeview ()
732 if (ignore_reorder || !_session || _session->deletion_in_progress()) {
736 TreeModel::Children rows = track_model->children();
742 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync presentation info from treeview\n");
744 TreeModel::Children::iterator ri;
747 PresentationInfo::order_t master_key = _session->master_order_key ();
748 PresentationInfo::order_t order = 0;
750 PresentationInfo::ChangeSuspender cs;
752 for (ri = rows.begin(); ri != rows.end(); ++ri) {
753 bool visible = (*ri)[stripable_columns.visible];
754 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
756 #ifndef NDEBUG // these should not exist in the mixer's treeview
761 if (stripable->is_monitor() || stripable->is_auditioner()) {
765 if (stripable->is_master()) {
771 stripable->presentation_info().set_hidden (!visible);
773 // leave master where it is.
774 if (order == master_key) {
778 if (order != stripable->presentation_info().order()) {
779 stripable->set_presentation_order (order);
785 change |= _session->ensure_stripable_sort_order ();
788 DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
789 _session->set_dirty();
794 Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_changed)
796 if (!_session || _session->deletion_in_progress()) {
800 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from presentation info.\n");
802 /* we could get here after either a change in the Mixer or Editor sort
803 * order, but either way, the mixer order keys reflect the intended
804 * order for the GUI, so reorder the treeview model to match it.
807 vector<int> neworder;
808 TreeModel::Children rows = track_model->children();
809 uint32_t old_order = 0;
810 bool changed = false;
816 TreeOrderKeys sorted;
817 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
818 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
819 sorted.push_back (TreeOrderKey (old_order, stripable));
822 TreeOrderKeySorter cmp;
824 sort (sorted.begin(), sorted.end(), cmp);
825 neworder.assign (sorted.size(), 0);
829 for (TreeOrderKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
831 neworder[n] = sr->old_display_order;
833 if (sr->old_display_order != n) {
839 Unwinder<bool> uw (ignore_reorder, true);
840 track_model->reorder (neworder);
843 if (what_changed.contains (Properties::selected)) {
845 PresentationInfo::ChangeSuspender cs;
847 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
848 boost::shared_ptr<Stripable> stripable = (*i)->stripable();
849 if (stripable && stripable->is_selected()) {
852 _selection.remove (*i);
856 if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll () && !_strip_selection_change_without_scroll) {
857 move_stripable_into_view ((*_selection.axes.begin())->stripable());
860 TreeModel::Children rows = track_model->children();
861 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
862 AxisView* av = (*i)[stripable_columns.strip];
863 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
867 if (vms->vca() && vms->vca()->is_selected()) {
868 _selection.add (vms);
870 _selection.remove (vms);
875 redisplay_track_list ();
880 Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) const
882 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
883 if ((*i)->route() == r) {
892 Mixer_UI::strip_by_stripable (boost::shared_ptr<Stripable> s) const
894 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
895 if ((*i)->stripable() == s) {
904 Mixer_UI::axis_view_by_stripable (boost::shared_ptr<Stripable> s) const
906 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
907 if ((*i)->stripable() == s) {
912 TreeModel::Children rows = track_model->children();
913 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
914 AxisView* av = (*i)[stripable_columns.strip];
915 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
916 if (vms && vms->stripable () == s) {
925 Mixer_UI::axis_view_by_control (boost::shared_ptr<AutomationControl> c) const
927 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
928 if ((*i)->control() == c) {
937 Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
939 /* Selecting a mixer-strip may also select grouped-tracks, and
940 * presentation_info_changed() being emitted and
941 * _selection.axes.begin() is being moved into view. This may
942 * effectively move the track that was clicked-on out of view.
944 * So here only the track that is actually clicked-on is moved into
945 * view (in case it's partially visible)
947 PBD::Unwinder<bool> uw (_strip_selection_change_without_scroll, true);
948 move_stripable_into_view (strip->stripable());
950 if (ev->button == 1) {
951 if (_selection.selected (strip)) {
952 /* primary-click: toggle selection state of strip */
953 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
954 _selection.remove (strip, true);
955 } else if (_selection.axes.size() > 1) {
956 /* de-select others */
957 _selection.set (strip);
959 PublicEditor& pe = PublicEditor::instance();
960 TimeAxisView* tav = pe.time_axis_view_from_stripable (strip->stripable());
962 pe.set_selected_mixer_strip (*tav);
965 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
966 _selection.add (strip, true);
967 } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
969 /* extend selection */
971 vector<MixerStrip*> tmp;
972 bool accumulate = false;
973 bool found_another = false;
975 strips.sort (MixerStripSorter());
977 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
982 /* hit clicked strip, start accumulating till we hit the first
991 } else if (_selection.selected (ms)) {
992 /* hit selected strip. if currently accumulating others,
993 we're done. if not accumulating others, start doing so.
995 found_another = true;
1009 tmp.push_back (strip);
1011 if (found_another) {
1012 PresentationInfo::ChangeSuspender cs;
1013 for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
1014 _selection.add (*i, true);
1017 _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
1020 _selection.set (strip);
1029 Mixer_UI::vca_button_release_event (GdkEventButton *ev, VCAMasterStrip *strip)
1031 _selection.set (strip);
1036 Mixer_UI::set_session (Session* sess)
1038 SessionHandlePtr::set_session (sess);
1040 if (_plugin_selector) {
1041 _plugin_selector->set_session (_session);
1044 _group_tabs->set_session (sess);
1046 if (_monitor_section) {
1047 _monitor_section->set_session (_session);
1051 _selection.clear ();
1055 refill_favorite_plugins();
1058 XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
1059 set_state (*node, 0);
1063 initial_track_display ();
1065 _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_routes, this, _1), gui_context());
1066 _session->route_group_added.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_route_group, this, _1), gui_context());
1067 _session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1068 _session->route_groups_reordered.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1069 _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context());
1070 _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1071 _session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1073 _session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_masters, this, _1), gui_context());
1075 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context ());
1077 route_groups_changed ();
1083 /* catch up on selection state, etc. */
1086 sc.add (Properties::selected);
1087 _selection.presentation_info_changed (sc);
1093 Mixer_UI::session_going_away ()
1095 ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away);
1097 _in_group_rebuild_or_clear = true;
1098 group_model->clear ();
1099 _in_group_rebuild_or_clear = false;
1101 _selection.clear ();
1102 track_model->clear ();
1104 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1108 if (_monitor_section) {
1109 _monitor_section->tearoff().hide_visible ();
1112 monitor_section_detached ();
1118 SessionHandlePtr::session_going_away ();
1125 Mixer_UI::track_visibility_changed (std::string const & path)
1127 if (_session && _session->deletion_in_progress()) {
1133 if ((iter = track_model->get_iter (path))) {
1135 AxisView* av = (*iter)[stripable_columns.strip];
1136 bool visible = (*iter)[stripable_columns.visible];
1138 if (av->set_marked_for_display (!visible)) {
1139 update_track_visibility ();
1145 Mixer_UI::update_track_visibility ()
1147 TreeModel::Children rows = track_model->children();
1148 TreeModel::Children::iterator i;
1151 Unwinder<bool> uw (no_track_list_redisplay, true);
1153 for (i = rows.begin(); i != rows.end(); ++i) {
1154 AxisView* av = (*i)[stripable_columns.strip];
1155 (*i)[stripable_columns.visible] = av->marked_for_display ();
1158 /* force presentation catch up with visibility changes
1161 sync_presentation_info_from_treeview ();
1164 redisplay_track_list ();
1168 Mixer_UI::show_strip (MixerStrip* ms)
1170 TreeModel::Children rows = track_model->children();
1171 TreeModel::Children::iterator i;
1173 for (i = rows.begin(); i != rows.end(); ++i) {
1175 AxisView* av = (*i)[stripable_columns.strip];
1176 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1178 (*i)[stripable_columns.visible] = true;
1179 av->set_marked_for_display (true);
1180 update_track_visibility ();
1187 Mixer_UI::hide_strip (MixerStrip* ms)
1189 TreeModel::Children rows = track_model->children();
1190 TreeModel::Children::iterator i;
1192 for (i = rows.begin(); i != rows.end(); ++i) {
1194 AxisView* av = (*i)[stripable_columns.strip];
1195 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1197 (*i)[stripable_columns.visible] = false;
1198 av->set_marked_for_display (false);
1199 update_track_visibility ();
1206 Mixer_UI::start_updating ()
1208 fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips));
1213 Mixer_UI::stop_updating ()
1215 fast_screen_update_connection.disconnect();
1220 Mixer_UI::fast_update_strips ()
1222 if (_content.is_mapped () && _session) {
1223 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1224 (*i)->fast_update ();
1230 Mixer_UI::set_all_strips_visibility (bool yn)
1232 TreeModel::Children rows = track_model->children();
1233 TreeModel::Children::iterator i;
1236 Unwinder<bool> uw (no_track_list_redisplay, true);
1238 for (i = rows.begin(); i != rows.end(); ++i) {
1240 AxisView* av = (*i)[stripable_columns.strip];
1241 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1247 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1251 (*i)[stripable_columns.visible] = yn;
1255 redisplay_track_list ();
1260 Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn)
1262 TreeModel::Children rows = track_model->children();
1263 TreeModel::Children::iterator i;
1266 Unwinder<bool> uw (no_track_list_redisplay, true);
1268 for (i = rows.begin(); i != rows.end(); ++i) {
1270 AxisView* av = (*i)[stripable_columns.strip];
1271 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1277 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1281 boost::shared_ptr<AudioTrack> at = strip->audio_track();
1282 boost::shared_ptr<MidiTrack> mt = strip->midi_track();
1286 (*i)[stripable_columns.visible] = yn;
1290 if (at) { /* track */
1291 (*i)[stripable_columns.visible] = yn;
1296 if (!at && !mt) { /* bus */
1297 (*i)[stripable_columns.visible] = yn;
1302 if (mt) { /* midi-track */
1303 (*i)[stripable_columns.visible] = yn;
1310 redisplay_track_list ();
1314 Mixer_UI::hide_all_routes ()
1316 set_all_strips_visibility (false);
1320 Mixer_UI::show_all_routes ()
1322 set_all_strips_visibility (true);
1326 Mixer_UI::show_all_audiobus ()
1328 set_all_audio_midi_visibility (2, true);
1331 Mixer_UI::hide_all_audiobus ()
1333 set_all_audio_midi_visibility (2, false);
1337 Mixer_UI::show_all_audiotracks()
1339 set_all_audio_midi_visibility (1, true);
1342 Mixer_UI::hide_all_audiotracks ()
1344 set_all_audio_midi_visibility (1, false);
1348 Mixer_UI::show_all_miditracks()
1350 set_all_audio_midi_visibility (3, true);
1353 Mixer_UI::hide_all_miditracks ()
1355 set_all_audio_midi_visibility (3, false);
1359 Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
1361 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
1362 sync_presentation_info_from_treeview ();
1366 Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
1368 /* this happens as the second step of a DnD within the treeview as well
1369 as when a row/route is actually deleted.
1371 if it was a deletion then we have to force a redisplay because
1372 order keys may not have changed.
1375 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
1376 sync_presentation_info_from_treeview ();
1378 if (_route_deletion_in_progress) {
1379 redisplay_track_list ();
1384 Mixer_UI::spill_redisplay (boost::shared_ptr<VCA> vca)
1386 TreeModel::Children rows = track_model->children();
1387 std::list<boost::shared_ptr<VCA> > vcas;
1388 vcas.push_back (vca);
1390 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1391 AxisView* av = (*i)[stripable_columns.strip];
1392 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
1393 if (vms && vms->vca()->slaved_to (vca)) {
1394 vcas.push_back (vms->vca());
1398 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1400 AxisView* av = (*i)[stripable_columns.strip];
1401 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1402 bool const visible = (*i)[stripable_columns.visible];
1405 /* we're in the middle of changing a row, don't worry */
1409 if (!strip->route()) {
1410 /* non-route element */
1414 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1418 bool slaved = false;
1419 for (std::list<boost::shared_ptr<VCA> >::const_iterator m = vcas.begin(); m != vcas.end(); ++m) {
1420 if (strip->route()->slaved_to (*m)) {
1426 if (slaved && visible) {
1428 if (strip->packed()) {
1429 strip_packer.reorder_child (*strip, -1); /* put at end */
1431 strip_packer.pack_start (*strip, false, false);
1432 strip->set_packed (true);
1437 if (strip->packed()) {
1438 strip_packer.remove (*strip);
1439 strip->set_packed (false);
1446 Mixer_UI::redisplay_track_list ()
1448 if (no_track_list_redisplay) {
1452 boost::shared_ptr<Stripable> ss = spilled_strip.lock ();
1454 boost::shared_ptr<VCA> sv = boost::dynamic_pointer_cast<VCA> (ss);
1456 if (_spill_scroll_position <= 0 && scroller.get_hscrollbar()) {
1457 _spill_scroll_position = scroller.get_hscrollbar()->get_adjustment()->get_value();
1459 spill_redisplay (sv);
1464 TreeModel::Children rows = track_model->children();
1465 TreeModel::Children::iterator i;
1466 uint32_t n_masters = 0;
1468 container_clear (vca_hpacker);
1470 vca_hpacker.pack_end (vca_scroller_base, true, true);
1471 vca_hpacker.pack_end (add_vca_button, false, false);
1473 add_vca_button.show ();
1474 vca_scroller_base.show();
1476 for (i = rows.begin(); i != rows.end(); ++i) {
1478 AxisView* s = (*i)[stripable_columns.strip];
1479 bool const visible = (*i)[stripable_columns.visible];
1480 boost::shared_ptr<Stripable> stripable = (*i)[stripable_columns.stripable];
1483 /* we're in the middle of changing a row, don't worry */
1487 VCAMasterStrip* vms;
1489 if ((vms = dynamic_cast<VCAMasterStrip*> (s))) {
1491 vca_hpacker.pack_start (*vms, false, false);
1498 MixerStrip* strip = dynamic_cast<MixerStrip*> (s);
1506 if (strip->packed()) {
1507 strip_packer.reorder_child (*strip, -1); /* put at end */
1509 strip_packer.pack_start (*strip, false, false);
1510 strip->set_packed (true);
1515 if (stripable->is_master() || stripable->is_monitor()) {
1516 /* do nothing, these cannot be hidden */
1518 if (strip->packed()) {
1519 strip_packer.remove (*strip);
1520 strip->set_packed (false);
1526 /* update visibility of VCA assign buttons */
1528 if (n_masters == 0) {
1529 //show/hide the channelstrip VCA assign buttons on channelstrips:
1530 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1532 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleVCAPane");
1534 act->set_sensitive (false);
1537 //remove the VCA packer, but don't change our prior setting for show/hide:
1538 vca_vpacker.hide ();
1540 //show/hide the channelstrip VCA assign buttons on channelstrips:
1541 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1543 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleVCAPane");
1545 act->set_sensitive (true);
1547 //if we were showing VCAs before, show them now:
1548 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1550 showhide_vcas ( tact->get_active () );
1553 _group_tabs->set_dirty ();
1555 if (_spill_scroll_position > 0 && scroller.get_hscrollbar()) {
1556 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1557 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), _spill_scroll_position)));
1559 _spill_scroll_position = 0;
1564 Mixer_UI::strip_width_changed ()
1566 _group_tabs->set_dirty ();
1569 TreeModel::Children rows = track_model->children();
1570 TreeModel::Children::iterator i;
1573 for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
1574 AxisView* av = (*i)[stripable_columns.strip];
1575 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1581 bool visible = (*i)[stripable_columns.visible];
1584 strip->queue_draw();
1591 struct PresentationInfoMixerSorter
1593 bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
1594 if (a->is_master()) {
1595 /* master after everything else */
1597 } else if (b->is_master()) {
1598 /* everything else before master */
1601 return a->presentation_info().order () < b->presentation_info().order ();
1606 Mixer_UI::initial_track_display ()
1609 _session->get_stripables (sl);
1611 sl.sort (PresentationInfoMixerSorter());
1614 /* These are also used inside ::add_stripables() but we need
1615 * them here because we're going to clear the track_model also.
1617 Unwinder<bool> uw1 (no_track_list_redisplay, true);
1618 Unwinder<bool> uw2 (ignore_reorder, true);
1620 track_model->clear ();
1621 add_stripables (sl);
1624 sync_treeview_from_presentation_info (Properties::order);
1628 Mixer_UI::track_display_button_press (GdkEventButton* ev)
1630 if (Keyboard::is_context_menu_event (ev)) {
1631 if (track_menu == 0) {
1632 build_track_menu ();
1634 track_menu->popup (ev->button, ev->time);
1637 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 1)) {
1638 TreeModel::Path path;
1639 TreeViewColumn* column;
1641 if (track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1642 TreeIter iter = track_model->get_iter (path);
1643 if ((*iter)[stripable_columns.visible]) {
1644 boost::shared_ptr<ARDOUR::Stripable> s = (*iter)[stripable_columns.stripable];
1645 move_stripable_into_view (s);
1654 Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
1656 if (!scroller.get_hscrollbar()) {
1659 if (s->presentation_info().special () || s->presentation_info().flag_match (PresentationInfo::VCA)) {
1669 Gtk::Allocation alloc;
1670 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
1671 if ((*i)->route() == s) {
1674 (*i)->translate_coordinates (strip_packer, 0, 0, x0, y);
1675 alloc = (*i)->get_allocation ();
1683 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1685 if (x0 < adj->get_value()) {
1686 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
1687 } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
1688 int x1 = x0 + alloc.get_width() - adj->get_page_size();
1689 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
1694 Mixer_UI::build_track_menu ()
1696 using namespace Menu_Helpers;
1697 using namespace Gtk;
1699 track_menu = new Menu;
1700 track_menu->set_name ("ArdourContextMenu");
1701 MenuList& items = track_menu->items();
1703 items.push_back (MenuElem (_("Show All"), sigc::mem_fun(*this, &Mixer_UI::show_all_routes)));
1704 items.push_back (MenuElem (_("Hide All"), sigc::mem_fun(*this, &Mixer_UI::hide_all_routes)));
1705 items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiotracks)));
1706 items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiotracks)));
1707 items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::show_all_miditracks)));
1708 items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::hide_all_miditracks)));
1709 items.push_back (MenuElem (_("Show All Busses"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiobus)));
1710 items.push_back (MenuElem (_("Hide All Busses"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiobus)));
1715 Mixer_UI::stripable_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Stripable> ws)
1717 if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) {
1721 boost::shared_ptr<Stripable> s = ws.lock ();
1727 TreeModel::Children rows = track_model->children();
1728 TreeModel::Children::iterator i;
1730 for (i = rows.begin(); i != rows.end(); ++i) {
1731 boost::shared_ptr<Stripable> ss = (*i)[stripable_columns.stripable];
1735 if (what_changed.contains (ARDOUR::Properties::name)) {
1736 (*i)[stripable_columns.text] = s->name();
1739 if (what_changed.contains (ARDOUR::Properties::hidden)) {
1740 (*i)[stripable_columns.visible] = !s->presentation_info().hidden();
1741 redisplay_track_list ();
1748 if (s->is_master ()) {
1752 error << _("track display list item for renamed strip not found!") << endmsg;
1756 Mixer_UI::group_display_button_press (GdkEventButton* ev)
1758 TreeModel::Path path;
1759 TreeViewColumn* column;
1763 if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1764 if (ev->button == 3) {
1765 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1770 TreeIter iter = group_model->get_iter (path);
1772 if (ev->button == 3) {
1773 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1778 RouteGroup* group = (*iter)[group_columns.group];
1780 if (Keyboard::is_context_menu_event (ev)) {
1781 _group_tabs->get_menu(group)->popup (1, ev->time);
1785 switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
1787 if (Keyboard::is_edit_event (ev)) {
1789 // edit_route_group (group);
1791 group_display.queue_draw();
1800 bool visible = (*iter)[group_columns.visible];
1801 (*iter)[group_columns.visible] = !visible;
1803 group_display.queue_draw();
1816 Mixer_UI::activate_all_route_groups ()
1818 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
1822 Mixer_UI::disable_all_route_groups ()
1824 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
1828 Mixer_UI::route_groups_changed ()
1830 ENSURE_GUI_THREAD (*this, &Mixer_UI::route_groups_changed);
1832 _in_group_rebuild_or_clear = true;
1834 /* just rebuild the while thing */
1836 group_model->clear ();
1839 /* this is currently not used,
1840 * Mixer_UI::group_display_button_press() has a case for it,
1841 * and a commented edit_route_group() but that's n/a since 2011.
1843 * This code is left as reminder that
1844 * row[group_columns.group] = 0 has special meaning.
1848 row = *(group_model->append());
1849 row[group_columns.visible] = true;
1850 row[group_columns.text] = (_("-all-"));
1851 row[group_columns.group] = 0;
1855 _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
1857 _group_tabs->set_dirty ();
1858 _in_group_rebuild_or_clear = false;
1862 Mixer_UI::new_route_group ()
1864 _group_tabs->run_new_group_dialog (0, false);
1868 Mixer_UI::remove_selected_route_group ()
1870 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1871 TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
1877 TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
1880 /* selection mode is single, so rows.begin() is it */
1882 if ((iter = group_model->get_iter (*i))) {
1884 RouteGroup* rg = (*iter)[group_columns.group];
1887 _session->remove_route_group (*rg);
1893 Mixer_UI::route_group_property_changed (RouteGroup* group, const PropertyChange& change)
1895 if (in_group_row_change) {
1899 /* force an update of any mixer strips that are using this group,
1900 otherwise mix group names don't change in mixer strips
1903 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1904 if ((*i)->route_group() == group) {
1905 (*i)->route_group_changed();
1909 TreeModel::iterator i;
1910 TreeModel::Children rows = group_model->children();
1911 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1913 in_group_row_change = true;
1915 for (i = rows.begin(); i != rows.end(); ++i) {
1916 if ((*i)[group_columns.group] == group) {
1917 (*i)[group_columns.visible] = !group->is_hidden ();
1918 (*i)[group_columns.text] = group->name ();
1923 in_group_row_change = false;
1925 if (change.contains (Properties::name)) {
1926 _group_tabs->set_dirty ();
1929 for (list<MixerStrip*>::iterator j = strips.begin(); j != strips.end(); ++j) {
1930 if ((*j)->route_group() == group) {
1931 if (group->is_hidden ()) {
1941 Mixer_UI::toggle_mixer_list ()
1943 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMixerList");
1945 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1946 showhide_mixer_list (tact->get_active());
1951 Mixer_UI::showhide_mixer_list (bool yn)
1954 list_vpacker.show ();
1956 list_vpacker.hide ();
1961 Mixer_UI::toggle_monitor_section ()
1963 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
1965 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1966 showhide_monitor_section (tact->get_active());
1972 Mixer_UI::showhide_monitor_section (bool yn)
1974 if (!monitor_section()) {
1977 if (monitor_section()->tearoff().torn_off()) {
1982 monitor_section()->tearoff().show();
1984 monitor_section()->tearoff().hide();
1989 Mixer_UI::toggle_vcas ()
1991 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleVCAPane");
1993 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
1994 showhide_vcas (tact->get_active());
1999 Mixer_UI::showhide_vcas (bool yn)
2010 Mixer_UI::toggle_mixbuses ()
2012 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMixbusPane");
2014 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2015 showhide_mixbuses (tact->get_active());
2020 Mixer_UI::showhide_mixbuses (bool on)
2032 Mixer_UI::route_group_name_edit (const std::string& path, const std::string& new_text)
2037 if ((iter = group_model->get_iter (path))) {
2039 if ((group = (*iter)[group_columns.group]) == 0) {
2043 if (new_text != group->name()) {
2044 group->set_name (new_text);
2050 Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter)
2054 if (in_group_row_change) {
2058 if ((group = (*iter)[group_columns.group]) == 0) {
2062 std::string name = (*iter)[group_columns.text];
2064 if (name != group->name()) {
2065 group->set_name (name);
2068 bool hidden = !(*iter)[group_columns.visible];
2070 if (hidden != group->is_hidden ()) {
2071 group->set_hidden (hidden, this);
2075 /** Called when a group model row is deleted, but also when the model is
2076 * reordered by a user drag-and-drop; the latter is what we are
2077 * interested in here.
2080 Mixer_UI::route_group_row_deleted (Gtk::TreeModel::Path const &)
2082 if (_in_group_rebuild_or_clear) {
2086 /* Re-write the session's route group list so that the new order is preserved */
2088 list<RouteGroup*> new_list;
2090 Gtk::TreeModel::Children children = group_model->children();
2091 for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) {
2092 RouteGroup* g = (*i)[group_columns.group];
2094 new_list.push_back (g);
2098 _session->reorder_route_groups (new_list);
2103 Mixer_UI::add_route_group (RouteGroup* group)
2105 ENSURE_GUI_THREAD (*this, &Mixer_UI::add_route_group, group)
2108 in_group_row_change = true;
2110 TreeModel::Row row = *(group_model->append());
2111 row[group_columns.visible] = !group->is_hidden ();
2112 row[group_columns.group] = group;
2113 if (!group->name().empty()) {
2114 row[group_columns.text] = group->name();
2116 row[group_columns.text] = _("unnamed");
2120 group->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::route_group_property_changed, this, group, _1), gui_context());
2123 TreeViewColumn* col = group_display.get_column (0);
2124 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
2125 group_display.set_cursor (group_model->get_path (row), *col, *name_cell, true);
2128 _group_tabs->set_dirty ();
2130 in_group_row_change = false;
2134 Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
2136 using namespace Menu_Helpers;
2138 if (Keyboard::is_context_menu_event (ev)) {
2139 ARDOUR_UI::instance()->add_route ();
2147 Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint time)
2149 if (data.get_target() != "PluginFavoritePtr") {
2150 context->drag_finish (false, false, time);
2154 const void * d = data.get_data();
2155 const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>*>(d);
2157 PluginPresetList nfos;
2159 tv->get_object_drag_data (nfos, &source);
2161 Route::ProcessorList pl;
2164 for (list<PluginPresetPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
2165 PluginPresetPtr ppp = (*i);
2166 PluginInfoPtr pip = ppp->_pip;
2167 if (!pip->is_instrument ()) {
2170 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);
2174 context->drag_finish (ok, false, time);
2178 Mixer_UI::set_strip_width (Width w, bool save)
2182 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2183 (*i)->set_width_enum (w, save ? (*i)->width_owner() : this);
2188 struct PluginStateSorter {
2190 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2191 std::list<std::string>::const_iterator aiter = std::find(_user.begin(), _user.end(), (*a).unique_id);
2192 std::list<std::string>::const_iterator biter = std::find(_user.begin(), _user.end(), (*b).unique_id);
2193 if (aiter != _user.end() && biter != _user.end()) {
2194 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2196 if (aiter != _user.end()) {
2199 if (biter != _user.end()) {
2202 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2205 PluginStateSorter(std::list<std::string> user) : _user (user) {}
2207 std::list<std::string> _user;
2211 Mixer_UI::set_state (const XMLNode& node, int version)
2215 Tabbable::set_state (node, version);
2217 if (node.get_property ("narrow-strips", yn)) {
2219 set_strip_width (Narrow);
2221 set_strip_width (Wide);
2225 node.get_property ("show-mixer", _visible);
2227 if (node.get_property ("maximised", yn)) {
2228 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalMixer"));
2230 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2231 bool fs = tact && tact->get_active();
2233 ActionManager::do_action ("Common", "ToggleMaximalMixer");
2237 if (node.get_property ("show-mixer-list", yn)) {
2238 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Mixer"), X_("ToggleMixerList"));
2240 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2243 /* do it twice to force the change */
2244 tact->set_active (!yn);
2245 tact->set_active (yn);
2248 if (node.get_property ("monitor-section-visible", yn)) {
2249 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Mixer"), X_("ToggleMonitorSection"));
2251 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2254 /* do it twice to force the change */
2255 tact->set_active (!yn);
2256 tact->set_active (yn);
2259 if (node.get_property ("show-vca-pane", yn)) {
2260 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Mixer"), X_("ToggleVCAPane"));
2262 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2265 /* do it twice to force the change */
2266 tact->set_active (!yn);
2267 tact->set_active (yn);
2271 if (node.get_property ("show-mixbus-pane", yn)) {
2272 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Mixer"), X_("ToggleMixbusPane"));
2274 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2277 /* do it twice to force the change */
2278 tact->set_active (!yn);
2279 tact->set_active (yn);
2284 //check for the user's plugin_order file
2285 XMLNode plugin_order_new(X_("PO"));
2286 if (PluginManager::instance().load_plugin_order_file(plugin_order_new)) {
2287 store_current_favorite_order ();
2288 std::list<string> order;
2289 const XMLNodeList& kids = plugin_order_new.children("PluginInfo");
2290 XMLNodeConstIterator i;
2291 for (i = kids.begin(); i != kids.end(); ++i) {
2292 std::string unique_id;
2293 if ((*i)->get_property ("unique-id", unique_id)) {
2294 order.push_back (unique_id);
2295 if ((*i)->get_property ("expanded", yn)) {
2296 favorite_ui_state[unique_id] = yn;
2300 PluginStateSorter cmp (order);
2301 favorite_order.sort (cmp);
2302 sync_treeview_from_favorite_order ();
2305 //if there is no user file, then use an existing one from instant.xml
2306 //NOTE: if you are loading an old session, this might come from the session's instant.xml
2307 //Todo: in the next major version, we should probably stop doing the instant.xml check, and just use the new file
2308 XMLNode* plugin_order;
2309 if ((plugin_order = find_named_node (node, "PluginOrder")) != 0) {
2310 store_current_favorite_order ();
2311 std::list<string> order;
2312 const XMLNodeList& kids = plugin_order->children("PluginInfo");
2313 XMLNodeConstIterator i;
2314 for (i = kids.begin(); i != kids.end(); ++i) {
2315 std::string unique_id;
2316 if ((*i)->get_property ("unique-id", unique_id)) {
2317 order.push_back (unique_id);
2318 if ((*i)->get_property ("expanded", yn)) {
2319 favorite_ui_state[unique_id] = yn;
2324 PluginStateSorter cmp (order);
2325 favorite_order.sort (cmp);
2326 sync_treeview_from_favorite_order ();
2334 Mixer_UI::save_plugin_order_file ()
2336 //this writes the plugin order to the user's preference file ( plugin_metadata/plugin_order )
2338 //NOTE: this replaces the old code that stores info in instant.xml
2339 //why? because instant.xml prefers the per-session settings, and we want this to be a global pref
2341 store_current_favorite_order ();
2342 XMLNode plugin_order ("PluginOrder");
2344 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i, ++cnt) {
2345 XMLNode* p = new XMLNode ("PluginInfo");
2346 p->set_property ("sort", cnt);
2347 p->set_property ("unique-id", (*i)->unique_id);
2348 if (favorite_ui_state.find ((*i)->unique_id) != favorite_ui_state.end ()) {
2349 p->set_property ("expanded", favorite_ui_state[(*i)->unique_id]);
2351 plugin_order.add_child_nocopy (*p);
2353 PluginManager::instance().save_plugin_order_file( plugin_order );
2357 Mixer_UI::get_state ()
2359 XMLNode* node = new XMLNode (X_("Mixer"));
2361 node->add_child_nocopy (Tabbable::get_state());
2363 node->set_property (X_("mixer-rhs-pane1-pos"), rhs_pane1.get_divider());
2364 node->set_property (X_("mixer-rhs_pane2-pos"), rhs_pane2.get_divider());
2365 node->set_property (X_("mixer-list-hpane-pos"), list_hpane.get_divider());
2366 node->set_property (X_("mixer-inner-pane-pos"), inner_pane.get_divider());
2368 node->set_property ("narrow-strips", (_strip_width == Narrow));
2369 node->set_property ("show-mixer", _visible);
2370 node->set_property ("maximised", _maximised);
2372 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMixerList");
2373 assert (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2374 assert (tact); node->set_property ("show-mixer-list", tact->get_active ());
2376 act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
2377 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2378 assert (tact); node->set_property ("monitor-section-visible", tact->get_active ());
2380 act = ActionManager::get_action ("Mixer", "ToggleVCAPane");
2381 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2382 assert (tact); node->set_property ("show-vca-pane", tact->get_active ());
2385 act = ActionManager::get_action ("Mixer", "ToggleMixbusPane");
2386 assert (act); tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2387 assert (tact); node->set_property ("show-mixbus-pane", tact->get_active ());
2394 Mixer_UI::scroll_left ()
2396 if (!scroller.get_hscrollbar()) return;
2397 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2398 int sc_w = scroller.get_width();
2399 int sp_w = strip_packer.get_width();
2403 int lp = adj->get_value();
2405 using namespace Gtk::Box_Helpers;
2406 const BoxList& strips = strip_packer.children();
2407 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2408 if (i->get_widget() == & add_button) {
2412 if (i->get_widget() == &mb_shadow) {
2416 lm += i->get_widget()->get_width ();
2418 lm -= i->get_widget()->get_width ();
2422 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2426 Mixer_UI::scroll_right ()
2428 if (!scroller.get_hscrollbar()) return;
2429 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2430 int sc_w = scroller.get_width();
2431 int sp_w = strip_packer.get_width();
2435 int lp = adj->get_value();
2437 using namespace Gtk::Box_Helpers;
2438 const BoxList& strips = strip_packer.children();
2439 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2440 if (i->get_widget() == & add_button) {
2444 if (i->get_widget() == &mb_shadow) {
2448 lm += i->get_widget()->get_width ();
2453 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2457 Mixer_UI::on_scroll_event (GdkEventScroll* ev)
2459 switch (ev->direction) {
2460 case GDK_SCROLL_LEFT:
2464 if (ev->state & Keyboard::TertiaryModifier) {
2470 case GDK_SCROLL_RIGHT:
2474 case GDK_SCROLL_DOWN:
2475 if (ev->state & Keyboard::TertiaryModifier) {
2487 Mixer_UI::parameter_changed (string const & p)
2489 if (p == "show-group-tabs") {
2490 bool const s = _session->config.get_show_group_tabs ();
2492 _group_tabs->show ();
2494 _group_tabs->hide ();
2496 } else if (p == "default-narrow_ms") {
2497 bool const s = UIConfiguration::instance().get_default_narrow_ms ();
2498 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2499 (*i)->set_width_enum (s ? Narrow : Wide, this);
2505 Mixer_UI::set_route_group_activation (RouteGroup* g, bool a)
2507 g->set_active (a, this);
2511 Mixer_UI::plugin_selector()
2513 #ifdef DEFER_PLUGIN_SELECTOR_LOAD
2514 if (!_plugin_selector)
2515 _plugin_selector = new PluginSelector (PluginManager::instance());
2518 return _plugin_selector;
2522 Mixer_UI::setup_track_display ()
2524 track_model = ListStore::create (stripable_columns);
2525 track_display.set_model (track_model);
2526 track_display.append_column (_("Show"), stripable_columns.visible);
2527 track_display.append_column (_("Strips"), stripable_columns.text);
2528 track_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
2529 track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
2530 track_display.get_column (0)->set_expand(false);
2531 track_display.get_column (1)->set_expand(true);
2532 track_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
2533 track_display.set_name (X_("EditGroupList"));
2534 track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
2535 track_display.set_reorderable (true);
2536 track_display.set_headers_visible (true);
2537 track_display.set_can_focus(false);
2539 track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete));
2540 track_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_reorder));
2542 CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (0));
2543 track_list_visible_cell->property_activatable() = true;
2544 track_list_visible_cell->property_radio() = false;
2545 track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed));
2547 track_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::track_display_button_press), false);
2549 track_display_scroller.add (track_display);
2550 track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
2552 VBox* v = manage (new VBox);
2554 v->pack_start (track_display_scroller, true, true);
2556 track_display_frame.set_name("BaseFrame");
2557 track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
2558 track_display_frame.add (*v);
2560 track_display_scroller.show();
2561 track_display_frame.show();
2562 track_display.show();
2566 Mixer_UI::new_track_or_bus ()
2568 ARDOUR_UI::instance()->add_route ();
2572 Mixer_UI::update_title ()
2574 if (!own_window()) {
2581 if (_session->snap_name() != _session->name()) {
2582 n = _session->snap_name ();
2584 n = _session->name ();
2587 if (_session->dirty ()) {
2591 WindowTitle title (n);
2592 title += S_("Window|Mixer");
2593 title += Glib::get_application_name ();
2594 own_window()->set_title (title.get_string());
2598 WindowTitle title (S_("Window|Mixer"));
2599 title += Glib::get_application_name ();
2600 own_window()->set_title (title.get_string());
2605 Mixer_UI::strip_by_x (int x)
2607 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2610 (*i)->translate_coordinates (_content, 0, 0, x1, y);
2611 x2 = x1 + (*i)->get_width();
2613 if (x >= x1 && x <= x2) {
2622 Mixer_UI::set_axis_targets_for_operation ()
2624 _axis_targets.clear ();
2626 if (!_selection.empty()) {
2627 _axis_targets = _selection.axes;
2631 // removed "implicit" selections of strips, after discussion on IRC
2636 Mixer_UI::set_monitor_action_sensitivity (bool yn)
2638 // TODO use ActionMap::find_toggle_action()->set_*();
2639 Glib::RefPtr<Action> act;
2640 Glib::RefPtr<ToggleAction> tact;
2642 act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
2643 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2644 tact->set_active (yn);
2646 act = ActionManager::get_action (X_("Monitor"), "monitor-cut-all");
2647 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2648 tact->set_sensitive (yn);
2650 act = ActionManager::get_action (X_("Monitor"), "monitor-dim-all");
2651 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2652 tact->set_sensitive (yn);
2654 act = ActionManager::get_action (X_("Monitor"), "monitor-mono");
2655 tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
2656 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);
2691 Mixer_UI::toggle_midi_input_active (bool flip_others)
2693 boost::shared_ptr<RouteList> rl (new RouteList);
2696 set_axis_targets_for_operation ();
2698 for (AxisViewSelection::iterator r = _axis_targets.begin(); r != _axis_targets.end(); ++r) {
2699 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> ((*r)->stripable());
2703 onoff = !mt->input_active();
2707 _session->set_exclusive_input_active (rl, onoff, flip_others);
2711 Mixer_UI::maximise_mixer_space ()
2713 if (!own_window()) {
2721 _window->fullscreen ();
2726 Mixer_UI::restore_mixer_space ()
2728 if (!own_window()) {
2736 own_window()->unfullscreen();
2741 Mixer_UI::monitor_section_attached ()
2743 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
2744 assert (act); act->set_sensitive (true);
2746 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2748 showhide_monitor_section ( tact->get_active () );
2752 Mixer_UI::monitor_section_detached ()
2754 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
2755 act->set_sensitive (false);
2759 Mixer_UI::store_current_favorite_order ()
2761 typedef Gtk::TreeModel::Children type_children;
2762 type_children children = favorite_plugins_model->children();
2763 favorite_order.clear();
2764 for(type_children::iterator iter = children.begin(); iter != children.end(); ++iter)
2766 Gtk::TreeModel::Row row = *iter;
2767 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2768 favorite_order.push_back (ppp->_pip);
2769 std::string name = row[favorite_plugins_columns.name];
2770 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2775 Mixer_UI::save_favorite_ui_state (const TreeModel::iterator& iter, const TreeModel::Path& path)
2777 Gtk::TreeModel::Row row = *iter;
2778 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2780 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2784 Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs)
2786 PluginManager& manager (PluginManager::instance());
2787 for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
2789 /* not a Favorite? skip it */
2790 if (manager.get_status (*i) != PluginManager::Favorite) {
2794 /* Check the tag combo selection, and skip this plugin if it doesn't match the selected tag(s) */
2795 string test = favorite_plugins_tag_combo.get_active_text();
2796 if (test != _("Show All")) {
2797 vector<string> tags = manager.get_tags(*i);
2799 //does the selected tag match any of the tags in the plugin?
2800 vector<string>::iterator tt = find (tags.begin(), tags.end(), test);
2801 if (tt == tags.end()) {
2806 result.push_back (*i);
2810 struct PluginCustomSorter {
2812 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2813 PluginInfoList::const_iterator aiter = _user.begin();
2814 PluginInfoList::const_iterator biter = _user.begin();
2815 while (aiter != _user.end()) { if ((*aiter)->unique_id == a->unique_id) { break; } ++aiter; }
2816 while (biter != _user.end()) { if ((*biter)->unique_id == b->unique_id) { break; } ++biter; }
2818 if (aiter != _user.end() && biter != _user.end()) {
2819 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2821 if (aiter != _user.end()) {
2824 if (biter != _user.end()) {
2827 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2829 PluginCustomSorter(PluginInfoList user) : _user (user) {}
2831 PluginInfoList _user;
2835 Mixer_UI::refill_favorite_plugins ()
2837 PluginInfoList plugs;
2838 PluginManager& mgr (PluginManager::instance());
2841 refiller (plugs, mgr.lv2_plugin_info ());
2843 #ifdef WINDOWS_VST_SUPPORT
2844 refiller (plugs, mgr.windows_vst_plugin_info ());
2846 #ifdef LXVST_SUPPORT
2847 refiller (plugs, mgr.lxvst_plugin_info ());
2849 #ifdef MACVST_SUPPORT
2850 refiller (plugs, mgr.mac_vst_plugin_info ());
2852 #ifdef AUDIOUNIT_SUPPORT
2853 refiller (plugs, mgr.au_plugin_info ());
2855 refiller (plugs, mgr.ladspa_plugin_info ());
2856 refiller (plugs, mgr.lua_plugin_info ());
2858 store_current_favorite_order ();
2860 PluginCustomSorter cmp (favorite_order);
2863 favorite_order = plugs;
2865 sync_treeview_from_favorite_order ();
2869 Mixer_UI::plugin_list_changed ()
2871 refill_favorite_plugins();
2876 Mixer_UI::refill_tag_combo ()
2878 PluginManager& mgr (PluginManager::instance());
2880 std::vector<std::string> tags = mgr.get_all_tags (PluginManager::OnlyFavorites);
2882 favorite_plugins_tag_combo.clear();
2883 favorite_plugins_tag_combo.append_text (_("Show All"));
2885 for (vector<string>::iterator t = tags.begin (); t != tags.end (); ++t) {
2886 favorite_plugins_tag_combo.append_text (*t);
2889 favorite_plugins_tag_combo.set_active_text (_("Show All"));
2893 Mixer_UI::sync_treeview_favorite_ui_state (const TreeModel::Path& path, const TreeModel::iterator&)
2896 if (!(iter = favorite_plugins_model->get_iter (path))) {
2899 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
2903 PluginInfoPtr pip = ppp->_pip;
2904 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2905 if (favorite_ui_state[pip->unique_id]) {
2906 favorite_plugins_display.expand_row (path, true);
2912 Mixer_UI::sync_treeview_from_favorite_order ()
2914 favorite_plugins_model->clear ();
2915 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i) {
2916 PluginInfoPtr pip = (*i);
2918 TreeModel::Row newrow = *(favorite_plugins_model->append());
2919 newrow[favorite_plugins_columns.name] = (*i)->name;
2920 newrow[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip));
2925 vector<ARDOUR::Plugin::PresetRecord> presets = (*i)->get_presets (true);
2926 for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator j = presets.begin(); j != presets.end(); ++j) {
2927 Gtk::TreeModel::Row child_row = *(favorite_plugins_model->append (newrow.children()));
2928 child_row[favorite_plugins_columns.name] = (*j).label;
2929 child_row[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip, &(*j)));
2931 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2932 if (favorite_ui_state[pip->unique_id]) {
2933 favorite_plugins_display.expand_row (favorite_plugins_model->get_path(newrow), true);
2940 Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
2942 using namespace Gtk::Menu_Helpers;
2944 Gtk::Menu* m = manage (new Menu);
2945 MenuList& items = m->items ();
2947 if (_selection.axes.empty()) {
2948 items.push_back (MenuElem (_("No Track/Bus is selected.")));
2950 items.push_back (MenuElem (_("Add at the top"),
2951 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
2952 items.push_back (MenuElem (_("Add Pre-Fader"),
2953 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
2954 items.push_back (MenuElem (_("Add Post-Fader"),
2955 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
2956 items.push_back (MenuElem (_("Add at the end"),
2957 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
2960 items.push_back (SeparatorElem());
2962 items.push_back (MenuElem (_("Remove from favorites"), sigc::mem_fun (*this, &Mixer_UI::remove_selected_from_favorites)));
2964 ARDOUR::PluginPresetPtr ppp = selected_plugin();
2965 if (ppp && ppp->_preset.valid && ppp->_preset.user) {
2966 // we cannot currently delete AU presets
2967 if (!ppp->_pip || ppp->_pip->type != AudioUnit) {
2968 items.push_back (MenuElem (_("Delete Preset"), sigc::mem_fun (*this, &Mixer_UI::delete_selected_preset)));
2972 m->popup (ev->button, ev->time);
2976 Mixer_UI::plugin_row_button_press (GdkEventButton *ev)
2978 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) {
2979 TreeModel::Path path;
2980 TreeViewColumn* column;
2982 if (favorite_plugins_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
2983 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
2985 selection->unselect_all();
2986 selection->select(path);
2989 ARDOUR::PluginPresetPtr ppp = selected_plugin();
2991 popup_note_context_menu (ev);
2999 Mixer_UI::selected_plugin ()
3001 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
3003 return PluginPresetPtr();
3005 Gtk::TreeModel::iterator iter = selection->get_selected();
3007 return PluginPresetPtr();
3009 return (*iter)[favorite_plugins_columns.plugin];
3013 Mixer_UI::add_selected_processor (ProcessorPosition pos)
3015 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3017 add_favorite_processor (ppp, pos);
3022 Mixer_UI::delete_selected_preset ()
3027 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3028 if (!ppp || !ppp->_preset.valid || !ppp->_preset.user) {
3031 PluginPtr plugin = ppp->_pip->load (*_session);
3032 plugin->get_presets();
3033 plugin->remove_preset (ppp->_preset.label);
3037 Mixer_UI::remove_selected_from_favorites ()
3039 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3043 PluginManager::PluginStatusType status = PluginManager::Normal;
3044 PluginManager& manager (PluginManager::instance());
3046 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3047 manager.save_statuses ();
3051 Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
3054 if (!(iter = favorite_plugins_model->get_iter (path))) {
3057 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
3058 add_favorite_processor (ppp, AddPreFader); // TODO: preference?!
3062 Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos)
3064 if (!_session || _selection.axes.empty()) {
3068 PluginInfoPtr pip = ppp->_pip;
3069 for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) {
3070 boost::shared_ptr<ARDOUR::Route> rt = boost::dynamic_pointer_cast<ARDOUR::Route> ((*i)->stripable());
3076 PluginPtr p = pip->load (*_session);
3082 if (ppp->_preset.valid) {
3083 p->load_preset (ppp->_preset);
3086 Route::ProcessorStreams err;
3087 boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
3091 rt->add_processor_by_index (processor, 0, &err, Config->get_new_plugins_active ());
3094 rt->add_processor (processor, PreFader, &err, Config->get_new_plugins_active ());
3101 boost::shared_ptr<Processor> np = rt->nth_processor (idx);
3105 if (!np->display_to_user()) {
3108 if (boost::dynamic_pointer_cast<Amp> (np) && // Fader, not Trim
3109 boost::dynamic_pointer_cast<Amp> (np)->gain_control()->parameter().type() == GainAutomation) {
3114 rt->add_processor_by_index (processor, ++pos, &err, Config->get_new_plugins_active ());
3118 rt->add_processor_by_index (processor, -1, &err, Config->get_new_plugins_active ());
3125 PluginTreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, const Gtk::SelectionData& data) const
3127 if (data.get_target() != "GTK_TREE_MODEL_ROW") {
3131 // only allow to re-order top-level items
3133 if (TreePath::get_from_selection_data (data, src)) {
3134 if (src.up() && src.up()) {
3139 // don't allow to drop as child-rows.
3140 Gtk::TreeModel::Path _dest = dest; // un const
3141 const bool is_child = _dest.up (); // explicit bool for clang
3142 if (!is_child || _dest.empty ()) {
3149 Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
3151 if (data.get_target() != "PluginPresetPtr") {
3154 if (data.get_length() != sizeof (PluginPresetPtr)) {
3157 const void *d = data.get_data();
3158 const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
3160 PluginManager::PluginStatusType status = PluginManager::Favorite;
3161 PluginManager& manager (PluginManager::instance());
3163 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3164 manager.save_statuses ();
3168 Mixer_UI::do_vca_assign (boost::shared_ptr<VCA> vca)
3170 /* call protected MixerActor:: method */
3175 Mixer_UI::do_vca_unassign (boost::shared_ptr<VCA> vca)
3177 /* call protected MixerActor:: method */
3182 Mixer_UI::show_spill (boost::shared_ptr<Stripable> s)
3184 boost::shared_ptr<Stripable> ss = spilled_strip.lock();
3187 show_spill_change (s); /* EMIT SIGNAL */
3189 _group_tabs->hide ();
3191 _group_tabs->show ();
3193 redisplay_track_list ();
3198 Mixer_UI::showing_spill_for (boost::shared_ptr<Stripable> s) const
3200 return s == spilled_strip.lock();
3204 Mixer_UI::register_actions ()
3206 Glib::RefPtr<ActionGroup> group = ActionManager::create_action_group (this, X_("Mixer"));
3208 ActionManager::register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::solo_action));
3209 ActionManager::register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::mute_action));
3210 ActionManager::register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::rec_enable_action));
3211 ActionManager::register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_up_action));
3212 ActionManager::register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_down_action));
3213 ActionManager::register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::unity_gain_action));
3216 ActionManager::register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::copy_processors));
3217 ActionManager::register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::cut_processors));
3218 ActionManager::register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::paste_processors));
3219 ActionManager::register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::delete_processors));
3220 ActionManager::register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &Mixer_UI::select_all_processors));
3221 ActionManager::register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::toggle_processors));
3222 ActionManager::register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins));
3223 ActionManager::register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none));
3225 ActionManager::register_action (group, "select-next-stripable", _("Select Next Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_next_strip));
3226 ActionManager::register_action (group, "select-prev-stripable", _("Scroll Previous Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_prev_strip));
3228 ActionManager::register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left));
3229 ActionManager::register_action (group, "scroll-right", _("Scroll Mixer Window to the right"), sigc::mem_fun (*this, &Mixer_UI::scroll_right));
3231 ActionManager::register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
3232 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_midi_input_active), false));
3234 ActionManager::register_toggle_action (group, X_("ToggleMixerList"), _("Mixer: Show Mixer List"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixer_list));
3236 ActionManager::register_toggle_action (group, X_("ToggleVCAPane"), _("Mixer: Show VCAs"), sigc::mem_fun (*this, &Mixer_UI::toggle_vcas));
3239 ActionManager::register_toggle_action (group, X_("ToggleMixbusPane"), _("Mixer: Show Mixbuses"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixbus_pane));
3242 ActionManager::register_toggle_action (group, X_("ToggleMonitorSection"), _("Mixer: Show Monitor Section"), sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_section));
3246 Mixer_UI::load_bindings ()
3248 bindings = Bindings::get_bindings (X_("Mixer"));
3251 template<class T> void
3252 Mixer_UI::control_action (boost::shared_ptr<T> (Stripable::*get_control)() const)
3254 boost::shared_ptr<ControlList> cl (new ControlList);
3255 boost::shared_ptr<AutomationControl> ac;
3257 bool have_val = false;
3259 set_axis_targets_for_operation ();
3261 BOOST_FOREACH(AxisView* r, _axis_targets) {
3262 boost::shared_ptr<Stripable> s = r->stripable();
3264 ac = (s.get()->*get_control)();
3268 val = !ac->get_value();
3275 _session->set_controls (cl, val, Controllable::UseGroup);
3279 Mixer_UI::solo_action ()
3281 control_action (&Stripable::solo_control);
3285 Mixer_UI::mute_action ()
3287 control_action (&Stripable::mute_control);
3291 Mixer_UI::rec_enable_action ()
3293 control_action (&Stripable::rec_enable_control);
3296 AutomationControlSet
3297 Mixer_UI::selected_gaincontrols ()
3299 set_axis_targets_for_operation ();
3300 AutomationControlSet rv;
3301 BOOST_FOREACH(AxisView* r, _axis_targets) {
3302 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3304 boost::shared_ptr<GainControl> ac (ms->route()->gain_control());
3305 ControlList cl (ac->grouped_controls());
3306 for (ControlList::const_iterator c = cl.begin(); c != cl.end (); ++c) {
3316 Mixer_UI::step_gain_up_action ()
3318 AutomationControlSet acs = selected_gaincontrols ();
3319 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3320 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3322 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) + 0.1), Controllable::NoGroup);
3327 Mixer_UI::step_gain_down_action ()
3329 AutomationControlSet acs = selected_gaincontrols ();
3330 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3331 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3333 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) - 0.1), Controllable::NoGroup);
3338 Mixer_UI::unity_gain_action ()
3340 set_axis_targets_for_operation ();
3342 BOOST_FOREACH(AxisView* r, _axis_targets) {
3343 boost::shared_ptr<Stripable> s = r->stripable();
3345 boost::shared_ptr<AutomationControl> ac = s->gain_control();
3347 ac->set_value (1.0, Controllable::UseGroup);
3354 Mixer_UI::copy_processors ()
3356 set_axis_targets_for_operation ();
3358 BOOST_FOREACH(AxisView* r, _axis_targets) {
3359 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3361 ms->copy_processors ();
3366 Mixer_UI::cut_processors ()
3368 set_axis_targets_for_operation ();
3370 BOOST_FOREACH(AxisView* r, _axis_targets) {
3371 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3373 ms->cut_processors ();
3378 Mixer_UI::paste_processors ()
3380 set_axis_targets_for_operation ();
3382 BOOST_FOREACH(AxisView* r, _axis_targets) {
3383 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3385 ms->paste_processors ();
3390 Mixer_UI::select_all_processors ()
3392 set_axis_targets_for_operation ();
3394 BOOST_FOREACH(AxisView* r, _axis_targets) {
3395 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3397 ms->select_all_processors ();
3402 Mixer_UI::toggle_processors ()
3404 set_axis_targets_for_operation ();
3406 BOOST_FOREACH(AxisView* r, _axis_targets) {
3407 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3409 ms->toggle_processors ();
3414 Mixer_UI::ab_plugins ()
3416 set_axis_targets_for_operation ();
3418 BOOST_FOREACH(AxisView* r, _axis_targets) {
3419 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3427 Mixer_UI::vca_assign (boost::shared_ptr<VCA> vca)
3429 set_axis_targets_for_operation ();
3430 BOOST_FOREACH(AxisView* r, _axis_targets) {
3431 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3433 ms->vca_assign (vca);
3439 Mixer_UI::vca_unassign (boost::shared_ptr<VCA> vca)
3441 set_axis_targets_for_operation ();
3442 BOOST_FOREACH(AxisView* r, _axis_targets) {
3443 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3445 ms->vca_unassign (vca);