UI performance improvement

cvs
Slava Pestov 2006-01-27 04:44:08 +00:00
parent 13ef8f9412
commit 6d5be43001
1 changed files with 7 additions and 5 deletions

View File

@ -1,13 +1,14 @@
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: gadgets-layouts
USING: gadgets generic io kernel math namespaces ;
! Incremental layout allows adding lines to panes to be O(1).
! Note that incremental packs are distinct from ordinary packs
! defined in layouts.factor, since you don't want all packs to
! be incremental. In particular, if the children of the pack
! change size, the incremental strategy does not work.
! be incremental. In particular, incremental packs do not
! support non-default values for pack-align, pack-fill and
! pack-gap.
! The cursor is the current size of the incremental pack.
! New gadgets are added at cursor-cursor*gadget-orientation.
@ -37,7 +38,7 @@ M: incremental pref-dim* ( incremental -- dim )
swap set-rect-loc ;
: prefer-incremental ( gadget -- )
dup pref-dim over set-rect-dim layout ;
dup forget-pref-dim dup pref-dim over set-rect-dim layout ;
: add-incremental ( gadget incremental -- )
2dup (add-gadget)
@ -49,4 +50,5 @@ M: incremental pref-dim* ( incremental -- dim )
: clear-incremental ( incremental -- )
dup (clear-gadget)
{ 0 0 0 } over set-incremental-cursor
dup forget-pref-dim
gadget-parent [ relayout ] when* ;