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

View File

@ -18,8 +18,9 @@
;; mixin to add geometry management to pasteboard with the give type of alignement ;; mixin to add geometry management to pasteboard with the give type of alignement
(define (make-aligned-pasteboard type) (define (make-aligned-pasteboard type)
(class* pasteboard% (aligned-pasteboard<%>) (class* pasteboard% (aligned-pasteboard<%>)
(inherit resize move-to find-first-snip refresh-delayed? (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 (field
[needs-realign? false] [needs-realign? false]
@ -50,9 +51,15 @@
;; set-algined-min-sizes (-> void?) ;; set-algined-min-sizes (-> void?)
;; set the aligned min width and height of the pasteboard based on it's children snips ;; 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) (define/public (aligned-min-sizes-invalid)
;; Do I need to dynamic-let ignore-resizing? in here? ;; This in-edit-sequence? is not sound. It causes me to percollate invalidation
(if (refresh-delayed?) ;; 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) (set! needs-realign? true)
(begin (begin
(set! needs-realign? false) (set! needs-realign? false)
@ -80,7 +87,10 @@
(align type alloted-width alloted-height (align type alloted-width alloted-height
(map-snip build-rect first-snip))]) (map-snip build-rect first-snip))])
(begin-edit-sequence) (begin-edit-sequence)
(for-each-snip move/resize first-snip aligned-rects) (let ([was-locked? (is-locked?)])
(lock false)
(for-each-snip move/resize first-snip aligned-rects)
(lock was-locked?))
(end-edit-sequence))))) (end-edit-sequence)))))
;;move/resize (snip-pos? rect? . -> . void?) ;;move/resize (snip-pos? rect? . -> . void?)