Browser improvements
Browser with a unified toolbar and a header that is always visible. The prev/next buttons are moved to the bottom of the page.db4
parent
1371cb4090
commit
376eb20f8b
|
@ -111,23 +111,29 @@ M: word set-article-parent swap "help-parent" set-word-prop ;
|
||||||
bi
|
bi
|
||||||
] { } make [ ($navigation-table) ] unless-empty ;
|
] { } make [ ($navigation-table) ] unless-empty ;
|
||||||
|
|
||||||
: ($navigation) ( topic -- )
|
: ($navigation-path) ( topic -- )
|
||||||
help-path-style get [
|
help-path-style get
|
||||||
[ help-path [ reverse $breadcrumbs ] unless-empty ]
|
[ help-path [ reverse $breadcrumbs ] unless-empty ]
|
||||||
[ $navigation-table ] bi
|
with-style ;
|
||||||
] with-style ;
|
|
||||||
|
: ($navigation-prev-next) ( topic -- )
|
||||||
|
help-path-style get
|
||||||
|
[ $navigation-table ]
|
||||||
|
with-style ;
|
||||||
|
|
||||||
: $title ( topic -- )
|
: $title ( topic -- )
|
||||||
title-style get [
|
title-style get [
|
||||||
title-style get [
|
title-style get [
|
||||||
[ ($title) ] [ ($navigation) ] bi
|
[ ($title) ] [ ($navigation-path) ] bi
|
||||||
] with-nesting
|
] with-nesting
|
||||||
] with-style ;
|
] with-style ;
|
||||||
|
|
||||||
: print-topic ( topic -- )
|
: print-topic ( topic -- )
|
||||||
>link
|
>link
|
||||||
last-element off
|
last-element off
|
||||||
[ $title ] [ ($blank-line) article-content print-content nl ] bi ;
|
[ nl article-content print-content nl ]
|
||||||
|
[ ($blank-line) ($navigation-prev-next) ]
|
||||||
|
bi ;
|
||||||
|
|
||||||
SYMBOL: help-hook
|
SYMBOL: help-hook
|
||||||
|
|
||||||
|
|
|
@ -34,16 +34,30 @@ M: browser-gadget set-history-value
|
||||||
[ set-control-value ]
|
[ set-control-value ]
|
||||||
2bi ;
|
2bi ;
|
||||||
|
|
||||||
|
: <help-header> ( browser-gadget -- gadget )
|
||||||
|
model>> [ '[ _ $title ] try ] <pane-control> ;
|
||||||
|
|
||||||
|
: add-help-header ( track -- track )
|
||||||
|
dup <help-header> { 3 3 } <border>
|
||||||
|
COLOR: FactorLightTan <solid> >>interior
|
||||||
|
COLOR: grey75 <solid-underlined> >>boundary
|
||||||
|
{ 1 0 } >>fill f track-add ;
|
||||||
|
|
||||||
: <help-pane> ( browser-gadget -- gadget )
|
: <help-pane> ( browser-gadget -- gadget )
|
||||||
model>> [ '[ _ print-topic ] try ] <pane-control> ;
|
model>> [ '[ _ print-topic ] try ] <pane-control> ;
|
||||||
|
|
||||||
|
: add-help-pane ( track -- track )
|
||||||
|
dup dup <help-pane> { 10 0 } <border> { 1 1 } >>fill
|
||||||
|
<scroller> >>scroller scroller>> 1 track-add ;
|
||||||
|
|
||||||
: search-browser ( string browser -- )
|
: search-browser ( string browser -- )
|
||||||
'[ <apropos-search> _ show-help ] unless-empty ;
|
'[ <apropos-search> _ show-help ] unless-empty ;
|
||||||
|
|
||||||
: <search-field> ( browser -- field )
|
: <search-field> ( browser -- field )
|
||||||
'[ _ search-browser ] <action-field>
|
'[ _ search-browser ] <action-field>
|
||||||
10 >>min-cols
|
10 >>min-cols
|
||||||
10 >>max-cols ;
|
10 >>max-cols
|
||||||
|
COLOR: white <solid> >>interior ;
|
||||||
|
|
||||||
: <browser-toolbar> ( browser -- toolbar )
|
: <browser-toolbar> ( browser -- toolbar )
|
||||||
horizontal <track>
|
horizontal <track>
|
||||||
|
@ -51,7 +65,13 @@ M: browser-gadget set-history-value
|
||||||
1/2 >>align
|
1/2 >>align
|
||||||
{ 5 5 } >>gap
|
{ 5 5 } >>gap
|
||||||
over <toolbar> f track-add
|
over <toolbar> f track-add
|
||||||
swap search-field>> "Search:" label-on-left 1 track-add ;
|
swap search-field>> " Search" label-on-left 1 track-add ;
|
||||||
|
|
||||||
|
: add-browser-toolbar ( track -- track )
|
||||||
|
dup <browser-toolbar> { 3 3 } <border>
|
||||||
|
button-background <solid> >>interior
|
||||||
|
COLOR: grey75 <solid-underlined> >>boundary
|
||||||
|
{ 1 0 } >>fill f track-add ;
|
||||||
|
|
||||||
: <browser-gadget> ( link -- gadget )
|
: <browser-gadget> ( link -- gadget )
|
||||||
vertical browser-gadget new-track
|
vertical browser-gadget new-track
|
||||||
|
@ -59,9 +79,9 @@ M: browser-gadget set-history-value
|
||||||
swap >link <model> >>model
|
swap >link <model> >>model
|
||||||
dup <history> >>history
|
dup <history> >>history
|
||||||
dup <search-field> >>search-field
|
dup <search-field> >>search-field
|
||||||
dup <browser-toolbar> { 3 3 } <border> { 1 0 } >>fill f track-add
|
add-browser-toolbar
|
||||||
dup dup <help-pane> { 10 0 } <border> { 1 1 } >>fill
|
add-help-header
|
||||||
<scroller> >>scroller scroller>> 1 track-add ;
|
add-help-pane ;
|
||||||
|
|
||||||
M: browser-gadget graft*
|
M: browser-gadget graft*
|
||||||
[ add-definition-observer ] [ call-next-method ] bi ;
|
[ add-definition-observer ] [ call-next-method ] bi ;
|
||||||
|
|
Loading…
Reference in New Issue