--- a/Scroller.st Thu Apr 29 09:09:14 1999 +0200
+++ b/Scroller.st Thu Apr 29 10:00:47 1999 +0200
@@ -1035,138 +1035,136 @@
mm xL xR yT yB color1 color2|
(thumbHeight >= 100) ifTrue:[^ self].
+
+ w := thumbFrame width.
+ h := thumbFrame height.
+
orientation == #vertical ifTrue:[
- thumbFrame height >= height ifTrue:[^ self].
+ h >= height ifTrue:[^ self].
] ifFalse:[
- thumbFrame width >= width ifTrue:[^ self].
+ w >= width ifTrue:[^ self].
].
l := thumbFrame left.
t := thumbFrame top.
- w := thumbFrame width.
- h := thumbFrame height.
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 displayRectangle:thumbFrame.
- ].
- 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.
- orientation == #vertical ifTrue:[
- self displayRectangleX:l y:t width:w"-1" height:h.
- ] ifFalse:[
- self displayRectangleX:l y:t width:w height:h"-1".
- ]
+ 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.
+ 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"
+ 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.
+ 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
- ]
- ]
+ 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.
+ 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"
+ 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.
+ 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 := 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: / 12.5.1998 / 20:39:52 / cg"
+ "Modified: / 29.4.1999 / 09:35:52 / cg"
!
drawThumbBackgroundInX:x y:y width:w height:h
@@ -1613,7 +1611,7 @@
sizeChanged:how
"size of scroller changed - recompute thumbs frame and redraw it"
- |oldThumbFrame|
+ |oldThumbFrame oldTop oldBot newTop newBot|
oldThumbFrame := thumbFrame.
thumbFrame := nil.
@@ -1624,12 +1622,31 @@
thumbFrame = oldThumbFrame ifTrue:[
^ self
].
+
+"/ "/ try to redraw as little as possible
+"/ orientation == #vertical ifTrue:[
+"/ oldTop := oldThumbFrame top.
+"/ oldBot := oldThumbFrame bottom.
+"/ newTop := thumbFrame top.
+"/ newBot := thumbFrame bottom.
+"/ newTop <= oldTop ifTrue:[
+"/ newBot >= oldBot ifTrue:[
+"/ self drawThumb.
+"/ ^ self.
+"/ ].
+"/
+"/ ] ifFalse:[
+"/ self drawThumbBackgroundInX:0 y:oldTop width:width height:(newTop-oldTop).
+"/ self drawThumb.
+"/ ]
+"/ ]
+ self invalidate:(oldThumbFrame merge: thumbFrame).
+ ^ self.
].
- "/ self clear.
self invalidate
].
- "Modified: / 7.11.1998 / 14:45:08 / cg"
+ "Modified: / 29.4.1999 / 09:43:12 / cg"
!
update:something with:aParameter from:changedObject
@@ -2321,5 +2338,5 @@
!Scroller class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.127 1999-04-28 17:52:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.128 1999-04-29 08:00:47 cg Exp $'
! !