Stop editor summary viewbox being moved too far down in y.
authorCarl Hetherington <carl@carlh.net>
Tue, 1 Dec 2009 18:25:36 +0000 (18:25 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 1 Dec 2009 18:25:36 +0000 (18:25 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6253 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_summary.cc

index 555c56edfc7acbd9b8ab273b2fceab7180486a8b..764ec31a3061f448f1a444a56ac6a79d83dcbd3d 100644 (file)
@@ -453,8 +453,26 @@ EditorSummary::set_editor (pair<double,double> const & x, pair<double, double> 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) /