X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmixer_ui.cc;h=4c5d60d6c753c27479b2a7efe9df713f6c8ae532;hb=addbc86874f612898af48af8c2163d0fb54da545;hp=97485d162e19e3472ddb42e53b52e9bd28562201;hpb=b4c43f08785b8b971d09a1f543415e81395f4231;p=ardour.git diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 97485d162e..4c5d60d6c7 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -25,6 +25,8 @@ #include #include +#include + #include #include "pbd/convert.h" @@ -42,10 +44,10 @@ #include "ardour/amp.h" #include "ardour/debug.h" +#include "ardour/audio_track.h" #include "ardour/midi_track.h" #include "ardour/plugin_manager.h" #include "ardour/route_group.h" -#include "ardour/route_sorters.h" #include "ardour/session.h" #include "ardour/vca.h" #include "ardour/vca_manager.h" @@ -56,6 +58,7 @@ #include "monitor_section.h" #include "plugin_selector.h" #include "public_editor.h" +#include "mouse_cursors.h" #include "ardour_ui.h" #include "prompter.h" #include "utils.h" @@ -63,11 +66,12 @@ #include "actions.h" #include "gui_thread.h" #include "mixer_group_tabs.h" +#include "route_sorter.h" #include "timers.h" #include "ui_config.h" #include "vca_master_strip.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace ARDOUR_UI_UTILS; @@ -103,16 +107,16 @@ Mixer_UI::Mixer_UI () , ignore_reorder (false) , _in_group_rebuild_or_clear (false) , _route_deletion_in_progress (false) - , _following_editor_selection (false) , _maximised (false) , _show_mixer_list (true) + , myactions (X_("mixer")) { - Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_order_keys, this), gui_context()); - - /* bindings was already set in MixerActor constructor */ - + register_actions (); + load_bindings (); _content.set_data ("ardour-bindings", bindings); + PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context()); + scroller.set_can_default (true); // set_default (scroller); @@ -132,9 +136,12 @@ Mixer_UI::Mixer_UI () _group_tabs = new MixerGroupTabs (this); VBox* b = manage (new VBox); + b->set_spacing (0); + b->set_border_width (0); b->pack_start (*_group_tabs, PACK_SHRINK); b->pack_start (strip_packer); b->show_all (); + b->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false); scroller.add (*b); scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC); @@ -143,12 +150,13 @@ Mixer_UI::Mixer_UI () group_model = ListStore::create (group_columns); group_display.set_model (group_model); - group_display.append_column (_("Group"), group_columns.text); group_display.append_column (_("Show"), group_columns.visible); + group_display.append_column (_("Group"), group_columns.text); group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); - group_display.get_column (0)->set_expand(true); - group_display.get_column (1)->set_expand(false); + group_display.get_column (0)->set_expand(false); + group_display.get_column (1)->set_expand(true); + group_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); group_display.set_name ("EditGroupList"); group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE); group_display.set_reorderable (true); @@ -158,13 +166,13 @@ Mixer_UI::Mixer_UI () /* name is directly editable */ - CellRendererText* name_cell = dynamic_cast(group_display.get_column_cell_renderer (0)); + CellRendererText* name_cell = dynamic_cast(group_display.get_column_cell_renderer (1)); name_cell->property_editable() = true; name_cell->signal_edited().connect (sigc::mem_fun (*this, &Mixer_UI::route_group_name_edit)); /* use checkbox for the active column */ - CellRendererToggle* active_cell = dynamic_cast(group_display.get_column_cell_renderer (1)); + CellRendererToggle* active_cell = dynamic_cast(group_display.get_column_cell_renderer (0)); active_cell->property_activatable() = true; active_cell->property_radio() = false; @@ -219,6 +227,7 @@ Mixer_UI::Mixer_UI () favorite_plugins_display.set_headers_visible (true); favorite_plugins_display.set_rules_hint (true); favorite_plugins_display.set_can_focus (false); + favorite_plugins_display.set_tooltip_column (0); favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr"); favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index()); favorite_plugins_display.add_drop_targets (target_list); @@ -236,33 +245,71 @@ Mixer_UI::Mixer_UI () favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN); favorite_plugins_frame.add (favorite_plugins_scroller); - rhs_pane1.pack1 (favorite_plugins_frame, false, true); - rhs_pane1.pack2 (track_display_frame); - rhs_pane2.pack1 (rhs_pane1); - rhs_pane2.pack2 (group_display_frame); + rhs_pane1.add (favorite_plugins_frame); + rhs_pane1.add (track_display_frame); + + rhs_pane2.add (rhs_pane1); + rhs_pane2.add (group_display_frame); list_vpacker.pack_start (rhs_pane2, true, true); - vca_scroller.add (vca_packer); + vca_label_bar.set_size_request (-1, 16 + 1); /* must match height in GroupTabs::set_size_request() + 1 border px*/ + vca_vpacker.pack_start (vca_label_bar, false, false); + + vca_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); + vca_scroller_base.set_name (X_("MixerWindow")); + vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false); + vca_hpacker.pack_end (vca_scroller_base, true, true); + + vca_scroller.add (vca_hpacker); vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC); + vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release)); - inner_pane.pack1 (scroller); - inner_pane.pack2 (vca_scroller); + vca_vpacker.pack_start (vca_scroller, true, true); + + inner_pane.add (scroller); + inner_pane.add (vca_vpacker); global_hpacker.pack_start (inner_pane, true, true); global_hpacker.pack_start (out_packer, false, false); - list_hpane.pack1(list_vpacker, false, true); - list_hpane.pack2(global_hpacker, true, false); + list_hpane.set_check_divider_position (true); + list_hpane.add (list_vpacker); + list_hpane.add (global_hpacker); + list_hpane.set_child_minsize (list_vpacker, 1); + + + XMLNode const * settings = ARDOUR_UI::instance()->mixer_settings(); + float fract; + + { + LocaleGuard lg; + + if (!settings || !settings->get_property ("mixer-rhs-pane1-pos", fract) || fract > 1.0) { + fract = 0.6f; + } + rhs_pane1.set_divider (0, fract); - rhs_pane1.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler), - static_cast (&rhs_pane1))); - rhs_pane2.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler), - static_cast (&rhs_pane2))); - list_hpane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler), - static_cast (&list_hpane))); - inner_pane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler), - static_cast (&inner_pane))); + if (!settings || !settings->get_property ("mixer-rhs-pane2-pos", fract) || fract > 1.0) { + fract = 0.7f; + } + rhs_pane2.set_divider (0, fract); + + if (!settings || !settings->get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) { + fract = 0.2f; + } + list_hpane.set_divider (0, fract); + + if (!settings || !settings->get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) { + fract = 0.8f; + } + inner_pane.set_divider (0, fract); + } + + rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down); + rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down); + list_hpane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right); + inner_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right); _content.pack_start (list_hpane, true, true); @@ -291,9 +338,13 @@ Mixer_UI::Mixer_UI () rhs_pane1.show(); rhs_pane2.show(); strip_packer.show(); - inner_pane.show (); + inner_pane.show(); vca_scroller.show(); - vca_packer.show(); + vca_vpacker.show(); + vca_hpacker.show(); + vca_label_bar.show(); + vca_label.show(); + vca_scroller_base.show(); out_packer.show(); list_hpane.show(); group_display.show(); @@ -301,6 +352,10 @@ Mixer_UI::Mixer_UI () MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context()); + /* handle escape */ + + ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context()); + #ifndef DEFER_PLUGIN_SELECTOR_LOAD _plugin_selector = new PluginSelector (PluginManager::instance ()); #else @@ -318,12 +373,13 @@ Mixer_UI::~Mixer_UI () delete _monitor_section; } delete _plugin_selector; + delete track_menu; } void -Mixer_UI::track_editor_selection () +Mixer_UI::escape () { - PublicEditor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &Mixer_UI::follow_editor_selection)); + select_none (); } Gtk::Window* @@ -333,14 +389,16 @@ Mixer_UI::use_own_window (bool and_fill_it) Gtk::Window* win = Tabbable::use_own_window (and_fill_it); - if (win && new_window) { win->set_name ("MixerWindow"); ARDOUR_UI::instance()->setup_toplevel_window (*win, _("Mixer"), this); - win->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false); win->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win)); win->set_data ("ardour-bindings", bindings); update_title (); + if (!win->get_focus()) { + /* set focus widget to something, anything */ + win->set_focus (scroller); + } } return win; @@ -355,13 +413,13 @@ Mixer_UI::show_window () parameter_changed ("show-group-tabs"); /* now reset each strips width so the right widgets are shown */ - MixerStrip* ms; TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator ri; for (ri = rows.begin(); ri != rows.end(); ++ri) { - ms = (*ri)[track_columns.strip]; + AxisView* av = (*ri)[stripable_columns.strip]; + MixerStrip* ms = dynamic_cast (av); if (!ms) { continue; } @@ -374,24 +432,6 @@ Mixer_UI::show_window () scroller_base.grab_focus (); } -void -Mixer_UI::add_masters (VCAList& vcas) -{ - for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { - - VCAMasterStrip* vms = new VCAMasterStrip (_session, *v); - - TreeModel::Row row = *(track_model->append()); - row[track_columns.text] = (*v)->name(); - row[track_columns.visible] = true; - row[track_columns.vca] = vms; - - vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context()); - } - - redisplay_track_list (); -} - void Mixer_UI::remove_master (VCAMasterStrip* vms) { @@ -404,7 +444,7 @@ Mixer_UI::remove_master (VCAMasterStrip* vms) TreeModel::Children::iterator ri; for (ri = rows.begin(); ri != rows.end(); ++ri) { - if ((*ri)[track_columns.vca] == vms) { + if ((*ri)[stripable_columns.strip] == vms) { PBD::Unwinder uw (_route_deletion_in_progress, true); track_model->erase (ri); break; @@ -412,107 +452,172 @@ Mixer_UI::remove_master (VCAMasterStrip* vms) } } +bool +Mixer_UI::masters_scroller_button_release (GdkEventButton* ev) +{ + using namespace Menu_Helpers; + + if (Keyboard::is_context_menu_event (ev)) { + ARDOUR_UI::instance()->add_route (); + return true; + } + + return false; +} + +void +Mixer_UI::add_masters (VCAList& vlist) +{ + StripableList sl; + + for (VCAList::iterator v = vlist.begin(); v != vlist.end(); ++v) { + sl.push_back (boost::dynamic_pointer_cast (*v)); + } + + add_stripables (sl); +} + void -Mixer_UI::add_strips (RouteList& routes) +Mixer_UI::add_routes (RouteList& rlist) +{ + StripableList sl; + + for (RouteList::iterator r = rlist.begin(); r != rlist.end(); ++r) { + sl.push_back (*r); + } + + add_stripables (sl); +} + +void +Mixer_UI::add_stripables (StripableList& slist) { Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end(); + bool from_scratch = (track_model->children().size() == 0); uint32_t nroutes = 0; + slist.sort (StripablePresentationInfoSorter()); + for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) { - boost::shared_ptr r = (*it)[track_columns.route]; + boost::shared_ptr s = (*it)[stripable_columns.stripable]; - if (!r) { + if (!s) { continue; } nroutes++; - if (r->order_key() == (routes.front()->order_key() + routes.size())) { + if (s->presentation_info().order() == (slist.front()->presentation_info().order() + slist.size())) { insert_iter = it; break; } } - if (nroutes) { - _selection.clear_routes (); - } - MixerStrip* strip; try { - no_track_list_redisplay = true; + PBD::Unwinder uw (no_track_list_redisplay, true); + track_display.set_model (Glib::RefPtr()); - for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { - boost::shared_ptr route = (*x); + for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) { - if (route->is_auditioner()) { - continue; - } + boost::shared_ptr route; + boost::shared_ptr vca; - if (route->is_monitor()) { + if ((vca = boost::dynamic_pointer_cast (*s))) { - if (!_monitor_section) { - _monitor_section = new MonitorSection (_session); + VCAMasterStrip* vms = new VCAMasterStrip (_session, vca); - XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section")); - if (mnode) { - _monitor_section->tearoff().set_state (*mnode); - } + TreeModel::Row row = *(track_model->append()); + + row[stripable_columns.text] = vca->name(); + row[stripable_columns.visible] = vms->marked_for_display (); + row[stripable_columns.strip] = vms; + row[stripable_columns.stripable] = vca; + + vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context()); + + } else if ((route = boost::dynamic_pointer_cast (*s))) { + + if (route->is_auditioner()) { + continue; } - out_packer.pack_end (_monitor_section->tearoff(), false, false); - _monitor_section->set_session (_session); - _monitor_section->tearoff().show_all (); + if (route->is_monitor()) { + + if (!_monitor_section) { + _monitor_section = new MonitorSection (_session); - _monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached)); - _monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached)); + XMLNode* mnode = ARDOUR_UI::instance()->tearoff_settings (X_("monitor-section")); + if (mnode) { + _monitor_section->tearoff().set_state (*mnode); + } + } - monitor_section_attached (); + out_packer.pack_end (_monitor_section->tearoff(), false, false); + _monitor_section->set_session (_session); + _monitor_section->tearoff().show_all (); - route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context()); + _monitor_section->tearoff().Detach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_detached)); + _monitor_section->tearoff().Attach.connect (sigc::mem_fun(*this, &Mixer_UI::monitor_section_attached)); - /* no regular strip shown for control out */ + monitor_section_attached (); - continue; - } + route->DropReferences.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::monitor_section_going_away, this), gui_context()); + + /* no regular strip shown for control out */ - strip = new MixerStrip (*this, _session, route); - strips.push_back (strip); + continue; + } - UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; + strip = new MixerStrip (*this, _session, route); + strips.push_back (strip); - if (strip->width_owner() != strip) { - strip->set_width_enum (_strip_width, this); - } + UIConfiguration::instance().get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; - show_strip (strip); + if (strip->width_owner() != strip) { + strip->set_width_enum (_strip_width, this); + } - TreeModel::Row row = *(track_model->insert(insert_iter)); - row[track_columns.text] = route->name(); - row[track_columns.visible] = strip->route()->is_master() ? true : strip->marked_for_display(); - row[track_columns.route] = route; - row[track_columns.strip] = strip; - row[track_columns.vca] = 0; + show_strip (strip); - if (nroutes != 0) { - _selection.add (strip); - } + if (!route->is_master()) { - route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context()); + TreeModel::Row row = *(track_model->insert (insert_iter)); - strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed)); - strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip)); + row[stripable_columns.text] = route->name(); + row[stripable_columns.visible] = strip->marked_for_display(); + row[stripable_columns.stripable] = route; + row[stripable_columns.strip] = strip; + + } else { + + out_packer.pack_start (*strip, false, false); + strip->set_packed (true); + } + + strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed)); + strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip)); + } + + (*s)->presentation_info().PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr(*s)), gui_context()); + (*s)->PropertyChanged.connect (*this, invalidator(*this), boost::bind (&Mixer_UI::stripable_property_changed, this, _1, boost::weak_ptr(*s)), gui_context()); } } catch (const std::exception& e) { error << string_compose (_("Error adding GUI elements for new tracks/busses %1"), e.what()) << endmsg; } - no_track_list_redisplay = false; track_display.set_model (track_model); - sync_order_keys_from_treeview (); + /* catch up on selection state, which we left to the editor to set */ + sync_treeview_from_presentation_info (PropertyChange (Properties::selected)); + + if (!from_scratch) { + sync_presentation_info_from_treeview (); + } + redisplay_track_list (); } @@ -567,7 +672,7 @@ Mixer_UI::remove_strip (MixerStrip* strip) } for (ri = rows.begin(); ri != rows.end(); ++ri) { - if ((*ri)[track_columns.strip] == strip) { + if ((*ri)[stripable_columns.strip] == strip) { PBD::Unwinder uw (_route_deletion_in_progress, true); track_model->erase (ri); break; @@ -576,67 +681,20 @@ Mixer_UI::remove_strip (MixerStrip* strip) } void -Mixer_UI::reset_remote_control_ids () +Mixer_UI::presentation_info_changed (PropertyChange const & what_changed) { - if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) { - return; - } - - TreeModel::Children rows = track_model->children(); + PropertyChange soh; + soh.add (Properties::selected); + soh.add (Properties::order); + soh.add (Properties::hidden); - if (rows.empty()) { - return; - } - - DEBUG_TRACE (DEBUG::OrderKeys, "mixer resets remote control ids after remote model change\n"); - - TreeModel::Children::iterator ri; - bool rid_change = false; - uint32_t rid = 1; - uint32_t invisible_key = UINT32_MAX; - - for (ri = rows.begin(); ri != rows.end(); ++ri) { - - /* skip two special values */ - - if (rid == Route::MasterBusRemoteControlID) { - rid++; - } - - if (rid == Route::MonitorBusRemoteControlID) { - rid++; - } - - boost::shared_ptr route = (*ri)[track_columns.route]; - bool visible = (*ri)[track_columns.visible]; - - if (!route) { - continue; - } - - if (!route->is_master() && !route->is_monitor()) { - - uint32_t new_rid = (visible ? rid : invisible_key--); - - if (new_rid != route->remote_control_id()) { - route->set_remote_control_id_explicit (new_rid); - rid_change = true; - } - - if (visible) { - rid++; - } - } - } - - if (rid_change) { - /* tell the world that we changed the remote control IDs */ - _session->notify_remote_id_change (); + if (what_changed.contains (soh)) { + sync_treeview_from_presentation_info (what_changed); } } void -Mixer_UI::sync_order_keys_from_treeview () +Mixer_UI::sync_presentation_info_from_treeview () { if (ignore_reorder || !_session || _session->deletion_in_progress()) { return; @@ -648,67 +706,100 @@ Mixer_UI::sync_order_keys_from_treeview () return; } - DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync order keys from model\n"); + DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync presentation info from treeview\n"); TreeModel::Children::iterator ri; - bool changed = false; - bool rid_change = false; + bool change = false; uint32_t order = 0; - uint32_t rid = 1; - uint32_t invisible_key = UINT32_MAX; + + OrderingKeys sorted; + const size_t cmp_max = rows.size (); + + // special case master if it's got PI order 0 lets keep it there + if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) { + order++; + } + + PresentationInfo::ChangeSuspender cs; for (ri = rows.begin(); ri != rows.end(); ++ri) { - boost::shared_ptr route = (*ri)[track_columns.route]; - bool visible = (*ri)[track_columns.visible]; + bool visible = (*ri)[stripable_columns.visible]; + boost::shared_ptr stripable = (*ri)[stripable_columns.stripable]; - if (!route) { + if (!stripable) { continue; } - uint32_t old_key = route->order_key (); + /* Monitor and Auditioner do not get their presentation + * info reset here. + */ - if (order != old_key) { - route->set_order_key (order); - changed = true; + if (stripable->is_monitor() || stripable->is_auditioner()) { + continue; } - if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) { - - uint32_t new_rid = (visible ? rid : invisible_key--); + /* Master also doesn't get set here but since the editor allows + * it to be reordered, we need to preserve its ordering. + */ - if (new_rid != route->remote_control_id()) { - route->set_remote_control_id_explicit (new_rid); - rid_change = true; - } + stripable->presentation_info().set_hidden (!visible); - if (visible) { - rid++; - } + // master may not get set here, but if it is zero keep it there + if (stripable->is_master() && (stripable->presentation_info().order() == 0)) { + continue; + } + if (order != stripable->presentation_info().order()) { + stripable->set_presentation_order (order); + change = true; } + sorted.push_back (OrderKeys (order, stripable, cmp_max)); + ++order; } - if (changed) { - /* tell everyone that we changed the mixer sort keys */ - _session->sync_order_keys (); + if (!change) { + // VCA (and Mixbus) special cases according to SortByNewDisplayOrder + uint32_t n = 0; + SortByNewDisplayOrder cmp; + sort (sorted.begin(), sorted.end(), cmp); + for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) { + if (_session->master_out() && (_session->master_out()->presentation_info().order() == n)) { + ++n; + } + if (sr->old_display_order != n) { + change = true; + break; + } + } + if (change) { + n = 0; + for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) { + if (_session->master_out() && (_session->master_out()->presentation_info().order() == n)) { + ++n; + } + if (sr->stripable->presentation_info().order() != n) { + sr->stripable->set_presentation_order (n); + } + } + } } - if (rid_change) { - /* tell the world that we changed the remote control IDs */ - _session->notify_remote_id_change (); + if (change) { + DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n"); + _session->set_dirty(); } } void -Mixer_UI::sync_treeview_from_order_keys () +Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_changed) { if (!_session || _session->deletion_in_progress()) { return; } - DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from order keys.\n"); + DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync model from presentation info.\n"); /* we could get here after either a change in the Mixer or Editor sort * order, but either way, the mixer order keys reflect the intended @@ -725,32 +816,11 @@ Mixer_UI::sync_treeview_from_order_keys () } OrderingKeys sorted; - uint32_t vca_cnt = 0; - uint32_t max_route_order_key = 0; - - /* count number of Routes in track_model (there may be some odd reason - why this is not the same as the number in the session, but here we - care about the track model. - */ - - for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) { - boost::shared_ptr route = (*ri)[track_columns.route]; - if (route) { - max_route_order_key = max (route->order_key(), max_route_order_key); - } - } + const size_t cmp_max = rows.size (); for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) { - boost::shared_ptr route = (*ri)[track_columns.route]; - if (!route) { - /* VCAs need to sort after all routes. We don't display - * them in the same place (March 2016), but we don't - * want them intermixed in the track_model - */ - sorted.push_back (OrderKeys (old_order, max_route_order_key + ++vca_cnt)); - } else { - sorted.push_back (OrderKeys (old_order, route->order_key ())); - } + boost::shared_ptr stripable = (*ri)[stripable_columns.stripable]; + sorted.push_back (OrderKeys (old_order, stripable, cmp_max)); } SortByNewDisplayOrder cmp; @@ -767,9 +837,6 @@ Mixer_UI::sync_treeview_from_order_keys () if (sr->old_display_order != n) { changed = true; } - - DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("MIXER change order from %1 to %2\n", - sr->old_display_order, n)); } if (changed) { @@ -777,43 +844,57 @@ Mixer_UI::sync_treeview_from_order_keys () track_model->reorder (neworder); } + if (what_changed.contains (Properties::selected)) { + + PresentationInfo::ChangeSuspender cs; + + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + boost::shared_ptr stripable = (*i)->stripable(); + if (stripable && stripable->presentation_info().selected()) { + _selection.add (*i); + } else { + _selection.remove (*i); + } + } + + if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll ()) { + move_stripable_into_view ((*_selection.axes.begin())->stripable()); + } + } + redisplay_track_list (); } -void -Mixer_UI::follow_editor_selection () + +MixerStrip* +Mixer_UI::strip_by_route (boost::shared_ptr r) const { - if (_following_editor_selection) { - return; + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->route() == r) { + return (*i); + } } - _following_editor_selection = true; - _selection.block_routes_changed (true); - - TrackSelection& s (PublicEditor::instance().get_selection().tracks); - - _selection.clear_routes (); + return 0; +} - for (TrackViewList::iterator i = s.begin(); i != s.end(); ++i) { - RouteTimeAxisView* rtav = dynamic_cast (*i); - if (rtav) { - MixerStrip* ms = strip_by_route (rtav->route()); - if (ms) { - _selection.add (ms); - } +MixerStrip* +Mixer_UI::strip_by_stripable (boost::shared_ptr s) const +{ + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->stripable() == s) { + return (*i); } } - _following_editor_selection = false; - _selection.block_routes_changed (false); + return 0; } - -MixerStrip* -Mixer_UI::strip_by_route (boost::shared_ptr r) +AxisView* +Mixer_UI::axis_by_stripable (boost::shared_ptr s) const { - for (list::iterator i = strips.begin(); i != strips.end(); ++i) { - if ((*i)->route() == r) { + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->stripable() == s) { return (*i); } } @@ -829,7 +910,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) /* primary-click: toggle selection state of strip */ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { _selection.remove (strip); - } else if (_selection.routes.size() > 1) { + } else if (_selection.axes.size() > 1) { /* de-select others */ _selection.set (strip); } @@ -838,53 +919,62 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) _selection.add (strip); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) { - if (!_selection.selected(strip)) { - - /* extend selection */ - - vector tmp; - bool accumulate = false; - bool found_another = false; - - tmp.push_back (strip); - - for (list::iterator i = strips.begin(); i != strips.end(); ++i) { - if ((*i) == strip) { - /* hit clicked strip, start accumulating till we hit the first - selected strip - */ - if (accumulate) { - /* done */ - break; - } else { - accumulate = true; - } - } else if (_selection.selected (*i)) { - /* hit selected strip. if currently accumulating others, - we're done. if not accumulating others, start doing so. - */ - found_another = true; - if (accumulate) { - /* done */ - break; - } else { - accumulate = true; - } + /* extend selection */ + + vector tmp; + bool accumulate = false; + bool found_another = false; + + OrderingKeys sorted; + const size_t cmp_max = strips.size (); + for (list::iterator i = strips.begin(); i != strips.end(); ++i) { + sorted.push_back (OrderKeys (-1, (*i)->stripable(), cmp_max)); + } + SortByNewDisplayOrder cmp; + sort (sorted.begin(), sorted.end(), cmp); + + for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr) { + MixerStrip* ms = strip_by_stripable (sr->stripable); + assert (ms); + + if (ms == strip) { + /* hit clicked strip, start accumulating till we hit the first + selected strip + */ + if (accumulate) { + /* done */ + break; } else { - if (accumulate) { - tmp.push_back (*i); - } + accumulate = true; } - } - - if (found_another) { - for (vector::iterator i = tmp.begin(); i != tmp.end(); ++i) { - _selection.add (*i); + } else if (_selection.selected (ms)) { + /* hit selected strip. if currently accumulating others, + we're done. if not accumulating others, start doing so. + */ + found_another = true; + if (accumulate) { + /* done */ + break; + } else { + accumulate = true; + } + } else { + if (accumulate) { + tmp.push_back (ms); } - } else - _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet + } } + tmp.push_back (strip); + + if (found_another) { + PresentationInfo::ChangeSuspender cs; + for (vector::iterator i = tmp.begin(); i != tmp.end(); ++i) { + _selection.add (*i); + } + } else { + _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet + } } else { _selection.set (strip); } @@ -905,6 +995,10 @@ Mixer_UI::set_session (Session* sess) _group_tabs->set_session (sess); + if (_monitor_section) { + _monitor_section->set_session (_session); + } + if (!_session) { return; } @@ -918,7 +1012,7 @@ Mixer_UI::set_session (Session* sess) initial_track_display (); - _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_strips, this, _1), gui_context()); + _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_routes, this, _1), gui_context()); _session->route_group_added.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_route_group, this, _1), gui_context()); _session->route_group_removed.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context()); _session->route_groups_reordered.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::route_groups_changed, this), gui_context()); @@ -980,13 +1074,12 @@ Mixer_UI::track_visibility_changed (std::string const & path) TreeIter iter; if ((iter = track_model->get_iter (path))) { - MixerStrip* strip = (*iter)[track_columns.strip]; - if (strip) { - bool visible = (*iter)[track_columns.visible]; - if (strip->set_marked_for_display (!visible)) { - update_track_visibility (); - } + AxisView* av = (*iter)[stripable_columns.strip]; + bool visible = (*iter)[stripable_columns.visible]; + + if (av->set_marked_for_display (!visible)) { + update_track_visibility (); } } } @@ -1001,16 +1094,14 @@ Mixer_UI::update_track_visibility () Unwinder uw (no_track_list_redisplay, true); for (i = rows.begin(); i != rows.end(); ++i) { - MixerStrip *strip = (*i)[track_columns.strip]; - if (strip) { - (*i)[track_columns.visible] = strip->marked_for_display (); - } + AxisView* av = (*i)[stripable_columns.strip]; + (*i)[stripable_columns.visible] = av->marked_for_display (); } - /* force route order keys catch up with visibility changes + /* force presentation catch up with visibility changes */ - sync_order_keys_from_treeview (); + sync_presentation_info_from_treeview (); } redisplay_track_list (); @@ -1024,10 +1115,12 @@ Mixer_UI::show_strip (MixerStrip* ms) for (i = rows.begin(); i != rows.end(); ++i) { - MixerStrip* strip = (*i)[track_columns.strip]; + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); if (strip == ms) { - (*i)[track_columns.visible] = true; - redisplay_track_list (); + (*i)[stripable_columns.visible] = true; + av->set_marked_for_display (true); + update_track_visibility (); break; } } @@ -1041,10 +1134,12 @@ Mixer_UI::hide_strip (MixerStrip* ms) for (i = rows.begin(); i != rows.end(); ++i) { - MixerStrip* strip = (*i)[track_columns.strip]; + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); if (strip == ms) { - (*i)[track_columns.visible] = false; - redisplay_track_list (); + (*i)[stripable_columns.visible] = false; + av->set_marked_for_display (false); + update_track_visibility (); break; } } @@ -1085,8 +1180,8 @@ Mixer_UI::set_all_strips_visibility (bool yn) for (i = rows.begin(); i != rows.end(); ++i) { - TreeModel::Row row = (*i); - MixerStrip* strip = row[track_columns.strip]; + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); if (!strip) { continue; @@ -1096,7 +1191,7 @@ Mixer_UI::set_all_strips_visibility (bool yn) continue; } - (*i)[track_columns.visible] = yn; + (*i)[stripable_columns.visible] = yn; } } @@ -1114,8 +1209,9 @@ Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn) Unwinder uw (no_track_list_redisplay, true); for (i = rows.begin(); i != rows.end(); ++i) { - TreeModel::Row row = (*i); - MixerStrip* strip = row[track_columns.strip]; + + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); if (!strip) { continue; @@ -1130,24 +1226,24 @@ Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn) switch (tracks) { case 0: - (*i)[track_columns.visible] = yn; + (*i)[stripable_columns.visible] = yn; break; case 1: if (at) { /* track */ - (*i)[track_columns.visible] = yn; + (*i)[stripable_columns.visible] = yn; } break; case 2: if (!at && !mt) { /* bus */ - (*i)[track_columns.visible] = yn; + (*i)[stripable_columns.visible] = yn; } break; case 3: if (mt) { /* midi-track */ - (*i)[track_columns.visible] = yn; + (*i)[stripable_columns.visible] = yn; } break; } @@ -1202,12 +1298,11 @@ Mixer_UI::hide_all_miditracks () set_all_audio_midi_visibility (3, false); } - void Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/) { DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n"); - sync_order_keys_from_treeview (); + sync_presentation_info_from_treeview (); } void @@ -1221,7 +1316,7 @@ Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&) */ DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n"); - sync_order_keys_from_treeview (); + sync_presentation_info_from_treeview (); if (_route_deletion_in_progress) { redisplay_track_list (); @@ -1229,63 +1324,130 @@ Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&) } void -Mixer_UI::redisplay_track_list () +Mixer_UI::spill_redisplay (boost::shared_ptr vca) { TreeModel::Children rows = track_model->children(); - TreeModel::Children::iterator i; + std::list > vcas; + vcas.push_back (vca); + + for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) { + AxisView* av = (*i)[stripable_columns.strip]; + VCAMasterStrip* vms = dynamic_cast (av); + if (vms && vms->vca()->slaved_to (vca)) { + vcas.push_back (vms->vca()); + } + } + + for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) { + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); + bool const visible = (*i)[stripable_columns.visible]; + + if (!strip) { + /* we're in the middle of changing a row, don't worry */ + continue; + } + + if (!strip->route()) { + /* non-route element */ + continue; + } + + if (strip->route()->is_master() || strip->route()->is_monitor()) { + continue; + } + + bool slaved = false; + for (std::list >::const_iterator m = vcas.begin(); m != vcas.end(); ++m) { + if (strip->route()->slaved_to (*m)) { + slaved = true; + break; + } + } + + if (slaved && visible) { + + if (strip->packed()) { + strip_packer.reorder_child (*strip, -1); /* put at end */ + } else { + strip_packer.pack_start (*strip, false, false); + strip->set_packed (true); + } + + } else { + + if (strip->packed()) { + strip_packer.remove (*strip); + strip->set_packed (false); + } + } + } +} + +void +Mixer_UI::redisplay_track_list () +{ if (no_track_list_redisplay) { return; } - container_clear (vca_packer); + boost::shared_ptr ss = spilled_strip.lock (); + if (ss) { + boost::shared_ptr sv = boost::dynamic_pointer_cast (ss); + if (sv) { + spill_redisplay (sv); + return; + } + } + + TreeModel::Children rows = track_model->children(); + TreeModel::Children::iterator i; + uint32_t n_masters = 0; + + container_clear (vca_hpacker); + vca_hpacker.pack_end (vca_scroller_base, true, true); for (i = rows.begin(); i != rows.end(); ++i) { - VCAMasterStrip* vms = (*i)[track_columns.vca]; + AxisView* s = (*i)[stripable_columns.strip]; + bool const visible = (*i)[stripable_columns.visible]; + boost::shared_ptr stripable = (*i)[stripable_columns.stripable]; - if (vms) { - vca_packer.pack_start (*vms, false, false); - vms->show (); + if (!s) { + /* we're in the middle of changing a row, don't worry */ continue; } - MixerStrip* strip = (*i)[track_columns.strip]; + VCAMasterStrip* vms; - if (!strip) { - /* we're in the middle of changing a row, don't worry */ + if ((vms = dynamic_cast (s))) { + if (visible) { + vca_hpacker.pack_start (*vms, false, false); + vms->show (); + n_masters++; + } continue; } - bool const visible = (*i)[track_columns.visible]; + MixerStrip* strip = dynamic_cast (s); + + if (!strip) { + continue; + } if (visible) { - strip->set_gui_property ("visible", true); if (strip->packed()) { - - if (strip->route()->is_master() || strip->route()->is_monitor()) { - out_packer.reorder_child (*strip, -1); - - } else { - strip_packer.reorder_child (*strip, -1); /* put at end */ - } - + strip_packer.reorder_child (*strip, -1); /* put at end */ } else { - - if (strip->route()->is_master() || strip->route()->is_monitor()) { - out_packer.pack_start (*strip, false, false); - } else { - strip_packer.pack_start (*strip, false, false); - } + strip_packer.pack_start (*strip, false, false); strip->set_packed (true); } } else { - strip->set_gui_property ("visible", false); - - if (strip->route()->is_master() || strip->route()->is_monitor()) { + if (stripable->is_master() || stripable->is_monitor()) { /* do nothing, these cannot be hidden */ } else { if (strip->packed()) { @@ -1296,6 +1458,16 @@ Mixer_UI::redisplay_track_list () } } + /* update visibility of VCA assign buttons */ + + if (n_masters == 0) { + UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA"))); + vca_vpacker.hide (); + } else { + UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA"))); + vca_vpacker.show (); + } + _group_tabs->set_dirty (); } @@ -1310,13 +1482,14 @@ Mixer_UI::strip_width_changed () long order; for (order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) { - MixerStrip* strip = (*i)[track_columns.strip]; + AxisView* av = (*i)[stripable_columns.strip]; + MixerStrip* strip = dynamic_cast (av); if (strip == 0) { continue; } - bool visible = (*i)[track_columns.visible]; + bool visible = (*i)[stripable_columns.visible]; if (visible) { strip->queue_draw(); @@ -1326,51 +1499,119 @@ Mixer_UI::strip_width_changed () } +struct PresentationInfoMixerSorter +{ + bool operator() (boost::shared_ptr a, boost::shared_ptr b) { + if (a->is_master()) { + /* master after everything else */ + return false; + } else if (b->is_master()) { + /* everything else before master */ + return true; + } + return a->presentation_info().order () < b->presentation_info().order (); + } +}; + void Mixer_UI::initial_track_display () { + StripableList sl; + boost::shared_ptr routes = _session->get_routes(); - RouteList copy (*routes); - ARDOUR::SignalOrderRouteSorter sorter; - copy.sort (sorter); + for (RouteList::iterator r = routes->begin(); r != routes->end(); ++r) { + sl.push_back (*r); + } - { - Unwinder uw1 (no_track_list_redisplay, true); - Unwinder uw2 (ignore_reorder, true); + VCAList vcas = _session->vca_manager().vcas(); - track_model->clear (); - VCAList vcas = _session->vca_manager().vcas(); - add_masters (vcas); - add_strips (copy); + for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { + sl.push_back (boost::dynamic_pointer_cast (*v)); } - _session->sync_order_keys (); + sl.sort (PresentationInfoMixerSorter()); - redisplay_track_list (); -} + { + /* These are also used inside ::add_stripables() but we need + * them here because we're going to clear the track_model also. + */ + Unwinder uw1 (no_track_list_redisplay, true); + Unwinder uw2 (ignore_reorder, true); -void -Mixer_UI::show_track_list_menu () -{ - if (track_menu == 0) { - build_track_menu (); + track_model->clear (); + add_stripables (sl); } - track_menu->popup (1, gtk_get_current_event_time()); + sync_treeview_from_presentation_info (Properties::order); } bool Mixer_UI::track_display_button_press (GdkEventButton* ev) { if (Keyboard::is_context_menu_event (ev)) { - show_track_list_menu (); + if (track_menu == 0) { + build_track_menu (); + } + track_menu->popup (ev->button, ev->time); return true; } + if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 1)) { + TreeModel::Path path; + TreeViewColumn* column; + int cellx, celly; + if (track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + TreeIter iter = track_model->get_iter (path); + if ((*iter)[stripable_columns.visible]) { + boost::shared_ptr s = (*iter)[stripable_columns.stripable]; + move_stripable_into_view (s); + } + } + } return false; } +void +Mixer_UI::move_stripable_into_view (boost::shared_ptr s) +{ + if (!scroller.get_hscrollbar()) { + return; + } + if (s->presentation_info().special () || s->presentation_info().flag_match (PresentationInfo::VCA)) { + return; + } +#ifdef MIXBUS + if (s->mixbus ()) { + return; + } +#endif + bool found = false; + int x0 = 0; + Gtk::Allocation alloc; + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->route() == s) { + int y; + found = true; + (*i)->translate_coordinates (strip_packer, 0, 0, x0, y); + alloc = (*i)->get_allocation (); + break; + } + } + if (!found) { + return; + } + + Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); + + if (x0 < adj->get_value()) { + adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0))); + } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) { + int x1 = x0 + alloc.get_width() - adj->get_page_size(); + adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1))); + } +} + void Mixer_UI::build_track_menu () { @@ -1393,20 +1634,35 @@ Mixer_UI::build_track_menu () } void -Mixer_UI::strip_property_changed (const PropertyChange& what_changed, MixerStrip* mx) +Mixer_UI::stripable_property_changed (const PropertyChange& what_changed, boost::weak_ptr ws) { - if (!what_changed.contains (ARDOUR::Properties::name)) { + if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) { return; } - ENSURE_GUI_THREAD (*this, &Mixer_UI::strip_name_changed, what_changed, mx) + boost::shared_ptr s = ws.lock (); + + if (!s) { + return; + } TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; for (i = rows.begin(); i != rows.end(); ++i) { - if ((*i)[track_columns.strip] == mx) { - (*i)[track_columns.text] = mx->route()->name(); + boost::shared_ptr ss = (*i)[stripable_columns.stripable]; + + if (s == ss) { + + if (what_changed.contains (ARDOUR::Properties::name)) { + (*i)[stripable_columns.text] = s->name(); + } + + if (what_changed.contains (ARDOUR::Properties::hidden)) { + (*i)[stripable_columns.visible] = !s->presentation_info().hidden(); + redisplay_track_list (); + } + return; } } @@ -1423,13 +1679,17 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev) int celly; if (!group_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { - _group_tabs->get_menu(0)->popup (1, ev->time); + if (ev->button == 3) { + _group_tabs->get_menu(0)->popup (ev->button, ev->time); + } return true; } TreeIter iter = group_model->get_iter (path); if (!iter) { - _group_tabs->get_menu(0)->popup (1, ev->time); + if (ev->button == 3) { + _group_tabs->get_menu(0)->popup (ev->button, ev->time); + } return true; } @@ -1441,7 +1701,7 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev) } switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) { - case 0: + case 1: if (Keyboard::is_edit_event (ev)) { if (group) { // edit_route_group (group); @@ -1453,7 +1713,7 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev) } break; - case 1: + case 0: { bool visible = (*iter)[group_columns.visible]; (*iter)[group_columns.visible] = !visible; @@ -1519,9 +1779,7 @@ Mixer_UI::route_groups_changed () void Mixer_UI::new_route_group () { - RouteList rl; - - _group_tabs->run_new_group_dialog (rl); + _group_tabs->run_new_group_dialog (0, false); } void @@ -1602,12 +1860,6 @@ Mixer_UI::show_mixer_list (bool yn) { if (yn) { list_vpacker.show (); - - //if user wants to show the pane, we should make sure that it is wide enough to be visible - int width = list_hpane.get_position(); - if (width < 40) { - list_hpane.set_position(40); - } } else { list_vpacker.hide (); } @@ -1725,7 +1977,7 @@ Mixer_UI::add_route_group (RouteGroup* group) if (focus) { TreeViewColumn* col = group_display.get_column (0); - CellRendererText* name_cell = dynamic_cast(group_display.get_column_cell_renderer (0)); + CellRendererText* name_cell = dynamic_cast(group_display.get_column_cell_renderer (1)); group_display.set_cursor (group_model->get_path (row), *col, *name_cell, true); } @@ -1757,7 +2009,7 @@ Mixer_UI::scroller_drag_data_received (const Glib::RefPtr& con } const void * d = data.get_data(); - const Gtkmm2ext::DnDTreeView* tv = reinterpret_cast*>(d); + const Gtkmm2ext::DnDTreeView* tv = reinterpret_cast*>(d); PluginPresetList nfos; TreeView* source; @@ -1772,7 +2024,7 @@ Mixer_UI::scroller_drag_data_received (const Glib::RefPtr& con if (!pip->is_instrument ()) { continue; } - ARDOUR_UI::instance()->session_add_midi_track (NULL, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0); + ARDOUR_UI::instance()->session_add_midi_track ((RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order); ok = true; } @@ -1815,26 +2067,22 @@ private: int Mixer_UI::set_state (const XMLNode& node, int version) { - XMLProperty const * prop; + LocaleGuard lg; + bool yn; Tabbable::set_state (node, version); - if ((prop = node.property ("narrow-strips"))) { - if (string_is_affirmative (prop->value())) { + if (node.get_property ("narrow-strips", yn)) { + if (yn) { set_strip_width (Narrow); } else { set_strip_width (Wide); } } - if ((prop = node.property ("show-mixer"))) { - if (string_is_affirmative (prop->value())) { - _visible = true; - } - } + node.get_property ("show-mixer", _visible); - if ((prop = node.property ("maximised"))) { - bool yn = string_is_affirmative (prop->value()); + if (node.get_property ("maximised", yn)) { Glib::RefPtr act = ActionManager::get_action (X_("Common"), X_("ToggleMaximalMixer")); assert (act); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -1844,8 +2092,7 @@ Mixer_UI::set_state (const XMLNode& node, int version) } } - if ((prop = node.property ("show-mixer-list"))) { - bool yn = string_is_affirmative (prop->value()); + if (node.get_property ("show-mixer-list", yn)) { Glib::RefPtr act = ActionManager::get_action (X_("Common"), X_("ToggleMixerList")); assert (act); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); @@ -1863,11 +2110,11 @@ Mixer_UI::set_state (const XMLNode& node, int version) const XMLNodeList& kids = plugin_order->children("PluginInfo"); XMLNodeConstIterator i; for (i = kids.begin(); i != kids.end(); ++i) { - if ((prop = (*i)->property ("unique-id"))) { - std::string unique_id = prop->value(); + std::string unique_id; + if ((*i)->get_property ("unique-id", unique_id)) { order.push_back (unique_id); - if ((prop = (*i)->property ("expanded"))) { - favorite_ui_state[unique_id] = string_is_affirmative (prop->value()); + if ((*i)->get_property ("expanded", yn)) { + favorite_ui_state[unique_id] = yn; } } } @@ -1882,33 +2129,29 @@ XMLNode& Mixer_UI::get_state () { XMLNode* node = new XMLNode (X_("Mixer")); - char buf[128]; + LocaleGuard lg; node->add_child_nocopy (Tabbable::get_state()); - snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (rhs_pane1, true)); - node->add_property(X_("mixer-rhs-pane1-pos"), string(buf)); - snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (rhs_pane2, true)); - node->add_property(X_("mixer-rhs_pane2-pos"), string(buf)); - snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (list_hpane, false)); - node->add_property(X_("mixer-list-hpane-pos"), string(buf)); - snprintf(buf,sizeof(buf), "%f", paned_position_as_fraction (inner_pane, false)); - node->add_property(X_("mixer-inner-pane-pos"), string(buf)); + node->set_property (X_("mixer-rhs-pane1-pos"), rhs_pane1.get_divider()); + node->set_property (X_("mixer-rhs_pane2-pos"), rhs_pane2.get_divider()); + node->set_property (X_("mixer-list-hpane-pos"), list_hpane.get_divider()); + node->set_property (X_("mixer-inner-pane-pos"), inner_pane.get_divider()); - node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no"); - node->add_property ("show-mixer", _visible ? "yes" : "no"); - node->add_property ("show-mixer-list", _show_mixer_list ? "yes" : "no"); - node->add_property ("maximised", _maximised ? "yes" : "no"); + node->set_property ("narrow-strips", (_strip_width == Narrow)); + node->set_property ("show-mixer", _visible); + node->set_property ("show-mixer-list", _show_mixer_list); + node->set_property ("maximised", _maximised); store_current_favorite_order (); XMLNode* plugin_order = new XMLNode ("PluginOrder"); - int cnt = 0; + uint32_t cnt = 0; for (PluginInfoList::const_iterator i = favorite_order.begin(); i != favorite_order.end(); ++i, ++cnt) { XMLNode* p = new XMLNode ("PluginInfo"); - p->add_property ("sort", cnt); - p->add_property ("unique-id", (*i)->unique_id); + p->set_property ("sort", cnt); + p->set_property ("unique-id", (*i)->unique_id); if (favorite_ui_state.find ((*i)->unique_id) != favorite_ui_state.end ()) { - p->add_property ("expanded", favorite_ui_state[(*i)->unique_id]); + p->set_property ("expanded", favorite_ui_state[(*i)->unique_id]); } plugin_order->add_child_nocopy (*p); } @@ -1917,156 +2160,28 @@ Mixer_UI::get_state () return *node; } -void -Mixer_UI::pane_allocation_handler (Allocation& allocation, Gtk::Paned* which) -{ - float pos; - XMLProperty* prop = 0; - XMLNode* geometry = ARDOUR_UI::instance()->mixer_settings(); - int height = default_height; - static bool done[4] = { false, false, false, false }; - - /* Gtk::Paned behaves very oddly and rather undesirably. Setting the - * position is a crapshoot if you time it incorrectly with the overall - * sizing of the Paned. For example, if you might retrieve the size with - * ::get_position() and then later call ::set_position() on a Paned at - * a time when its allocation is different than it was when you retrieved - * the position. The position will be interpreted as the size of the - * first (top or left) child widget. If packing/size allocation later - * resizes the Paned to a (final) smaller size, the position will be - * used in ways that mean that the Paned ends up NOT in the same state - * that it was in when you originally saved the position. - * - * Concrete example: Paned is 800 pixels wide, position is 400 - * (halfway). Save position as 400. During program restart, set - * position to 400, before Paned has been allocated any space. Paned - * ends up initially sized to 1200 pixels. Position is now 1/3 of the - * way across/down. Subsequent resizes will leave the position 1/3 of - * the way across, rather than leaving it as a fixed pixel - * position. Eventually, the Paned ends up 800 pixels wide/high again, - * but the position is now 267, not 400. - * - * So ... - * - * We deal with this by using two strategies: - * - * 1) only set the position if the allocated size of the Paned is at - * least as big as it needs to be for the position to make sense. - * - * 2) in recent versions of Ardour, save the position as a fraction, - * and restore it using that fraction. - * - * So, we will only call ::set_position() AFTER the Paned is of a - * sensible size, and then in addition, we will set the position in a - * way that will be maintained as/when/if the Paned is resized. - * - * Once we've called ::set_position() on a Paned, we don't do it - * again. - */ - - if (which == static_cast (&rhs_pane1)) { - - if (done[0]) { - return; - } - - if (!geometry || (prop = geometry->property("mixer-rhs-pane1-pos")) == 0) { - pos = height / 3; - } else { - pos = atof (prop->value()); - } - - if (pos > 1.0f) { - /* older versions of Ardour stored absolute position */ - if ((done[0] = (allocation.get_height() > pos))) { - rhs_pane1.set_position (pos); - } - } else { - if ((done[0] = (allocation.get_height() > 1.0/pos))) { - paned_set_position_as_fraction (rhs_pane1, pos, true); - } - } - } - - if (which == static_cast (&rhs_pane2)) { - - if (done[1]) { - return; - } - - if (!geometry || (prop = geometry->property("mixer-rhs-pane2-pos")) == 0) { - pos = 2 * height / 3; - } else { - pos = atof (prop->value()); - } - - if (pos > 1.0f) { - /* older versions of Ardour stored absolute position */ - if ((done[1] = (allocation.get_height() > pos))) { - rhs_pane2.set_position (pos); - } - } else { - if ((done[1] = (allocation.get_height() > 1.0/pos))) { - paned_set_position_as_fraction (rhs_pane2, pos, true); - } - } - } - - if (which == static_cast (&list_hpane)) { - - if (done[2]) { - return; - } - - if (!geometry || (prop = geometry->property("mixer-list-hpane-pos")) == 0) { - pos = std::max ((float)100, rintf ((float) 125 * UIConfiguration::instance().get_ui_scale())); - } else { - pos = max (0.1, atof (prop->value ())); - } - - if (pos > 1.0f) { - if ((done[2] = (allocation.get_width() > pos))) { - list_hpane.set_position (pos); - } - } else { - if ((done[2] = (allocation.get_width() > 1.0/pos))) { - paned_set_position_as_fraction (list_hpane, pos, false); - } - } - } - - if (which == static_cast (&inner_pane)) { - - if (done[3]) { - return; - } - - if (!geometry || (prop = geometry->property("mixer-inner-pane-pos")) == 0) { - pos = std::max ((float)100, rintf ((float) 125 * UIConfiguration::instance().get_ui_scale())); - } else { - pos = max (0.1, atof (prop->value ())); - } - - if (pos > 1.0f) { - /* older versions of Ardour stored absolute position */ - if ((done[3] = (allocation.get_width() > pos))) { - inner_pane.set_position (pos); - } - } else { - if ((done[3] = (allocation.get_width() > 1.0/pos))) { - paned_set_position_as_fraction (inner_pane, pos, false); - } - } - } -} - void Mixer_UI::scroll_left () { if (!scroller.get_hscrollbar()) return; Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); - /* stupid GTK: can't rely on clamping across versions */ - scroller.get_hscrollbar()->set_value (max (adj->get_lower(), adj->get_value() - adj->get_step_increment())); + int sc_w = scroller.get_width(); + int sp_w = strip_packer.get_width(); + if (sp_w <= sc_w) { + return; + } + int lp = adj->get_value(); + int lm = 0; + using namespace Gtk::Box_Helpers; + const BoxList& strips = strip_packer.children(); + for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) { + lm += i->get_widget()->get_width (); + if (lm >= lp) { + lm -= i->get_widget()->get_width (); + break; + } + } + scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0))); } void @@ -2074,8 +2189,22 @@ Mixer_UI::scroll_right () { if (!scroller.get_hscrollbar()) return; Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); - /* stupid GTK: can't rely on clamping across versions */ - scroller.get_hscrollbar()->set_value (min (adj->get_upper(), adj->get_value() + adj->get_step_increment())); + int sc_w = scroller.get_width(); + int sp_w = strip_packer.get_width(); + if (sp_w <= sc_w) { + return; + } + int lp = adj->get_value(); + int lm = 0; + using namespace Gtk::Box_Helpers; + const BoxList& strips = strip_packer.children(); + for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) { + lm += i->get_widget()->get_width (); + if (lm > lp + 1) { + break; + } + } + scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0))); } bool @@ -2123,8 +2252,6 @@ Mixer_UI::parameter_changed (string const & p) for (list::iterator i = strips.begin(); i != strips.end(); ++i) { (*i)->set_width_enum (s ? Narrow : Wide, this); } - } else if (p == "remote-model") { - reset_remote_control_ids (); } else if (p == "use-monitor-bus") { if (_session && !_session->monitor_out()) { monitor_section_detached (); @@ -2152,15 +2279,15 @@ Mixer_UI::plugin_selector() void Mixer_UI::setup_track_display () { - track_model = ListStore::create (track_columns); + track_model = ListStore::create (stripable_columns); track_display.set_model (track_model); - track_display.append_column (_("Strips"), track_columns.text); - track_display.append_column (_("Show"), track_columns.visible); + track_display.append_column (_("Show"), stripable_columns.visible); + track_display.append_column (_("Strips"), stripable_columns.text); track_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); - track_display.get_column (0)->set_expand(true); - track_display.get_column (1)->set_expand(false); - track_display.get_column (0)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); + track_display.get_column (0)->set_expand(false); + track_display.get_column (1)->set_expand(true); + track_display.get_column (1)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); track_display.set_name (X_("EditGroupList")); track_display.get_selection()->set_mode (Gtk::SELECTION_NONE); track_display.set_reorderable (true); @@ -2170,7 +2297,7 @@ Mixer_UI::setup_track_display () track_model->signal_row_deleted().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_delete)); track_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &Mixer_UI::track_list_reorder)); - CellRendererToggle* track_list_visible_cell = dynamic_cast(track_display.get_column_cell_renderer (1)); + CellRendererToggle* track_list_visible_cell = dynamic_cast(track_display.get_column_cell_renderer (0)); track_list_visible_cell->property_activatable() = true; track_list_visible_cell->property_radio() = false; track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed)); @@ -2260,12 +2387,12 @@ Mixer_UI::strip_by_x (int x) } void -Mixer_UI::set_route_targets_for_operation () +Mixer_UI::set_axis_targets_for_operation () { - _route_targets.clear (); + _axis_targets.clear (); if (!_selection.empty()) { - _route_targets = _selection.routes; + _axis_targets = _selection.axes; return; } @@ -2291,13 +2418,13 @@ Mixer_UI::toggle_midi_input_active (bool flip_others) boost::shared_ptr rl (new RouteList); bool onoff = false; - set_route_targets_for_operation (); + set_axis_targets_for_operation (); - for (RouteUISelection::iterator r = _route_targets.begin(); r != _route_targets.end(); ++r) { - boost::shared_ptr mt = (*r)->midi_track(); + for (AxisViewSelection::iterator r = _axis_targets.begin(); r != _axis_targets.end(); ++r) { + boost::shared_ptr mt = boost::dynamic_pointer_cast ((*r)->stripable()); if (mt) { - rl->push_back ((*r)->route()); + rl->push_back (mt); onoff = !mt->input_active(); } } @@ -2427,6 +2554,9 @@ Mixer_UI::refill_favorite_plugins () #ifdef LXVST_SUPPORT refiller (plugs, mgr.lxvst_plugin_info ()); #endif +#ifdef MACVST_SUPPORT + refiller (plugs, mgr.mac_vst_plugin_info ()); +#endif #ifdef AUDIOUNIT_SUPPORT refiller (plugs, mgr.au_plugin_info ()); #endif @@ -2498,7 +2628,7 @@ Mixer_UI::popup_note_context_menu (GdkEventButton *ev) Gtk::Menu* m = manage (new Menu); MenuList& items = m->items (); - if (_selection.routes.empty()) { + if (_selection.axes.empty()) { items.push_back (MenuElem (_("No Track/Bus is selected."))); } else { items.push_back (MenuElem (_("Add at the top"), @@ -2615,17 +2745,23 @@ Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* col void Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos) { - if (!_session || _selection.routes.empty()) { + if (!_session || _selection.axes.empty()) { return; } PluginInfoPtr pip = ppp->_pip; - for (RouteUISelection::iterator i = _selection.routes.begin(); i != _selection.routes.end(); ++i) { - boost::shared_ptr rt = (*i)->route(); - if (!rt) { continue; } + for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) { + boost::shared_ptr rt = boost::dynamic_pointer_cast ((*i)->stripable()); + + if (!rt) { + continue; + } PluginPtr p = pip->load (*_session); - if (!p) { continue; } + + if (!p) { + continue; + } if (ppp->_preset.valid) { p->load_preset (ppp->_preset); @@ -2725,3 +2861,252 @@ Mixer_UI::do_vca_unassign (boost::shared_ptr vca) /* call protected MixerActor:: method */ vca_unassign (vca); } + +void +Mixer_UI::show_spill (boost::shared_ptr s) +{ + boost::shared_ptr ss = spilled_strip.lock(); + if (ss != s) { + spilled_strip = s; + show_spill_change (s); /* EMIT SIGNAL */ + if (s) { + _group_tabs->hide (); + } else { + _group_tabs->show (); + } + redisplay_track_list (); + } +} + +bool +Mixer_UI::showing_spill_for (boost::shared_ptr s) const +{ + return s == spilled_strip.lock(); +} + +void +Mixer_UI::show_editor_window () const +{ + PublicEditor::instance().make_visible (); +} + +void +Mixer_UI::register_actions () +{ + Glib::RefPtr group = myactions.create_action_group (X_("Mixer")); + + myactions.register_action (group, "show-editor", _("Show Editor"), sigc::mem_fun (*this, &Mixer_UI::show_editor_window)); + + myactions.register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::solo_action)); + myactions.register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::mute_action)); + myactions.register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::rec_enable_action)); + myactions.register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_up_action)); + myactions.register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_down_action)); + myactions.register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::unity_gain_action)); + + + myactions.register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::copy_processors)); + myactions.register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::cut_processors)); + myactions.register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::paste_processors)); + myactions.register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::delete_processors)); + myactions.register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &Mixer_UI::select_all_processors)); + myactions.register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::toggle_processors)); + myactions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins)); + myactions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none)); + + myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left)); + myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the right"), sigc::mem_fun (*this, &Mixer_UI::scroll_right)); + + myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"), + sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_midi_input_active), false)); +} + +void +Mixer_UI::load_bindings () +{ + bindings = Bindings::get_bindings (X_("Mixer"), myactions); +} + +template void +Mixer_UI::control_action (boost::shared_ptr (Stripable::*get_control)() const) +{ + boost::shared_ptr cl (new ControlList); + boost::shared_ptr ac; + bool val = false; + bool have_val = false; + + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + boost::shared_ptr s = r->stripable(); + if (s) { + ac = (s.get()->*get_control)(); + if (ac) { + cl->push_back (ac); + if (!have_val) { + val = !ac->get_value(); + have_val = true; + } + } + } + } + + _session->set_controls (cl, val, Controllable::UseGroup); +} + +void +Mixer_UI::solo_action () +{ + control_action (&Stripable::solo_control); +} + +void +Mixer_UI::mute_action () +{ + control_action (&Stripable::mute_control); +} + +void +Mixer_UI::rec_enable_action () +{ + control_action (&Stripable::rec_enable_control); +} + +void +Mixer_UI::step_gain_up_action () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->step_gain_up (); + } + } +} + +void +Mixer_UI::step_gain_down_action () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->step_gain_down (); + } + } +} + +void +Mixer_UI::unity_gain_action () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + boost::shared_ptr s = r->stripable(); + if (s) { + boost::shared_ptr ac = s->gain_control(); + if (ac) { + ac->set_value (1.0, Controllable::UseGroup); + } + } + } +} + +void +Mixer_UI::copy_processors () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->copy_processors (); + } + } +} +void +Mixer_UI::cut_processors () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->cut_processors (); + } + } +} +void +Mixer_UI::paste_processors () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->paste_processors (); + } + } +} +void +Mixer_UI::select_all_processors () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->select_all_processors (); + } + } +} +void +Mixer_UI::toggle_processors () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->toggle_processors (); + } + } +} +void +Mixer_UI::ab_plugins () +{ + set_axis_targets_for_operation (); + + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->ab_plugins (); + } + } +} + +void +Mixer_UI::vca_assign (boost::shared_ptr vca) +{ + set_axis_targets_for_operation (); + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->vca_assign (vca); + } + } +} + +void +Mixer_UI::vca_unassign (boost::shared_ptr vca) +{ + set_axis_targets_for_operation (); + BOOST_FOREACH(AxisView* r, _axis_targets) { + MixerStrip* ms = dynamic_cast (r); + if (ms) { + ms->vca_unassign (vca); + } + } +}