ListModelView.st
changeset 2244 c9a195d28e72
parent 2188 774f66eedaea
child 2257 6d59932d078d
--- a/ListModelView.st	Thu Oct 03 17:39:12 2002 +0200
+++ b/ListModelView.st	Fri Oct 04 09:02:13 2002 +0200
@@ -471,15 +471,14 @@
     dltHeight := (self heightOfLineAt:aLnNr) - oldHeight.
 
     dltHeight == 0 ifTrue:[
-        ^ self redrawLineAt:aLnNr
+        self invalidateLineAt:aLnNr.
+      ^ self
     ].
 
     aLnNr + 1 to:startOfLinesY size do:[:i|
         startOfLinesY at:i put:((startOfLinesY at:i) + dltHeight)
     ].
     self invalidate.
-
-
 !
 
 listChangedInsert:start nItems:nLines
@@ -774,33 +773,43 @@
 
 !
 
-redraw
-    "redraw complete view
+invalidateLineAt:aLineNr
+    "invalidate a specific line; add a damage to redraw to the input event queue.
     "
-    self redrawX:0 y:0 width:width height:height.
-
-
+    self invalidateLineAt:aLineNr repairNow:false.
 !
 
-redrawLineAt:aLineNr
-    "redraw a specific line
+invalidateLineAt:aLineNr repairNow:doRepair
+    "add a damage to redraw the line specified by its line number to the
+     input event queue. If repairNow is true, force the view to repair all
+     of its damaged areas right now.
     "
     |y0 "{ Class:SmallInteger }"
      y1 "{ Class:SmallInteger }"
      yB "{ Class:SmallInteger }"
     |
 
-    (shown and:[aLineNr notNil]) ifTrue:[
-        yB := height - margin.
-        y0 := (self yVisibleOfLine:aLineNr) max:margin.
+    (shown and:[aLineNr notNil and:[aLineNr > 0]]) ifFalse:[
+        ^ self
+    ].
 
-        y0 < yB ifTrue:[
-            y1 := (self yVisibleOfLine:(aLineNr + 1)) min:yB.
-            y1 > margin ifTrue:[
-                self invalidateX:0 y:y0 width:width height:(y1 - y0)
-            ]
+    yB := height - margin.
+    y0 := (self yVisibleOfLine:aLineNr) max:margin.
+
+    y0 < yB ifTrue:[
+        y1 := (self yVisibleOfLine:(aLineNr + 1)) min:yB.
+
+        y1 > margin ifTrue:[
+            self invalidateX:0 y:y0 width:width height:(y1 - y0) repairNow:doRepair.
         ]
     ]
+!
+
+redraw
+    "redraw complete view
+    "
+    self redrawX:0 y:0 width:width height:height.
+
 
 !
 
@@ -1616,6 +1625,7 @@
 !ListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.57 2002-09-16 09:38:57 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.58 2002-10-04 07:02:13 ca Exp $'
 ! !
+
 ListModelView initialize!