root/trunk/orca/qt/oconf.r

Revision 1, 2.0 kB (checked in by krobillard, 3 years ago)

Import orca & thune.

Line 
1; Orca Configurator GUI
2
3
4cfg-file: %config.r
5
6
7config-options: [
8    ; Name      Default  Description
9
10    rebol          no   "REBOL compatibility"
11    number_arrays  no   "Experimental integer & decimal arrays"
12    bytecode       yes  "Converts code to/from binary format"
13    compress       yes  "bzip2 compression"
14    hex_token      yes  "'$' marks start of hexidecimal integer"
15    glmath         yes  "Adds vec3! & matrix! datatypes"
16]
17
18
19build-config: func [/local vbox setw]
20[
21    config: make block! 20
22    vbox: gui/2/4/3/2   ; Ugly magic numbers
23
24    foreach [name default tip] config-options [
25        setw: to-set-word name
26
27        append config setw
28        append config default
29
30        append gui setw
31        append vbox reduce [setw 'checkbox to-string name 'tip tip]
32        ;vbox: skip vbox 5
33    ]
34
35    config: context config
36
37    append gui none
38    gui: context gui
39]
40
41
42; Set config values to match widget values.
43set-config-values: does [
44    foreach w next first config [
45        set in config w
46            widget-value get in gui w
47    ]
48]
49
50
51; Set widget values to match config values.
52set-widget-values: does [
53    foreach w next first config [
54        set-widget-value get in gui w
55            get in config w
56    ]
57]
58
59
60gui: [
61    dialog: [
62        title "Orca Configurator"
63        vbox [
64            group "Options" [
65                vbox [
66            ; Checkboxes inserted here.
67                ]
68            ]
69
70            hbox [
71                label "Boot.r format:"
72                boot-format: combo "Strings" "Bytecode"
73                spacer
74            ]
75            spacer
76            hbox [
77                spacer
78                button "Save" [close yes]
79                button "Exit" [close no]
80            ]
81        ]
82    ]
83
84    boot-format: none
85
86    ; Widget handles appended here.
87]
88
89
90build-config
91
92if exists? cfg-file [
93    config: make config load cfg-file
94]
95
96wid: widget gui/dialog
97;probe gui
98;probe wid
99set-widget-values
100if exec wid [
101    set-config-values
102    write cfg-file config
103    print ["Wrote" cfg-file]
104]
105
106
107;eof
Note: See TracBrowser for help on using the browser.