|
944 | 944 | 1.0))) |
945 | 945 |
|
946 | 946 | ;; returns the user's preferred color, wrt to the current color scheme |
947 | | -(define (lookup-in-color-scheme color-name) |
| 947 | +(define (lookup-in-color-scheme color-name #:wob? [wob? (white-on-black-color-scheme?)]) |
948 | 948 | (lookup-in-color-scheme/given-mapping |
949 | 949 | color-name |
950 | 950 | (preferences:get (color-scheme-entry-name->pref-name color-name)) |
951 | | - (get-current-color-scheme))) |
| 951 | + (get-current-color-scheme #:wob? wob?))) |
952 | 952 |
|
953 | 953 | (define (lookup-in-given-color-scheme color-name color-scheme) |
954 | 954 | (lookup-in-color-scheme/given-mapping |
|
980 | 980 | ;; set-color : symbol (or/c string? (is-a?/c color%) (is-a?/c style-delta%)) -> void |
981 | 981 | (define (set-in-color-scheme color-name clr/sd) |
982 | 982 | (define table (preferences:get (color-scheme-entry-name->pref-name color-name))) |
983 | | - (define current-color-scheme (get-current-color-scheme)) |
| 983 | + (define current-color-scheme (get-current-color-scheme #:wob? (white-on-black-color-scheme?))) |
984 | 984 | (define scheme-name (color-scheme-name current-color-scheme)) |
985 | 985 | (define new-table |
986 | 986 | (cond |
|
1011 | 1011 | (= (send c1 blue) (send c2 blue)) |
1012 | 1012 | (= (send c1 alpha) (send c2 alpha)))) |
1013 | 1013 |
|
1014 | | -(define (get-current-color-scheme #:wob? [wob? #f]) |
| 1014 | +(define (get-current-color-scheme #:wob? wob?) |
1015 | 1015 | ;; if pref is not recognized as an existing color scheme name, |
1016 | 1016 | ;; return one of the two original color schemes so that |
1017 | 1017 | ;; if some color scheme goes away, we have some |
|
1025 | 1025 | [wob? (built-in-wob-color-scheme)] |
1026 | 1026 | [else (built-in-color-scheme)])) |
1027 | 1027 |
|
1028 | | -(define (get-current-color-scheme-name #:wob? [wob? #f]) |
| 1028 | +(define (get-current-color-scheme-name #:wob? [wob? (white-on-black-color-scheme?)]) |
1029 | 1029 | (color-scheme-name (get-current-color-scheme #:wob? wob?))) |
1030 | 1030 |
|
1031 | 1031 | ;; string -> (or/c #f color-scheme?) |
|
1107 | 1107 | (fn (lookup-in-color-scheme/given-mapping |
1108 | 1108 | color |
1109 | 1109 | ht |
1110 | | - (get-current-color-scheme))))))) |
| 1110 | + (get-current-color-scheme |
| 1111 | + #:wob? (white-on-black-color-scheme?)))))))) |
1111 | 1112 | (void)) |
1112 | 1113 |
|
1113 | 1114 | ;; we remove elements of the list when the function isn't reachable anymore |
|
1315 | 1316 | (preferences:set 'framework:white-on-black-mode? |
1316 | 1317 | (match (send white-on-black-mode-choice get-selection) |
1317 | 1318 | [0 #f] |
1318 | | - [1 #t])))]) |
1319 | | - (preferences:add-callback |
1320 | | - 'framework:white-on-black-mode? |
1321 | | - (λ (_1 val) |
1322 | | - (send white-on-black-mode-choice |
1323 | | - set-selection |
1324 | | - (if val 1 0))))] |
| 1319 | + [1 #t])))])] |
1325 | 1320 | [else |
1326 | 1321 | (new choice% |
1327 | 1322 | [parent bottom-hp] |
|
1335 | 1330 | (match (send white-on-black-mode-choice get-selection) |
1336 | 1331 | [0 'platform] |
1337 | 1332 | [1 #f] |
1338 | | - [2 #t])))]) |
1339 | | - (preferences:add-callback |
1340 | | - 'framework:white-on-black-mode? |
1341 | | - (λ (_1 val) |
1342 | | - (send white-on-black-mode-choice |
1343 | | - set-selection |
1344 | | - (match val |
1345 | | - ['platform 0] |
1346 | | - [#t 2] |
1347 | | - [#f 1]))))])) |
| 1333 | + [2 #t])))])])) |
| 1334 | + (case (system-type) |
| 1335 | + [(windows) |
| 1336 | + (preferences:add-callback |
| 1337 | + 'framework:white-on-black-mode? |
| 1338 | + (λ (_1 val) |
| 1339 | + (send white-on-black-mode-choice |
| 1340 | + set-selection |
| 1341 | + (if val 1 0))))] |
| 1342 | + [else |
| 1343 | + (preferences:add-callback |
| 1344 | + 'framework:white-on-black-mode? |
| 1345 | + (λ (_1 val) |
| 1346 | + (send white-on-black-mode-choice |
| 1347 | + set-selection |
| 1348 | + (match val |
| 1349 | + ['platform 0] |
| 1350 | + [#t 2] |
| 1351 | + [#f 1]))))]) |
1348 | 1352 | (define wid (apply max (map (λ (x) (send x get-width)) buttons))) |
1349 | 1353 | (for ([b (in-list buttons)]) |
1350 | 1354 | (send b min-width wid)) |
|
0 commit comments