diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-01-04 17:23:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-01-04 17:23:51 +0000 |
commit | d41f7a0a701bb7af04ab4b3c2a26ff23f96407f9 (patch) | |
tree | 011fcafb38e617b16a3069dd8cbab5d816e0a6ca /gtk2_ardour/editor_ops.cc | |
parent | f7a174a59b091ca545bffbd5b1d1bcaced95285f (diff) |
a few fixes for zoom, plus the results of unfinished work on zoom redrawing, plus cleanup of debugging code in DnDTreevew
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2827 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 88e284776c..c3202f6a90 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1518,6 +1518,7 @@ Editor::temporal_zoom (gdouble fpu) nframes64_t where; bool in_track_canvas; double nfpu; + double l; nfpu = fpu; @@ -1548,11 +1549,18 @@ Editor::temporal_zoom (gdouble fpu) break; case ZoomFocusPlayhead: - /* try to keep the playhead in the center */ - if (playhead_cursor->current_frame < half_page_size) { + /* try to keep the playhead in the same place */ + + where = playhead_cursor->current_frame; + + l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); + + if (l < 0) { leftmost_after_zoom = 0; + } else if (l > max_frames) { + leftmost_after_zoom = max_frames - new_page_size; } else { - leftmost_after_zoom = playhead_cursor->current_frame - half_page_size; + leftmost_after_zoom = (nframes64_t) l; } break; @@ -1571,7 +1579,7 @@ Editor::temporal_zoom (gdouble fpu) } else { - double l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); + l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); if (l < 0) { leftmost_after_zoom = 0; @@ -1585,7 +1593,7 @@ Editor::temporal_zoom (gdouble fpu) break; case ZoomFocusEdit: - /* try to keep the edit point in the center */ + /* try to keep the edit point in the same place */ where = get_preferred_edit_position (); if (where > 0) { |