#TUNING by cg
class: Scroller
changed:
#drawEdgedLineFrom:y:toX:y:level:lightColor:shadowColor:
#drawHandleFormAtX:y:
#drawThumb
#drawThumbBackgroundInX:y:width:height:
draw by sending messages to gc instead of self.
(new GC structure)
--- a/Scroller.st Tue Jan 24 23:16:12 2017 +0100
+++ b/Scroller.st Tue Jan 24 23:17:27 2017 +0100
@@ -1095,16 +1095,16 @@
self paint:color1.
x1 = x2 ifTrue:[
"/ vertical
- self displayLineFromX:x1 y:y1-dl toX:x2 y:y2-dl.
- self paint:color2.
+ gc displayLineFromX:x1 y:y1-dl toX:x2 y:y2-dl.
+ gc paint:color2.
x := x1 + 1.
- self displayLineFromX:x y:y1 toX:x y:y2.
+ gc displayLineFromX:x y:y1 toX:x y:y2.
] ifFalse:[
"/ horizontal
- self displayLineFromX:x1-dl y:y1 toX:x2-dl y:y2.
- self paint:color2.
+ gc displayLineFromX:x1-dl y:y1 toX:x2-dl y:y2.
+ gc paint:color2.
y := y1 + 1.
- self displayLineFromX:x1 y:y toX:x2 y:y.
+ gc displayLineFromX:x1 y:y toX:x2 y:y.
].
!
@@ -1113,12 +1113,12 @@
thumbShadowColor := thumbShadowColor onDevice:device.
- self paint:thumbShadowColor.
- self displayForm:shadowForm x:x y:y.
+ gc paint:thumbShadowColor.
+ gc displayForm:shadowForm x:x y:y.
lightForm notNil ifTrue:[
thumbLightColor := thumbLightColor onDevice:device.
- self paint:thumbLightColor.
- self displayForm:lightForm x:x y:y.
+ gc paint:thumbLightColor.
+ gc displayForm:lightForm x:x y:y.
].
"Modified: / 19.5.1998 / 16:26:49 / cg"
@@ -1294,21 +1294,21 @@
].
].
].
- self paint:(clr2 mixed:m with:clr).
+ gc paint:(clr2 mixed:m with:clr).
(orientation == #vertical) ifTrue:[
- self displayLineFromX:(l+i-1) y:t+1 toX:(l+i-1) y:(t+h-2)
+ gc displayLineFromX:(l+i-1) y:t+1 toX:(l+i-1) y:(t+h-2)
] ifFalse:[
- self displayLineFromX:(l+1) y:(t+i-1) toX:(l+w-2) y:(t+i-1)
+ gc displayLineFromX:(l+1) y:(t+i-1) toX:(l+w-2) y:(t+i-1)
].
].
] ifFalse:[
- self paint:clr.
+ gc paint:clr.
(xpStyle and:[self isMiniScroller not]) ifTrue:[
"/ hack for xp
(orientation == #vertical) ifTrue:[
- self fillRectangleX:l y:t+1 width:w-2 height:h-4.
+ gc fillRectangleX:l y:t+1 width:w-2 height:h-4.
] ifFalse:[
- self fillRectangleX:l+1 y:t width:w-4 height:h-2.
+ gc fillRectangleX:l+1 y:t width:w-4 height:h-2.
]
] ifFalse:[
(styleSheet at:#'scroller.roundStyle' default:false) ifTrue:[
@@ -1320,11 +1320,11 @@
left := l+i-1.
right := l+w-i+1.
yLine := t+3-i.
- self displayLineFromX:left y:yLine toX:right y:yLine.
+ gc displayLineFromX:left y:yLine toX:right y:yLine.
yLine := t+h-3-1+i.
- self displayLineFromX:left y:yLine toX:right y:yLine.
+ gc displayLineFromX:left y:yLine toX:right y:yLine.
].
- self fillRectangleX:l y:t+3 width:w height:h-6.
+ gc fillRectangleX:l y:t+3 width:w height:h-6.
] ifFalse:[
1 to:3 do:[:i |
|xLine top bot|
@@ -1332,14 +1332,14 @@
top := t+i-1.
bot := t+h-i+1.
xLine := l+3-i.
- self displayLineFromX:xLine y:top toX:xLine y:bot.
+ gc displayLineFromX:xLine y:top toX:xLine y:bot.
xLine := l+w-3-1+i.
- self displayLineFromX:xLine y:top toX:xLine y:bot.
+ gc displayLineFromX:xLine y:top toX:xLine y:bot.
].
- self fillRectangleX:l+3 y:t width:w-6 height:h.
+ gc fillRectangleX:l+3 y:t width:w-6 height:h.
].
] ifFalse:[
- self fillRectangleX:l y:t width:w height:h.
+ gc fillRectangleX:l y:t width:w height:h.
].
].
].
@@ -1368,42 +1368,42 @@
thumbFrameColor notNil ifTrue:[
clr2 := styleSheet colorAt:#'scroller.thumbFrameColor2'.
clr2 notNil ifTrue:[
- self paint:clr2.
+ gc paint:clr2.
(orientation == #vertical) ifTrue:[
- self displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-3.
- self displayLineFromX:l y:t+h-3 toX:l+w-2 y:t+h-3.
+ gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-3.
+ gc displayLineFromX:l y:t+h-3 toX:l+w-2 y:t+h-3.
] ifFalse:[
- self displayLineFromX:l+2 y:t+h-2 toX:l+w-3 y:t+h-2.
- self displayLineFromX:l+w-3 y:t toX:l+w-3 y:t+h-2.
+ gc displayLineFromX:l+2 y:t+h-2 toX:l+w-3 y:t+h-2.
+ gc displayLineFromX:l+w-3 y:t toX:l+w-3 y:t+h-2.
].
].
vistaStyle ifTrue:[
- self paint:clr slightlyDarkened.
+ gc paint:clr slightlyDarkened.
] ifFalse:[
- self paint:thumbFrameColor.
+ gc paint:thumbFrameColor.
].
xpStyle ifTrue:[
(orientation == #vertical) ifTrue:[
- self displayLineFromX:l+w-1 y:t+1 toX:l+w-1 y:t+h-3.
- self displayLineFromX:l+1 y:t+h-2 toX:l+w-2 y:t+h-2.
- self displayLineFromX:l+w-2 y:t+h-3 toX:l+w-2 y:t+h-3.
+ gc displayLineFromX:l+w-1 y:t+1 toX:l+w-1 y:t+h-3.
+ gc displayLineFromX:l+1 y:t+h-2 toX:l+w-2 y:t+h-2.
+ gc displayLineFromX:l+w-2 y:t+h-3 toX:l+w-2 y:t+h-3.
"/ self displayLineFromX:l-2 y:t+h-3 toX:l-2 y:t+h-3.
] ifFalse:[
- self displayLineFromX:l+2 y:t+h-1 toX:l+w-3 y:t+h-1.
- self displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-2.
- self displayLineFromX:l+w-3 y:t+h-2 toX:l+w-3 y:t+h-2.
+ gc displayLineFromX:l+2 y:t+h-1 toX:l+w-3 y:t+h-1.
+ gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-2.
+ gc displayLineFromX:l+w-3 y:t+h-2 toX:l+w-3 y:t+h-2.
].
] ifFalse:[
h := h - 1.
- self displayRectangleX:l y:t width:w height:h.
+ gc displayRectangleX:l y:t width:w height:h.
].
vistaStyle ifTrue:[
- self paint:clr lightened.
- self displayPointX:l y:t.
- self displayPointX:l+w-1 y:t.
- self displayPointX:l y:t+h-1.
- self displayPointX:l+w-1 y:t+h-1.
+ gc paint:clr lightened.
+ gc displayPointX:l y:t.
+ gc displayPointX:l+w-1 y:t.
+ gc displayPointX:l y:t+h-1.
+ gc displayPointX:l+w-1 y:t+h-1.
].
].
@@ -1437,16 +1437,16 @@
shown ifTrue:[
oldClip := self clippingBoundsOrNil.
self clippingBounds:(Rectangle left:x top:y width:w height:h).
- self clearDeviceRectangleX:x y:y width:w height:h.
+ gc clearDeviceRectangleX:x y:y width:w height:h.
styleSheet name == #winVista ifTrue:[
- self paint:(Color greyByte:16rE3).
+ gc paint:(Color greyByte:16rE3).
(orientation == #vertical) ifTrue:[
- self displayLineFromX:0 y:0 toX:0 y:height-1.
- self displayLineFromX:1 y:0 toX:1 y:height-1.
+ gc displayLineFromX:0 y:0 toX:0 y:height-1.
+ gc displayLineFromX:1 y:0 toX:1 y:height-1.
] ifFalse:[
- self displayLineFromX:0 y:0 toX:width-1 y:0.
- self displayLineFromX:0 y:1 toX:width-1 y:1.
+ gc displayLineFromX:0 y:0 toX:width-1 y:0.
+ gc displayLineFromX:0 y:1 toX:width-1 y:1.
].
].
@@ -1461,15 +1461,15 @@
gH := frameBeforeMove height.
ghostColor notNil ifTrue:[
- self paint:ghostColor.
- self fillRectangle:frameBeforeMove.
+ gc paint:ghostColor.
+ gc fillRectangle:frameBeforeMove.
].
(ghostLevel ~~ 0) ifTrue:[
self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
].
ghostFrameColor notNil ifTrue:[
- self paint:ghostFrameColor.
- self displayRectangleX:gX y:gY width:gW height:gH
+ gc paint:ghostFrameColor.
+ gc displayRectangleX:gX y:gY width:gW height:gH
].
]
]