invalidation when size changes and thumbHeight becomes >= 100
authorClaus Gittinger <cg@exept.de>
Mon, 03 Apr 2000 17:34:39 +0200
changeset 2176 7069af4213d6
parent 2175 5042e15f3cf6
child 2177 f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Scroller.st
--- a/Scroller.st	Mon Apr 03 16:39:12 2000 +0200
+++ b/Scroller.st	Mon Apr 03 17:34:39 2000 +0200
@@ -1039,136 +1039,145 @@
      h "{ Class: SmallInteger }"
      x "{ Class: SmallInteger }"
      y "{ Class: SmallInteger }"
-     mm xL xR yT yB color1 color2|
+     mm xL xR yT yB color1 color2 b r|
 
     (thumbHeight >= 100) ifTrue:[^ self].
 
     w := thumbFrame width.
     h := thumbFrame height.
+    l := thumbFrame left.
+    t := thumbFrame top.
 
     orientation == #vertical ifTrue:[
-	h >= height ifTrue:[^ self].
+        b := thumbFrame bottom.
+        b >= (height - margin) ifTrue:[
+            t <= margin ifTrue:[
+                ^ self
+            ]
+        ].
     ] ifFalse:[
-	w >= width ifTrue:[^ self].
+        r := thumbFrame right.
+        r >= (width - margin) ifTrue:[
+            l <= margin ifTrue:[
+                ^ self
+            ]
+        ].
     ].
 
-    l := thumbFrame left.
-    t := thumbFrame top.
-
     self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]).
     self fillRectangleX:l y:t width:w-1 height:h.
 
     lvl := thumbLevel.
     scrolling ifTrue:[
-	lvl := thumbActiveLevel
+        lvl := thumbActiveLevel
     ].
 
     lvl == 0 ifTrue:[
-	thumbFrameColor notNil ifTrue:[
-	    self paint:thumbFrameColor.
-	    self displayRectangleX:l y:t width:w height:h.
-	].
-	thumbImage notNil ifTrue:[
-	    thumbImage displayOn:self x:l y:t
-	].
-	^ self
+        thumbFrameColor notNil ifTrue:[
+            self paint:thumbFrameColor.
+            self displayRectangleX:l y:t width:w height:h.
+        ].
+        thumbImage notNil ifTrue:[
+            thumbImage displayOn:self x:l y:t
+        ].
+        ^ self
     ].
 
     self drawEdgesForX:l y:t width:w height:h level:lvl
