From da6ddf5d8bb022c4a64354b2724a740282011d5a Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 17 Jun 2006 20:00:10 +0000 Subject: [PATCH] Minor code cleanups for table output in UI --- library/ui/gadgets/grids.factor | 3 +-- library/ui/gadgets/presentations.factor | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/library/ui/gadgets/grids.factor b/library/ui/gadgets/grids.factor index 87b525700b..80525d6a72 100644 --- a/library/ui/gadgets/grids.factor +++ b/library/ui/gadgets/grids.factor @@ -41,8 +41,7 @@ C: grid ( children -- grid ) M: grid pref-dim* ( grid -- dim ) [ [ - [ 0 [ + ] reduce ] keep length - 1 [-] gap * + + [ sum ] keep length 1 [-] gap * + ] 2apply 0 3array ] with-grid ; diff --git a/library/ui/gadgets/presentations.factor b/library/ui/gadgets/presentations.factor index 297bb89c1b..58b74147e7 100644 --- a/library/ui/gadgets/presentations.factor +++ b/library/ui/gadgets/presentations.factor @@ -89,10 +89,14 @@ M: object-button gadget-help ( button -- string ) >r dup r> swap >r swap with-pane r> ; inline +: styled-grid ( style grid -- ) + 5 over set-grid-gap + border-width rot hash [ 5 ] unless* ; + : ( quot style grid -- gadget ) [ [ pick pick >r >r -rot styled-pane r> r> rot ] map - ] map 2nip 5 over set-grid-gap ; + ] map styled-grid nip ; M: pane with-stream-table ( grid quot style pane -- ) >r rot r> print-gadget ;