fix the handling of the drracket:show-line-numbers? preference

so the line numbers change no matter who sets the preference
This commit is contained in:
Robby Findler 2011-04-10 17:43:06 -05:00
parent 6b503fa947
commit 2c2669bfa6
2 changed files with 14 additions and 10 deletions

View File

@ -338,15 +338,7 @@
(λ (editor-panel)
(make-check-box 'drracket:show-line-numbers?
(string-constant show-line-numbers)
editor-panel
(lambda (value)
(define (drracket:frame? frame)
(and (is-a? frame top-level-window<%>)
(is-a? frame drracket:unit:frame%)))
;; is it a hack to use `get-top-level-windows' ?
(define frames (filter drracket:frame? (get-top-level-windows)))
(when (not (null? frames))
(send (car frames) show-line-numbers! value))))
editor-panel)
;; come back to this one.
#;

View File

@ -1422,7 +1422,19 @@ module browser threading seems wrong.
(λ (l) (remq execute-warning-panel l)))
(send execute-warning-canvas set-message #f))])))
(define/public (show-line-numbers! show)
;; bind the proc to a field
;; so it stays alive as long
;; as the frame stays alive
(define show-line-numbers-pref-fn
(let ([fn (lambda (pref value) (show-line-numbers! value))])
(preferences:add-callback
'drracket:show-line-numbers?
fn
#t)
fn))
(define/private (show-line-numbers! show)
(for ([tab tabs])
(define text (send tab get-defs))
(send text show-line-numbers! show))