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-20 03:22:26 -04:00
|
|
|
USING: help arrays compiler gadgets gadgets-books
|
2006-10-22 18:46:02 -04:00
|
|
|
gadgets-browser gadgets-buttons gadgets-dataflow gadgets-help
|
2006-09-20 03:22:26 -04:00
|
|
|
gadgets-listener gadgets-presentations gadgets-walker
|
|
|
|
gadgets-workspace generic kernel math modules scratchpad
|
|
|
|
sequences syntax words io namespaces hashtables
|
2006-09-23 02:40:25 -04:00
|
|
|
gadgets-scrolling gadgets-panes gadgets-messages ;
|
2006-08-26 17:13:24 -04:00
|
|
|
|
|
|
|
C: tool ( gadget -- tool )
|
|
|
|
{
|
2006-10-05 17:15:41 -04:00
|
|
|
{
|
2006-10-06 20:41:25 -04:00
|
|
|
[ dup dup class tool 2array <toolbar> ]
|
2006-10-05 17:15:41 -04:00
|
|
|
f
|
|
|
|
f
|
|
|
|
@top
|
|
|
|
}
|
|
|
|
{
|
|
|
|
f
|
|
|
|
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
|
|
|
|
2006-09-20 03:22:26 -04:00
|
|
|
M: tool tool-scroller tool-gadget tool-scroller ;
|
|
|
|
|
|
|
|
M: tool tool-help tool-gadget tool-help ;
|
|
|
|
|
|
|
|
: help-window ( topic -- )
|
|
|
|
[ [ help ] make-pane <scroller> ] keep
|
|
|
|
article-title open-titled-window ;
|
|
|
|
|
|
|
|
: tool-help-window ( tool -- )
|
|
|
|
tool-help [ help-window ] when* ;
|
|
|
|
|
2006-10-09 23:57:32 -04:00
|
|
|
tool "toolbar" {
|
2006-09-20 03:22:26 -04:00
|
|
|
{ "Tool help" T{ key-down f f "F1" } [ tool-help-window ] }
|
|
|
|
} define-commands
|
|
|
|
|
2006-08-26 03:46:37 -04:00
|
|
|
: workspace-tabs
|
|
|
|
{
|
2006-08-31 21:58:15 -04:00
|
|
|
{ "Listener" <listener-gadget> }
|
2006-09-23 02:40:25 -04:00
|
|
|
{ "Messages" <messages> }
|
2006-08-31 21:58:15 -04:00
|
|
|
{ "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-10-22 18:08:49 -04:00
|
|
|
workspace-tabs 1 <column> [ execute <tool> ] map <book>
|
2006-08-31 21:58:15 -04:00
|
|
|
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
|
2006-09-23 02:40:25 -04:00
|
|
|
open-window
|
|
|
|
listener-gadget get-tool start-listener ;
|
2006-08-27 19:02:16 -04:00
|
|
|
|
2006-11-11 00:43:39 -05:00
|
|
|
: tool-window ( class -- ) workspace-window show-tool 2drop ;
|
2006-09-19 02:30:21 -04:00
|
|
|
|
2006-09-20 03:22:26 -04:00
|
|
|
: tool-scroll-up ( workspace -- )
|
|
|
|
current-page tool-scroller [ scroll-up-page ] when* ;
|
2006-09-19 02:30:21 -04:00
|
|
|
|
2006-09-20 03:22:26 -04:00
|
|
|
: tool-scroll-down ( workspace -- )
|
|
|
|
current-page tool-scroller [ scroll-down-page ] when* ;
|
2006-08-27 23:22:30 -04:00
|
|
|
|
2006-10-09 23:57:32 -04:00
|
|
|
workspace "scrolling" {
|
2006-09-20 03:22:26 -04:00
|
|
|
{ "Scroll up" T{ key-down f { C+ } "PAGE_UP" } [ tool-scroll-up ] }
|
|
|
|
{ "Scroll down" T{ key-down f { C+ } "PAGE_DOWN" } [ tool-scroll-down ] }
|
|
|
|
} define-commands
|
2006-08-31 21:58:15 -04:00
|
|
|
|
2006-10-09 23:57:32 -04:00
|
|
|
workspace "tool-switch" {
|
2006-09-20 03:22:26 -04:00
|
|
|
{ "Listener" T{ key-down f f "F2" } [ listener-gadget select-tool ] }
|
2006-09-24 15:28:27 -04:00
|
|
|
{ "Messages" T{ key-down f f "F3" } [ messages select-tool ] }
|
2006-09-23 02:40:25 -04:00
|
|
|
{ "Definitions" T{ key-down f f "F4" } [ browser select-tool ] }
|
|
|
|
{ "Documentation" T{ key-down f f "F5" } [ help-gadget select-tool ] }
|
|
|
|
{ "Walker" T{ key-down f f "F6" } [ walker-gadget select-tool ] }
|
|
|
|
{ "Dataflow" T{ key-down f f "F7" } [ dataflow-gadget select-tool ] }
|
2006-09-20 03:22:26 -04:00
|
|
|
} define-commands
|
2006-09-01 03:58:47 -04:00
|
|
|
|
2006-10-09 23:57:32 -04:00
|
|
|
workspace "tool-window" {
|
2006-11-11 00:43:39 -05:00
|
|
|
{ "New listener" T{ key-down f { S+ } "F2" } [ listener-gadget tool-window ] }
|
|
|
|
{ "New definitions" T{ key-down f { S+ } "F3" } [ browser tool-window ] }
|
|
|
|
{ "New documentation" T{ key-down f { S+ } "F4" } [ help-gadget tool-window ] }
|
2006-09-20 03:22:26 -04:00
|
|
|
} define-commands
|
|
|
|
|
2006-10-09 23:57:32 -04:00
|
|
|
workspace "workflow" {
|
2006-10-04 00:40:10 -04:00
|
|
|
{ "Reload changed sources" T{ key-down f f "F8" } [ drop [ reload-modules ] call-listener ] }
|
|
|
|
{ "Recompile changed words" T{ key-down f { S+ } "F8" } [ drop [ recompile ] call-listener ] }
|
2006-08-27 23:22:30 -04:00
|
|
|
} define-commands
|