class: Tools::CodeView2
authorClaus Gittinger <cg@exept.de>
Thu, 06 Mar 2014 22:47:08 +0100
changeset 14127 7bc7d22565b3
parent 14126 454c06ae7055
child 14128 9be54971efa0
class: Tools::CodeView2 better redraw after scroll: for horiz. scroll, no redraw at all; for small deltas (line-scrolling), only draw affected areas.
Tools__CodeView2.st
--- a/Tools__CodeView2.st	Thu Mar 06 17:20:00 2014 +0100
+++ b/Tools__CodeView2.st	Thu Mar 06 22:47:08 2014 +0100
@@ -2313,19 +2313,40 @@
 !
 
 update:something with:aParameter from:changedObject
-"/    self shown ifFalse:[^self].
+    |deltaY numPixels hScrollerHeight|
 
     (changedObject == textView) ifTrue:[
         ((something == #sizeOfContents)
         or:[ "false "(something == #visibility)"" ]) ifTrue:[
             self adjustSizeForLongestLine.
 
-"/            (numberOfLines ~= (textView list size max:textView cursorLine)) ifTrue:[
-"/                self invalidate.
-"/            ].
+            "/ (numberOfLines ~= (textView list size max:textView cursorLine)) ifTrue:[
+            "/     self invalidate.
+            "/ ].
             ^ self.
         ].
         something == #originOfContents ifTrue:[
+            aParameter notNil ifTrue:[
+                deltaY := aParameter y.
+                deltaY = 0 ifTrue:[^ self].
+
+                numPixels := deltaY abs.
+                numPixels < (height // 5) ifTrue:[
+                    deltaY < 0 ifTrue:[
+                        self invalidateX:0 y:0 width:width height:numPixels.
+                    ] ifFalse:[
+                        hScrollerHeight := 0.
+                        (textViewScroller notNil
+                        and:[textViewScroller horizontalScrollBar notNil]) ifTrue:[
+                            hScrollerHeight := textViewScroller horizontalScrollBar height.
+                        ].
+                        numPixels := numPixels + 4.
+                        self invalidateX:0 y:height-numPixels-hScrollerHeight width:width height:numPixels+hScrollerHeight.
+                    ].
+                    self repairDamage.
+                    ^ self.
+                ].
+            ].
             self invalidateLines.
             ^ self.
         ].
@@ -3878,15 +3899,15 @@
 !CodeView2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.142 2014-03-05 13:41:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.143 2014-03-06 21:47:08 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.142 2014-03-05 13:41:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.143 2014-03-06 21:47:08 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__CodeView2.st,v 1.142 2014-03-05 13:41:18 cg Exp $'
+    ^ '$Id: Tools__CodeView2.st,v 1.143 2014-03-06 21:47:08 cg Exp $'
 ! !