ui.gadgets.tables: cache table rows only on model-changed.
parent
37b27b7fbe
commit
6d447cb939
|
@ -80,12 +80,6 @@ CONSTANT: image-padding 2
|
||||||
M: image-name cell-dim nip image-dim first2 image-padding ;
|
M: image-name cell-dim nip image-dim first2 image-padding ;
|
||||||
M: image-name draw-cell nip draw-image ;
|
M: image-name draw-cell nip draw-image ;
|
||||||
|
|
||||||
: table-rows ( table -- rows )
|
|
||||||
[ control-value ] [ renderer>> ] bi '[ _ row-columns ] map ;
|
|
||||||
|
|
||||||
: update-table-rows ( table -- )
|
|
||||||
[ table-rows ] [ rows<< ] bi ; inline
|
|
||||||
|
|
||||||
: column-offsets ( widths gap -- x xs )
|
: column-offsets ( widths gap -- x xs )
|
||||||
[ 0 ] dip '[ _ + + ] accumulate ;
|
[ 0 ] dip '[ _ + + ] accumulate ;
|
||||||
|
|
||||||
|
@ -129,9 +123,7 @@ CONSTANT: column-title-background COLOR: light-gray
|
||||||
[ [ + ] change-nth ] [ 3drop ] if ;
|
[ [ + ] change-nth ] [ 3drop ] if ;
|
||||||
|
|
||||||
M: table layout*
|
M: table layout*
|
||||||
[ update-table-rows ]
|
[ update-cached-widths ] [ update-filled-column ] bi ;
|
||||||
[ update-cached-widths ]
|
|
||||||
[ update-filled-column ] tri ;
|
|
||||||
|
|
||||||
: row-rect ( table row -- rect )
|
: row-rect ( table row -- rect )
|
||||||
[ [ line-height ] dip * 0 swap 2array ]
|
[ [ line-height ] dip * 0 swap 2array ]
|
||||||
|
@ -279,6 +271,13 @@ PRIVATE>
|
||||||
[ model>> value>> ] [ renderer>> ] bi
|
[ model>> value>> ] [ renderer>> ] bi
|
||||||
'[ _ row-value? ] with find drop ;
|
'[ _ row-value? ] with find drop ;
|
||||||
|
|
||||||
|
: update-table-rows ( table -- )
|
||||||
|
[
|
||||||
|
[ control-value ] [ renderer>> ] bi
|
||||||
|
'[ _ row-columns ] map
|
||||||
|
]
|
||||||
|
[ rows<< ] bi ; inline
|
||||||
|
|
||||||
: update-selection ( table -- )
|
: update-selection ( table -- )
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -294,6 +293,7 @@ PRIVATE>
|
||||||
|
|
||||||
M: table model-changed
|
M: table model-changed
|
||||||
nip
|
nip
|
||||||
|
dup update-table-rows
|
||||||
dup update-selection
|
dup update-selection
|
||||||
dup update-mouse-index
|
dup update-mouse-index
|
||||||
[ dup mouse-index>> show-row-summary ] [ relayout ] bi ;
|
[ dup mouse-index>> show-row-summary ] [ relayout ] bi ;
|
||||||
|
|
Loading…
Reference in New Issue