diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-07-06 13:37:30 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-07-06 13:39:10 -0400 |
commit | da7d7f950233f109f82f7e7ea5c62f81ef3d7bbb (patch) | |
tree | 14fdd5b6d40af1b3807067058aef2b22460dba30 /gtk2_ardour/editor.cc | |
parent | 2047ee527c688ed2c2bedea79a7e01088da58d72 (diff) |
many changes associated with rationalizing selection flow
Diffstat (limited to 'gtk2_ardour/editor.cc')
-rw-r--r-- | gtk2_ardour/editor.cc | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 146a4e7e44..20547e8e18 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -805,6 +805,12 @@ Editor::Editor () ControlProtocol::VerticalZoomInSelected.connect (*this, invalidator (*this), boost::bind (&Editor::control_vertical_zoom_in_selected, this), gui_context()); ControlProtocol::VerticalZoomOutSelected.connect (*this, invalidator (*this), boost::bind (&Editor::control_vertical_zoom_out_selected, this), gui_context()); + ControlProtocol::AddStripableToSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Add), gui_context()); + ControlProtocol::RemoveStripableFromSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Toggle), gui_context()); + ControlProtocol::SetStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Set), gui_context()); + ControlProtocol::ToggleStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Toggle), gui_context()); + ControlProtocol::ClearStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_unselect, this), gui_context()); + BasicUI::AccessAction.connect (*this, invalidator (*this), boost::bind (&Editor::access_action, this, _1, _2), gui_context()); /* handle escape */ @@ -1007,6 +1013,30 @@ Editor::control_unselect () } void +Editor::control_select (boost::shared_ptr<Stripable> s, Selection::Operation op) +{ + TimeAxisView* tav = axis_view_from_stripable (s); + + if (tav) { + switch (op) { + case Selection::Add: + selection->add (tav); + break; + case Selection::Toggle: + selection->toggle (tav); + break; + case Selection::Extend: + break; + case Selection::Set: + selection->set (tav); + break; + } + } else { + selection->clear_tracks (); + } +} + +void Editor::control_step_tracks_up () { scroll_tracks_up_line (); @@ -5155,16 +5185,13 @@ Editor::region_view_removed () _summary->set_background_dirty (); } -RouteTimeAxisView* -Editor::axis_view_from_route (boost::shared_ptr<Route> r) const +TimeAxisView* +Editor::axis_view_from_stripable (boost::shared_ptr<Stripable> s) const { - TrackViewList::const_iterator j = track_views.begin (); - while (j != track_views.end()) { - RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*j); - if (rtv && rtv->route() == r) { - return rtv; + for (TrackViewList::const_iterator j = track_views.begin (); j != track_views.end(); ++j) { + if ((*j)->stripable() == s) { + return *j; } - ++j; } return 0; @@ -5177,7 +5204,7 @@ Editor::axis_views_from_routes (boost::shared_ptr<RouteList> r) const TrackViewList t; for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { - TimeAxisView* tv = axis_view_from_route (*i); + TimeAxisView* tv = axis_view_from_stripable (*i); if (tv) { t.push_back (tv); } |