Merge branch 'master' of git://factorcode.org/git/factor

db4
Joe Groff 2008-07-13 20:19:56 -07:00
commit cf12a4ec0b
5 changed files with 21 additions and 20 deletions

View File

@ -114,6 +114,8 @@ VARS: population-label cohesion-label alignment-label separation-label ;
<frame>
<shelf>
{
[ "ESC - Pause" [ drop toggle-loop ] button* ]
@ -139,7 +141,7 @@ VARS: population-label cohesion-label alignment-label separation-label ;
"e - +0.1" [ drop inc-separation-weight ] button* add-gadget
"d - -0.1" [ drop dec-separation-weight ] button* add-gadget ]
} [ call ] map [ [ gadget, ] each ] make-shelf
} [ call ] map [ add-gadget ] each
1 over set-pack-fill
over @top grid-add

View File

@ -15,7 +15,8 @@ TUPLE: color-preview < gadget ;
: <color-preview> ( model -- gadget )
color-preview new-gadget
{ 100 100 } over set-rect-dim ;
swap >>model
{ 100 100 } >>dim ;
M: color-preview model-changed
swap model-value over set-gadget-interior relayout-1 ;
@ -26,7 +27,10 @@ M: color-preview model-changed
: <color-sliders> ( -- model gadget )
3 [ 0 0 0 255 <range> ] replicate
dup [ range-model ] map <compose>
swap [ [ <color-slider> gadget, ] each ] make-filled-pile ;
swap
<filled-pile>
swap
[ <color-slider> add-gadget ] each ;
: <color-picker> ( -- gadget )
[

View File

@ -180,10 +180,6 @@ HELP: focusable-child
{ $values { "gadget" gadget } { "child" gadget } }
{ $description "Outputs the child of the gadget which would prefer to receive keyboard focus." } ;
HELP: gadget,
{ $values { "gadget" gadget } }
{ $description "Adds a new child to the gadget being constructed. This word can only be used from a quotation passed to " { $link make-gadget } "." } ;
HELP: make-gadget
{ $values { "gadget" gadget } { "quot" quotation } }
{ $description "Calls the quotation in a new scope with the gadget stored in the " { $link gadget } " variable." } ;

View File

@ -357,8 +357,6 @@ M: f request-focus-on 2drop ;
: focus-path ( world -- seq )
[ focus>> ] follow ;
: gadget, ( gadget -- ) gadget get swap add-gadget drop ;
: g ( -- gadget ) gadget get ;
: g-> ( x -- x x gadget ) dup g ;

View File

@ -47,12 +47,12 @@ search-field H{
{ T{ key-down f f "RET" } [ find-search-list invoke-value-action ] }
} set-gestures
: <search-model> ( producer -- model )
>r g live-search-field gadget-model
: <search-model> ( live-search producer -- live-search filter )
>r dup field>> model>> ! live-search model :: producer
ui-running? [ 1/5 seconds <delay> ] when
[ "\n" join ] r> append <filter> ;
: <search-list> ( seq limited? presenter -- gadget )
: <search-list> ( live-search seq limited? presenter -- live-search list )
>r
[ limited-completions ] [ completions ] ? curry
<search-model>
@ -60,14 +60,15 @@ search-field H{
swap <list> ;
: <live-search> ( string seq limited? presenter -- gadget )
{ 0 1 } live-search new-track
[
<search-field> g-> set-live-search-field f track,
<search-list> g-> set-live-search-list
<scroller> 1 track,
] make-gadget
[ live-search-field set-editor-string ] keep
[ live-search-field end-of-document ] keep ;
{ 0 1 } live-search new-track
<search-field> >>field
dup field>> f track-add*
-roll <search-list> >>list
dup list>> <scroller> 1 track-add*
swap
over field>> set-editor-string
dup field>> end-of-document ;
M: live-search focusable-child* live-search-field ;