summaryrefslogtreecommitdiff
path: root/gtk2_ardour/time_axis_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-06-29 19:08:19 +0000
committerCarl Hetherington <carl@carlh.net>2010-06-29 19:08:19 +0000
commit7898aabcaa08659cd0bee5bba61df4503b7fadc7 (patch)
tree57cfb8e9693f527595bd5a9045e60f3c9d8c7573 /gtk2_ardour/time_axis_view.cc
parentbebeb5abec36919ac4fce9602a2ad94a4d79935a (diff)
Fix vertical canvas autoscroll when dragging track heights. Fixes #3240.
git-svn-id: svn://localhost/ardour2/branches/3.0@7327 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/time_axis_view.cc')
-rw-r--r--gtk2_ardour/time_axis_view.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 978ce6debb..58dbd595bf 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -52,6 +52,7 @@
#include "rgb_macros.h"
#include "utils.h"
#include "streamview.h"
+#include "editor_drag.h"
#include "i18n.h"
@@ -1242,6 +1243,7 @@ TimeAxisView::resizer_button_press (GdkEventButton* event)
bool
TimeAxisView::resizer_button_release (GdkEventButton*)
{
+ _editor.stop_canvas_autoscroll ();
_resize_drag_start = -1;
return true;
}
@@ -1256,6 +1258,19 @@ bool
TimeAxisView::resizer_motion (GdkEventMotion* ev)
{
if (_resize_drag_start >= 0) {
+ /* (ab)use the DragManager to do autoscrolling; adjust the event coordinates
+ into the trackview space that DragManager::motion_handler is expecting,
+ and then fake a DragManager motion event so that when maybe_autoscroll
+ asks DragManager for the current pointer position it will get the correct
+ answers.
+ */
+ int tx, ty;
+ resizer.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
+ ev->y = ty + _editor.get_canvas_timebars_vsize ();
+ _editor.drags()->motion_handler ((GdkEvent *) ev, false);
+ _editor.maybe_autoscroll (false, true);
+
+ /* now do the actual TAV resize */
int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);
_editor.add_to_idle_resize (this, delta);
_resize_drag_start = ev->y_root;