added gui for file-trees

db4
Sam Anklesaria 2009-05-03 12:29:29 -05:00
parent 7d020d8f2f
commit 0ca6a6c63f
1 changed files with 10 additions and 5 deletions

View 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 ;
t <tree> [ [ tree-insert ] curry each ] keep ;
: <dir-table> ( tree-model -- table )
<frp-list*> [ node>> 1array ] >>quot
[ selected-value>> <switch> ]
[ swap >>model ] bi ;