1 ! Copyright (C) 2007, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: ui.gadgets colors kernel ui.render namespaces models
4 models.mapping sequences ui.gadgets.buttons ui.gadgets.packs
5 ui.gadgets.labels tools.deploy.config tools.deploy.config.editor
6 namespaces ui.gadgets.editors ui.gadgets.borders ui.gestures
7 ui.commands assocs ui.gadgets.tracks ui ui.tools.listener
8 tools.deploy vocabs ui.tools.workspace system accessors fry ;
11 TUPLE: deploy-gadget < pack vocab settings ;
13 : bundle-name ( parent -- parent )
14 deploy-name get <field>
15 "Executable name:" label-on-left add-gadget ;
17 : deploy-ui ( parent -- parent )
19 "Include user interface framework" <checkbox> add-gadget ;
21 : io-settings ( parent -- parent )
22 "Input/output support:" <label> add-gadget
23 deploy-io get deploy-io-options <radio-buttons> add-gadget ;
25 : reflection-settings ( parent -- parent )
26 "Reflection support:" <label> add-gadget
27 deploy-reflection get deploy-reflection-options <radio-buttons> add-gadget ;
29 : advanced-settings ( parent -- parent )
30 "Advanced:" <label> add-gadget
31 deploy-compiler? get "Use optimizing compiler" <checkbox> add-gadget
32 deploy-math? get "Rational and complex number support" <checkbox> add-gadget
33 deploy-threads? get "Threading support" <checkbox> add-gadget
34 deploy-unicode? get "Unicode character literal support" <checkbox> add-gadget
35 deploy-word-props? get "Retain all word properties" <checkbox> add-gadget
36 deploy-word-defs? get "Retain all word definitions" <checkbox> add-gadget
37 deploy-c-types? get "Retain all C types" <checkbox> add-gadget ;
39 : deploy-settings-theme ( gadget -- gadget )
43 : <deploy-settings> ( vocab -- control )
44 default-config [ <model> ] assoc-map
54 namespace <mapping> >>model
58 : find-deploy-gadget ( gadget -- deploy-gadget )
59 [ deploy-gadget? ] find-parent ;
61 : find-deploy-vocab ( gadget -- vocab )
62 find-deploy-gadget vocab>> ;
64 : find-deploy-config ( gadget -- config )
65 find-deploy-vocab deploy-config ;
67 : find-deploy-settings ( gadget -- settings )
68 find-deploy-gadget settings>> ;
70 : com-revert ( gadget -- )
71 dup find-deploy-config
72 swap find-deploy-settings set-control-value ;
74 : com-save ( gadget -- )
75 dup find-deploy-settings control-value
76 swap find-deploy-vocab set-deploy-config ;
78 : com-deploy ( gadget -- )
80 dup find-deploy-vocab '[ _ deploy ] call-listener
84 "ui.tools.deploy" help-window ;
90 : com-close ( gadget -- )
93 deploy-gadget "misc" "Miscellaneous commands" {
94 { T{ key-down f f "ESC" } com-close }
97 deploy-gadget "toolbar" f {
98 { T{ key-down f f "F1" } com-help }
101 { T{ key-down f f "RET" } com-deploy }
104 : <deploy-gadget> ( vocab -- gadget )
105 deploy-gadget new-gadget
107 { 0 1 } >>orientation
108 swap <deploy-settings> >>settings
109 dup settings>> add-gadget
110 dup <toolbar> { 10 10 } >>gap add-gadget
111 deploy-settings-theme
114 : deploy-tool ( vocab -- )
116 [ <deploy-gadget> 10 <border> ]
117 [ "Deploying \"" "\"" surround ] bi