From ba09117dfa6c46a52c3536e43c8022f9cf6107a6 Mon Sep 17 00:00:00 2001 From: Sampo Savolainen Date: Wed, 23 Aug 2006 18:29:22 +0000 Subject: [PATCH] Make canvas autoscroll work properly. git-svn-id: svn://localhost/ardour2/trunk@845 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_rulers.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 47641655e7..86bd19b9bf 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -215,7 +215,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev) if (session == 0 || !ruler_pressed_button) { return FALSE; } - + double wcx=0,wcy=0; double cx=0,cy=0; @@ -231,24 +231,23 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev) jack_nframes_t where = leftmost_frame + pixel_to_frame (x); - /// ripped from maybe_autoscroll + + /// ripped from maybe_autoscroll, and adapted to work here jack_nframes_t one_page = (jack_nframes_t) rint (canvas_width * frames_per_unit); jack_nframes_t rightmost_frame = leftmost_frame + one_page; - jack_nframes_t frame = pixel_to_frame (cx); - if (autoscroll_timeout_tag < 0) { - if (frame > rightmost_frame) { + if (where > rightmost_frame) { if (rightmost_frame < max_frames) { - start_canvas_autoscroll (1); + start_canvas_autoscroll (10); } - } else if (frame < leftmost_frame) { + } else if (where <= leftmost_frame) { if (leftmost_frame > 0) { start_canvas_autoscroll (-1); } } } else { - if (frame >= leftmost_frame && frame < rightmost_frame) { + if (where >= leftmost_frame && where < rightmost_frame) { stop_canvas_autoscroll (); } }