From 37b27b7fbe08ed874f8decb0fddb9aed6325f4ef Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 20 Sep 2012 17:49:58 -0700 Subject: [PATCH] ui.gadgets.tables: reduce generic dispatch. --- basis/ui/gadgets/tables/tables.factor | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/basis/ui/gadgets/tables/tables.factor b/basis/ui/gadgets/tables/tables.factor index aecdfa0b7b..7909526e86 100644 --- a/basis/ui/gadgets/tables/tables.factor +++ b/basis/ui/gadgets/tables/tables.factor @@ -66,24 +66,18 @@ rows ; > ] dip [ [ cell-width ] [ cell-padding ] bi + ] with map ; + [ font>> ] dip [ cell-dim nip + ] with map ; : compute-total-width ( gap widths -- total ) swap [ column-offsets drop ] keep - ; @@ -178,8 +172,10 @@ M: table layout* ] bi ; :: column-loc ( font column width align -- loc ) - font column cell-width width swap - align * column cell-padding 2 / 1 align - * + - font column cell-height \ line-height get swap - 2 / + font column cell-dim :> ( cell-width cell-height cell-padding ) + cell-width width swap - align * + cell-padding 2 / 1 align - * + + cell-height \ line-height get swap - 2 / [ >integer ] bi@ 2array ; : translate-column ( width gap -- ) @@ -233,8 +229,7 @@ M: table draw-gadget* M: table line-height* ( table -- y ) [ font>> ] [ renderer>> prototype-row ] bi - [ [ cell-height ] [ cell-padding ] bi + ] with - [ max ] map-reduce ; + [ cell-dim + nip ] with [ max ] map-reduce ; M: table pref-dim* [ compute-column-widths drop ] keep