srot optionally recusrive
svn: r52
This commit is contained in:
parent
ac0941d7d3
commit
724c893b1f
|
@ -78,8 +78,9 @@ New methods:
|
|||
> on-item-closed :: (send a-list on-item-closed i) - called when the
|
||||
arrow for `i' is turned up
|
||||
|
||||
> sort :: (send a-list sort less-than-proc) - sorts items in the list
|
||||
by calling `less-than-proc' on pairs of items.
|
||||
> sort :: (send a-list sort less-than-proc [recur?]) - sorts items in
|
||||
the list by calling `less-than-proc' on pairs of items; if
|
||||
`recur?' is #t (the default), sub-items are sorted recursively
|
||||
|
||||
> can-do-edit-operation? :: (send a-list can-do-edit-operation? sym bool)
|
||||
- like the method on editor<%>s; returns #f always
|
||||
|
|
|
@ -398,17 +398,18 @@
|
|||
[e (line-end-position pos)])
|
||||
(delete (if (zero? s) s (sub1 s)) (if (zero? s) (add1 e) e)))]
|
||||
[else (loop (add1 pos) (cdr l) (cons (car l) others))])))]
|
||||
[sort (lambda (less-than?)
|
||||
[sort (opt-lambda (less-than? [recur? #t])
|
||||
(let ([l (mergesort children (lambda (a b)
|
||||
(less-than? (send a get-item)
|
||||
(send b get-item))))])
|
||||
(begin-edit-sequence)
|
||||
(for-each (lambda (child)
|
||||
(when (is-a? child hierarchical-list-snip%)
|
||||
(let ([ed (send child get-content-buffer)])
|
||||
(when (is-a? ed hierarchical-list-text%)
|
||||
(send ed sort less-than?)))))
|
||||
children)
|
||||
(when recur?
|
||||
(for-each (lambda (child)
|
||||
(when (is-a? child hierarchical-list-snip%)
|
||||
(let ([ed (send child get-content-buffer)])
|
||||
(when (is-a? ed hierarchical-list-text%)
|
||||
(send ed sort less-than?)))))
|
||||
children))
|
||||
(erase)
|
||||
(let ([to-scroll-to #f])
|
||||
(for-each
|
||||
|
@ -642,7 +643,7 @@
|
|||
[set-no-sublists (lambda x (send top-buffer set-no-sublists . x))]
|
||||
[new-list (lambda x (send top-buffer new-list . x))]
|
||||
[delete-item (lambda (i) (send top-buffer delete-item i))]
|
||||
[sort (lambda (less-than?) (send top-buffer sort less-than?))]
|
||||
[sort (opt-lambda (less-than? [recur? #t]) (send top-buffer sort less-than? recur?))]
|
||||
[get-items (lambda () (send top-buffer get-items))]
|
||||
[toggle-open/closed
|
||||
(lambda ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user