}
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);
framepos_t leftmost_after_zoom = 0;
framepos_t where;
bool in_track_canvas;
+ bool use_mouse_frame = true;
framecnt_t nfpp;
double l;
case ZoomFocusMouse:
/* try to keep the mouse over the same point in the display */
- if (!mouse_frame (where, in_track_canvas)) {
- /* use playhead instead */
- where = playhead_cursor->current_frame ();
-
- if (where < half_page_size) {
- leftmost_after_zoom = 0;
- } else {
- leftmost_after_zoom = where - half_page_size;
- }
-
- } else {
+ if (_drags->active()) {
+ where = _drags->current_pointer_frame ();
+ } else if (!mouse_frame (where, in_track_canvas)) {
+ use_mouse_frame = false;
+ }
+ if (use_mouse_frame) {
l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
if (l < 0) {
} else {
leftmost_after_zoom = (framepos_t) l;
}
- }
+ } else {
+ /* use playhead instead */
+ where = playhead_cursor->current_frame ();
+ if (where < half_page_size) {
+ leftmost_after_zoom = 0;
+ } else {
+ leftmost_after_zoom = where - half_page_size;
+ }
+ }
break;
case ZoomFocusEdit: