From 0299229e417ad6b8332ae3c9eafbf67a1c369727 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Sun, 11 Feb 2018 09:39:45 -0600 Subject: SoloSelection: gui part. --- gtk2_ardour/editor_ops.cc | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'gtk2_ardour/editor_ops.cc') diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index d94506012b..7173e267e6 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1962,6 +1962,31 @@ void Editor::temporal_zoom_selection (Editing::ZoomAxis axes) { if (!selection) return; + + if ( selection->regions.empty() && selection->time.empty() ) { + if (axes == Horizontal || axes == Both) { + temporal_zoom_step(true); + } + if (axes == Vertical || axes == Both) { + if ( !track_views.empty() ) { + + TrackViewList tvl; + + //implicit hack: by extending the top & bottom check outside the current view limits, we include the trackviews immediately above & below what is visible + const double top = vertical_adjustment.get_value() - 10; + const double btm = top + _visible_canvas_height + 10; + + for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { + if ( (*iter)->covered_by_y_range (top, btm) ) { + tvl.push_back(*iter); + } + } + + fit_tracks (tvl); + } + } + return; + } //ToDo: if notes are selected, zoom to that @@ -5865,6 +5890,54 @@ Editor::toggle_record_enable () } } +StripableList +tracklist_to_stripables( TrackViewList list ) +{ + StripableList ret; + + for (TrackSelection::iterator i = list.begin(); i != list.end(); ++i) { + RouteTimeAxisView* rtv = dynamic_cast ((*i)); + + if (rtv && rtv->is_track()) { + ret.push_back( rtv->track() ); + } + } + + return ret; +} + +void +Editor::play_solo_selection (bool restart) +{ + //note: session::solo_selection takes care of invalidating the region playlist + + if ( (!selection->tracks.empty()) && selection->time.length() > 0 ) { //a range is selected; solo the tracks and roll + + StripableList sl = tracklist_to_stripables (selection->tracks); + _session->solo_selection( sl, true ); + + if ( restart ) { + samplepos_t start = selection->time.start(); + samplepos_t end = selection->time.end_sample(); + _session->request_bounded_roll (start, end); + } + } else if ( ! selection->tracks.empty() ) { //no range is selected, but tracks are selected; solo the tracks and roll + StripableList sl = tracklist_to_stripables (selection->tracks); + _session->solo_selection( sl, true ); + _session->request_cancel_play_range(); + transition_to_rolling (true); + + } else if ( ! selection->regions.empty() ) { //solo any tracks with selected regions, and roll + StripableList sl = tracklist_to_stripables ( get_tracks_for_range_action() ); + _session->solo_selection( sl, true ); + _session->request_cancel_play_range(); + transition_to_rolling (true); + } else { + _session->request_cancel_play_range(); + transition_to_rolling (true); //no selection. just roll. + } +} + void Editor::toggle_solo () { -- cgit v1.2.3