fixed an edit sequence bug but introduced an inefficientcy

original commit: 2e9f1f4d0f08ad8ba75251e9e76ff1e6a41dcdd5
This commit is contained in:
Mike MacHenry 2003-12-18 22:18:36 +00:00
parent 3de9188432
commit eb40e63cd1
2 changed files with 18 additions and 10 deletions

View File

@ -109,12 +109,10 @@
[(value) (set! stretchable-height-field value)]
[() stretchable-height-field]))
;; resize (number? number? . -> . boolean?)
;; called to resize the snip
(rename [super-resize resize])
(define/override (resize width height)
(super-resize width height))
;; (positive? positive? . -> . void?)
;; called to resize the snip to a given size without effecting its alignd-min-sizes
;; STATUS: Do I need to override resize and have it set the aligned-min-sizes?
(inherit resize)
(define/public (stretch width height)
(resize width height)
(let ([left (box 0)]

View File

@ -18,8 +18,9 @@
;; mixin to add geometry management to pasteboard with the give type of alignement
(define (make-aligned-pasteboard type)
(class* pasteboard% (aligned-pasteboard<%>)
(inherit resize move-to find-first-snip refresh-delayed?
begin-edit-sequence end-edit-sequence)
begin-edit-sequence end-edit-sequence is-locked? lock)
(field
[needs-realign? false]
@ -50,9 +51,15 @@
;; set-algined-min-sizes (-> void?)
;; set the aligned min width and height of the pasteboard based on it's children snips
(inherit in-edit-sequence?)
(define/public (aligned-min-sizes-invalid)
;; Do I need to dynamic-let ignore-resizing? in here?
(if (refresh-delayed?)
;; This in-edit-sequence? is not sound. It causes me to percollate invalidation
;; up the spin of my tree even when it is not visible (which refresh-delayed?
;; checks for. However, for some types of refreshed-delayed? blocks, like a
;; parent editor's edit-sequence, I have not yet figured out a way to reshedule
;; an alignment. With in-edit-sequence? blocking, I know I'll always get the
;; after-edit-sequence call where I can invoke alignment.
(if (in-edit-sequence?) ;(refresh-delayed?)
(set! needs-realign? true)
(begin
(set! needs-realign? false)
@ -80,7 +87,10 @@
(align type alloted-width alloted-height
(map-snip build-rect first-snip))])
(begin-edit-sequence)
(let ([was-locked? (is-locked?)])
(lock false)
(for-each-snip move/resize first-snip aligned-rects)
(lock was-locked?))
(end-edit-sequence)))))
;;move/resize (snip-pos? rect? . -> . void?)