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