diff --git a/collects/framework/editor.ss b/collects/framework/editor.ss index 05bc62df..6f4b515a 100644 --- a/collects/framework/editor.ss +++ b/collects/framework/editor.ss @@ -13,6 +13,7 @@ (define basic<%> (interface (editor<%>) + has-focus? editing-this-file? local-edit-sequence? run-after-edit-sequence @@ -28,6 +29,18 @@ get-canvas get-max-width get-admin set-filename) + (private + [has-focus #f]) + (rename [super-on-focus on-focus]) + (override + [on-focus + (lambda (x) + (set! has-focus x))]) + (public + [has-focus? + (lambda () + has-focus)]) + (rename [super-begin-edit-sequence begin-edit-sequence] [super-end-edit-sequence end-edit-sequence]) (private @@ -46,10 +59,6 @@ (error 'end-edit-sequence "extra end-edit-sequence")) (super-end-edit-sequence))]) - (rename [super-set-modified set-modified] - [super-on-focus on-focus] - [super-lock lock]) - (public [on-close void] [get-top-level-window @@ -128,6 +137,8 @@ [else (hash-table-for-each ht (lambda (k t) (t))) (for-each (lambda (t) (t)) queue)]))))]) + + (rename [super-lock lock]) (private [is-locked? #f]) (public diff --git a/collects/framework/scheme.ss b/collects/framework/scheme.ss index c0923324..fe5ebc23 100644 --- a/collects/framework/scheme.ss +++ b/collects/framework/scheme.ss @@ -138,6 +138,7 @@ [super-after-delete after-delete] [super-after-set-size-constraint after-set-size-constraint] [super-after-set-position after-set-position]) + (inherit has-focus?) (override [on-focus (lambda (on?) @@ -146,32 +147,38 @@ [after-change-style (lambda (start len) (unless (get-styles-fixed) - (highlight-parens)) + (when (has-focus?) + (highlight-parens))) (super-after-change-style start len))] [after-edit-sequence (lambda () - (unless in-highlight-parens? - (highlight-parens)) + (when (has-focus?) + (unless in-highlight-parens? + (highlight-parens))) (super-after-edit-sequence))] [after-insert (lambda (start size) (send backward-cache invalidate start) (send forward-cache forward-invalidate start size) - (highlight-parens) + (when (has-focus?) + (highlight-parens)) (super-after-insert start size))] [after-delete (lambda (start size) (super-after-delete start size) (send backward-cache invalidate start) (send forward-cache forward-invalidate (+ start size) (- size)) - (highlight-parens))] + (when (has-focus?) + (highlight-parens)))] [after-set-size-constraint (lambda () - (highlight-parens) + (when (has-focus?) + (highlight-parens)) (super-after-set-size-constraint))] [after-set-position (lambda () - (highlight-parens) + (when (has-focus?) + (highlight-parens)) (super-after-set-position))]) (private @@ -601,7 +608,7 @@ #f)]) ans))] [flash-backward-sexp - (lambda (start-pos move?) + (lambda (start-pos) (let ([end-pos (get-backward-sexp start-pos)]) (if end-pos (flash-on end-pos (add1 end-pos)) @@ -753,7 +760,7 @@ (define setup-keymap (lambda (keymap) - (let ([add-pos-function ;; wx: this needs to be cleaned up! + (let ([add-pos-function (lambda (name ivar-sym) (send keymap add-function name (lambda (edit event) diff --git a/collects/framework/text.ss b/collects/framework/text.ss index 4af50047..cb53330d 100644 --- a/collects/framework/text.ss +++ b/collects/framework/text.ss @@ -16,7 +16,7 @@ ;; unless matthew makes it primitive (define basic<%> - (interface (text<%>) + (interface (editor:basic<%> text<%>) highlight-range get-styles-fixed set-styles-fixed @@ -26,8 +26,8 @@ (define basic-mixin (mixin (editor:basic<%> text<%>) (basic<%>) args (inherit get-canvases get-admin split-snip get-snip-position - delete find-snip invalidate-bitmap-cache set-autowrap-bitmap + delete find-snip invalidate-bitmap-cache set-file-format get-file-format get-style-list is-modified? change-style set-modified position-location get-extent) @@ -296,7 +296,6 @@ (insert-edit released/copied dest-position dest-position) (loop prev))]))))]) - (public [initial-autowrap-bitmap (lambda () (icon:get-autowrap-bitmap))])