Make limited scrollers more versatile: they now have a min-dim and a max-dim
parent
eb6cdcc06e
commit
6e9b2a6c73
|
@ -129,10 +129,12 @@ M: scroller focusable-child*
|
|||
M: scroller model-changed
|
||||
nip f >>follows drop ;
|
||||
|
||||
TUPLE: limited-scroller < scroller fixed-dim ;
|
||||
TUPLE: limited-scroller < scroller
|
||||
{ min-dim initial: { 0 0 } }
|
||||
{ max-dim initial: { 1/0. 1/0. } } ;
|
||||
|
||||
: <limited-scroller> ( gadget dim -- scroller )
|
||||
>r limited-scroller new-scroller r> >>fixed-dim ;
|
||||
: <limited-scroller> ( gadget -- scroller )
|
||||
limited-scroller new-scroller ;
|
||||
|
||||
M: limited-scroller pref-dim*
|
||||
fixed-dim>> ;
|
||||
[ call-next-method ] [ min-dim>> vmax ] [ max-dim>> vmin ] tri ;
|
||||
|
|
|
@ -96,9 +96,12 @@ TUPLE: deploy-gadget < pack vocab settings ;
|
|||
: com-close ( gadget -- )
|
||||
close-window ;
|
||||
|
||||
deploy-gadget "misc" "Miscellaneous commands" {
|
||||
{ T{ key-down f f "ESC" } com-close }
|
||||
} define-command-map
|
||||
|
||||
deploy-gadget "toolbar" f {
|
||||
{ f com-close }
|
||||
{ f com-help }
|
||||
{ T{ key-down f f "F1" } com-help }
|
||||
{ f com-revert }
|
||||
{ f com-save }
|
||||
{ T{ key-down f f "RET" } com-deploy }
|
||||
|
|
|
@ -25,7 +25,9 @@ TUPLE: listener-gadget < track input output stack ;
|
|||
: listener-input, ( listener -- listener )
|
||||
dup <listener-input> >>input
|
||||
dup input>>
|
||||
{ 0 100 } <limited-scroller>
|
||||
<limited-scroller>
|
||||
{ 0 100 } >>min-dim
|
||||
{ 1/0. 100 } >>max-dim
|
||||
"Input" <labelled-gadget>
|
||||
f track-add ;
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ M: traceback-gadget pref-dim* drop { 550 600 } ;
|
|||
<pane-control> ;
|
||||
|
||||
: <variables-gadget> ( model -- gadget )
|
||||
<namestack-display> { 400 400 } <limited-scroller> ;
|
||||
<namestack-display>
|
||||
<limited-scroller>
|
||||
{ 400 400 } >>min-dim
|
||||
{ 400 400 } >>max-dim ;
|
||||
|
||||
: variables ( traceback -- )
|
||||
model>> <variables-gadget>
|
||||
|
|
|
@ -47,12 +47,15 @@ M: gadget tool-scroller drop f ;
|
|||
: get-tool ( class -- gadget )
|
||||
get-workspace find-tool nip ;
|
||||
|
||||
: <help-pane> ( topic -- pane )
|
||||
<pane> [ [ help ] with-pane ] keep ;
|
||||
|
||||
: help-window ( topic -- )
|
||||
[
|
||||
<pane> [ [ help ] with-pane ] keep
|
||||
{ 550 700 } <limited-scroller>
|
||||
] keep
|
||||
article-title open-window ;
|
||||
<help-pane> <limited-scroller>
|
||||
{ 550 700 } >>max-dim
|
||||
] [ article-title ] bi
|
||||
open-window ;
|
||||
|
||||
: hide-popup ( workspace -- )
|
||||
dup popup>> track-remove
|
||||
|
|
Loading…
Reference in New Issue