]> gitweb.factorcode.org Git - factor.git/commitdiff
added gui for file-trees
authorSam Anklesaria <sam@Tintin.local>
Sun, 3 May 2009 17:29:29 +0000 (12:29 -0500)
committerSam Anklesaria <sam@Tintin.local>
Sun, 3 May 2009 17:29:29 +0000 (12:29 -0500)
extra/file-trees/file-trees.factor

index 788291c0a23bdc3a0d77a0f3c64db6fb04e9962f..eadfccdc4c0adfabb5372e49404786254749d329 100644 (file)
@@ -1,10 +1,10 @@
-USING: accessors delegate delegate.protocols io.pathnames
-kernel locals namespaces sequences vectors
-tools.annotations prettyprint ;
+USING: accessors arrays delegate delegate.protocols
+io.pathnames kernel locals namespaces prettyprint sequences
+ui.frp vectors ;
 IN: file-trees
 
 TUPLE: tree node children ;
-CONSULT: sequence-protocol tree children>> [ node>> ] map ;
+CONSULT: sequence-protocol tree children>> ;
 
 : <tree> ( start -- tree ) V{ } clone
    [ tree boa dup children>> ] [ ".." swap tree boa ] bi swap push ;
@@ -20,4 +20,9 @@ DEFER: (tree-insert)
       path-rest [ path-head tree-insert ] unless-empty
    ] if* ;
 : create-tree ( file-list -- tree ) [ path-components ] map
-   t <tree> [ [ tree-insert ] curry each ] keep ;
\ No newline at end of file
+   t <tree> [ [ tree-insert ] curry each ] keep ;
+
+: <dir-table> ( tree-model -- table )
+   <frp-list*> [ node>> 1array ] >>quot
+   [ selected-value>> <switch> ]
+   [ swap >>model ] bi ;
\ No newline at end of file