@@ -567,6 +567,31 @@ the state transitions / contracts are:
567
567
(cadr current)))))
568
568
(update-tf-bkg))
569
569
570
+ (define (add-boolean-option-with-ask-me parent label option1 option2 pref-key)
571
+ (define rb
572
+ (new radio-box%
573
+ [label label]
574
+ [parent parent]
575
+ [choices (list option1
576
+ option2
577
+ (string-constant ask-me-each-time))]
578
+ [callback
579
+ (λ (rb evt)
580
+ (preferences:set pref-key
581
+ (case (send rb get-selection)
582
+ [(0 ) #t ]
583
+ [(1 ) #f ]
584
+ [(2 ) 'ask ])))]))
585
+ (define (update-rb what)
586
+ (send rb set-selection
587
+ (case what
588
+ [(#t ) 0 ]
589
+ [(#f ) 1 ]
590
+ [(ask) 2 ])))
591
+ (update-rb (preferences:get pref-key))
592
+ (preferences:add-callback pref-key (λ (p v) (update-rb v)))
593
+ (void))
594
+
570
595
(define (add-general-checkbox-panel) (add-general-checkbox-panel/real))
571
596
(define (add-general-checkbox-panel/real)
572
597
(set! add-general-checkbox-panel/real void)
@@ -579,28 +604,12 @@ the state transitions / contracts are:
579
604
(string-constant backup-unsaved-files))
580
605
(add-check editor-panel 'framework:backup-files? (string-constant first-change-files))
581
606
582
- (define auto-load-rb
583
- (new radio-box%
584
- [label (string-constant autoload-automatically-reload)]
585
- [parent editor-panel]
586
- [choices (list (string-constant autoload-when-the-editor-isnt-dirty)
587
- (string-constant autoload-never-revert)
588
- (string-constant autoload-ask-about-reverting))]
589
- [callback
590
- (λ (rb evt)
591
- (preferences:set 'framework:autoload
592
- (case (send rb get-selection)
593
- [(0 ) #t ]
594
- [(1 ) #f ]
595
- [(2 ) 'ask ])))]))
596
- (define (update-auto-load-rb what)
597
- (send auto-load-rb set-selection
598
- (case what
599
- [(#t ) 0 ]
600
- [(#f ) 1 ]
601
- [(ask) 2 ])))
602
- (update-auto-load-rb (preferences:get 'framework:autoload ))
603
- (preferences:add-callback 'framework:autoload (λ (p v) (update-auto-load-rb v)))
607
+ (add-boolean-option-with-ask-me
608
+ editor-panel
609
+ (string-constant autoload-automatically-reload)
610
+ (string-constant autoload-when-the-editor-isnt-dirty)
611
+ (string-constant autoload-never-revert)
612
+ 'framework:autoload )
604
613
605
614
(unless (equal? (system-type) 'unix )
606
615
(define (bool->pref b) (if b 'std 'common ))
0 commit comments