13
0

Change Editor temporal zoom methods to be able to use different scale for the zoom

This commit is contained in:
Tim Mayberry 2016-02-09 20:37:53 +10:00
parent 4499066f39
commit 9485748e17
2 changed files with 29 additions and 9 deletions

View File

@ -297,8 +297,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
framecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
void temporal_zoom_step_mouse_focus (bool coarser);
void temporal_zoom_step (bool zoom_out);
void temporal_zoom_step_scale (bool zoom_out, double scale);
void temporal_zoom_step_mouse_focus (bool zoom_out);
void temporal_zoom_step_mouse_focus_scale (bool zoom_out, double scale);
void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
void tav_zoom_step (bool coarser);
void tav_zoom_smooth (bool coarser, bool force_all);

View File

@ -1710,25 +1710,43 @@ Editor::tav_zoom_smooth (bool coarser, bool force_all)
}
void
Editor::temporal_zoom_step_mouse_focus (bool coarser)
Editor::temporal_zoom_step_mouse_focus_scale (bool zoom_out, double scale)
{
Editing::ZoomFocus temp_focus = zoom_focus;
zoom_focus = Editing::ZoomFocusMouse;
temporal_zoom_step (coarser);
temporal_zoom_step_scale (zoom_out, scale);
zoom_focus = temp_focus;
}
void
Editor::temporal_zoom_step (bool coarser)
Editor::temporal_zoom_step_mouse_focus (bool zoom_out)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, coarser)
temporal_zoom_step_mouse_focus_scale (zoom_out, 2.0);
}
void
Editor::temporal_zoom_step (bool zoom_out)
{
temporal_zoom_step_scale (zoom_out, 2.0);
}
void
Editor::temporal_zoom_step_scale (bool zoom_out, double scale)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, zoom_out, scale)
framecnt_t nspp = samples_per_pixel;
if (coarser) {
nspp *= 2;
if (zoom_out) {
nspp *= scale;
if (nspp == samples_per_pixel) {
nspp *= 2.0;
}
} else {
nspp /= 2;
nspp /= scale;
if (nspp == samples_per_pixel) {
nspp /= 2.0;
}
}
temporal_zoom (nspp);