From 91bcf2ad271b8380a27cf87da0c03017fa3da244 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 7 Jan 2013 16:26:36 -0600 Subject: [PATCH] adjust drracket so check syntax can add its preferences itself closes PR 13419 (cherry picked from commit 3e3283aeba1f239cc8722b4f13bfb19d48e8642e) --- collects/drracket/private/drsig.rkt | 2 ++ collects/drracket/private/module-language-tools.rkt | 8 +++++++- collects/drracket/private/module-language.rkt | 5 ++--- collects/drracket/private/syncheck/gui.rkt | 6 ++++++ collects/drracket/tool-lib.rkt | 8 ++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/collects/drracket/private/drsig.rkt b/collects/drracket/private/drsig.rkt index f852dc916a..0a700f6a20 100644 --- a/collects/drracket/private/drsig.rkt +++ b/collects/drracket/private/drsig.rkt @@ -109,8 +109,10 @@ (define-signature drracket:module-language-tools^ extends drracket:module-language-tools-cm^ (add-opt-out-toolbar-button add-online-expansion-handler + register-online-expansion-pref ;; the below should be hidden from tools + get-online-expansion-pref-funcs (struct online-expansion-handler (mod-path id local-handler)) get-online-expansion-handlers no-more-online-expansion-handlers)) diff --git a/collects/drracket/private/module-language-tools.rkt b/collects/drracket/private/module-language-tools.rkt index 27e0fa39c8..dc06b20692 100644 --- a/collects/drracket/private/module-language-tools.rkt +++ b/collects/drracket/private/module-language-tools.rkt @@ -320,4 +320,10 @@ [else (set! online-expansion-handlers (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)))) diff --git a/collects/drracket/private/module-language.rkt b/collects/drracket/private/module-language.rkt index 2063b6b69f..5268861570 100644 --- a/collects/drracket/private/module-language.rkt +++ b/collects/drracket/private/module-language.rkt @@ -2317,7 +2317,6 @@ (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 other-choice 'drracket:online-expansion:other-errors) - (preferences:add-check vp - 'drracket:syncheck:show-arrows? - (string-constant show-arrows-on-mouseover)) + (for ([f (in-list (drracket:module-language-tools:get-online-expansion-pref-funcs))]) + (f vp)) parent-vp)))) diff --git a/collects/drracket/private/syncheck/gui.rkt b/collects/drracket/private/syncheck/gui.rkt index 93c2615354..16eb03c2de 100644 --- a/collects/drracket/private/syncheck/gui.rkt +++ b/collects/drracket/private/syncheck/gui.rkt @@ -89,6 +89,11 @@ If the namespace does not, they are colored the unbound color. number-between-zero-and-one?)) (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) (color-prefs:build-color-selection-panel parent 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)) (fw:color-prefs:add-to-preferences-panel (string-constant check-syntax) 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:get/extend:extend-definitions-text make-syncheck-text%) (drracket:get/extend:extend-definitions-canvas docs-editor-canvas-mixin) diff --git a/collects/drracket/tool-lib.rkt b/collects/drracket/tool-lib.rkt index d7a998dcdb..c17638008d 100644 --- a/collects/drracket/tool-lib.rkt +++ b/collects/drracket/tool-lib.rkt @@ -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, 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 drracket:module-language:add-module-language (-> any)