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

@ -7350,14 +7350,25 @@ Editor::playhead_forward_to_grid ()
return;
}
MusicSample pos (playhead_cursor->current_sample (), 0);
MusicSample pos (playhead_cursor->current_sample (), 0);
if (pos.sample < max_samplepos - 1) {
pos.sample += 2;
snap_to_internal (pos, RoundUpAlways, SnapToGrid, false, true);
_session->request_locate (pos.sample);
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)) {
reset_x_origin (pos.sample - (current_page_samples()*0.9));
@ -7374,10 +7385,20 @@ Editor::playhead_backward_to_grid ()
MusicSample pos (playhead_cursor->current_sample (), 0);
if (pos.sample > 2) {
pos.sample -= 2;
snap_to_internal (pos, RoundDownAlways, SnapToGrid, false, true);
_session->request_locate (pos.sample);
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 */