2006-05-25 23:25:00 -04:00
|
|
|
! Copyright (C) 2006 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
IN: gadgets-help
|
|
|
|
USING: gadgets gadgets-panes gadgets-presentations
|
|
|
|
gadgets-scrolling gadgets-tabs gadgets-tiles gadgets-tracks help
|
2006-05-25 23:45:19 -04:00
|
|
|
io kernel sequences words ;
|
2006-05-25 23:25:00 -04:00
|
|
|
|
2006-05-26 02:44:31 -04:00
|
|
|
TUPLE: help-gadget showing history tabs ;
|
2006-05-25 23:25:00 -04:00
|
|
|
|
|
|
|
TUPLE: history pane seq ;
|
|
|
|
|
|
|
|
C: history ( -- gadget )
|
|
|
|
V{ } clone over set-history-seq
|
|
|
|
<pane> dup pick set-history-pane
|
|
|
|
<scroller> "History" f <tile> over set-gadget-delegate ;
|
|
|
|
|
|
|
|
: update-history ( history -- )
|
|
|
|
dup history-seq swap history-pane [
|
2006-05-26 02:44:31 -04:00
|
|
|
<reversed> [
|
2006-05-25 23:25:00 -04:00
|
|
|
[ article-title ] keep simple-object terpri
|
|
|
|
] each
|
|
|
|
] with-pane ;
|
|
|
|
|
2006-05-26 02:44:31 -04:00
|
|
|
: add-history ( help -- )
|
|
|
|
dup help-gadget-history swap help-gadget-showing dup
|
|
|
|
[ over history-seq push-new update-history ] [ 2drop ] if ;
|
2006-05-25 23:25:00 -04:00
|
|
|
|
|
|
|
C: help-gadget ( -- gadget )
|
|
|
|
{
|
|
|
|
{ [ <history> ] set-help-gadget-history 1/4 }
|
|
|
|
{ [ <tabs> ] set-help-gadget-tabs 3/4 }
|
|
|
|
} { 1 0 0 } make-track* ;
|
|
|
|
|
2006-05-26 02:44:31 -04:00
|
|
|
M: help-gadget gadget-title
|
|
|
|
"Help - " swap help-gadget-showing article-title append ;
|
2006-05-26 02:29:44 -04:00
|
|
|
|
2006-05-25 23:25:00 -04:00
|
|
|
: show-help ( link help -- )
|
2006-05-26 02:44:31 -04:00
|
|
|
dup add-history [ set-help-gadget-showing ] 2keep
|
|
|
|
dup update-title {
|
2006-06-11 23:38:39 -04:00
|
|
|
{ "Article" [ help ] }
|
2006-05-25 23:25:00 -04:00
|
|
|
{ "Links in" [ links-in. ] }
|
|
|
|
} swap help-gadget-tabs set-pages ;
|
|
|
|
|
|
|
|
: help-tool
|
|
|
|
[ help-gadget? ]
|
|
|
|
[ <help-gadget> ]
|
|
|
|
[ show-help ] ;
|
|
|
|
|
2006-05-25 23:49:36 -04:00
|
|
|
M: link show-object ( link button -- ) help-tool call-tool ;
|