13
0

playhead_X_to_grid: Handle the case of GridTypeNone

This commit is contained in:
Ben Loftis 2018-05-08 09:03:20 -05:00
parent a5d90c3d9d
commit c074c7ce52

View File

@ -7352,11 +7352,22 @@ Editor::playhead_forward_to_grid ()
MusicSample pos (playhead_cursor->current_sample (), 0);
if ( _grid_type == GridTypeNone) {
if (pos.sample < max_samplepos - current_page_samples()*0.1) {
pos.sample += current_page_samples()*0.1;
_session->request_locate (pos.sample);
} else {
_session->request_locate (0);
}
} else {
if (pos.sample < max_samplepos - 1) {
pos.sample += 2;
snap_to_internal (pos, RoundUpAlways, SnapToGrid, false, true);
_session->request_locate (pos.sample);
}
}
/* keep PH visible in window */
if (pos.sample > (_leftmost_sample + current_page_samples() *0.9)) {
@ -7374,11 +7385,21 @@ Editor::playhead_backward_to_grid ()
MusicSample pos (playhead_cursor->current_sample (), 0);
if ( _grid_type == GridTypeNone) {
if ( pos.sample > current_page_samples()*0.1 ) {
pos.sample -= current_page_samples()*0.1;
_session->request_locate (pos.sample);
} else {
_session->request_locate (0);
}
} else {
if (pos.sample > 2) {
pos.sample -= 2;
snap_to_internal (pos, RoundDownAlways, SnapToGrid, false, true);
_session->request_locate (pos.sample);
}
}
/* keep PH visible in window */
if (pos.sample < (_leftmost_sample + current_page_samples() *0.1)) {