]> gitweb.factorcode.org Git - factor.git/commitdiff
frp-editors use field-models
authorSam Anklesaria <sam@Tintin.local>
Sat, 30 May 2009 17:51:35 +0000 (12:51 -0500)
committerSam Anklesaria <sam@Tintin.local>
Sat, 30 May 2009 17:51:35 +0000 (12:51 -0500)
basis/inverse/inverse.factor
extra/ui/frp/gadgets/gadgets.factor

index 70af955c77049d59a1bcaeb19cb9346dcaac0e6e..7a9e821b37740a2ce9a1fdd45a632f2ab7acb678 100755 (executable)
@@ -243,10 +243,6 @@ DEFER: __
 
 \ if* 2 [ swap [ undo-if* ] 2curry ] define-pop-inverse
 
-! misc
-\ join 1 [ [ split ] curry ] define-pop-inverse
-\ split 1 [ [ join ] curry ] define-pop-inverse
-
 ! Constructor inverse
 : deconstruct-pred ( class -- quot )
     "predicate" word-prop [ dupd call assure ] curry ;
index 1fd656308262203396da5c369e6e3d7f66442f2b..3568d4036d6916ee8c387dd91071d8a7dba86f4b 100644 (file)
@@ -1,7 +1,7 @@
 USING: accessors arrays kernel models monads ui.frp.signals ui.gadgets
 ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.editors
-ui.gadgets.tables sequences splitting models.illusion
-ui.gadgets.scrollers documents ;
+ui.gadgets.tables sequences splitting
+ui.gadgets.scrollers ui.gadgets.borders ;
 IN: ui.frp.gadgets
 
 TUPLE: frp-button < button hook ;
@@ -32,10 +32,13 @@ M: table output-model dup multiple-selection?>>
    [ dup val-quot>> [ selected-value>> ] [ selected-index*>> ] if ] if ;
 M: model-field output-model field-model>> ;
 M: scroller output-model viewport>> children>> first output-model ;
-M: multiline-editor output-model model>> [ "\n" join ] <illusion> ;
 
 : <frp-field> ( -- field ) "" <model> <model-field> ;
-: <frp-editor> ( model -- editor ) [ "\n" split document new-model ] bind <multiline-editor> swap >>model ;
+: <frp-field*> ( model -- field ) "" <model> swap <switch> <model-field> ;
+: <frp-editor> ( model -- gadget )
+    model-field [ <multiline-editor> ] dip new-border dup gadget-child >>editor
+    field-theme swap >>field-model { 1 0 } >>align ;
+: <frp-editor*> ( model -- editor ) "" <model> swap <switch> <frp-editor> ;
 
 IN: accessors
 M: frp-button text>> children>> first text>> ;
\ No newline at end of file