diff options
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 97 |
1 files changed, 57 insertions, 40 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index cbda900255..2706a44669 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -710,7 +710,8 @@ Editor::build_region_boundary_cache () break; case SyncPoint: - rpos = r->adjust_to_sync (r->first_frame()); + rpos = r->sync_position (); + //r->adjust_to_sync (r->first_frame()); break; default: @@ -796,7 +797,8 @@ Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, Tra break; case SyncPoint: - rpos = r->adjust_to_sync (r->first_frame()); + rpos = r->sync_position (); + // r->adjust_to_sync (r->first_frame()); break; } @@ -826,6 +828,7 @@ Editor::find_next_region_boundary (nframes64_t pos, int32_t dir, const TrackView nframes64_t distance = max_frames; nframes64_t current_nearest = -1; + for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) { nframes64_t contender; nframes64_t d; @@ -851,10 +854,45 @@ Editor::find_next_region_boundary (nframes64_t pos, int32_t dir, const TrackView return current_nearest; } +nframes64_t +Editor::get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen) +{ + nframes64_t target; + TrackViewList tvl; + + if (with_selection && Config->get_region_boundaries_from_selected_tracks()) { + + if (!selection->tracks.empty()) { + + target = find_next_region_boundary (pos, dir, selection->tracks); + + } else { + + if (only_onscreen || Config->get_region_boundaries_from_onscreen_tracks()) { + get_onscreen_tracks (tvl); + target = find_next_region_boundary (pos, dir, tvl); + } else { + target = find_next_region_boundary (pos, dir, track_views); + } + } + + } else { + + if (only_onscreen || Config->get_region_boundaries_from_onscreen_tracks()) { + get_onscreen_tracks (tvl); + target = find_next_region_boundary (pos, dir, tvl); + } else { + target = find_next_region_boundary (pos, dir, track_views); + } + } + + return target; +} + void -Editor::cursor_to_region_boundary (Cursor* cursor, int32_t dir) +Editor::cursor_to_region_boundary (bool with_selection, int32_t dir) { - nframes64_t pos = cursor->current_frame; + nframes64_t pos = playhead_cursor->current_frame; nframes64_t target; if (!session) { @@ -866,37 +904,24 @@ Editor::cursor_to_region_boundary (Cursor* cursor, int32_t dir) pos += dir; } - if (!selection->tracks.empty()) { - - target = find_next_region_boundary (pos, dir, selection->tracks); - - } else { - - target = find_next_region_boundary (pos, dir, track_views); - } - - if (target < 0) { + if ((target = get_region_boundary (pos, dir, with_selection, false)) < 0) { return; } - if (cursor == playhead_cursor) { - session->request_locate (target); - } else { - cursor->set_position (target); - } + session->request_locate (target); } void -Editor::cursor_to_next_region_boundary (Cursor* cursor) +Editor::cursor_to_next_region_boundary (bool with_selection) { - cursor_to_region_boundary (cursor, 1); + cursor_to_region_boundary (with_selection, 1); } void -Editor::cursor_to_previous_region_boundary (Cursor* cursor) +Editor::cursor_to_previous_region_boundary (bool with_selection) { - cursor_to_region_boundary (cursor, -1); + cursor_to_region_boundary (with_selection, -1); } void @@ -945,7 +970,8 @@ Editor::cursor_to_region_point (Cursor* cursor, RegionPoint point, int32_t dir) break; case SyncPoint: - pos = r->adjust_to_sync (r->first_frame()); + pos = r->sync_position (); + // r->adjust_to_sync (r->first_frame()); break; } @@ -1044,7 +1070,7 @@ Editor::cursor_to_selection_end (Cursor *cursor) } void -Editor::selected_marker_to_region_boundary (int32_t dir) +Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir) { nframes64_t target; Location* loc; @@ -1076,16 +1102,7 @@ Editor::selected_marker_to_region_boundary (int32_t dir) pos += dir; } - if (!selection->tracks.empty()) { - - target = find_next_region_boundary (pos, dir, selection->tracks); - - } else { - - target = find_next_region_boundary (pos, dir, track_views); - } - - if (target < 0) { + if ((target = get_region_boundary (pos, dir, with_selection, false)) < 0) { return; } @@ -1093,15 +1110,15 @@ Editor::selected_marker_to_region_boundary (int32_t dir) } void -Editor::selected_marker_to_next_region_boundary () +Editor::selected_marker_to_next_region_boundary (bool with_selection) { - selected_marker_to_region_boundary (1); + selected_marker_to_region_boundary (with_selection, 1); } void -Editor::selected_marker_to_previous_region_boundary () +Editor::selected_marker_to_previous_region_boundary (bool with_selection) { - selected_marker_to_region_boundary (-1); + selected_marker_to_region_boundary (with_selection, -1); } void @@ -3633,7 +3650,7 @@ Editor::freeze_thread () gint Editor::freeze_progress_timeout (void *arg) { - interthread_progress_bar.set_fraction (current_interthread_info->progress/100); + interthread_progress_bar.set_fraction (current_interthread_info->progress); return !(current_interthread_info->done || current_interthread_info->cancel); } |