]> gitweb.factorcode.org Git - factor.git/commitdiff
UI performance improvement
authorSlava Pestov <slava@factorcode.org>
Fri, 27 Jan 2006 04:44:08 +0000 (04:44 +0000)
committerSlava Pestov <slava@factorcode.org>
Fri, 27 Jan 2006 04:44:08 +0000 (04:44 +0000)
library/ui/incremental.factor

index c9ba67c35b9a3a7215e92f6888b48c1dc71baf63..aa194cda7d7986d93a218ebf4a3867f7b7ebc33a 100644 (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* ;