summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-09-17 16:56:15 +0200
committerRobin Gareus <robin@gareus.org>2019-09-17 17:18:29 +0200
commitfb4cbb9f9ee61a5c0fec9fa43eff5a0e59d7f9ed (patch)
tree9ab7f8389ad49f8c83cbf2d11c67741fe9653f9b
parent9851c9b08aaf6977e923734c81a319ec33af4ba1 (diff)
Correctly handle Zoom > Edit-point > Mouse
Previously this failed if the event was initiated outside of the canvas (e.g. Zoom buttons). This also fixes a special case of Zooming to an edit-point at zero.
-rw-r--r--gtk2_ardour/editor_ops.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index c4c6f18ac8..48968378eb 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1800,7 +1800,13 @@ Editor::temporal_zoom (samplecnt_t fpp)
new_page_size = (samplepos_t) floor (_visible_canvas_width * nfpp);
half_page_size = new_page_size / 2;
- switch (zoom_focus) {
+ Editing::ZoomFocus zf = zoom_focus;
+
+ if (zf == ZoomFocusEdit && _edit_point == EditAtMouse) {
+ zf = ZoomFocusMouse;
+ }
+
+ switch (zf) {
case ZoomFocusLeft:
leftmost_after_zoom = current_leftmost;
break;
@@ -1870,9 +1876,7 @@ Editor::temporal_zoom (samplecnt_t fpp)
case ZoomFocusEdit:
/* try to keep the edit point in the same place */
where = get_preferred_edit_position ();
-
- if (where > 0) {
-
+ {
double l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
if (l < 0) {
@@ -1882,10 +1886,6 @@ Editor::temporal_zoom (samplecnt_t fpp)
} else {
leftmost_after_zoom = (samplepos_t) l;
}
-
- } else {
- /* edit point not defined */
- return;
}
break;