From da7d7f950233f109f82f7e7ea5c62f81ef3d7bbb Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 6 Jul 2016 13:37:30 -0400 Subject: many changes associated with rationalizing selection flow --- gtk2_ardour/mixer_ui.cc | 60 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 21 deletions(-) (limited to 'gtk2_ardour/mixer_ui.cc') diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index ca0320eb6f..af621daae3 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -816,11 +816,11 @@ Mixer_UI::follow_editor_selection () _selection.clear_routes (); 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); + TimeAxisView* tav = dynamic_cast (*i); + if (tav) { + AxisView* axis = axis_by_stripable (tav->stripable()); + if (axis) { + _selection.add (axis); } } } @@ -831,9 +831,9 @@ Mixer_UI::follow_editor_selection () MixerStrip* -Mixer_UI::strip_by_route (boost::shared_ptr r) +Mixer_UI::strip_by_route (boost::shared_ptr r) const { - for (list::iterator i = strips.begin(); i != strips.end(); ++i) { + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { if ((*i)->route() == r) { return (*i); } @@ -842,6 +842,18 @@ Mixer_UI::strip_by_route (boost::shared_ptr r) return 0; } +AxisView* +Mixer_UI::axis_by_stripable (boost::shared_ptr s) const +{ + for (list::const_iterator i = strips.begin(); i != strips.end(); ++i) { + if ((*i)->stripable() == s) { + return (*i); + } + } + + return 0; +} + bool Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) { @@ -850,7 +862,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); } @@ -2220,12 +2232,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; } @@ -2251,13 +2263,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(); } } @@ -2458,7 +2470,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"), @@ -2575,17 +2587,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); -- cgit v1.2.3