Code cleanups

db4
Slava Pestov 2008-11-20 18:11:25 -06:00
parent a671678357
commit 1477a0f6f5
4 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
! Copyright (C) 2005, 2007 Slava Pestov.
! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays generic kernel math namespaces sequences words
splitting grouping math.vectors ui.gadgets.grids ui.gadgets

View File

@ -21,9 +21,11 @@ TUPLE: viewport < gadget ;
swap add-gadget ;
M: viewport layout*
dup rect-dim viewport-gap 2 v*n v-
over gadget-child pref-dim vmax
swap gadget-child (>>dim) ;
[
[ rect-dim viewport-gap 2 v*n v- ]
[ gadget-child pref-dim ]
bi vmax
] [ gadget-child ] bi (>>dim) ;
M: viewport focusable-child*
gadget-child ;

View File

@ -48,7 +48,7 @@ search-field H{
} set-gestures
: <search-model> ( live-search producer -- live-search filter )
>r dup field>> model>> ! live-search model :: producer
>r dup field>> model>>
ui-running? [ 1/5 seconds <delay> ] when
[ "\n" join ] r> append <filter> ;

View File

@ -129,8 +129,8 @@ SYMBOL: ui-hook
: notify ( gadget -- )
dup graft-state>>
dup first { f f } { t t } ?
pick (>>graft-state) {
[ first { f f } { t t } ? >>graft-state ] keep
{
{ { f t } [ dup activate-control graft* ] }
{ { t f } [ dup deactivate-control ungraft* ] }
} case ;