factor/extra/ui/tools/deploy/deploy.factor

111 lines
3.1 KiB
Factor
Raw Normal View History

2007-10-31 01:09:24 -04:00
! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: ui.gadgets colors kernel ui.render namespaces
2007-11-13 18:51:10 -05:00
models sequences ui.gadgets.buttons
2007-10-31 01:09:24 -04:00
ui.gadgets.packs ui.gadgets.labels tools.deploy.config
namespaces ui.gadgets.editors ui.gadgets.borders ui.gestures
ui.commands assocs ui.gadgets.tracks ui ui.tools.listener
2007-11-05 00:46:03 -05:00
tools.deploy vocabs ui.tools.workspace system ;
2007-10-31 01:09:24 -04:00
IN: ui.tools.deploy
TUPLE: deploy-gadget vocab settings ;
: bundle-name ( -- )
2007-11-05 00:46:03 -05:00
deploy-name get <field>
"Executable name:" label-on-left gadget, ;
2007-10-31 20:26:24 -04:00
: deploy-ui ( -- )
deploy-ui? get
"Include user interface framework" <checkbox> gadget, ;
2007-10-31 01:09:24 -04:00
: exit-when-windows-closed ( -- )
"stop-after-last-window?" get
"Exit when last UI window closed" <checkbox> gadget, ;
: io-settings ( -- )
"Input/output support:" <label> gadget,
deploy-io get deploy-io-options <radio-buttons> gadget, ;
: reflection-settings ( -- )
"Reflection support:" <label> gadget,
deploy-reflection get deploy-reflection-options <radio-buttons> gadget, ;
: advanced-settings ( -- )
"Advanced:" <label> gadget,
deploy-compiler? get "Use optimizing compiler" <checkbox> gadget,
deploy-math? get "Rational and complex number support" <checkbox> gadget,
deploy-word-props? get "Include word properties" <checkbox> gadget,
deploy-word-defs? get "Include word definitions" <checkbox> gadget,
2007-10-31 01:09:24 -04:00
deploy-c-types? get "Include C types" <checkbox> gadget, ;
: deploy-settings-theme
{ 10 10 } over set-pack-gap
1 swap set-pack-fill ;
2007-11-05 00:46:03 -05:00
: <deploy-settings> ( vocab -- control )
2007-10-31 01:09:24 -04:00
default-config [ <model> ] assoc-map [
[
bundle-name
2007-10-31 20:26:24 -04:00
deploy-ui
2007-11-05 00:46:03 -05:00
macosx? [ exit-when-windows-closed ] when
2007-10-31 01:09:24 -04:00
io-settings
reflection-settings
advanced-settings
] make-pile dup deploy-settings-theme
2007-11-13 18:51:10 -05:00
namespace <mapping> over set-gadget-model
2007-10-31 01:09:24 -04:00
] bind ;
: find-deploy-gadget
[ deploy-gadget? ] find-parent ;
: find-deploy-vocab
find-deploy-gadget deploy-gadget-vocab ;
: find-deploy-config
2007-11-05 00:46:03 -05:00
find-deploy-vocab deploy-config ;
2007-10-31 01:09:24 -04:00
: find-deploy-settings
find-deploy-gadget deploy-gadget-settings ;
: com-revert ( gadget -- )
dup find-deploy-config
swap find-deploy-settings set-control-value ;
: com-save ( gadget -- )
dup find-deploy-settings control-value
swap find-deploy-vocab set-deploy-config ;
: com-deploy ( gadget -- )
dup com-save
2007-11-05 00:46:03 -05:00
find-deploy-vocab [ deploy ] curry call-listener ;
2007-10-31 20:26:24 -04:00
: com-help ( -- )
"ui-deploy" help-window ;
\ com-help H{
{ +nullary+ t }
} define-command
2007-10-31 01:09:24 -04:00
deploy-gadget "toolbar" f {
2007-10-31 20:26:24 -04:00
{ f com-help }
2007-10-31 01:09:24 -04:00
{ f com-revert }
{ f com-save }
{ T{ key-down f f "RETURN" } com-deploy }
} define-command-map
2007-10-31 20:26:24 -04:00
: buttons,
g <toolbar> { 10 10 } over set-pack-gap gadget, ;
2007-10-31 01:09:24 -04:00
: <deploy-gadget> ( vocab -- gadget )
2007-10-31 21:52:46 -04:00
f deploy-gadget construct-boa [
2007-11-05 00:46:03 -05:00
dup <deploy-settings>
2007-10-31 20:26:24 -04:00
g-> set-deploy-gadget-settings gadget,
buttons,
] { 0 1 } build-pack
dup deploy-settings-theme
dup com-revert ;
2007-10-31 01:09:24 -04:00
: deploy-tool ( vocab -- )
2007-10-31 20:26:24 -04:00
vocab-name dup <deploy-gadget> 10 <border>
2007-10-31 01:09:24 -04:00
"Deploying \"" rot "\"" 3append open-window ;