return;
}
- double fpu = zoom_range_clock->current_duration() / _visible_canvas_width;
+ framecnt_t fpu = llrintf (zoom_range_clock->current_duration() / _visible_canvas_width);
bool clamped = clamp_samples_per_pixel (fpu);
if (clamped) {
void
Editor::center_screen (framepos_t frame)
{
- double const page = _visible_canvas_width * samples_per_pixel;
+ framecnt_t const page = _visible_canvas_width * samples_per_pixel;
/* if we're off the page, then scroll.
*/
}
if ((prop = node.property ("zoom"))) {
- reset_zoom (PBD::atof (prop->value()));
+ /* older versions of ardour used floating point samples_per_pixel */
+ double f = PBD::atof (prop->value());
+ reset_zoom (llrintf (f));
} else {
reset_zoom (samples_per_pixel);
}
maybe_add_mixer_strip_width (*node);
node->add_property ("zoom-focus", enum_2_string (zoom_focus));
- snprintf (buf, sizeof(buf), "%f", samples_per_pixel);
+
+ snprintf (buf, sizeof(buf), "%" PRId64, samples_per_pixel);
node->add_property ("zoom", buf);
node->add_property ("snap-to", enum_2_string (_snap_type));
node->add_property ("snap-mode", enum_2_string (_snap_mode));
}
void
-Editor::reset_zoom (double fpp)
+Editor::reset_zoom (framecnt_t spp)
{
- clamp_samples_per_pixel (fpp);
+ clamp_samples_per_pixel (spp);
- if (fpp == samples_per_pixel) {
+ if (spp == samples_per_pixel) {
return;
}
pending_visual_change.add (VisualChange::ZoomLevel);
- pending_visual_change.samples_per_pixel = fpp;
+ pending_visual_change.samples_per_pixel = spp;
ensure_visual_change_idle_handler ();
}
* @param fpu New frames per unit; should already have been clamped so that it is sensible.
*/
void
-Editor::set_samples_per_pixel (double fpp)
+Editor::set_samples_per_pixel (framecnt_t spp)
{
+ clamp_samples_per_pixel (spp);
+ samples_per_pixel = spp;
+
if (tempo_lines) {
tempo_lines->tempo_map_changed();
}
- samples_per_pixel = fpp;
-
/* convert fpu to frame count */
- framepos_t frames = (framepos_t) floor (samples_per_pixel * _visible_canvas_width);
+ framepos_t frames = samples_per_pixel * _visible_canvas_width;
if (samples_per_pixel != zoom_range_clock->current_duration()) {
zoom_range_clock->set (frames);
double const last_time_origin = horizontal_position ();
+
if (p & VisualChange::ZoomLevel) {
set_samples_per_pixel (pending_visual_change.samples_per_pixel);
compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
- }
- if (p & VisualChange::ZoomLevel) {
update_video_timeline();
}