mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 14:16:31 +01:00
fix up operation of Editor::temporal_zoom_to_frame() which had not been updated since samples_per_pixel was changed to an integer (framecnt_t)
This commit is contained in:
parent
17e94e02e8
commit
f945edded6
1 changed files with 27 additions and 9 deletions
|
|
@ -1779,23 +1779,41 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
|
||||||
if (!_session) {
|
if (!_session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double range_before = frame - leftmost_frame;
|
|
||||||
double new_fpp;
|
|
||||||
|
|
||||||
new_fpp = samples_per_pixel;
|
framecnt_t range_before = frame - leftmost_frame;
|
||||||
|
framecnt_t new_spp;
|
||||||
|
|
||||||
if (coarser) {
|
if (coarser) {
|
||||||
new_fpp *= 1.61803399;
|
if (samples_per_pixel <= 1) {
|
||||||
range_before *= 1.61803399;
|
new_spp = 2;
|
||||||
} else {
|
} else {
|
||||||
new_fpp = max(1.0,(new_fpp/1.61803399));
|
new_spp = samples_per_pixel + (samples_per_pixel/2);
|
||||||
range_before /= 1.61803399;
|
}
|
||||||
|
range_before += range_before/2;
|
||||||
|
} else {
|
||||||
|
if (samples_per_pixel >= 1) {
|
||||||
|
new_spp = samples_per_pixel - (samples_per_pixel/2);
|
||||||
|
} else {
|
||||||
|
/* could bail out here since we cannot zoom any finer,
|
||||||
|
but leave that to the clamp_samples_per_pixel() and
|
||||||
|
equality test below
|
||||||
|
*/
|
||||||
|
new_spp = samples_per_pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_fpp == samples_per_pixel) {
|
range_before -= range_before/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
clamp_samples_per_pixel (new_spp);
|
||||||
|
|
||||||
|
if (new_spp == samples_per_pixel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* zoom focus is automatically taken as @param frame when this
|
||||||
|
method is used.
|
||||||
|
*/
|
||||||
|
|
||||||
framepos_t new_leftmost = frame - (framepos_t)range_before;
|
framepos_t new_leftmost = frame - (framepos_t)range_before;
|
||||||
|
|
||||||
if (new_leftmost > frame) {
|
if (new_leftmost > frame) {
|
||||||
|
|
@ -1806,7 +1824,7 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
|
||||||
new_leftmost = 0;
|
new_leftmost = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
reposition_and_zoom (new_leftmost, new_fpp);
|
reposition_and_zoom (new_leftmost, new_spp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue