]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.frp.layout checks namespace only to 1 level
authorSam Anklesaria <sam@Tintin.local>
Wed, 17 Jun 2009 23:05:54 +0000 (18:05 -0500)
committerSam Anklesaria <sam@Tintin.local>
Wed, 17 Jun 2009 23:05:54 +0000 (18:05 -0500)
extra/ui/frp/layout/layout.factor

index af7432ae43111fa867ab9be8f567ba19d992906b..038b739e52dbc6a794d793b89679ed0d797352f4 100644 (file)
@@ -1,21 +1,22 @@
-USING: accessors arrays fry kernel lexer make math.parser models
+USING: accessors assocs arrays fry kernel lexer make math.parser models
 models.product namespaces parser sequences ui.frp.gadgets
 ui.gadgets ui.gadgets.books ui.gadgets.tracks vectors words
 combinators ui.frp.signals ;
 QUALIFIED: make
 IN: ui.frp.layout
 
-PREDICATE: true < word t = ;
 SYMBOL: inserting
 TUPLE: layout gadget size ; C: <layout> layout
 TUPLE: placeholder < gadget ;
 ERROR: no-models-in-books models ;
 
 DEFER: insert-item
-HOOK: , inserting ( uiitem -- )
-M: f , make:, ;
-M: placeholder , [ inserting get insert-item ] keep relayout ;
-M: true , dup placeholder? [ inserting set ] [ "No location to add UI item" throw ] if ;
+: , ( uiitem -- ) inserting namespace at {
+    { f [ make:, ] }
+    { t [ dup placeholder? [ inserting set ] [ "No location to add UI item" throw ] if ] }
+    [ placeholder? [ [ inserting get insert-item ] keep relayout ] [ drop ] if ]
+} case ;
+
 SYNTAX: UI[ parse-quotation '[ [ t inserting _  with-variable ] ] over push-all ;
 
 SYNTAX: ,% scan string>number [ <layout> , ] curry over push-all ;