-		shadow:thumbShadowColor light:thumbLightColor
-		halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
-		style:thumbEdgeStyle.
+                shadow:thumbShadowColor light:thumbLightColor
+                halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
+                style:thumbEdgeStyle.
 
     thumbFrameColor notNil ifTrue:[
-	self paint:thumbFrameColor.
-	self displayRectangleX:l y:t width:w height:h.
+        self paint:thumbFrameColor.
+        self displayRectangleX:l y:t width:w height:h.
     ].
 
     thumbImage notNil ifTrue:[
-	thumbImage displayOn:self x:l y:t
+        thumbImage displayOn:self x:l y:t
     ].
 
     (tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[
-	shadowForm notNil ifTrue:[
-	    handleX := l + ((w - 8) // 2).
-	    handleY := t + ((h - 8) // 2).
-	    self drawHandleFormAtX:handleX y:handleY
-	].
-	^ self
+        shadowForm notNil ifTrue:[
+            handleX := l + ((w - 8) // 2).
+            handleY := t + ((h - 8) // 2).
+            self drawHandleFormAtX:handleX y:handleY
+        ].
+        ^ self
     ].
 
     "iris style - draw tallys"
 
     tallyLevel > 0 ifTrue:[
-	color1 := thumbLightColor.
-	color2 := thumbShadowColor.
+        color1 := thumbLightColor.
+        color2 := thumbShadowColor.
     ] ifFalse:[
-	color1 := thumbShadowColor.
-	color2 := thumbLightColor.
+        color1 := thumbShadowColor.
+        color2 := thumbLightColor.
     ].
 
     "draw tally marks"
 
     (orientation == #vertical) ifTrue:[
-	self paint:color1.
-	y := t + (h // 2) - 1.
-	xL := l + lvl - 1.
-	xR := l + w - lvl "+ 1".
-	self displayLineFromX:xL y:y toX:xR y:y.
-	y := y + 1.
-	self paint:color2.
-	self displayLineFromX:xL y:y toX:xR y:y.
-
-	tallyMarks > 1 ifTrue:[
-	    "dont draw other marks if there is not enough space"
-
-	    mm := device verticalPixelPerMillimeter rounded.
-	    h > (mm * (tallyMarks * 2)) ifTrue:[
-		y := y - 1 - mm.
-		self paint:color1.
-		self displayLineFromX:xL y:y toX:xR y:y.
-		y := y + 1.
-		self paint:color2.
-		self displayLineFromX:xL y:y toX:xR y:y.
-
-		y := y - 1 + mm + mm.
-		self paint:color1.
-		self displayLineFromX:xL y:y toX:xR y:y.
-		y := y + 1.
-		self paint:color2.
-		self displayLineFromX:xL y:y toX:xR y:y
-	    ]
-	]
+        self paint:color1.
+        y := t + (h // 2) - 1.
+        xL := l + lvl - 1.
+        xR := l + w - lvl "+ 1".
+        self displayLineFromX:xL y:y toX:xR y:y.
+        y := y + 1.
+        self paint:color2.
+        self displayLineFromX:xL y:y toX:xR y:y.
+
+        tallyMarks > 1 ifTrue:[
+            "dont draw other marks if there is not enough space"
+
+            mm := device verticalPixelPerMillimeter rounded.
+            h > (mm * (tallyMarks * 2)) ifTrue:[
+                y := y - 1 - mm.
+                self paint:color1.
+                self displayLineFromX:xL y:y toX:xR y:y.
+                y := y + 1.
+                self paint:color2.
+                self displayLineFromX:xL y:y toX:xR y:y.
+
+                y := y - 1 + mm + mm.
+                self paint:color1.
+                self displayLineFromX:xL y:y toX:xR y:y.
+                y := y + 1.
+                self paint:color2.
+                self displayLineFromX:xL y:y toX:xR y:y
+            ]
+        ]
     ] ifFalse:[
-	x := l + (w // 2) - 1.
-	yT := t + lvl - 1.
-	yB := t + h - lvl "+ 1".
-	self paint:color1.
-	self displayLineFromX:x y:yT toX:x y:yB.
-	self paint:color2.
-	x := x + 1.
-	self displayLineFromX:x y:yT toX:x y:yB.
-
-	tallyMarks > 1 ifTrue:[
-	    "dont draw other marks if there is not enough space"
-
-	    mm := device horizontalPixelPerMillimeter rounded.
-	    w > (mm * (tallyMarks * 2)) ifTrue:[
-		x := x - 1 - mm.
-		self paint:color1.
-		self displayLineFromX:x y:yT toX:x y:yB.
-		x := x + 1.
-		self paint:color2.
-		self displayLineFromX:x y:yT toX:x y:yB.
-
-		x := x - 1 + mm + mm.
-		self paint:color1.
-		self displayLineFromX:x y:yT toX:x y:yB.
-		x := x + 1.
-		self paint:color2.
-		self displayLineFromX:x y:yT toX:x y:yB
-	    ]
-	]
+        x := l + (w // 2) - 1.
+        yT := t + lvl - 1.
+        yB := t + h - lvl "+ 1".
+        self paint:color1.
+        self displayLineFromX:x y:yT toX:x y:yB.
+        self paint:color2.
+        x := x + 1.
+        self displayLineFromX:x y:yT toX:x y:yB.
+
+        tallyMarks > 1 ifTrue:[
+            "dont draw other marks if there is not enough space"
+
+            mm := device horizontalPixelPerMillimeter rounded.
+            w > (mm * (tallyMarks * 2)) ifTrue:[
+                x := x - 1 - mm.
+                self paint:color1.
+                self displayLineFromX:x y:yT toX:x y:yB.
+                x := x + 1.
+                self paint:color2.
+                self displayLineFromX:x y:yT toX:x y:yB.
+
+                x := x - 1 + mm + mm.
+                self paint:color1.
+                self displayLineFromX:x y:yT toX:x y:yB.
+                x := x + 1.
+                self paint:color2.
+                self displayLineFromX:x y:yT toX:x y:yB
+            ]
+        ]
     ]
 
     "Modified: / 29.4.1999 / 09:35:52 / cg"
@@ -1643,11 +1652,6 @@
                 ^ self
             ].
 
-            thumbHeight >= 100 ifTrue:[
-                self invalidate:oldThumbFrame.
-                ^ self.
-            ].
-
             "/ try to redraw as little as possible
 
             oldTop := oldThumbFrame top.
@@ -2423,5 +2427,5 @@
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.142 2000-04-03 14:39:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.143 2000-04-03 15:34:39 cg Exp $'
 ! !