a few tweaks to zoom computations so that zoom-to-range works correctly
This commit is contained in:
parent
b73f725676
commit
b2a183d4b7
@ -1640,14 +1640,14 @@ Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GdkScreen* screen = gdk_screen_get_default ();
|
GdkScreen* screen = gdk_screen_get_default ();
|
||||||
gint pixwidth = gdk_screen_get_width (screen);
|
const gint pixwidth = gdk_screen_get_width (screen);
|
||||||
gint mmwidth = gdk_screen_get_width_mm (screen);
|
const gint mmwidth = gdk_screen_get_width_mm (screen);
|
||||||
double pix_per_mm = (double) pixwidth/ (double) mmwidth;
|
const double pix_per_mm = (double) pixwidth/ (double) mmwidth;
|
||||||
double one_centimeter_in_pixels = pix_per_mm * 10.0;
|
const double one_centimeter_in_pixels = pix_per_mm * 10.0;
|
||||||
|
|
||||||
framepos_t range = end - start;
|
const framepos_t range = end - start;
|
||||||
double new_fpp = (double) range / (double) _visible_canvas_width;
|
const framecnt_t new_fpp = (framecnt_t) ceil ((double) range / (double) _visible_canvas_width);
|
||||||
framepos_t extra_samples = (framepos_t) floor (one_centimeter_in_pixels * new_fpp);
|
const framepos_t extra_samples = (framepos_t) floor (one_centimeter_in_pixels * new_fpp);
|
||||||
|
|
||||||
if (start > extra_samples) {
|
if (start > extra_samples) {
|
||||||
start -= extra_samples;
|
start -= extra_samples;
|
||||||
@ -1662,7 +1662,6 @@ Editor::calc_extra_zoom_edges(framepos_t &start, framepos_t &end)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::temporal_zoom_region (bool both_axes)
|
Editor::temporal_zoom_region (bool both_axes)
|
||||||
{
|
{
|
||||||
@ -1693,7 +1692,7 @@ Editor::temporal_zoom_region (bool both_axes)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
calc_extra_zoom_edges(start, end);
|
calc_extra_zoom_edges (start, end);
|
||||||
|
|
||||||
/* if we're zooming on both axes we need to save track heights etc.
|
/* if we're zooming on both axes we need to save track heights etc.
|
||||||
*/
|
*/
|
||||||
@ -1754,7 +1753,7 @@ Editor::temporal_zoom_selection (bool both_axes)
|
|||||||
fit_selected_tracks();
|
fit_selected_tracks();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
temporal_zoom_region(both_axes);
|
temporal_zoom_region (both_axes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1802,9 +1801,9 @@ Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
|
|||||||
|
|
||||||
framepos_t range = end - start;
|
framepos_t range = end - start;
|
||||||
|
|
||||||
double const new_fpp = (double) range / (double) _visible_canvas_width;
|
const framecnt_t new_fpp = (framecnt_t) ceil ((double) range / (double) _visible_canvas_width);
|
||||||
|
|
||||||
framepos_t new_page = (framepos_t) floor (_visible_canvas_width * new_fpp);
|
framepos_t new_page = range;
|
||||||
framepos_t middle = (framepos_t) floor ((double) start + ((double) range / 2.0f));
|
framepos_t middle = (framepos_t) floor ((double) start + ((double) range / 2.0f));
|
||||||
framepos_t new_leftmost = (framepos_t) floor ((double) middle - ((double) new_page / 2.0f));
|
framepos_t new_leftmost = (framepos_t) floor ((double) middle - ((double) new_page / 2.0f));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user