diff --git a/collects/drracket/private/debug.rkt b/collects/drracket/private/debug.rkt index 0ffa8f56fd..52a7b12e37 100644 --- a/collects/drracket/private/debug.rkt +++ b/collects/drracket/private/debug.rkt @@ -1765,7 +1765,7 @@ profile todo: ;; GUI. They only manage the profiling information reported ;; in the bottom window (define profile-text% - (class text:basic% + (class text:line-spacing% (init-field tab) ;; clear-profile-display : -> void diff --git a/collects/drracket/private/font.rkt b/collects/drracket/private/font.rkt index 73a9e725e3..43e210eae4 100644 --- a/collects/drracket/private/font.rkt +++ b/collects/drracket/private/font.rkt @@ -172,7 +172,7 @@ [text (make-object (text:foreground-color-mixin (editor:standard-style-list-mixin - text:basic%)))] + text:line-spacing%)))] [ex-panel (make-object horizontal-panel% main)] [msg (make-object message% (string-constant example-text) ex-panel)] [canvas (make-object canvas:color% main text)] diff --git a/collects/drracket/private/multi-file-search.rkt b/collects/drracket/private/multi-file-search.rkt index 386e5e1c7d..168031eb33 100644 --- a/collects/drracket/private/multi-file-search.rkt +++ b/collects/drracket/private/multi-file-search.rkt @@ -124,10 +124,11 @@ (define results-super-text% (text:hide-caret/selection-mixin - (text:basic-mixin - (editor:standard-style-list-mixin - (editor:basic-mixin - text%))))) + (text:line-spacing-mixin + (text:basic-mixin + (editor:standard-style-list-mixin + (editor:basic-mixin + text%)))))) ;; results-text% : derived from text% ;; init args: zoom-text @@ -631,7 +632,7 @@ (define (exact-match-searcher params key) ;; thread: main eventspace thread (let ([case-sensitive? (car params)]) (λ (filename add-entry) ;; thread: searching thread - (let ([text (make-object text:basic%)]) + (let ([text (make-object text:line-spacing%)]) (send text load-file filename) (let loop ([pos 0]) (let ([found (send text find-string key 'forward pos 'eof #t case-sensitive?)]) diff --git a/collects/drracket/private/rep.rkt b/collects/drracket/private/rep.rkt index e2671264cb..bed7dce817 100644 --- a/collects/drracket/private/rep.rkt +++ b/collects/drracket/private/rep.rkt @@ -1978,7 +1978,7 @@ TODO (insert/delta text " in: ") (insert/delta text (format "~s" (syntax->datum expr)) error-text-style-delta)) (insert/delta text "\n") - (when (and (is-a? src text:basic%) + (when (and (is-a? src text:basic<%>) (number? pos) (number? span)) (highlight-errors (list (list src (- pos 1) (+ pos -1 span))))))) @@ -1997,7 +1997,7 @@ TODO (insert-file-name/icon src pos span line col)) (insert/delta text (format "~a" (exn-message exn)) error-delta) (insert/delta text "\n") - (when (and (is-a? src text:basic%) + (when (and (is-a? src text:basic<%>) (number? pos) (number? span)) (highlight-errors (list (list src (- pos 1) (+ pos -1 span))))))] diff --git a/collects/drracket/private/unit.rkt b/collects/drracket/private/unit.rkt index 5525d24bf1..95dec42ed3 100644 --- a/collects/drracket/private/unit.rkt +++ b/collects/drracket/private/unit.rkt @@ -1531,7 +1531,7 @@ module browser threading seems wrong. (member logger-panel (send logger-parent-panel get-children)))) (define/private (new-logger-text) - (set! logger-gui-text (new (text:hide-caret/selection-mixin text:basic%))) + (set! logger-gui-text (new (text:hide-caret/selection-mixin text:line-spacing%))) (send logger-gui-text lock #t)) (define/public (update-logger-window command) diff --git a/collects/drracket/sprof.rkt b/collects/drracket/sprof.rkt index 50f83d7406..0f50626860 100644 --- a/collects/drracket/sprof.rkt +++ b/collects/drracket/sprof.rkt @@ -86,7 +86,7 @@ [else (format "~a" n)])) (define cumulative-t% - (class text:basic% + (class text:line-spacing% (init-field open-button vp ec1 lp info-editor) (inherit begin-edit-sequence end-edit-sequence diff --git a/collects/framework/private/main.rkt b/collects/framework/private/main.rkt index 815790e0cb..2c59ca2bea 100644 --- a/collects/framework/private/main.rkt +++ b/collects/framework/private/main.rkt @@ -22,6 +22,10 @@ (application-preferences-handler (λ () (preferences:show-dialog))) +(preferences:set-default 'framework:line-spacing-add-gap? + (not (eq? (system-type) 'windows)) + boolean?) + ;; used to time how long it takes to set a preference; the value is not actually used. (preferences:set-default 'drracket:prefs-debug #f (λ (x) #t)) diff --git a/collects/framework/private/preferences.rkt b/collects/framework/private/preferences.rkt index 24dd3d9f52..99ff92076f 100644 --- a/collects/framework/private/preferences.rkt +++ b/collects/framework/private/preferences.rkt @@ -456,7 +456,7 @@ the state transitions / contracts are: (list (string-constant editor-prefs-panel-label) (string-constant general-prefs-panel-label)) (λ (editor-panel) - (make-check editor-panel 'framework:delete-forward? (string-constant map-delete-to-backspace) + (make-check editor-panel 'framework:delete-forward? (string-constant map-delete-to-backspace) not not) (make-check editor-panel 'framework:auto-set-wrap? @@ -499,6 +499,10 @@ the state transitions / contracts are: 'framework:always-use-platform-specific-linefeed-convention (string-constant always-use-platform-specific-linefeed-convention) values values)) + (make-check editor-panel + 'framework:line-spacing-add-gap? + (string-constant add-spacing-between-lines) + values values) (editor-panel-procs editor-panel))))]) (add-editor-checkbox-panel))) diff --git a/collects/framework/private/sig.rkt b/collects/framework/private/sig.rkt index 9f46f22f95..439253458f 100644 --- a/collects/framework/private/sig.rkt +++ b/collects/framework/private/sig.rkt @@ -168,6 +168,7 @@ (define-signature text-class^ (basic<%> + line-spacing<%> first-line<%> line-numbers<%> foreground-color<%> @@ -187,6 +188,7 @@ autocomplete<%> basic% + line-spacing% hide-caret/selection% nbsp->space% normalize-paste% @@ -206,6 +208,7 @@ input-box% basic-mixin + line-spacing-mixin first-line-mixin line-numbers-mixin foreground-color-mixin diff --git a/collects/framework/private/text.rkt b/collects/framework/private/text.rkt index 6a9311cd93..8af8dc71de 100644 --- a/collects/framework/private/text.rkt +++ b/collects/framework/private/text.rkt @@ -56,10 +56,6 @@ (values register-port-name! lookup-port-name))) - -;; wx: `default-wrapping?', add as the initial value for auto-wrap bitmap, -;; unless matthew makes it primitive - (define basic<%> (interface (editor:basic<%> (class->interface text%)) highlight-range @@ -545,6 +541,23 @@ (define (hash-cons! h k v) (hash-set! h k (cons v (hash-ref h k '())))) +(define line-spacing<%> (interface ())) + +(define line-spacing-mixin + (mixin (basic<%>) (line-spacing<%>) + (super-new) + (inherit set-line-spacing) + ;; this is a field so that the weakly + ;; held callback works out properly + (define (pref-cb-func sym val) + (set-line-spacing (if val 1 0))) + (preferences:add-callback 'framework:line-spacing-add-gap? + pref-cb-func + #t) + (set-line-spacing (if (preferences:get 'framework:line-spacing-add-gap?) + 1 + 0)))) + (define first-line<%> (interface () highlight-first-line @@ -4119,11 +4132,12 @@ designates the character that triggers autocompletion (setup-padding))) (define basic% (basic-mixin (editor:basic-mixin text%))) -(define hide-caret/selection% (hide-caret/selection-mixin basic%)) -(define nbsp->space% (nbsp->space-mixin basic%)) -(define normalize-paste% (normalize-paste-mixin basic%)) -(define delegate% (delegate-mixin basic%)) -(define wide-snip% (wide-snip-mixin basic%)) +(define line-spacing% (line-spacing-mixin basic%)) +(define hide-caret/selection% (hide-caret/selection-mixin line-spacing%)) +(define nbsp->space% (nbsp->space-mixin line-spacing%)) +(define normalize-paste% (normalize-paste-mixin line-spacing%)) +(define delegate% (delegate-mixin line-spacing%)) +(define wide-snip% (wide-snip-mixin line-spacing%)) (define standard-style-list% (editor:standard-style-list-mixin wide-snip%)) (define input-box% (input-box-mixin standard-style-list%)) (define -keymap% (editor:keymap-mixin standard-style-list%)) diff --git a/collects/scribblings/framework/text.scrbl b/collects/scribblings/framework/text.scrbl index 0c8b78ffe0..073c8eb1a5 100644 --- a/collects/scribblings/framework/text.scrbl +++ b/collects/scribblings/framework/text.scrbl @@ -171,6 +171,23 @@ } } +@definterface[text:line-spacing<%> (text:basic<%>)]{ + Objects implementing this interface adjust their + spacing based on the @racket['framework:line-spacing-add-gap?] + preference. +} + +@defmixin[text:line-spacing-mixin (text:basic<%>) (text:line-spacing<%>)]{ + Calls @method[text% set-line-spacing] to either @racket[0] or @racket[1] + when an object is created, based + on the @racket['framework:line-spacing-add-gap?] + preference. + + Also registers a callback (via @racket[preferences:add-callback]) to call + @method[text% set-line-spacing] when the @racket['framework:line-spacing-add-gap?] + preference changes. +} + @definterface[text:first-line<%> (text%)]{ Objects implementing this interface, when @method[text:first-line<%> @@ -1091,11 +1108,12 @@ } @defclass[text:basic% (text:basic-mixin (editor:basic-mixin text%)) ()]{} -@defclass[text:hide-caret/selection% (text:hide-caret/selection-mixin text:basic%) ()]{} -@defclass[text:nbsp->space% (text:nbsp->space-mixin text:basic%) ()]{} -@defclass[text:normalize-paste% (text:normalize-paste-mixin text:basic%) ()]{} -@defclass[text:delegate% (text:delegate-mixin text:basic%) ()]{} -@defclass[text:wide-snip% (text:wide-snip-mixin text:basic%) ()]{} +@defclass[text:line-spacing% (text:line-spacing-mixin text:basic%) ()]{} +@defclass[text:hide-caret/selection% (text:hide-caret/selection-mixin text:line-spacing%) ()]{} +@defclass[text:nbsp->space% (text:nbsp->space-mixin text:line-spacing%) ()]{} +@defclass[text:normalize-paste% (text:normalize-paste-mixin text:line-spacing%) ()]{} +@defclass[text:delegate% (text:delegate-mixin text:line-spacing%) ()]{} +@defclass[text:wide-snip% (text:wide-snip-mixin text:line-spacing%) ()]{} @defclass[text:standard-style-list% (editor:standard-style-list-mixin text:wide-snip%) ()]{} @defclass[text:input-box% (text:input-box-mixin text:standard-style-list%) ()]{} @defclass[text:keymap% (editor:keymap-mixin text:standard-style-list%) ()]{} diff --git a/collects/string-constants/private/english-string-constants.rkt b/collects/string-constants/private/english-string-constants.rkt index 0cdcc86e83..c9638d10a6 100644 --- a/collects/string-constants/private/english-string-constants.rkt +++ b/collects/string-constants/private/english-string-constants.rkt @@ -509,6 +509,8 @@ please adhere to these guidelines: (black-on-white-color-scheme "Black on White") ;; these two appear in the color preferences dialog on butttons (white-on-black-color-scheme "White on Black") ;; clicking the buttons changes the color schemes to some defaults that've been set up. + (add-spacing-between-lines "Add one pixel of extra space between lines") + ; title of the color choosing dialog ; should have entire alphabet