Refactoring.
This commit is contained in:
parent
f50d64b3b2
commit
8bceeadaab
|
@ -200,15 +200,9 @@
|
||||||
|
|
||||||
;; control panel
|
;; control panel
|
||||||
(define panel #f)
|
(define panel #f)
|
||||||
(define/public (show-optimization-coach)
|
(define (create-panel)
|
||||||
(define area-container (get-area-container))
|
|
||||||
(define definitions (get-definitions-text))
|
|
||||||
(define filters (send definitions get-filters))
|
|
||||||
(cond [panel
|
|
||||||
(send area-container add-child panel)]
|
|
||||||
[else
|
|
||||||
(set! panel (new horizontal-panel%
|
(set! panel (new horizontal-panel%
|
||||||
[parent area-container]
|
[parent (get-area-container)]
|
||||||
[stretchable-height #f]))
|
[stretchable-height #f]))
|
||||||
(new button%
|
(new button%
|
||||||
[label "Clear"]
|
[label "Clear"]
|
||||||
|
@ -227,8 +221,13 @@
|
||||||
(cons f filters)))
|
(cons f filters)))
|
||||||
;; redraw
|
;; redraw
|
||||||
(send definitions add-highlights))]
|
(send definitions add-highlights))]
|
||||||
[value (memq f filters)]))])
|
[value #f]))) ; will be updated in `show-optimization-coach'
|
||||||
|
|
||||||
|
(define/public (show-optimization-coach)
|
||||||
|
(cond [panel (send (get-area-container) add-child panel)]
|
||||||
|
[else (create-panel)])
|
||||||
;; update check-boxes
|
;; update check-boxes
|
||||||
|
(define filters (send (get-definitions-text) get-filters))
|
||||||
(for ([c (in-list (for/list ([c (in-list (send panel get-children))]
|
(for ([c (in-list (for/list ([c (in-list (send panel get-children))]
|
||||||
#:when (is-a? c check-box%))
|
#:when (is-a? c check-box%))
|
||||||
c))]
|
c))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user