original commit: a5f57c6907ebaa68449195980a382247cf28540a
This commit is contained in:
Robby Findler 2003-09-03 19:35:15 +00:00
parent 113aab5fc4
commit b2cab72ff6

View File

@ -3,7 +3,6 @@
(require (lib "string-constant.ss" "string-constants") (require (lib "string-constant.ss" "string-constants")
(lib "unitsig.ss") (lib "unitsig.ss")
(lib "class.ss") (lib "class.ss")
(lib "class100.ss")
(lib "include.ss") (lib "include.ss")
"sig.ss" "sig.ss"
"../gui-utils.ss" "../gui-utils.ss"
@ -1565,18 +1564,17 @@
(loop (send snip next)))))] (loop (send snip next)))))]
[text-keymap/editor% [text-keymap/editor%
(class100 text:keymap% args (class text:keymap%
(rename [super-get-keymaps get-keymaps]) (rename [super-get-keymaps get-keymaps])
(override (define/override (get-keymaps)
[get-keymaps
(lambda ()
(if (preferences:get 'framework:menu-bindings) (if (preferences:get 'framework:menu-bindings)
(append (list (keymap:get-editor)) (append (list (keymap:get-editor))
(super-get-keymaps)) (super-get-keymaps))
(append (super-get-keymaps) (append (super-get-keymaps)
(list (keymap:get-editor)))))]) (list (keymap:get-editor)))))
(sequence (inherit set-styles-fixed)
(apply super-init args)))] (super-new)
(set-styles-fixed #t))]
[find-panel (make-object horizontal-panel% dialog)] [find-panel (make-object horizontal-panel% dialog)]
@ -1812,18 +1810,15 @@
(set! searching-frame frame)) (set! searching-frame frame))
(define find-text% (define find-text%
(class100 text:keymap% args (class text:keymap%
(inherit get-text) (inherit get-text)
(rename [super-after-insert after-insert] (rename [super-after-insert after-insert]
[super-after-delete after-delete] [super-after-delete after-delete]
[super-on-focus on-focus]) [super-on-focus on-focus])
(private (define/private (get-searching-edit)
[get-searching-edit
(lambda ()
(and searching-frame (and searching-frame
(send searching-frame get-text-to-search)))]) (send searching-frame get-text-to-search)))
(public (define/public search
[search
(opt-lambda ([reset-search-anchor? #t] [beep? #t] [wrap? #t]) (opt-lambda ([reset-search-anchor? #t] [beep? #t] [wrap? #t])
(when searching-frame (when searching-frame
(let* ([string (get-text)] (let* ([string (get-text)]
@ -1880,58 +1875,51 @@
(found found-edit pos))) (found found-edit pos)))
(not-found found-edit #f))] (not-found found-edit #f))]
[else [else
(found found-edit first-pos)])))))))]) (found found-edit first-pos)]))))))))
(private-field (field
[dont-search #f]) [dont-search #f])
(public (define/public (stop-searching)
[stop-searching (set! dont-search #t))
(lambda () (define/public (start-searching)
(set! dont-search #t))] (set! dont-search #f))
[start-searching
(lambda ()
(set! dont-search #f))])
(override (define/override (on-focus on?)
[on-focus
(lambda (on?)
(when on? (when on?
(let ([edit (get-searching-edit)]) (let ([edit (get-searching-edit)])
(when edit (when edit
(reset-search-anchor (get-searching-edit))))) (reset-search-anchor (get-searching-edit)))))
(super-on-focus on?))] (super-on-focus on?))
[after-insert (define/override (after-insert x y)
(lambda (x y)
(super-after-insert x y) (super-after-insert x y)
(unless dont-search (unless dont-search
(search #f)))] (search #f)))
[after-delete (define/override (after-delete x y)
(lambda (x y)
(super-after-delete x y) (super-after-delete x y)
(unless dont-search (unless dont-search
(search #f)))]) (search #f)))
(sequence (apply super-init args)))) (super-new)
(inherit set-styles-fixed)
(set-styles-fixed #t)))
; this is here for when editors are printed, during debugging
(define replace-text% (define replace-text%
(class text:keymap% (class text:keymap%
(super-instantiate ()))) (inherit set-styles-fixed)
(super-instantiate ())
(set-styles-fixed #t)))
(define find-edit #f) (define find-edit #f)
(define replace-edit #f) (define replace-edit #f)
(define searchable-canvas% (define searchable-canvas%
(class100 editor-canvas% (parent) (class editor-canvas%
(inherit get-top-level-window set-line-count) (inherit get-top-level-window set-line-count)
(rename [super-on-focus on-focus]) (rename [super-on-focus on-focus])
(override (define/override (on-focus x)
[on-focus
(lambda (x)
(when x (when x
(set-searching-frame (get-top-level-window))) (set-searching-frame (get-top-level-window)))
(super-on-focus x))]) (super-on-focus x))
(sequence (super-new (style '(hide-hscroll hide-vscroll)))
(super-init parent #f '(hide-hscroll hide-vscroll)) (set-line-count 2)))
(set-line-count 2))))
(define (init-find/replace-edits) (define (init-find/replace-edits)
(unless find-edit (unless find-edit
@ -2283,7 +2271,7 @@
(super-instantiate ()))) (super-instantiate ())))
; to see printouts in memory debugging better. ; to see printouts in memory debugging better.
(define memory-text% (class100 text% args (sequence (apply super-init args)))) (define memory-text% (class text% (super-new)))
(define memory-text (make-object memory-text%)) (define memory-text (make-object memory-text%))
(send memory-text hide-caret #t) (send memory-text hide-caret #t)
(define show-memory-text? (define show-memory-text?