factor/basis/ui/tools/deploy/deploy.factor

124 lines
3.8 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 models
models.mapping sequences ui.gadgets.buttons 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 tools.deploy
vocabs ui.tools.workspace system accessors fry ;
2007-10-31 01:09:24 -04:00
IN: ui.tools.deploy
TUPLE: deploy-gadget < pack vocab settings ;
2007-10-31 01:09:24 -04:00
: bundle-name ( parent -- parent )
2007-11-05 00:46:03 -05:00
deploy-name get <field>
"Executable name:" label-on-left add-gadget ;
2007-10-31 20:26:24 -04:00
: deploy-ui ( parent -- parent )
2007-10-31 20:26:24 -04:00
deploy-ui? get
"Include user interface framework" <checkbox> add-gadget ;
2007-10-31 01:09:24 -04:00
: exit-when-windows-closed ( parent -- parent )
2007-10-31 01:09:24 -04:00
"stop-after-last-window?" get
"Exit when last UI window closed" <checkbox> add-gadget ;
: io-settings ( parent -- parent )
"Input/output support:" <label> add-gadget
deploy-io get deploy-io-options <radio-buttons> add-gadget ;
: reflection-settings ( parent -- parent )
"Reflection support:" <label> add-gadget
deploy-reflection get deploy-reflection-options <radio-buttons> add-gadget ;
: advanced-settings ( parent -- parent )
"Advanced:" <label> add-gadget
deploy-compiler? get "Use optimizing compiler" <checkbox> add-gadget
deploy-math? get "Rational and complex number support" <checkbox> add-gadget
deploy-threads? get "Threading support" <checkbox> add-gadget
deploy-unicode? get "Unicode character literal support" <checkbox> add-gadget
deploy-word-props? get "Retain all word properties" <checkbox> add-gadget
deploy-word-defs? get "Retain all word definitions" <checkbox> add-gadget
deploy-c-types? get "Retain all C types" <checkbox> add-gadget ;
2007-10-31 01:09:24 -04:00
: deploy-settings-theme ( gadget -- gadget )
{ 10 10 } >>gap
1 >>fill ;
2007-10-31 01:09:24 -04:00
2007-11-05 00:46:03 -05:00
: <deploy-settings> ( vocab -- control )
default-config [ <model> ] assoc-map
[
<pile>
bundle-name
deploy-ui
os macosx? [ exit-when-windows-closed ] when
io-settings
reflection-settings
advanced-settings
deploy-settings-theme
namespace <mapping> >>model
]
bind ;
2007-10-31 01:09:24 -04:00
2008-06-08 16:32:55 -04:00
: find-deploy-gadget ( gadget -- deploy-gadget )
2007-10-31 01:09:24 -04:00
[ deploy-gadget? ] find-parent ;
2008-06-08 16:32:55 -04:00
: find-deploy-vocab ( gadget -- vocab )
2008-09-01 04:40:31 -04:00
find-deploy-gadget vocab>> ;
2007-10-31 01:09:24 -04:00
2008-06-08 16:32:55 -04:00
: find-deploy-config ( gadget -- config )
2007-11-05 00:46:03 -05:00
find-deploy-vocab deploy-config ;
2007-10-31 01:09:24 -04:00
2008-06-08 16:32:55 -04:00
: find-deploy-settings ( gadget -- settings )
2008-09-01 04:40:31 -04:00
find-deploy-gadget settings>> ;
2007-10-31 01:09:24 -04:00
: 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
dup find-deploy-vocab '[ _ deploy ] call-listener
close-window ;
2007-10-31 20:26:24 -04:00
: com-help ( -- )
2008-01-11 03:32:25 -05:00
"ui.tools.deploy" help-window ;
2007-10-31 20:26:24 -04:00
\ com-help H{
{ +nullary+ t }
} define-command
2007-10-31 01:09:24 -04:00
: com-close ( gadget -- )
close-window ;
deploy-gadget "misc" "Miscellaneous commands" {
{ T{ key-down f f "ESC" } com-close }
} define-command-map
2007-10-31 01:09:24 -04:00
deploy-gadget "toolbar" f {
{ T{ key-down f f "F1" } com-help }
2007-10-31 01:09:24 -04:00
{ f com-revert }
{ f com-save }
2007-12-14 01:16:47 -05:00
{ T{ key-down f f "RET" } com-deploy }
2007-10-31 01:09:24 -04:00
} define-command-map
: <deploy-gadget> ( vocab -- gadget )
deploy-gadget new-gadget
over >>vocab
{ 0 1 } >>orientation
swap <deploy-settings> >>settings
dup settings>> add-gadget
dup <toolbar> { 10 10 } >>gap add-gadget
deploy-settings-theme
dup com-revert ;
2007-10-31 01:09:24 -04:00
: deploy-tool ( vocab -- )
vocab-name
[ <deploy-gadget> 10 <border> ]
2008-12-06 19:58:45 -05:00
[ "Deploying \"" "\"" surround ] bi
open-window ;