adjust drracket so check syntax can add its preferences itself

closes PR 13419
(cherry picked from commit 3e3283aeba)
This commit is contained in:
Robby Findler 2013-01-07 16:26:36 -06:00 committed by Ryan Culpepper
parent 1a9d203f29
commit 91bcf2ad27
5 changed files with 25 additions and 4 deletions

View File

@ -109,8 +109,10 @@
(define-signature drracket:module-language-tools^ extends drracket:module-language-tools-cm^ (define-signature drracket:module-language-tools^ extends drracket:module-language-tools-cm^
(add-opt-out-toolbar-button (add-opt-out-toolbar-button
add-online-expansion-handler add-online-expansion-handler
register-online-expansion-pref
;; the below should be hidden from tools ;; the below should be hidden from tools
get-online-expansion-pref-funcs
(struct online-expansion-handler (mod-path id local-handler)) (struct online-expansion-handler (mod-path id local-handler))
get-online-expansion-handlers get-online-expansion-handlers
no-more-online-expansion-handlers)) no-more-online-expansion-handlers))

View File

@ -320,4 +320,10 @@
[else [else
(set! online-expansion-handlers (set! online-expansion-handlers
(cons (online-expansion-handler mod-path id local-handler) (cons (online-expansion-handler mod-path id local-handler)
online-expansion-handlers))]))) online-expansion-handlers))]))
(define online-expansion-pref-funcs '())
(define (get-online-expansion-pref-funcs) online-expansion-pref-funcs)
(define online-expansion-prefs '())
(define (register-online-expansion-pref func)
(set! online-expansion-pref-funcs (cons func online-expansion-pref-funcs))))

View File

@ -2317,7 +2317,6 @@
(connect-to-prefs read-choice 'drracket:online-expansion:read-in-defs-errors) (connect-to-prefs read-choice 'drracket:online-expansion:read-in-defs-errors)
(connect-to-prefs var-choice 'drracket:online-expansion:variable-errors) (connect-to-prefs var-choice 'drracket:online-expansion:variable-errors)
(connect-to-prefs other-choice 'drracket:online-expansion:other-errors) (connect-to-prefs other-choice 'drracket:online-expansion:other-errors)
(preferences:add-check vp (for ([f (in-list (drracket:module-language-tools:get-online-expansion-pref-funcs))])
'drracket:syncheck:show-arrows? (f vp))
(string-constant show-arrows-on-mouseover))
parent-vp)))) parent-vp))))

View File

@ -89,6 +89,11 @@ If the namespace does not, they are colored the unbound color.
number-between-zero-and-one?)) number-between-zero-and-one?))
(preferences:set-default 'drracket:syncheck:show-arrows? #t boolean?) (preferences:set-default 'drracket:syncheck:show-arrows? #t boolean?)
(define (syncheck-add-to-online-expansion-prefs-panel vp)
(preferences:add-check vp
'drracket:syncheck:show-arrows?
(string-constant show-arrows-on-mouseover)))
(define (syncheck-add-to-preferences-panel parent) (define (syncheck-add-to-preferences-panel parent)
(color-prefs:build-color-selection-panel parent (color-prefs:build-color-selection-panel parent
lexically-bound-variable-style-pref lexically-bound-variable-style-pref
@ -2081,6 +2086,7 @@ If the namespace does not, they are colored the unbound color.
(add-check-syntax-key-bindings (drracket:rep:get-drs-bindings-keymap)) (add-check-syntax-key-bindings (drracket:rep:get-drs-bindings-keymap))
(fw:color-prefs:add-to-preferences-panel (string-constant check-syntax) (fw:color-prefs:add-to-preferences-panel (string-constant check-syntax)
syncheck-add-to-preferences-panel) syncheck-add-to-preferences-panel)
(drracket:module-language-tools:register-online-expansion-pref syncheck-add-to-online-expansion-prefs-panel)
(drracket:language:register-capability 'drscheme:check-syntax-button (flat-contract boolean?) #t) (drracket:language:register-capability 'drscheme:check-syntax-button (flat-contract boolean?) #t)
(drracket:get/extend:extend-definitions-text make-syncheck-text%) (drracket:get/extend:extend-definitions-text make-syncheck-text%)
(drracket:get/extend:extend-definitions-canvas docs-editor-canvas-mixin) (drracket:get/extend:extend-definitions-canvas docs-editor-canvas-mixin)

View File

@ -162,6 +162,14 @@ all of the names in the tools library, for use defining keybindings
and other tools), but any long running computations may freeze DrRacket's GUI, and other tools), but any long running computations may freeze DrRacket's GUI,
since this procedure is invoked on DrRacket's eventspace's handler thread.}) since this procedure is invoked on DrRacket's eventspace's handler thread.})
(proc-doc/names
drracket:module-language-tools:register-online-expansion-pref
(-> (-> (is-a?/c vertical-panel%) void?) void?)
(func)
@{Registers @racket[func] so that it is called while building the
preferences panel. The function is passed a panel that contains
other configuration controls for online expansion.})
(proc-doc/names (proc-doc/names
drracket:module-language:add-module-language drracket:module-language:add-module-language
(-> any) (-> any)