diff --git a/extra/ui/frp/layout/layout.factor b/extra/ui/frp/layout/layout.factor index 48cb0398e0..a4f0b09409 100644 --- a/extra/ui/frp/layout/layout.factor +++ b/extra/ui/frp/layout/layout.factor @@ -5,6 +5,7 @@ words tools.continuations ; IN: ui.frp.layout TUPLE: layout gadget size ; C: layout +ERROR: no-models models ; SYNTAX: ,% scan string>number [ , ] curry over push-all ; SYNTAX: ->% scan string>number '[ [ _ , ] [ output-model ] bi ] over push-all ; @@ -31,7 +32,8 @@ SYMBOL: wordnames : ( gadgets -- track ) horizontal ; inline : ( gadgets -- track ) vertical ; inline -: ( gadgets -- book ) f make-layout f handle-words ; inline +: ( quot: ( -- model ) -- book ) f make-layout roll dup activate-model handle-words + swap [ no-models ] unless-empty ; inline SYNTAX: $ CREATE-WORD dup [ , ] curry (( -- )) define-declared "$" expect word [ [ building get length swap wordnames get set-at ] [ , ] bi ] curry over push-all ; @@ -42,7 +44,7 @@ GENERIC# insert-item 1 ( item location -- ) M: gadget insert-item dup first book? [ first2 spin [ add-gadget ] keep insert-gadget ] [ [ f ] dip insert-item ] if ; M: layout insert-item first2 spin [ insert-layout ] keep gadget>> insert-gadget ; -M: model insert-item dup first book? [ "Books can't contain models" throw ] +M: model insert-item dup first book? [ no-models ] [ first model>> swap add-connection ] if ; : insert-items ( makelist -- ) f swap [ dup word?