From 9485748e17d0f122ed42ba353c08312d58dc188e Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Tue, 9 Feb 2016 20:37:53 +1000 Subject: [PATCH] Change Editor temporal zoom methods to be able to use different scale for the zoom --- gtk2_ardour/editor.h | 6 ++++-- gtk2_ardour/editor_ops.cc | 32 +++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 2c744fcf9f..e93ee2b21e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3d7adc5584..e074755a5f 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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);