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 , _plugin_selector (0)
107 , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
108 , _spill_scroll_position (0)
109 , ignore_reorder (false)
110 , _in_group_rebuild_or_clear (false)
111 , _route_deletion_in_progress (false)
113 , _strip_selection_change_without_scroll (false)
114 , _selection (*this, *this)
118 _content.set_data ("ardour-bindings", bindings);
120 PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context());
122 scroller.set_can_default (true);
123 // set_default (scroller);
125 scroller_base.set_flags (Gtk::CAN_FOCUS);
126 scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
127 scroller_base.set_name ("MixerWindow");
128 scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
130 /* set up drag-n-drop */
131 vector<TargetEntry> target_table;
132 target_table.push_back (TargetEntry ("PluginFavoritePtr"));
133 scroller_base.drag_dest_set (target_table);
134 scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
136 /* create a button to add VCA strips ... will get packed in redisplay_track_list() */
137 Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
139 add_vca_button.add (*w);
140 add_vca_button.set_can_focus(false);
141 add_vca_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
143 /* create a button to add mixer strips */
144 w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
147 add_button.set_can_focus(false);
148 add_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
150 /* add as last item of strip packer */
151 strip_packer.pack_end (scroller_base, true, true);
152 strip_packer.pack_end (add_button, false, false);
155 /* create a drop-shadow at the end of the mixer strips */
156 mb_shadow.set_size_request( 4, -1 );
157 mb_shadow.set_name("EditorWindow");
159 strip_packer.pack_end (mb_shadow, false, false);
162 _group_tabs = new MixerGroupTabs (this);
163 strip_group_box.set_spacing (0);
164 strip_group_box.set_border_width (0);
165 strip_group_box.pack_start (*_group_tabs, PACK_SHRINK);
166 strip_group_box.pack_start (strip_packer);
167 strip_group_box.show_all ();
168 strip_group_box.signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
170 scroller.add (strip_group_box);
171 scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
173 setup_track_display ();
175 group_model = ListStore::create (group_columns);
176 group_display.set_model (group_model);
177 group_display.append_column (_("Show"), group_columns.visible);
178 group_display.append_column (_("Group"), group_columns.text);
179 group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
180 group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
181 group_display.get_column (0)->set_expand(false);
182 group_display.get_column (1)->set_expand(true);
183 group_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
184 group_display.set_name ("EditGroupList");
185 group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
186 group_display.set_reorderable (true);
187 group_display.set_headers_visible (true);
188 group_display.set_rules_hint (true);
189 group_display.set_can_focus(false);
191 /* name is directly editable */
193 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
194 name_cell->property_editable() = true;
195 name_cell->signal_edited().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_name_edit));
197 /* use checkbox for the active column */
199 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(group_display.get_column_cell_renderer (0));
200 active_cell->property_activatable() = true;
201 active_cell->property_radio() = false;
203 group_model->signal_row_changed().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_change));
204 /* We use this to notice drag-and-drop reorders of the group list */
205 group_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_row_deleted));
206 group_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::group_display_button_press), false);
208 group_display_scroller.add (group_display);
209 group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
212 group_display_vbox.pack_start (group_display_scroller, true, true);
214 group_display_frame.set_name ("BaseFrame");
215 group_display_frame.set_shadow_type (Gtk::SHADOW_IN);
216 group_display_frame.add (group_display_vbox);
218 list<TargetEntry> target_list;
219 target_list.push_back (TargetEntry ("PluginPresetPtr"));
221 favorite_plugins_model = PluginTreeStore::create (favorite_plugins_columns);
222 favorite_plugins_display.set_model (favorite_plugins_model);
223 favorite_plugins_display.append_column (_("Favorite Plugins"), favorite_plugins_columns.name);
224 favorite_plugins_display.set_name ("EditGroupList");
225 favorite_plugins_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
226 favorite_plugins_display.set_reorderable (false);
227 favorite_plugins_display.set_headers_visible (true);
228 favorite_plugins_display.set_rules_hint (true);
229 favorite_plugins_display.set_can_focus (false);
230 favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr");
231 favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
232 favorite_plugins_display.add_drop_targets (target_list);
233 favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
234 favorite_plugins_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_button_press), false);
235 favorite_plugins_display.signal_drop.connect (sigc::mem_fun (*this, &Mixer_UI::plugin_drop));
236 favorite_plugins_display.signal_row_expanded().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
237 favorite_plugins_display.signal_row_collapsed().connect (sigc::mem_fun (*this, &Mixer_UI::save_favorite_ui_state));
238 if (UIConfiguration::instance().get_use_tooltips()) {
239 favorite_plugins_display.set_tooltip_column (0);
241 favorite_plugins_model->signal_row_has_child_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::sync_treeview_favorite_ui_state));
243 favorite_plugins_scroller.add (favorite_plugins_display);
244 favorite_plugins_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
246 favorite_plugins_frame.set_name ("BaseFrame");
247 favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN);
248 favorite_plugins_frame.add (favorite_plugins_vbox);
250 favorite_plugins_vbox.pack_start (favorite_plugins_scroller, true, true);
251 favorite_plugins_vbox.pack_start (favorite_plugins_tag_combo, false, false);
252 favorite_plugins_tag_combo.signal_changed().connect (sigc::mem_fun (*this, &Mixer_UI::tag_combo_changed));
254 rhs_pane1.add (favorite_plugins_frame);
255 rhs_pane1.add (track_display_frame);
257 rhs_pane2.add (rhs_pane1);
258 rhs_pane2.add (group_display_frame);
260 list_vpacker.pack_start (rhs_pane2, true, true);
262 vca_label_bar.set_size_request (-1, 16 + 1); /* must match height in GroupTabs::set_size_request() + 1 border px*/
263 vca_vpacker.pack_start (vca_label_bar, false, false);
265 vca_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
266 vca_scroller_base.set_name (X_("MixerWindow"));
267 vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false);
269 vca_hpacker.signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_vca_scroll_event), false);
270 vca_scroller.add (vca_hpacker);
271 vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
272 vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
274 vca_vpacker.pack_start (vca_scroller, true, true);
276 inner_pane.add (scroller);
277 inner_pane.add (vca_vpacker);
279 global_hpacker.pack_start (inner_pane, true, true);
280 global_hpacker.pack_start (out_packer, false, false);
282 list_hpane.set_check_divider_position (true);
283 list_hpane.add (list_vpacker);
284 list_hpane.add (global_hpacker);
285 list_hpane.set_child_minsize (list_vpacker, 30);
287 XMLNode const * settings = ARDOUR_UI::instance()->mixer_settings();
290 if (!settings || !settings->get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) {
293 rhs_pane1.set_divider (0, fract);
295 if (!settings || !settings->get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) {
298 rhs_pane2.set_divider (0, fract);
300 if (!settings || !settings->get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) {
303 list_hpane.set_divider (0, fract);
305 if (!settings || !settings->get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) {
308 inner_pane.set_divider (0, fract);
310 rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
311 rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
312 list_hpane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
313 inner_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
315 _content.pack_start (list_hpane, true, true);
320 _content.set_name ("MixerWindow");
322 global_hpacker.show();
324 scroller_base.show();
325 scroller_hpacker.show();
326 mixer_scroller_vpacker.show();
328 group_display_button_label.show();
329 group_display_scroller.show();
330 favorite_plugins_scroller.show();
331 group_display_vbox.show();
332 group_display_frame.show();
333 favorite_plugins_frame.show();
341 vca_label_bar.show();
343 vca_scroller_base.show();
346 group_display.show();
347 favorite_plugins_display.show();
350 XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section"));
352 _monitor_section.tearoff().set_state (*mnode);
355 MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
356 VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
360 ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context());
362 #ifndef DEFER_PLUGIN_SELECTOR_LOAD
363 _plugin_selector = new PluginSelector (PluginManager::instance ());
365 #error implement deferred Plugin-Favorite list
368 PluginManager::instance ().PluginListChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
369 PluginManager::instance ().PluginStatusChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_list_changed, this), gui_context());
370 ARDOUR::Plugin::PresetsChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context());
373 Mixer_UI::~Mixer_UI ()
375 monitor_section_detached ();
377 delete _plugin_selector;
381 struct MixerStripSorter {
382 bool operator() (const MixerStrip* ms_a, const MixerStrip* ms_b)
384 boost::shared_ptr<ARDOUR::Stripable> const& a = ms_a->stripable ();
385 boost::shared_ptr<ARDOUR::Stripable> const& b = ms_b->stripable ();
386 return ARDOUR::Stripable::Sorter(true)(a, b);
398 Mixer_UI::tag_combo_changed ()
400 refill_favorite_plugins();
404 Mixer_UI::use_own_window (bool and_fill_it)
406 bool new_window = !own_window();
408 Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
410 if (win && new_window) {
411 win->set_name ("MixerWindow");
412 ARDOUR_UI::instance()->setup_toplevel_window (*win, _("Mixer"), this);
413 win->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win));
414 win->set_data ("ardour-bindings", bindings);
416 if (!win->get_focus()) {
417 /* set focus widget to something, anything */
418 win->set_focus (scroller);
426 Mixer_UI::show_window ()
428 Tabbable::show_window ();
430 /* show/hide group tabs as required */
431 parameter_changed ("show-group-tabs");
433 /* now reset each strips width so the right widgets are shown */
435 TreeModel::Children rows = track_model->children();
436 TreeModel::Children::iterator ri;
438 for (ri = rows.begin(); ri != rows.end(); ++ri) {
439 AxisView* av = (*ri)[stripable_columns.strip];
440 MixerStrip* ms = dynamic_cast<MixerStrip*> (av);
444 ms->set_width_enum (ms->get_width_enum (), ms->width_owner());
445 /* Fix visibility of mixer strip stuff */
446 ms->parameter_changed (X_("mixer-element-visibility"));
449 /* force focus into main area */
450 scroller_base.grab_focus ();
454 Mixer_UI::remove_master (VCAMasterStrip* vms)
456 if (_session && _session->deletion_in_progress()) {
457 /* its all being taken care of */
461 TreeModel::Children rows = track_model->children();
462 TreeModel::Children::iterator ri;
464 for (ri = rows.begin(); ri != rows.end(); ++ri) {
465 if ((*ri)[stripable_columns.strip] == vms) {
466 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
467 track_model->erase (ri);
474 Mixer_UI::masters_scroller_button_release (GdkEventButton* ev)
476 using namespace Menu_Helpers;
478 if (Keyboard::is_context_menu_event (ev)) {
479 ARDOUR_UI::instance()->add_route ();
487 Mixer_UI::new_masters_created ()
489 ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane")->set_active (true);
493 Mixer_UI::add_masters (VCAList& vlist)
497 for (VCAList::iterator v = vlist.begin(); v != vlist.end(); ++v) {
498 sl.push_back (boost::dynamic_pointer_cast<Stripable> (*v));
505 Mixer_UI::add_routes (RouteList& rlist)
509 for (RouteList::iterator r = rlist.begin(); r != rlist.end(); ++r) {
517 Mixer_UI::add_stripables (StripableList& slist)
519 Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
520 bool from_scratch = (track_model->children().size() == 0);
521 uint32_t nroutes = 0;
523 slist.sort (Stripable::Sorter());
525 for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
526 boost::shared_ptr<Stripable> s = (*it)[stripable_columns.stripable];
534 // XXX what does this special case do?
535 if (s->presentation_info().order() == (slist.front()->presentation_info().order() + slist.size())) {
544 PBD::Unwinder<bool> uw (no_track_list_redisplay, true);
546 track_display.set_model (Glib::RefPtr<ListStore>());
548 for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
550 boost::shared_ptr<Route> route;
551 boost::shared_ptr<VCA> vca;
553 if ((vca = boost::dynamic_pointer_cast<VCA> (*s))) {
555 VCAMasterStrip* vms = new VCAMasterStrip (_session, vca);
557 TreeModel::Row row = *(track_model->append());
559 row[stripable_columns.text] = vca->name();
560 row[stripable_columns.visible] = vms->marked_for_display ();
561 row[stripable_columns.strip] = vms;
562 row[stripable_columns.stripable] = vca;
564 vms->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::vca_button_release_event), vms));
566 } else if ((route = boost::dynamic_pointer_cast<Route> (*s))) {
568 if (route->is_auditioner()) {
572 if (route->is_monitor()) {
574 out_packer.pack_end (_monitor_section.tearoff(), false, false);
575 _monitor_section.set_session (_session);
576 _monitor_section.tearoff().show_all ();
578 _monitor_section.tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached));
579 _monitor_section.tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached));
581 if (_monitor_section.tearoff().torn_off()) {
582 monitor_section_detached ();
584 monitor_section_attached ();
587 route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context());
589 /* no regular strip shown for control out */
594 strip = new MixerStrip (*this, _session, route);
595 strips.push_back (strip);
597 UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
599 if (strip->width_owner() != strip) {
600 strip->set_width_enum (_strip_width, this);
605 if (route->is_master()) {
607 out_packer.pack_start (*strip, false, false);
608 strip->set_packed (true);
612 TreeModel::Row row = *(track_model->insert (insert_iter));
614 row[stripable_columns.text] = route->name();
615 row[stripable_columns.visible] = strip->marked_for_display();
616 row[stripable_columns.stripable] = route;
617 row[stripable_columns.strip] = strip;
620 strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
621 strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
624 (*s)->presentation_info().PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
625 (*s)->PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr<Stripable>(*s)), gui_context());
628 } catch (const std::exception& e) {
629 error << string_compose (_("Error adding GUI elements for new tracks/busses %1"), e.what()) << endmsg;
632 track_display.set_model (track_model);
634 /* catch up on selection state, which we left to the editor to set */
635 sync_treeview_from_presentation_info (PropertyChange (Properties::selected));
638 sync_presentation_info_from_treeview ();
641 redisplay_track_list ();
645 Mixer_UI::deselect_all_strip_processors ()
647 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
648 (*i)->deselect_all_processors();
653 Mixer_UI::select_none ()
655 _selection.clear_routes();
656 deselect_all_strip_processors();
660 Mixer_UI::select_next_strip ()
662 deselect_all_strip_processors();
663 _session->selection().select_next_stripable (true, false);
667 Mixer_UI::select_prev_strip ()
669 deselect_all_strip_processors();
670 _session->selection().select_prev_stripable (true, false);
674 Mixer_UI::delete_processors ()
676 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
677 (*i)->delete_processors();
683 Mixer_UI::remove_strip (MixerStrip* strip)
685 if (_session && _session->deletion_in_progress()) {
686 /* its all being taken care of */
690 TreeModel::Children rows = track_model->children();
691 TreeModel::Children::iterator ri;
692 list<MixerStrip *>::iterator i;
694 if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
698 PBD::Unwinder<bool> uwi (ignore_reorder, true);
700 for (ri = rows.begin(); ri != rows.end(); ++ri) {
701 if ((*ri)[stripable_columns.strip] == strip) {
702 PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
703 track_model->erase (ri);
710 Mixer_UI::presentation_info_changed (PropertyChange const & what_changed)
712 if (what_changed.contains (Properties::selected)) {
713 _selection.presentation_info_changed (what_changed);
717 soh.add (Properties::selected);
718 soh.add (Properties::order);
719 soh.add (Properties::hidden);
721 if (what_changed.contains (soh)) {
722 sync_treeview_from_presentation_info (what_changed);
727 Mixer_UI::sync_presentation_info_from_treeview ()
729 if (ignore_reorder || !_session || _session->deletion_in_progress()) {
733 TreeModel::Children rows = track_model->children();
739 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync presentation info from treeview\n");
741 TreeModel::Children::iterator ri;
744 PresentationInfo::order_t master_key = _session->master_order_key ();
745 PresentationInfo::order_t order = 0;
747 PresentationInfo::ChangeSuspender cs;
749 for (ri = rows.begin(); ri != rows.end(); ++ri) {
750 bool visible = (*ri)[stripable_columns.visible];
751 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
753 #ifndef NDEBUG // these should not exist in the mixer's treeview
758 if (stripable->is_monitor() || stripable->is_auditioner()) {
762 if (stripable->is_master()) {
768 stripable->presentation_info().set_hidden (!visible);
770 // leave master where it is.
771 if (order == master_key) {
775 if (order != stripable->presentation_info().order()) {
776 stripable->set_presentation_order (order);
782 change |= _session->ensure_stripable_sort_order ();
785 DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
786 _session->set_dirty();
791 Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_changed)
793 if (!_session || _session->deletion_in_progress()) {
797 DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from presentation info.\n");
799 /* we could get here after either a change in the Mixer or Editor sort
800 * order, but either way, the mixer order keys reflect the intended
801 * order for the GUI, so reorder the treeview model to match it.
804 vector<int> neworder;
805 TreeModel::Children rows = track_model->children();
806 uint32_t old_order = 0;
807 bool changed = false;
813 TreeOrderKeys sorted;
814 for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
815 boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
816 sorted.push_back (TreeOrderKey (old_order, stripable));
819 TreeOrderKeySorter cmp;
821 sort (sorted.begin(), sorted.end(), cmp);
822 neworder.assign (sorted.size(), 0);
826 for (TreeOrderKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
828 neworder[n] = sr->old_display_order;
830 if (sr->old_display_order != n) {
836 Unwinder<bool> uw (ignore_reorder, true);
837 track_model->reorder (neworder);
840 if (what_changed.contains (Properties::selected)) {
842 PresentationInfo::ChangeSuspender cs;
844 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
845 boost::shared_ptr<Stripable> stripable = (*i)->stripable();
846 if (stripable && stripable->is_selected()) {
849 _selection.remove (*i);
853 if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll () && !_strip_selection_change_without_scroll) {
854 move_stripable_into_view ((*_selection.axes.begin())->stripable());
857 TreeModel::Children rows = track_model->children();
858 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
859 AxisView* av = (*i)[stripable_columns.strip];
860 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
864 if (vms->vca() && vms->vca()->is_selected()) {
865 _selection.add (vms);
867 _selection.remove (vms);
872 redisplay_track_list ();
877 Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) const
879 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
880 if ((*i)->route() == r) {
889 Mixer_UI::strip_by_stripable (boost::shared_ptr<Stripable> s) const
891 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
892 if ((*i)->stripable() == s) {
901 Mixer_UI::axis_view_by_stripable (boost::shared_ptr<Stripable> s) const
903 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
904 if ((*i)->stripable() == s) {
909 TreeModel::Children rows = track_model->children();
910 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
911 AxisView* av = (*i)[stripable_columns.strip];
912 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
913 if (vms && vms->stripable () == s) {
922 Mixer_UI::axis_view_by_control (boost::shared_ptr<AutomationControl> c) const
924 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
925 if ((*i)->control() == c) {
934 Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
936 /* Selecting a mixer-strip may also select grouped-tracks, and
937 * presentation_info_changed() being emitted and
938 * _selection.axes.begin() is being moved into view. This may
939 * effectively move the track that was clicked-on out of view.
941 * So here only the track that is actually clicked-on is moved into
942 * view (in case it's partially visible)
944 PBD::Unwinder<bool> uw (_strip_selection_change_without_scroll, true);
945 move_stripable_into_view (strip->stripable());
947 if (ev->button == 1) {
948 if (_selection.selected (strip)) {
949 /* primary-click: toggle selection state of strip */
950 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
951 _selection.remove (strip, true);
952 } else if (_selection.axes.size() > 1) {
953 /* de-select others */
954 _selection.set (strip);
956 PublicEditor& pe = PublicEditor::instance();
957 TimeAxisView* tav = pe.time_axis_view_from_stripable (strip->stripable());
959 pe.set_selected_mixer_strip (*tav);
962 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
963 _selection.add (strip, true);
964 } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
966 /* extend selection */
968 vector<MixerStrip*> tmp;
969 bool accumulate = false;
970 bool found_another = false;
972 strips.sort (MixerStripSorter());
974 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
979 /* hit clicked strip, start accumulating till we hit the first
988 } else if (_selection.selected (ms)) {
989 /* hit selected strip. if currently accumulating others,
990 we're done. if not accumulating others, start doing so.
992 found_another = true;
1006 tmp.push_back (strip);
1008 if (found_another) {
1009 PresentationInfo::ChangeSuspender cs;
1010 for (vector<MixerStrip*>::iterator i = tmp.begin(); i != tmp.end(); ++i) {
1011 _selection.add (*i, true);
1014 _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet
1017 _selection.set (strip);
1026 Mixer_UI::vca_button_release_event (GdkEventButton *ev, VCAMasterStrip *strip)
1028 _selection.set (strip);
1033 Mixer_UI::set_session (Session* sess)
1035 SessionHandlePtr::set_session (sess);
1036 _monitor_section.set_session (sess);
1038 if (_plugin_selector) {
1039 _plugin_selector->set_session (_session);
1042 _group_tabs->set_session (sess);
1045 _selection.clear ();
1049 refill_favorite_plugins();
1052 XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
1053 set_state (*node, 0);
1057 initial_track_display ();
1059 _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_routes, this, _1), gui_context());
1060 _session->route_group_added.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_route_group, this, _1), gui_context());
1061 _session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1062 _session->route_groups_reordered.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context());
1063 _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context());
1064 _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1065 _session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
1067 _session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_masters, this, _1), gui_context());
1068 _session->vca_manager().VCACreated.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::new_masters_created, this), gui_context());
1070 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context ());
1072 route_groups_changed ();
1078 /* catch up on selection state, etc. */
1081 sc.add (Properties::selected);
1082 _selection.presentation_info_changed (sc);
1088 Mixer_UI::session_going_away ()
1090 ENSURE_GUI_THREAD (*this, &Mixer_UI::session_going_away);
1092 _in_group_rebuild_or_clear = true;
1093 group_model->clear ();
1094 _in_group_rebuild_or_clear = false;
1096 _selection.clear ();
1097 track_model->clear ();
1099 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1103 _monitor_section.tearoff().hide_visible ();
1105 monitor_section_detached ();
1111 SessionHandlePtr::session_going_away ();
1118 Mixer_UI::track_visibility_changed (std::string const & path)
1120 if (_session && _session->deletion_in_progress()) {
1126 if ((iter = track_model->get_iter (path))) {
1128 AxisView* av = (*iter)[stripable_columns.strip];
1129 bool visible = (*iter)[stripable_columns.visible];
1131 if (av->set_marked_for_display (!visible)) {
1132 update_track_visibility ();
1138 Mixer_UI::update_track_visibility ()
1140 TreeModel::Children rows = track_model->children();
1141 TreeModel::Children::iterator i;
1144 Unwinder<bool> uw (no_track_list_redisplay, true);
1146 for (i = rows.begin(); i != rows.end(); ++i) {
1147 AxisView* av = (*i)[stripable_columns.strip];
1148 (*i)[stripable_columns.visible] = av->marked_for_display ();
1151 /* force presentation catch up with visibility changes
1154 sync_presentation_info_from_treeview ();
1157 redisplay_track_list ();
1161 Mixer_UI::show_strip (MixerStrip* ms)
1163 TreeModel::Children rows = track_model->children();
1164 TreeModel::Children::iterator i;
1166 for (i = rows.begin(); i != rows.end(); ++i) {
1168 AxisView* av = (*i)[stripable_columns.strip];
1169 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1171 (*i)[stripable_columns.visible] = true;
1172 av->set_marked_for_display (true);
1173 update_track_visibility ();
1180 Mixer_UI::hide_strip (MixerStrip* ms)
1182 TreeModel::Children rows = track_model->children();
1183 TreeModel::Children::iterator i;
1185 for (i = rows.begin(); i != rows.end(); ++i) {
1187 AxisView* av = (*i)[stripable_columns.strip];
1188 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1190 (*i)[stripable_columns.visible] = false;
1191 av->set_marked_for_display (false);
1192 update_track_visibility ();
1199 Mixer_UI::start_updating ()
1201 fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips));
1206 Mixer_UI::stop_updating ()
1208 fast_screen_update_connection.disconnect();
1213 Mixer_UI::fast_update_strips ()
1215 if (_content.is_mapped () && _session) {
1216 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1217 (*i)->fast_update ();
1223 Mixer_UI::set_all_strips_visibility (bool yn)
1225 TreeModel::Children rows = track_model->children();
1226 TreeModel::Children::iterator i;
1229 Unwinder<bool> uw (no_track_list_redisplay, true);
1231 for (i = rows.begin(); i != rows.end(); ++i) {
1233 AxisView* av = (*i)[stripable_columns.strip];
1234 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1240 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1244 (*i)[stripable_columns.visible] = yn;
1248 redisplay_track_list ();
1253 Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn)
1255 TreeModel::Children rows = track_model->children();
1256 TreeModel::Children::iterator i;
1259 Unwinder<bool> uw (no_track_list_redisplay, true);
1261 for (i = rows.begin(); i != rows.end(); ++i) {
1263 AxisView* av = (*i)[stripable_columns.strip];
1264 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1270 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1274 boost::shared_ptr<AudioTrack> at = strip->audio_track();
1275 boost::shared_ptr<MidiTrack> mt = strip->midi_track();
1279 (*i)[stripable_columns.visible] = yn;
1283 if (at) { /* track */
1284 (*i)[stripable_columns.visible] = yn;
1289 if (!at && !mt) { /* bus */
1290 (*i)[stripable_columns.visible] = yn;
1295 if (mt) { /* midi-track */
1296 (*i)[stripable_columns.visible] = yn;
1303 redisplay_track_list ();
1307 Mixer_UI::hide_all_routes ()
1309 set_all_strips_visibility (false);
1313 Mixer_UI::show_all_routes ()
1315 set_all_strips_visibility (true);
1319 Mixer_UI::show_all_audiobus ()
1321 set_all_audio_midi_visibility (2, true);
1324 Mixer_UI::hide_all_audiobus ()
1326 set_all_audio_midi_visibility (2, false);
1330 Mixer_UI::show_all_audiotracks()
1332 set_all_audio_midi_visibility (1, true);
1335 Mixer_UI::hide_all_audiotracks ()
1337 set_all_audio_midi_visibility (1, false);
1341 Mixer_UI::show_all_miditracks()
1343 set_all_audio_midi_visibility (3, true);
1346 Mixer_UI::hide_all_miditracks ()
1348 set_all_audio_midi_visibility (3, false);
1352 Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
1354 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
1355 sync_presentation_info_from_treeview ();
1359 Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
1361 /* this happens as the second step of a DnD within the treeview as well
1362 as when a row/route is actually deleted.
1364 if it was a deletion then we have to force a redisplay because
1365 order keys may not have changed.
1368 DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
1369 sync_presentation_info_from_treeview ();
1371 if (_route_deletion_in_progress) {
1372 redisplay_track_list ();
1377 Mixer_UI::spill_redisplay (boost::shared_ptr<VCA> vca)
1379 TreeModel::Children rows = track_model->children();
1380 std::list<boost::shared_ptr<VCA> > vcas;
1381 vcas.push_back (vca);
1383 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1384 AxisView* av = (*i)[stripable_columns.strip];
1385 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
1386 if (vms && vms->vca()->slaved_to (vca)) {
1387 vcas.push_back (vms->vca());
1391 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1393 AxisView* av = (*i)[stripable_columns.strip];
1394 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1395 bool const visible = (*i)[stripable_columns.visible];
1398 /* we're in the middle of changing a row, don't worry */
1402 if (!strip->route()) {
1403 /* non-route element */
1407 if (strip->route()->is_master() || strip->route()->is_monitor()) {
1411 bool slaved = false;
1412 for (std::list<boost::shared_ptr<VCA> >::const_iterator m = vcas.begin(); m != vcas.end(); ++m) {
1413 if (strip->route()->slaved_to (*m)) {
1419 if (slaved && visible) {
1421 if (strip->packed()) {
1422 strip_packer.reorder_child (*strip, -1); /* put at end */
1424 strip_packer.pack_start (*strip, false, false);
1425 strip->set_packed (true);
1430 if (strip->packed()) {
1431 strip_packer.remove (*strip);
1432 strip->set_packed (false);
1439 Mixer_UI::redisplay_track_list ()
1441 if (no_track_list_redisplay) {
1445 boost::shared_ptr<Stripable> ss = spilled_strip.lock ();
1447 boost::shared_ptr<VCA> sv = boost::dynamic_pointer_cast<VCA> (ss);
1449 if (_spill_scroll_position <= 0 && scroller.get_hscrollbar()) {
1450 _spill_scroll_position = scroller.get_hscrollbar()->get_adjustment()->get_value();
1452 spill_redisplay (sv);
1457 TreeModel::Children rows = track_model->children();
1458 TreeModel::Children::iterator i;
1459 uint32_t n_masters = 0;
1461 container_clear (vca_hpacker);
1463 vca_hpacker.pack_end (vca_scroller_base, true, true);
1464 vca_hpacker.pack_end (add_vca_button, false, false);
1466 add_vca_button.show ();
1467 vca_scroller_base.show();
1469 for (i = rows.begin(); i != rows.end(); ++i) {
1471 AxisView* s = (*i)[stripable_columns.strip];
1472 bool const visible = (*i)[stripable_columns.visible];
1473 boost::shared_ptr<Stripable> stripable = (*i)[stripable_columns.stripable];
1476 /* we're in the middle of changing a row, don't worry */
1480 VCAMasterStrip* vms;
1482 if ((vms = dynamic_cast<VCAMasterStrip*> (s))) {
1484 vca_hpacker.pack_start (*vms, false, false);
1491 MixerStrip* strip = dynamic_cast<MixerStrip*> (s);
1499 if (strip->packed()) {
1500 strip_packer.reorder_child (*strip, -1); /* put at end */
1502 strip_packer.pack_start (*strip, false, false);
1503 strip->set_packed (true);
1508 if (stripable->is_master() || stripable->is_monitor()) {
1509 /* do nothing, these cannot be hidden */
1511 if (strip->packed()) {
1512 strip_packer.remove (*strip);
1513 strip->set_packed (false);
1519 /* update visibility of VCA assign buttons */
1521 if (n_masters == 0) {
1522 //show/hide the channelstrip VCA assign buttons on channelstrips:
1523 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1525 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleVCAPane");
1527 act->set_sensitive (false);
1530 //remove the VCA packer, but don't change our prior setting for show/hide:
1531 vca_vpacker.hide ();
1533 //show/hide the channelstrip VCA assign buttons on channelstrips:
1534 UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
1536 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane");
1537 act->set_sensitive (true);
1539 //if we were showing VCAs before, show them now:
1540 showhide_vcas (act->get_active ());
1543 _group_tabs->set_dirty ();
1545 if (_spill_scroll_position > 0 && scroller.get_hscrollbar()) {
1546 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1547 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), _spill_scroll_position)));
1549 _spill_scroll_position = 0;
1554 Mixer_UI::strip_width_changed ()
1556 _group_tabs->set_dirty ();
1559 TreeModel::Children rows = track_model->children();
1560 TreeModel::Children::iterator i;
1563 for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
1564 AxisView* av = (*i)[stripable_columns.strip];
1565 MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
1571 bool visible = (*i)[stripable_columns.visible];
1574 strip->queue_draw();
1581 struct PresentationInfoMixerSorter
1583 bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
1584 if (a->is_master()) {
1585 /* master after everything else */
1587 } else if (b->is_master()) {
1588 /* everything else before master */
1591 return a->presentation_info().order () < b->presentation_info().order ();
1596 Mixer_UI::initial_track_display ()
1599 _session->get_stripables (sl);
1601 sl.sort (PresentationInfoMixerSorter());
1604 /* These are also used inside ::add_stripables() but we need
1605 * them here because we're going to clear the track_model also.
1607 Unwinder<bool> uw1 (no_track_list_redisplay, true);
1608 Unwinder<bool> uw2 (ignore_reorder, true);
1610 track_model->clear ();
1611 add_stripables (sl);
1614 sync_treeview_from_presentation_info (Properties::order);
1618 Mixer_UI::track_display_button_press (GdkEventButton* ev)
1620 if (Keyboard::is_context_menu_event (ev)) {
1621 if (track_menu == 0) {
1622 build_track_menu ();
1624 track_menu->popup (ev->button, ev->time);
1627 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 1)) {
1628 TreeModel::Path path;
1629 TreeViewColumn* column;
1631 if (track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1632 TreeIter iter = track_model->get_iter (path);
1633 if ((*iter)[stripable_columns.visible]) {
1634 boost::shared_ptr<ARDOUR::Stripable> s = (*iter)[stripable_columns.stripable];
1635 move_stripable_into_view (s);
1644 Mixer_UI::move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
1646 if (!vca_scroller.get_hscrollbar()) {
1652 Gtk::Allocation alloc;
1654 TreeModel::Children rows = track_model->children();
1655 for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
1656 AxisView* av = (*i)[stripable_columns.strip];
1657 VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
1658 if (vms && vms->stripable () == s) {
1661 vms->translate_coordinates (vca_hpacker, 0, 0, x0, y);
1662 alloc = vms->get_allocation ();
1671 Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
1673 if (x0 < adj->get_value()) {
1674 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
1675 } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
1676 int x1 = x0 + alloc.get_width() - adj->get_page_size();
1677 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
1682 Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
1684 if (!scroller.get_hscrollbar()) {
1687 if (s->presentation_info().special ()) {
1690 if (s->presentation_info().flag_match (PresentationInfo::VCA)) {
1691 move_vca_into_view (s);
1700 Gtk::Allocation alloc;
1701 for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
1702 if ((*i)->route() == s) {
1705 (*i)->translate_coordinates (strip_packer, 0, 0, x0, y);
1706 alloc = (*i)->get_allocation ();
1714 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
1716 if (x0 < adj->get_value()) {
1717 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
1718 } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
1719 int x1 = x0 + alloc.get_width() - adj->get_page_size();
1720 adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
1725 Mixer_UI::build_track_menu ()
1727 using namespace Menu_Helpers;
1728 using namespace Gtk;
1730 track_menu = new Menu;
1731 track_menu->set_name ("ArdourContextMenu");
1732 MenuList& items = track_menu->items();
1734 items.push_back (MenuElem (_("Show All"), sigc::mem_fun(*this, &Mixer_UI::show_all_routes)));
1735 items.push_back (MenuElem (_("Hide All"), sigc::mem_fun(*this, &Mixer_UI::hide_all_routes)));
1736 items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiotracks)));
1737 items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiotracks)));
1738 items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::show_all_miditracks)));
1739 items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &Mixer_UI::hide_all_miditracks)));
1740 items.push_back (MenuElem (_("Show All Busses"), sigc::mem_fun(*this, &Mixer_UI::show_all_audiobus)));
1741 items.push_back (MenuElem (_("Hide All Busses"), sigc::mem_fun(*this, &Mixer_UI::hide_all_audiobus)));
1746 Mixer_UI::stripable_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Stripable> ws)
1748 if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) {
1752 boost::shared_ptr<Stripable> s = ws.lock ();
1758 TreeModel::Children rows = track_model->children();
1759 TreeModel::Children::iterator i;
1761 for (i = rows.begin(); i != rows.end(); ++i) {
1762 boost::shared_ptr<Stripable> ss = (*i)[stripable_columns.stripable];
1766 if (what_changed.contains (ARDOUR::Properties::name)) {
1767 (*i)[stripable_columns.text] = s->name();
1770 if (what_changed.contains (ARDOUR::Properties::hidden)) {
1771 (*i)[stripable_columns.visible] = !s->presentation_info().hidden();
1772 redisplay_track_list ();
1779 if (s->is_master ()) {
1783 error << _("track display list item for renamed strip not found!") << endmsg;
1787 Mixer_UI::group_display_button_press (GdkEventButton* ev)
1789 TreeModel::Path path;
1790 TreeViewColumn* column;
1794 if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
1795 if (ev->button == 3) {
1796 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1801 TreeIter iter = group_model->get_iter (path);
1803 if (ev->button == 3) {
1804 _group_tabs->get_menu(0)->popup (ev->button, ev->time);
1809 RouteGroup* group = (*iter)[group_columns.group];
1811 if (Keyboard::is_context_menu_event (ev)) {
1812 _group_tabs->get_menu(group)->popup (1, ev->time);
1816 switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
1818 if (Keyboard::is_edit_event (ev)) {
1820 // edit_route_group (group);
1822 group_display.queue_draw();
1831 bool visible = (*iter)[group_columns.visible];
1832 (*iter)[group_columns.visible] = !visible;
1834 group_display.queue_draw();
1847 Mixer_UI::activate_all_route_groups ()
1849 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), true));
1853 Mixer_UI::disable_all_route_groups ()
1855 _session->foreach_route_group (sigc::bind (sigc::mem_fun (*this, &Mixer_UI::set_route_group_activation), false));
1859 Mixer_UI::route_groups_changed ()
1861 ENSURE_GUI_THREAD (*this, &Mixer_UI::route_groups_changed);
1863 _in_group_rebuild_or_clear = true;
1865 /* just rebuild the while thing */
1867 group_model->clear ();
1870 /* this is currently not used,
1871 * Mixer_UI::group_display_button_press() has a case for it,
1872 * and a commented edit_route_group() but that's n/a since 2011.
1874 * This code is left as reminder that
1875 * row[group_columns.group] = 0 has special meaning.
1879 row = *(group_model->append());
1880 row[group_columns.visible] = true;
1881 row[group_columns.text] = (_("-all-"));
1882 row[group_columns.group] = 0;
1886 _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group));
1888 _group_tabs->set_dirty ();
1889 _in_group_rebuild_or_clear = false;
1893 Mixer_UI::new_route_group ()
1895 _group_tabs->run_new_group_dialog (0, false);
1899 Mixer_UI::remove_selected_route_group ()
1901 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1902 TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
1908 TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
1911 /* selection mode is single, so rows.begin() is it */
1913 if ((iter = group_model->get_iter (*i))) {
1915 RouteGroup* rg = (*iter)[group_columns.group];
1918 _session->remove_route_group (*rg);
1924 Mixer_UI::route_group_property_changed (RouteGroup* group, const PropertyChange& change)
1926 if (in_group_row_change) {
1930 /* force an update of any mixer strips that are using this group,
1931 otherwise mix group names don't change in mixer strips
1934 for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
1935 if ((*i)->route_group() == group) {
1936 (*i)->route_group_changed();
1940 TreeModel::iterator i;
1941 TreeModel::Children rows = group_model->children();
1942 Glib::RefPtr<TreeSelection> selection = group_display.get_selection();
1944 in_group_row_change = true;
1946 for (i = rows.begin(); i != rows.end(); ++i) {
1947 if ((*i)[group_columns.group] == group) {
1948 (*i)[group_columns.visible] = !group->is_hidden ();
1949 (*i)[group_columns.text] = group->name ();
1954 in_group_row_change = false;
1956 if (change.contains (Properties::name)) {
1957 _group_tabs->set_dirty ();
1960 for (list<MixerStrip*>::iterator j = strips.begin(); j != strips.end(); ++j) {
1961 if ((*j)->route_group() == group) {
1962 if (group->is_hidden ()) {
1972 Mixer_UI::toggle_mixer_list ()
1974 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleMixerList");
1975 showhide_mixer_list (act->get_active());
1979 Mixer_UI::showhide_mixer_list (bool yn)
1982 list_vpacker.show ();
1984 list_vpacker.hide ();
1989 Mixer_UI::toggle_monitor_section ()
1991 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleMonitorSection");
1992 showhide_monitor_section (act->get_active());
1997 Mixer_UI::showhide_monitor_section (bool yn)
1999 if (monitor_section().tearoff().torn_off()) {
2004 monitor_section().tearoff().show();
2006 monitor_section().tearoff().hide();
2011 Mixer_UI::toggle_vcas ()
2013 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane");
2014 showhide_vcas (act->get_active());
2018 Mixer_UI::showhide_vcas (bool yn)
2029 Mixer_UI::toggle_mixbuses ()
2031 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleMixbusPane");
2032 showhide_mixbuses (act->get_active());
2036 Mixer_UI::showhide_mixbuses (bool on)
2048 Mixer_UI::route_group_name_edit (const std::string& path, const std::string& new_text)
2053 if ((iter = group_model->get_iter (path))) {
2055 if ((group = (*iter)[group_columns.group]) == 0) {
2059 if (new_text != group->name()) {
2060 group->set_name (new_text);
2066 Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter)
2070 if (in_group_row_change) {
2074 if ((group = (*iter)[group_columns.group]) == 0) {
2078 std::string name = (*iter)[group_columns.text];
2080 if (name != group->name()) {
2081 group->set_name (name);
2084 bool hidden = !(*iter)[group_columns.visible];
2086 if (hidden != group->is_hidden ()) {
2087 group->set_hidden (hidden, this);
2091 /** Called when a group model row is deleted, but also when the model is
2092 * reordered by a user drag-and-drop; the latter is what we are
2093 * interested in here.
2096 Mixer_UI::route_group_row_deleted (Gtk::TreeModel::Path const &)
2098 if (_in_group_rebuild_or_clear) {
2102 /* Re-write the session's route group list so that the new order is preserved */
2104 list<RouteGroup*> new_list;
2106 Gtk::TreeModel::Children children = group_model->children();
2107 for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) {
2108 RouteGroup* g = (*i)[group_columns.group];
2110 new_list.push_back (g);
2114 _session->reorder_route_groups (new_list);
2119 Mixer_UI::add_route_group (RouteGroup* group)
2121 ENSURE_GUI_THREAD (*this, &Mixer_UI::add_route_group, group)
2124 in_group_row_change = true;
2126 TreeModel::Row row = *(group_model->append());
2127 row[group_columns.visible] = !group->is_hidden ();
2128 row[group_columns.group] = group;
2129 if (!group->name().empty()) {
2130 row[group_columns.text] = group->name();
2132 row[group_columns.text] = _("unnamed");
2136 group->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::route_group_property_changed, this, group, _1), gui_context());
2139 TreeViewColumn* col = group_display.get_column (0);
2140 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (1));
2141 group_display.set_cursor (group_model->get_path (row), *col, *name_cell, true);
2144 _group_tabs->set_dirty ();
2146 in_group_row_change = false;
2150 Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
2152 using namespace Menu_Helpers;
2154 if (Keyboard::is_context_menu_event (ev)) {
2155 ARDOUR_UI::instance()->add_route ();
2163 Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint time)
2165 if (data.get_target() != "PluginFavoritePtr") {
2166 context->drag_finish (false, false, time);
2170 const void * d = data.get_data();
2171 const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>* tv = reinterpret_cast<const Gtkmm2ext::DnDTreeView<ARDOUR::PluginPresetPtr>*>(d);
2173 PluginPresetList nfos;
2175 tv->get_object_drag_data (nfos, &source);
2177 Route::ProcessorList pl;
2180 for (list<PluginPresetPtr>::const_iterator i = nfos.begin(); i != nfos.end(); ++i) {
2181 PluginPresetPtr ppp = (*i);
2182 PluginInfoPtr pip = ppp->_pip;
2183 if (!pip->is_instrument ()) {
2186 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);
2190 context->drag_finish (ok, false, time);
2194 Mixer_UI::set_strip_width (Width w, bool save)
2198 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2199 (*i)->set_width_enum (w, save ? (*i)->width_owner() : this);
2204 struct PluginStateSorter {
2206 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2207 std::list<std::string>::const_iterator aiter = std::find(_user.begin(), _user.end(), (*a).unique_id);
2208 std::list<std::string>::const_iterator biter = std::find(_user.begin(), _user.end(), (*b).unique_id);
2209 if (aiter != _user.end() && biter != _user.end()) {
2210 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2212 if (aiter != _user.end()) {
2215 if (biter != _user.end()) {
2218 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2221 PluginStateSorter(std::list<std::string> user) : _user (user) {}
2223 std::list<std::string> _user;
2227 Mixer_UI::set_state (const XMLNode& node, int version)
2231 Tabbable::set_state (node, version);
2233 if (node.get_property ("narrow-strips", yn)) {
2235 set_strip_width (Narrow);
2237 set_strip_width (Wide);
2241 node.get_property ("show-mixer", _visible);
2244 node.get_property ("maximised", yn);
2246 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Common"), X_("ToggleMaximalMixer"));
2247 bool fs = act && act->get_active();
2249 ActionManager::do_action ("Common", "ToggleMaximalMixer");
2254 node.get_property ("show-mixer-list", yn);
2256 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMixerList"));
2257 /* do it twice to force the change */
2258 act->set_active (!yn);
2259 act->set_active (yn);
2263 node.get_property ("monitor-section-visible", yn);
2265 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMonitorSection"));
2266 /* do it twice to force the change */
2267 act->set_active (!yn);
2268 act->set_active (yn);
2272 node.get_property ("show-vca-pane", yn);
2274 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleVCAPane"));
2275 /* do it twice to force the change */
2276 act->set_active (!yn);
2277 act->set_active (yn);
2282 node.get_property ("show-mixbus-pane", yn);
2284 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMixbusPane"));
2285 /* do it twice to force the change */
2286 act->set_active (!yn);
2287 act->set_active (yn);
2291 //check for the user's plugin_order file
2292 XMLNode plugin_order_new(X_("PO"));
2293 if (PluginManager::instance().load_plugin_order_file(plugin_order_new)) {
2294 store_current_favorite_order ();
2295 std::list<string> order;
2296 const XMLNodeList& kids = plugin_order_new.children("PluginInfo");
2297 XMLNodeConstIterator i;
2298 for (i = kids.begin(); i != kids.end(); ++i) {
2299 std::string unique_id;
2300 if ((*i)->get_property ("unique-id", unique_id)) {
2301 order.push_back (unique_id);
2302 if ((*i)->get_property ("expanded", yn)) {
2303 favorite_ui_state[unique_id] = yn;
2307 PluginStateSorter cmp (order);
2308 favorite_order.sort (cmp);
2309 sync_treeview_from_favorite_order ();
2312 //if there is no user file, then use an existing one from instant.xml
2313 //NOTE: if you are loading an old session, this might come from the session's instant.xml
2314 //Todo: in the next major version, we should probably stop doing the instant.xml check, and just use the new file
2315 XMLNode* plugin_order;
2316 if ((plugin_order = find_named_node (node, "PluginOrder")) != 0) {
2317 store_current_favorite_order ();
2318 std::list<string> order;
2319 const XMLNodeList& kids = plugin_order->children("PluginInfo");
2320 XMLNodeConstIterator i;
2321 for (i = kids.begin(); i != kids.end(); ++i) {
2322 std::string unique_id;
2323 if ((*i)->get_property ("unique-id", unique_id)) {
2324 order.push_back (unique_id);
2325 if ((*i)->get_property ("expanded", yn)) {
2326 favorite_ui_state[unique_id] = yn;
2331 PluginStateSorter cmp (order);
2332 favorite_order.sort (cmp);
2333 sync_treeview_from_favorite_order ();
2341 Mixer_UI::save_plugin_order_file ()
2343 //this writes the plugin order to the user's preference file ( plugin_metadata/plugin_order )
2345 //NOTE: this replaces the old code that stores info in instant.xml
2346 //why? because instant.xml prefers the per-session settings, and we want this to be a global pref
2348 store_current_favorite_order ();
2349 XMLNode plugin_order ("PluginOrder");
2351 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i, ++cnt) {
2352 XMLNode* p = new XMLNode ("PluginInfo");
2353 p->set_property ("sort", cnt);
2354 p->set_property ("unique-id", (*i)->unique_id);
2355 if (favorite_ui_state.find ((*i)->unique_id) != favorite_ui_state.end ()) {
2356 p->set_property ("expanded", favorite_ui_state[(*i)->unique_id]);
2358 plugin_order.add_child_nocopy (*p);
2360 PluginManager::instance().save_plugin_order_file( plugin_order );
2364 Mixer_UI::get_state ()
2366 XMLNode* node = new XMLNode (X_("Mixer"));
2368 node->add_child_nocopy (Tabbable::get_state());
2370 node->set_property (X_("mixer-rhs-pane1-pos"), rhs_pane1.get_divider());
2371 node->set_property (X_("mixer-rhs_pane2-pos"), rhs_pane2.get_divider());
2372 node->set_property (X_("mixer-list-hpane-pos"), list_hpane.get_divider());
2373 node->set_property (X_("mixer-inner-pane-pos"), inner_pane.get_divider());
2375 node->set_property ("narrow-strips", (_strip_width == Narrow));
2376 node->set_property ("show-mixer", _visible);
2377 node->set_property ("maximised", _maximised);
2379 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleMixerList");
2380 node->set_property ("show-mixer-list", act->get_active ());
2382 act = ActionManager::get_toggle_action ("Mixer", "ToggleMonitorSection");
2383 node->set_property ("monitor-section-visible", act->get_active ());
2385 act = ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane");
2386 node->set_property ("show-vca-pane", act->get_active ());
2389 act = ActionManager::get_toggle_action ("Mixer", "ToggleMixbusPane");
2390 node->set_property ("show-mixbus-pane", act->get_active ());
2397 Mixer_UI::scroll_left ()
2399 if (!scroller.get_hscrollbar()) return;
2400 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2401 int sc_w = scroller.get_width();
2402 int sp_w = strip_packer.get_width();
2406 int lp = adj->get_value();
2408 using namespace Gtk::Box_Helpers;
2409 const BoxList& strips = strip_packer.children();
2410 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2411 if (i->get_widget() == & add_button) {
2415 if (i->get_widget() == &mb_shadow) {
2419 lm += i->get_widget()->get_width ();
2421 lm -= i->get_widget()->get_width ();
2425 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2429 Mixer_UI::scroll_right ()
2431 if (!scroller.get_hscrollbar()) return;
2432 Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
2433 int sc_w = scroller.get_width();
2434 int sp_w = strip_packer.get_width();
2438 int lp = adj->get_value();
2440 using namespace Gtk::Box_Helpers;
2441 const BoxList& strips = strip_packer.children();
2442 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2443 if (i->get_widget() == & add_button) {
2447 if (i->get_widget() == &mb_shadow) {
2451 lm += i->get_widget()->get_width ();
2456 scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2460 Mixer_UI::on_scroll_event (GdkEventScroll* ev)
2462 switch (ev->direction) {
2463 case GDK_SCROLL_LEFT:
2467 if (ev->state & Keyboard::TertiaryModifier) {
2473 case GDK_SCROLL_RIGHT:
2477 case GDK_SCROLL_DOWN:
2478 if (ev->state & Keyboard::TertiaryModifier) {
2489 Mixer_UI::vca_scroll_left ()
2491 if (!vca_scroller.get_hscrollbar()) return;
2492 Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
2493 int sc_w = vca_scroller.get_width();
2494 int sp_w = strip_packer.get_width();
2498 int lp = adj->get_value();
2500 using namespace Gtk::Box_Helpers;
2501 const BoxList& strips = vca_hpacker.children();
2502 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2503 if (i->get_widget() == &add_vca_button) {
2506 lm += i->get_widget()->get_width ();
2508 lm -= i->get_widget()->get_width ();
2512 vca_scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2516 Mixer_UI::vca_scroll_right ()
2518 if (!vca_scroller.get_hscrollbar()) return;
2519 Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
2520 int sc_w = vca_scroller.get_width();
2521 int sp_w = strip_packer.get_width();
2525 int lp = adj->get_value();
2527 using namespace Gtk::Box_Helpers;
2528 const BoxList& strips = vca_hpacker.children();
2529 for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
2530 if (i->get_widget() == &add_vca_button) {
2533 lm += i->get_widget()->get_width ();
2538 vca_scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
2542 Mixer_UI::on_vca_scroll_event (GdkEventScroll* ev)
2544 switch (ev->direction) {
2545 case GDK_SCROLL_LEFT:
2549 if (ev->state & Keyboard::TertiaryModifier) {
2555 case GDK_SCROLL_RIGHT:
2556 vca_scroll_right ();
2559 case GDK_SCROLL_DOWN:
2560 if (ev->state & Keyboard::TertiaryModifier) {
2561 vca_scroll_right ();
2571 Mixer_UI::parameter_changed (string const & p)
2573 if (p == "show-group-tabs") {
2574 bool const s = _session->config.get_show_group_tabs ();
2576 _group_tabs->show ();
2578 _group_tabs->hide ();
2580 } else if (p == "default-narrow_ms") {
2581 bool const s = UIConfiguration::instance().get_default_narrow_ms ();
2582 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2583 (*i)->set_width_enum (s ? Narrow : Wide, this);
2589 Mixer_UI::set_route_group_activation (RouteGroup* g, bool a)
2591 g->set_active (a, this);
2595 Mixer_UI::plugin_selector()
2597 #ifdef DEFER_PLUGIN_SELECTOR_LOAD
2598 if (!_plugin_selector)
2599 _plugin_selector = new PluginSelector (PluginManager::instance());
2602 return _plugin_selector;
2606 Mixer_UI::setup_track_display ()
2608 track_model = ListStore::create (stripable_columns);
2609 track_display.set_model (track_model);
2610 track_display.append_column (_("Show"), stripable_columns.visible);
2611 track_display.append_column (_("Strips"), stripable_columns.text);
2612 track_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
2613 track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
2614 track_display.get_column (0)->set_expand(false);
2615 track_display.get_column (1)->set_expand(true);
2616 track_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
2617 track_display.set_name (X_("EditGroupList"));
2618 track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
2619 track_display.set_reorderable (true);
2620 track_display.set_headers_visible (true);
2621 track_display.set_can_focus(false);
2623 track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete));
2624 track_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_reorder));
2626 CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (0));
2627 track_list_visible_cell->property_activatable() = true;
2628 track_list_visible_cell->property_radio() = false;
2629 track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed));
2631 track_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::track_display_button_press), false);
2633 track_display_scroller.add (track_display);
2634 track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
2636 VBox* v = manage (new VBox);
2638 v->pack_start (track_display_scroller, true, true);
2640 track_display_frame.set_name("BaseFrame");
2641 track_display_frame.set_shadow_type (Gtk::SHADOW_IN);
2642 track_display_frame.add (*v);
2644 track_display_scroller.show();
2645 track_display_frame.show();
2646 track_display.show();
2650 Mixer_UI::new_track_or_bus ()
2652 ARDOUR_UI::instance()->add_route ();
2656 Mixer_UI::update_title ()
2658 if (!own_window()) {
2665 if (_session->snap_name() != _session->name()) {
2666 n = _session->snap_name ();
2668 n = _session->name ();
2671 if (_session->dirty ()) {
2675 WindowTitle title (n);
2676 title += S_("Window|Mixer");
2677 title += Glib::get_application_name ();
2678 own_window()->set_title (title.get_string());
2682 WindowTitle title (S_("Window|Mixer"));
2683 title += Glib::get_application_name ();
2684 own_window()->set_title (title.get_string());
2689 Mixer_UI::strip_by_x (int x)
2691 for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
2694 (*i)->translate_coordinates (_content, 0, 0, x1, y);
2695 x2 = x1 + (*i)->get_width();
2697 if (x >= x1 && x <= x2) {
2706 Mixer_UI::set_axis_targets_for_operation ()
2708 _axis_targets.clear ();
2710 if (!_selection.empty()) {
2711 _axis_targets = _selection.axes;
2715 // removed "implicit" selections of strips, after discussion on IRC
2720 Mixer_UI::monitor_section_going_away ()
2722 XMLNode* ui_node = Config->extra_xml(X_("UI"));
2724 /* immediate state save.
2726 * Tearoff settings are otherwise only stored during
2727 * save_ardour_state(). The mon-section may or may not
2728 * exist at that point.
2732 XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
2734 tearoff_node->remove_nodes_and_delete (X_("monitor-section"));
2735 XMLNode* t = new XMLNode (X_("monitor-section"));
2736 _monitor_section.tearoff().add_state (*t);
2737 tearoff_node->add_child_nocopy (*t);
2741 monitor_section_detached ();
2742 out_packer.remove (_monitor_section.tearoff());
2746 Mixer_UI::toggle_midi_input_active (bool flip_others)
2748 boost::shared_ptr<RouteList> rl (new RouteList);
2751 set_axis_targets_for_operation ();
2753 for (AxisViewSelection::iterator r = _axis_targets.begin(); r != _axis_targets.end(); ++r) {
2754 boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> ((*r)->stripable());
2758 onoff = !mt->input_active();
2762 _session->set_exclusive_input_active (rl, onoff, flip_others);
2766 Mixer_UI::maximise_mixer_space ()
2768 if (!own_window()) {
2776 _window->fullscreen ();
2781 Mixer_UI::restore_mixer_space ()
2783 if (!own_window()) {
2791 own_window()->unfullscreen();
2796 Mixer_UI::monitor_section_attached ()
2798 Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleMonitorSection");
2799 act->set_sensitive (true);
2800 showhide_monitor_section (act->get_active ());
2804 Mixer_UI::monitor_section_detached ()
2806 Glib::RefPtr<Action> act = ActionManager::get_action ("Mixer", "ToggleMonitorSection");
2807 act->set_sensitive (false);
2811 Mixer_UI::store_current_favorite_order ()
2813 typedef Gtk::TreeModel::Children type_children;
2814 type_children children = favorite_plugins_model->children();
2815 favorite_order.clear();
2816 for(type_children::iterator iter = children.begin(); iter != children.end(); ++iter)
2818 Gtk::TreeModel::Row row = *iter;
2819 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2820 favorite_order.push_back (ppp->_pip);
2821 std::string name = row[favorite_plugins_columns.name];
2822 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2827 Mixer_UI::save_favorite_ui_state (const TreeModel::iterator& iter, const TreeModel::Path& path)
2829 Gtk::TreeModel::Row row = *iter;
2830 ARDOUR::PluginPresetPtr ppp = row[favorite_plugins_columns.plugin];
2832 favorite_ui_state[(*ppp->_pip).unique_id] = favorite_plugins_display.row_expanded (favorite_plugins_model->get_path(iter));
2836 Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs)
2838 PluginManager& manager (PluginManager::instance());
2839 for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
2841 /* not a Favorite? skip it */
2842 if (manager.get_status (*i) != PluginManager::Favorite) {
2846 /* Check the tag combo selection, and skip this plugin if it doesn't match the selected tag(s) */
2847 string test = favorite_plugins_tag_combo.get_active_text();
2848 if (test != _("Show All")) {
2849 vector<string> tags = manager.get_tags(*i);
2851 //does the selected tag match any of the tags in the plugin?
2852 vector<string>::iterator tt = find (tags.begin(), tags.end(), test);
2853 if (tt == tags.end()) {
2858 result.push_back (*i);
2862 struct PluginCustomSorter {
2864 bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
2865 PluginInfoList::const_iterator aiter = _user.begin();
2866 PluginInfoList::const_iterator biter = _user.begin();
2867 while (aiter != _user.end()) { if ((*aiter)->unique_id == a->unique_id) { break; } ++aiter; }
2868 while (biter != _user.end()) { if ((*biter)->unique_id == b->unique_id) { break; } ++biter; }
2870 if (aiter != _user.end() && biter != _user.end()) {
2871 return std::distance (_user.begin(), aiter) < std::distance (_user.begin(), biter);
2873 if (aiter != _user.end()) {
2876 if (biter != _user.end()) {
2879 return ARDOUR::cmp_nocase((*a).name, (*b).name) == -1;
2881 PluginCustomSorter(PluginInfoList user) : _user (user) {}
2883 PluginInfoList _user;
2887 Mixer_UI::refill_favorite_plugins ()
2889 PluginInfoList plugs;
2890 PluginManager& mgr (PluginManager::instance());
2893 refiller (plugs, mgr.lv2_plugin_info ());
2895 #ifdef WINDOWS_VST_SUPPORT
2896 refiller (plugs, mgr.windows_vst_plugin_info ());
2898 #ifdef LXVST_SUPPORT
2899 refiller (plugs, mgr.lxvst_plugin_info ());
2901 #ifdef MACVST_SUPPORT
2902 refiller (plugs, mgr.mac_vst_plugin_info ());
2904 #ifdef AUDIOUNIT_SUPPORT
2905 refiller (plugs, mgr.au_plugin_info ());
2907 refiller (plugs, mgr.ladspa_plugin_info ());
2908 refiller (plugs, mgr.lua_plugin_info ());
2910 store_current_favorite_order ();
2912 PluginCustomSorter cmp (favorite_order);
2915 favorite_order = plugs;
2917 sync_treeview_from_favorite_order ();
2921 Mixer_UI::plugin_list_changed ()
2923 refill_favorite_plugins();
2928 Mixer_UI::refill_tag_combo ()
2930 PluginManager& mgr (PluginManager::instance());
2932 std::vector<std::string> tags = mgr.get_all_tags (PluginManager::OnlyFavorites);
2934 favorite_plugins_tag_combo.clear();
2935 favorite_plugins_tag_combo.append_text (_("Show All"));
2937 for (vector<string>::iterator t = tags.begin (); t != tags.end (); ++t) {
2938 favorite_plugins_tag_combo.append_text (*t);
2941 favorite_plugins_tag_combo.set_active_text (_("Show All"));
2945 Mixer_UI::sync_treeview_favorite_ui_state (const TreeModel::Path& path, const TreeModel::iterator&)
2948 if (!(iter = favorite_plugins_model->get_iter (path))) {
2951 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
2955 PluginInfoPtr pip = ppp->_pip;
2956 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2957 if (favorite_ui_state[pip->unique_id]) {
2958 favorite_plugins_display.expand_row (path, true);
2964 Mixer_UI::sync_treeview_from_favorite_order ()
2966 favorite_plugins_model->clear ();
2967 for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i) {
2968 PluginInfoPtr pip = (*i);
2970 TreeModel::Row newrow = *(favorite_plugins_model->append());
2971 newrow[favorite_plugins_columns.name] = (*i)->name;
2972 newrow[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip));
2977 vector<ARDOUR::Plugin::PresetRecord> presets = (*i)->get_presets (true);
2978 for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator j = presets.begin(); j != presets.end(); ++j) {
2982 Gtk::TreeModel::Row child_row = *(favorite_plugins_model->append (newrow.children()));
2983 child_row[favorite_plugins_columns.name] = (*j).label;
2984 child_row[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip, &(*j)));
2986 if (favorite_ui_state.find (pip->unique_id) != favorite_ui_state.end ()) {
2987 if (favorite_ui_state[pip->unique_id]) {
2988 favorite_plugins_display.expand_row (favorite_plugins_model->get_path(newrow), true);
2995 Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
2997 using namespace Gtk::Menu_Helpers;
2999 Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
3000 MenuList& items = m->items ();
3002 if (_selection.axes.empty()) {
3003 items.push_back (MenuElem (_("No Track/Bus is selected.")));
3005 items.push_back (MenuElem (_("Add at the top"),
3006 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
3007 items.push_back (MenuElem (_("Add Pre-Fader"),
3008 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
3009 items.push_back (MenuElem (_("Add Post-Fader"),
3010 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
3011 items.push_back (MenuElem (_("Add at the end"),
3012 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
3015 items.push_back (SeparatorElem());
3017 items.push_back (MenuElem (_("Remove from favorites"), sigc::mem_fun (*this, &Mixer_UI::remove_selected_from_favorites)));
3019 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3020 if (ppp && ppp->_preset.valid && ppp->_preset.user) {
3021 // we cannot currently delete AU presets
3022 if (!ppp->_pip || ppp->_pip->type != AudioUnit) {
3023 items.push_back (MenuElem (_("Delete Preset"), sigc::mem_fun (*this, &Mixer_UI::delete_selected_preset)));
3027 m->popup (ev->button, ev->time);
3031 Mixer_UI::plugin_row_button_press (GdkEventButton *ev)
3033 if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) {
3034 TreeModel::Path path;
3035 TreeViewColumn* column;
3037 if (favorite_plugins_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
3038 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
3040 selection->unselect_all();
3041 selection->select(path);
3044 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3046 popup_note_context_menu (ev);
3054 Mixer_UI::selected_plugin ()
3056 Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
3058 return PluginPresetPtr();
3060 Gtk::TreeModel::iterator iter = selection->get_selected();
3062 return PluginPresetPtr();
3064 return (*iter)[favorite_plugins_columns.plugin];
3068 Mixer_UI::add_selected_processor (ProcessorPosition pos)
3070 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3072 add_favorite_processor (ppp, pos);
3077 Mixer_UI::delete_selected_preset ()
3082 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3083 if (!ppp || !ppp->_preset.valid || !ppp->_preset.user) {
3086 PluginPtr plugin = ppp->_pip->load (*_session);
3087 plugin->get_presets();
3088 plugin->remove_preset (ppp->_preset.label);
3092 Mixer_UI::remove_selected_from_favorites ()
3094 ARDOUR::PluginPresetPtr ppp = selected_plugin();
3098 PluginManager::PluginStatusType status = PluginManager::Normal;
3099 PluginManager& manager (PluginManager::instance());
3101 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3102 manager.save_statuses ();
3106 Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
3109 if (!(iter = favorite_plugins_model->get_iter (path))) {
3112 ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
3113 add_favorite_processor (ppp, AddPreFader); // TODO: preference?!
3117 Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos)
3119 if (!_session || _selection.axes.empty()) {
3123 PluginInfoPtr pip = ppp->_pip;
3124 for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) {
3125 boost::shared_ptr<ARDOUR::Route> rt = boost::dynamic_pointer_cast<ARDOUR::Route> ((*i)->stripable());
3131 PluginPtr p = pip->load (*_session);
3137 if (ppp->_preset.valid) {
3138 p->load_preset (ppp->_preset);
3141 Route::ProcessorStreams err;
3142 boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
3146 rt->add_processor_by_index (processor, 0, &err, Config->get_new_plugins_active ());
3149 rt->add_processor (processor, PreFader, &err, Config->get_new_plugins_active ());
3156 boost::shared_ptr<Processor> np = rt->nth_processor (idx);
3160 if (!np->display_to_user()) {
3163 if (boost::dynamic_pointer_cast<Amp> (np) && // Fader, not Trim
3164 boost::dynamic_pointer_cast<Amp> (np)->gain_control()->parameter().type() == GainAutomation) {
3169 rt->add_processor_by_index (processor, ++pos, &err, Config->get_new_plugins_active ());
3173 rt->add_processor_by_index (processor, -1, &err, Config->get_new_plugins_active ());
3180 PluginTreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest, const Gtk::SelectionData& data) const
3182 if (data.get_target() != "GTK_TREE_MODEL_ROW") {
3186 // only allow to re-order top-level items
3188 if (TreePath::get_from_selection_data (data, src)) {
3189 if (src.up() && src.up()) {
3194 // don't allow to drop as child-rows.
3195 Gtk::TreeModel::Path _dest = dest; // un const
3196 const bool is_child = _dest.up (); // explicit bool for clang
3197 if (!is_child || _dest.empty ()) {
3204 Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
3206 if (data.get_target() != "PluginPresetPtr") {
3209 if (data.get_length() != sizeof (PluginPresetPtr)) {
3212 const void *d = data.get_data();
3213 const PluginPresetPtr ppp = *(static_cast<const PluginPresetPtr*> (d));
3215 PluginManager::PluginStatusType status = PluginManager::Favorite;
3216 PluginManager& manager (PluginManager::instance());
3218 manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
3219 manager.save_statuses ();
3223 Mixer_UI::do_vca_assign (boost::shared_ptr<VCA> vca)
3225 /* call protected MixerActor:: method */
3230 Mixer_UI::do_vca_unassign (boost::shared_ptr<VCA> vca)
3232 /* call protected MixerActor:: method */
3237 Mixer_UI::show_spill (boost::shared_ptr<Stripable> s)
3239 boost::shared_ptr<Stripable> ss = spilled_strip.lock();
3242 show_spill_change (s); /* EMIT SIGNAL */
3244 _group_tabs->hide ();
3246 _group_tabs->show ();
3248 redisplay_track_list ();
3253 Mixer_UI::showing_spill_for (boost::shared_ptr<Stripable> s) const
3255 return s == spilled_strip.lock();
3259 Mixer_UI::register_actions ()
3261 Glib::RefPtr<ActionGroup> group = ActionManager::create_action_group (bindings, X_("Mixer"));
3263 ActionManager::register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::solo_action));
3264 ActionManager::register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::mute_action));
3265 ActionManager::register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::rec_enable_action));
3266 ActionManager::register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_up_action));
3267 ActionManager::register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_down_action));
3268 ActionManager::register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::unity_gain_action));
3271 ActionManager::register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::copy_processors));
3272 ActionManager::register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::cut_processors));
3273 ActionManager::register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::paste_processors));
3274 ActionManager::register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::delete_processors));
3275 ActionManager::register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &Mixer_UI::select_all_processors));
3276 ActionManager::register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::toggle_processors));
3277 ActionManager::register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins));
3278 ActionManager::register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none));
3280 ActionManager::register_action (group, "select-next-stripable", _("Select Next Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_next_strip));
3281 ActionManager::register_action (group, "select-prev-stripable", _("Scroll Previous Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_prev_strip));
3283 ActionManager::register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left));
3284 ActionManager::register_action (group, "scroll-right", _("Scroll Mixer Window to the right"), sigc::mem_fun (*this, &Mixer_UI::scroll_right));
3286 ActionManager::register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
3287 sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_midi_input_active), false));
3289 ActionManager::register_toggle_action (group, X_("ToggleMixerList"), _("Mixer: Show Mixer List"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixer_list));
3291 ActionManager::register_toggle_action (group, X_("ToggleVCAPane"), _("Mixer: Show VCAs"), sigc::mem_fun (*this, &Mixer_UI::toggle_vcas));
3294 ActionManager::register_toggle_action (group, X_("ToggleMixbusPane"), _("Mixer: Show Mixbusses"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixbuses));
3297 ActionManager::register_toggle_action (group, X_("ToggleMonitorSection"), _("Mixer: Show Monitor Section"), sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_section));
3301 Mixer_UI::load_bindings ()
3303 bindings = Bindings::get_bindings (X_("Mixer"));
3306 template<class T> void
3307 Mixer_UI::control_action (boost::shared_ptr<T> (Stripable::*get_control)() const)
3309 boost::shared_ptr<ControlList> cl (new ControlList);
3310 boost::shared_ptr<AutomationControl> ac;
3312 bool have_val = false;
3314 set_axis_targets_for_operation ();
3316 BOOST_FOREACH(AxisView* r, _axis_targets) {
3317 boost::shared_ptr<Stripable> s = r->stripable();
3319 ac = (s.get()->*get_control)();
3323 val = !ac->get_value();
3330 _session->set_controls (cl, val, Controllable::UseGroup);
3334 Mixer_UI::solo_action ()
3336 control_action (&Stripable::solo_control);
3340 Mixer_UI::mute_action ()
3342 control_action (&Stripable::mute_control);
3346 Mixer_UI::rec_enable_action ()
3348 control_action (&Stripable::rec_enable_control);
3351 AutomationControlSet
3352 Mixer_UI::selected_gaincontrols ()
3354 set_axis_targets_for_operation ();
3355 AutomationControlSet rv;
3356 BOOST_FOREACH(AxisView* r, _axis_targets) {
3357 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3359 boost::shared_ptr<GainControl> ac (ms->route()->gain_control());
3360 ControlList cl (ac->grouped_controls());
3361 for (ControlList::const_iterator c = cl.begin(); c != cl.end (); ++c) {
3371 Mixer_UI::step_gain_up_action ()
3373 AutomationControlSet acs = selected_gaincontrols ();
3374 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3375 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3377 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) + 0.1), Controllable::NoGroup);
3382 Mixer_UI::step_gain_down_action ()
3384 AutomationControlSet acs = selected_gaincontrols ();
3385 for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) {
3386 boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i);
3388 ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) - 0.1), Controllable::NoGroup);
3393 Mixer_UI::unity_gain_action ()
3395 set_axis_targets_for_operation ();
3397 BOOST_FOREACH(AxisView* r, _axis_targets) {
3398 boost::shared_ptr<Stripable> s = r->stripable();
3400 boost::shared_ptr<AutomationControl> ac = s->gain_control();
3402 ac->set_value (1.0, Controllable::UseGroup);
3409 Mixer_UI::copy_processors ()
3411 set_axis_targets_for_operation ();
3413 BOOST_FOREACH(AxisView* r, _axis_targets) {
3414 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3416 ms->copy_processors ();
3421 Mixer_UI::cut_processors ()
3423 set_axis_targets_for_operation ();
3425 BOOST_FOREACH(AxisView* r, _axis_targets) {
3426 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3428 ms->cut_processors ();
3433 Mixer_UI::paste_processors ()
3435 set_axis_targets_for_operation ();
3437 BOOST_FOREACH(AxisView* r, _axis_targets) {
3438 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3440 ms->paste_processors ();
3445 Mixer_UI::select_all_processors ()
3447 set_axis_targets_for_operation ();
3449 BOOST_FOREACH(AxisView* r, _axis_targets) {
3450 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3452 ms->select_all_processors ();
3457 Mixer_UI::toggle_processors ()
3459 set_axis_targets_for_operation ();
3461 BOOST_FOREACH(AxisView* r, _axis_targets) {
3462 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3464 ms->toggle_processors ();
3469 Mixer_UI::ab_plugins ()
3471 set_axis_targets_for_operation ();
3473 BOOST_FOREACH(AxisView* r, _axis_targets) {
3474 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3482 Mixer_UI::vca_assign (boost::shared_ptr<VCA> vca)
3484 set_axis_targets_for_operation ();
3485 BOOST_FOREACH(AxisView* r, _axis_targets) {
3486 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3488 ms->vca_assign (vca);
3494 Mixer_UI::vca_unassign (boost::shared_ptr<VCA> vca)
3496 set_axis_targets_for_operation ();
3497 BOOST_FOREACH(AxisView* r, _axis_targets) {
3498 MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
3500 ms->vca_unassign (vca);