2006-08-26 03:46:37 -04:00
|
|
|
! Copyright (C) 2006 Slava Pestov.
|
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2006-08-27 23:22:30 -04:00
|
|
|
IN: gadgets-workspace
|
2006-09-14 16:15:39 -04:00
|
|
|
USING: arrays compiler gadgets gadgets-books gadgets-browser
|
|
|
|
|
gadgets-buttons gadgets-controls gadgets-dataflow gadgets-frames
|
|
|
|
|
gadgets-grids gadgets-help gadgets-listener
|
|
|
|
|
gadgets-presentations gadgets-walker gadgets-workspace generic
|
|
|
|
|
kernel math modules scratchpad sequences syntax words ;
|
2006-08-26 17:13:24 -04:00
|
|
|
|
|
|
|
|
C: tool ( gadget -- tool )
|
|
|
|
|
{
|
|
|
|
|
{ [ dup <toolbar> ] f f @top }
|
2006-08-27 19:02:16 -04:00
|
|
|
{ [ ] set-tool-gadget f @center }
|
2006-08-26 17:13:24 -04:00
|
|
|
} make-frame* ;
|
|
|
|
|
|
2006-08-27 19:02:16 -04:00
|
|
|
M: tool focusable-child* tool-gadget ;
|
2006-08-26 17:13:24 -04:00
|
|
|
|
2006-08-27 19:02:16 -04:00
|
|
|
M: tool call-tool* tool-gadget call-tool* ;
|
2006-08-26 03:46:37 -04:00
|
|
|
|
|
|
|
|
: workspace-tabs
|
|
|
|
|
{
|
2006-08-31 21:58:15 -04:00
|
|
|
{ "Listener" <listener-gadget> }
|
|
|
|
|
{ "Definitions" <browser> }
|
|
|
|
|
{ "Documentation" <help-gadget> }
|
|
|
|
|
{ "Walker" <walker-gadget> }
|
2006-09-13 02:17:46 -04:00
|
|
|
{ "Dataflow" <dataflow-gadget> }
|
2006-08-26 03:46:37 -04:00
|
|
|
} ;
|
|
|
|
|
|
2006-08-27 19:02:16 -04:00
|
|
|
C: workspace ( -- workspace )
|
2006-08-31 21:58:15 -04:00
|
|
|
workspace-tabs [ second execute <tool> ] map <book>
|
|
|
|
|
over set-gadget-delegate dup dup set-control-self ;
|
2006-08-27 19:02:16 -04:00
|
|
|
|
2006-08-31 21:58:15 -04:00
|
|
|
M: workspace pref-dim* delegate pref-dim* { 550 650 } vmax ;
|
2006-08-26 03:46:37 -04:00
|
|
|
|
2006-08-26 17:13:24 -04:00
|
|
|
: <workspace-tabs> ( book -- tabs )
|
|
|
|
|
control-model
|
2006-08-26 03:46:37 -04:00
|
|
|
workspace-tabs dup length [ swap first 2array ] 2map
|
|
|
|
|
<radio-box> ;
|
|
|
|
|
|
2006-08-26 17:13:24 -04:00
|
|
|
: init-status ( world -- )
|
|
|
|
|
dup world-status <presentation-help> swap @bottom grid-add ;
|
|
|
|
|
|
2006-08-27 19:02:16 -04:00
|
|
|
: init-tabs ( world -- )
|
|
|
|
|
[ world-gadget <workspace-tabs> ] keep @top grid-add ;
|
2006-08-26 17:13:24 -04:00
|
|
|
|
2006-08-27 19:02:16 -04:00
|
|
|
: workspace-window ( -- workspace )
|
2006-08-26 17:13:24 -04:00
|
|
|
<workspace> dup <world>
|
|
|
|
|
[ init-status ] keep
|
|
|
|
|
[ init-tabs ] keep
|
|
|
|
|
open-window ;
|
2006-08-27 19:02:16 -04:00
|
|
|
|
2006-08-27 23:22:30 -04:00
|
|
|
: commands-window ( workspace -- )
|
|
|
|
|
dup find-world world-focus [ ] [ gadget-child ] ?if
|
|
|
|
|
[ commands. ] "Commands" pane-window ;
|
|
|
|
|
|
2006-08-31 21:58:15 -04:00
|
|
|
: tool-window ( class -- ) workspace-window show-tool drop ;
|
|
|
|
|
|
2006-08-27 23:22:30 -04:00
|
|
|
workspace {
|
2006-09-01 03:58:47 -04:00
|
|
|
{
|
|
|
|
|
"Tools"
|
|
|
|
|
{ "Keyboard help" T{ key-down f f "F1" } [ commands-window ] }
|
|
|
|
|
{ "Listener" T{ key-down f f "F2" } [ listener-gadget select-tool ] }
|
|
|
|
|
{ "Definitions" T{ key-down f f "F3" } [ browser select-tool ] }
|
|
|
|
|
{ "Documentation" T{ key-down f f "F4" } [ help-gadget select-tool ] }
|
|
|
|
|
{ "Walker" T{ key-down f f "F5" } [ walker-gadget select-tool ] }
|
2006-09-13 02:17:46 -04:00
|
|
|
{ "Dataflow" T{ key-down f f "F6" } [ walker-gadget select-tool ] }
|
2006-09-01 03:58:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"Tools in new window"
|
|
|
|
|
{ "New listener" T{ key-down f { S+ } "F2" } [ listener-gadget tool-window drop ] }
|
|
|
|
|
{ "New definitions" T{ key-down f { S+ } "F3" } [ browser tool-window drop ] }
|
|
|
|
|
{ "New documentation" T{ key-down f { S+ } "F4" } [ help-gadget tool-window drop ] }
|
|
|
|
|
}
|
2006-09-06 19:49:48 -04:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"Workflow"
|
|
|
|
|
{ "Reload changed sources" T{ key-down f f "F7" } [ drop [ reload-modules ] listener-gadget call-tool ] }
|
2006-09-13 02:17:46 -04:00
|
|
|
{ "Recompile changed words" T{ key-down f f "F8" } [ drop [ recompile ] listener-gadget call-tool ] }
|
2006-09-06 19:49:48 -04:00
|
|
|
}
|
2006-08-27 23:22:30 -04:00
|
|
|
} define-commands
|