From ce2d9cb4aacae917fd9117d923f124a8d5ecde2d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 1 Dec 2009 18:25:36 +0000 Subject: Stop editor summary viewbox being moved too far down in y. git-svn-id: svn://localhost/ardour2/branches/3.0@6253 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_summary.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 555c56edfc..764ec31a30 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -453,8 +453,26 @@ EditorSummary::set_editor (pair const & x, pair c is merely pending but not executing. But c'est la vie. */ + /* proposed bottom of the editor with the requested position */ + double const pb = y.second / _y_scale; + + /* bottom of the canvas */ + double const ch = _editor->full_canvas_height - _editor->canvas_timebars_vsize; + + /* requested y position */ + double ly = y.first / _y_scale; + + /* clamp y position so as not to go off the bottom */ + if (pb > ch) { + ly -= (pb - ch); + } + + if (ly < 0) { + ly = 0; + } + _editor->reset_x_origin (x.first / _x_scale + _start); - _editor->reset_y_origin (y.first / _y_scale); + _editor->reset_y_origin (ly); double const nx = ( ((x.second - x.first) / _x_scale) / -- cgit v1.2.3