From 4fe764ce6a0d20c1744527c35a1ff492c45f65fc Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 11 Jul 2008 02:28:00 -0500 Subject: [PATCH 1/2] resolve conflict --- extra/ui/gadgets/gadgets.factor | 43 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/extra/ui/gadgets/gadgets.factor b/extra/ui/gadgets/gadgets.factor index e4f929ed8e..58b58d4fdc 100755 --- a/extra/ui/gadgets/gadgets.factor +++ b/extra/ui/gadgets/gadgets.factor @@ -9,7 +9,9 @@ SYMBOL: ui-notify-flag : notify-ui-thread ( -- ) ui-notify-flag get-global raise-flag ; -TUPLE: rect loc dim ; +TUPLE: rect { loc initial: { 0 0 } } { dim initial: { 0 0 } } ; + +: ( -- rect ) rect new ; C: rect @@ -44,12 +46,14 @@ M: array rect-dim drop { 0 0 } ; : rect-union ( rect1 rect2 -- newrect ) (rect-union) ; -TUPLE: gadget < identity-tuple +TUPLE: gadget < rect pref-dim parent children orientation focus visible? root? clipped? layout-state graft-state graft-node interior boundary model ; +M: gadget equal? 2drop f ; + M: gadget hashcode* drop gadget hashcode* ; M: gadget model-changed 2drop ; @@ -58,18 +62,14 @@ M: gadget model-changed 2drop ; : nth-gadget ( n gadget -- child ) gadget-children nth ; -: ( -- rect ) { 0 0 } dup ; +: new-gadget ( class -- gadget ) + new + { 0 1 } >>orientation + t >>visible? + { f f } >>graft-state ; inline : ( -- gadget ) - { 0 1 } t { f f } { - set-delegate - set-gadget-orientation - set-gadget-visible? - set-gadget-graft-state - } gadget construct ; - -: construct-gadget ( class -- tuple ) - >r r> construct-delegate ; inline + gadget new-gadget ; : activate-control ( gadget -- ) dup gadget-model dup [ @@ -137,15 +137,6 @@ M: gadget children-on nip gadget-children ; : each-child ( gadget quot -- ) >r gadget-children r> each ; inline -: set-gadget-delegate ( gadget tuple -- ) - over [ - dup pick [ set-gadget-parent ] with each-child - ] when set-delegate ; - -: construct-control ( model gadget class -- control ) - >r tuck set-gadget-model - { set-gadget-delegate } r> construct ; inline - ! Selection protocol GENERIC: gadget-selection? ( gadget -- ? ) @@ -414,5 +405,11 @@ M: f request-focus-on 2drop ; swap dup \ make-gadget set gadget set call ] with-scope ; inline -: build-gadget ( tuple quot gadget -- tuple ) - pick set-gadget-delegate over >r with-gadget r> ; inline +! Deprecated +: set-gadget-delegate ( gadget tuple -- ) + over [ + dup pick [ set-gadget-parent ] with each-child + ] when set-delegate ; + +: construct-gadget ( class -- tuple ) + >r { set-delegate } r> construct ; inline From 698a66d076f2e118b95ee6540f445cbd7c88c1d4 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 11 Jul 2008 11:56:05 -0500 Subject: [PATCH 2/2] newfx: purge and purge! --- extra/newfx/newfx.factor | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extra/newfx/newfx.factor b/extra/newfx/newfx.factor index 9cc63fd57e..825c70001e 100644 --- a/extra/newfx/newfx.factor +++ b/extra/newfx/newfx.factor @@ -1,5 +1,5 @@ -USING: kernel sequences assocs qualified circular sets ; +USING: kernel sequences assocs qualified circular sets fry sequences.lib ; USING: math multi-methods ; @@ -242,4 +242,11 @@ METHOD: as-mutate { object object assoc } set-at ; : insert ( seq i obj -- seq ) >r cut r> prefix append ; -: splice ( seq i seq -- seq ) >r cut r> prepend append ; \ No newline at end of file +: splice ( seq i seq -- seq ) >r cut r> prepend append ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: purge ( seq quot -- seq ) [ not ] compose filter ; + +: purge! ( seq quot -- seq ) + dupd '[ swap @ [ pluck! ] [ drop ] if ] each-index ;