racket/gui: fix problems with canvas autoscroll

This commit is contained in:
Matthew Flatt 2014-08-14 08:48:42 -06:00
parent c61a4714e8
commit 39eae2e647
7 changed files with 15 additions and 2 deletions

View File

@ -532,7 +532,7 @@
(fix-dc)
(when (and (is-auto-scroll?)
(not (is-panel?)))
(reset-auto-scroll 0 0))
(reset-auto-scroll))
(on-size))
;; this `on-size' method is for `editor-canvas%', only:

View File

@ -59,7 +59,7 @@
h-pos v-pos)
(void))
(define/public (reset-auto-scroll h-pos v-pos)
(define/public (reset-auto-scroll [h-pos -1] [v-pos -1])
(let ([xb (box 0)]
[yb (box 0)])
(get-client-size xb yb)

View File

@ -242,6 +242,7 @@
is-auto-scroll? is-disabled-scroll?
get-virtual-width get-virtual-height
refresh-for-autoscroll refresh-all-children
reset-auto-scroll
get-eventspace
register-extra-gtk)
@ -368,6 +369,9 @@
(define/override (set-size x y w h)
(super set-size x y w h)
(when (and (is-auto-scroll?)
(not (is-panel?)))
(reset-auto-scroll))
(on-size))
(set! dc (new dc% [canvas this] [transparent? (memq 'transparent style)]))

View File

@ -286,6 +286,9 @@
[h (if (= h -1) (- (RECT-bottom r) (RECT-top r)) h)])
(MoveWindow canvas-hwnd 0 0 (max 1 (- w COMBO-WIDTH)) h #t)
(MoveWindow combo-hwnd 0 0 (max 1 w) (- h 2) #t)))
(when (and (is-auto-scroll?)
(not (is-panel?)))
(reset-auto-scroll))
(on-size))
;; this `on-size' method is for `editor-canvas%', only:

2
tmp1 Normal file
View File

@ -0,0 +1,2 @@
;(#t #f a () 9739 -3 . #((test) te " " st test #() b c))
(define foo (quote (#t #f #\a () 9739 -3 . #((test) "te \" \" st" "" test #() b c))))

2
tmp2 Normal file
View File

@ -0,0 +1,2 @@
;(#t #f a () 9739 -3 . #((test) te " " st test #() b c))
(define foo (quote (#t #f #\a () 9739 -3 . #((test) "te \" \" st" "" test #() b c))))

2
tmp3 Normal file
View File

@ -0,0 +1,2 @@
;(0.25 -3.25)
(define foo (quote (0.25 -3.25)))