#TUNING by cg
class: VariablePanel
changed:
#drawHandle:atX:y:
#drawHandleFormAtX:y:
#drawSnapAt:
#invertHandleBarAtX:y:
draw by sending messages to gc instead of self.
(new GC structure)
--- a/VariablePanel.st Tue Jan 24 23:25:06 2017 +0100
+++ b/VariablePanel.st Tue Jan 24 23:36:09 2017 +0100
@@ -1439,13 +1439,11 @@
]
].
- self paint:viewBackground.
- self lineStyle:#solid.
+ gc paint:viewBackground.
+ gc lineStyle:#solid.
orientation == #vertical ifTrue:[
- self fillRectangleX:mar y:hy
- width:(width - mar - mar)
- height:barHeightInt.
+ gc fillRectangleX:mar y:hy width:(width - mar - mar) height:barHeightInt.
(handleStyle notNil
and:[handleStyle ~~ #none]) ifTrue:[
(handleStyle ~~ #normal
@@ -1457,22 +1455,20 @@
y := hy + (barHeightInt // 2). "/ center of the bar
separatingLine ifTrue:[
- self paint:shadowColor.
- self displayLineFromX:mar y:y toX:(width - mar) y:y.
+ gc paint:shadowColor.
+ gc displayLineFromX:mar y:y toX:(width - mar) y:y.
y := y + 1.
- self paint:lightColor.
- self displayLineFromX:mar y:y toX:(width - mar) y:y.
- self paint:viewBackground.
+ gc paint:lightColor.
+ gc displayLineFromX:mar y:y toX:(width - mar) y:y.
+ gc paint:viewBackground.
].
- self fillRectangleX:(hx - barWidthInt)
- y:hy
- width:(barWidthInt + barWidthInt)
- height:h.
+ gc fillRectangleX:(hx - barWidthInt) y:hy
+ width:(barWidthInt + barWidthInt) height:h.
handleStyle == #line ifTrue:[
- self paint:handleColor.
- self displayLineFromX:hx - barWidthInt y:y toX:hx + barWidthInt y:y
+ gc paint:handleColor.
+ gc displayLineFromX:hx - barWidthInt y:y toX:hx + barWidthInt y:y
] ifFalse:[
y := hy.
handleStyle == #st80 ifTrue:[
@@ -1504,11 +1500,9 @@
].
handleStyle == #iris ifTrue:[
- self paint:handleColor.
- self fillDeviceRectangleX:(hx - barWidthInt + 2)
- y:(ym + 2)
- width:(barWidthInt + barWidthInt - 4)
- height:h - 4
+ gc paint:handleColor.
+ gc fillDeviceRectangleX:(hx - barWidthInt + 2) y:(ym + 2)
+ width:(barWidthInt + barWidthInt - 4) height:h - 4
]
]
].
@@ -1521,30 +1515,30 @@
handleStyle == #st80 ifTrue:[
y := hy - 1.
- self paint:lightColor.
- self displayLineFromX:mar y:y toX:(width - mar - mar - 1) y:y.
- self displayLineFromX:0 y:hy toX:0 y:(hy + knobHeight - 1).
+ gc paint:lightColor.
+ gc displayLineFromX:mar y:y toX:(width - mar - mar - 1) y:y.
+ gc displayLineFromX:0 y:hy toX:0 y:(hy + knobHeight - 1).
y := hy + knobHeight - 2.
- self paint:shadowColor.
- self displayLineFromX:mar y:y toX:(width - mar) y:y.
+ gc paint:shadowColor.
+ gc displayLineFromX:mar y:y toX:(width - mar) y:y.
"uncomment the -1 if you don't like the notch at the right end"
" VVV"
- self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1).
+ gc displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1).
].
] ifFalse:[
y := hy + barHeightInt - 1.
- self paint:handleColor.
+ gc paint:handleColor.
separatingLine ifTrue:[
- self displayLineFromX:0 y:hy+1 toX:width y:hy+1.
- self displayLineFromX:0 y:y toX:width y:y.
+ gc displayLineFromX:0 y:hy+1 toX:width y:hy+1.
+ gc displayLineFromX:0 y:y toX:width y:y.
].
- self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt.
+ gc fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt.
].
].
lbl := self handleLabelAt:hIndex.
lbl notNil ifTrue:[
hIndex ~~ 1 ifTrue:[
- self paint:self blackColor.
+ gc paint:self blackColor.
lbl displayOn:self x:mar y:hy + (lbl ascentOn:self)
"/ lbl isImageOrForm ifTrue:[
"/ lbl displayOn:self x:mar y:hy
@@ -1555,33 +1549,30 @@
].
] ifFalse:[
- self fillRectangleX:hx y:mar
- width:barHeightInt
- height:(height - mar - mar).
+ gc fillRectangleX:hx y:mar width:barHeightInt height:(height - mar - mar).
(handleStyle notNil
and:[handleStyle ~~ #none]) ifTrue:[
(handleStyle ~~ #normal
and:[handleStyle ~~ #mswindows]) ifTrue:[
- m := (barHeightInt - w) // 2.
+ "/ m := (barHeightInt - w) // 2.
m := (maxKnob - w) // 2.
- shadowForm isNil ifTrue:[
+ shadowForm isNil ifTrue:[
x := hx + (barHeightInt // 2).
separatingLine ifTrue:[
- self paint:shadowColor.
- self displayLineFromX:x y:mar toX:x y:(height - mar).
+ gc paint:shadowColor.
+ gc displayLineFromX:x y:mar toX:x y:(height - mar).
x := x + 1.
- self paint:lightColor.
- self displayLineFromX:x y:mar toX:x y:(height - mar).
- self paint:viewBackground.
+ gc paint:lightColor.
+ gc displayLineFromX:x y:mar toX:x y:(height - mar).
+ gc paint:viewBackground.
].
- self fillRectangleX:hx y:(hy - barWidthInt)
- width:w
- height:(barWidthInt + barWidthInt).
+ gc fillRectangleX:hx y:(hy - barWidthInt)
+ width:w height:(barWidthInt + barWidthInt).
handleStyle == #line ifTrue:[
- self paint:handleColor.
- self displayLineFromX:x y:hy - barWidthInt toX:x y:hy + barWidthInt.
+ gc paint:handleColor.
+ gc displayLineFromX:x y:hy - barWidthInt toX:x y:hy + barWidthInt.
] ifFalse:[
x := hx.
handleStyle == #st80 ifTrue:[
@@ -1604,18 +1595,14 @@
]
] ifFalse:[
handleLevel ~~ 0 ifTrue:[
- self drawEdgesForX:xm
- y:(hy - barWidthInt)
- width:w
- height:(barWidthInt + barWidthInt)
- level:handleLevel.
+ self drawEdgesForX:xm y:(hy - barWidthInt)
+ width:w height:(barWidthInt + barWidthInt)
+ level:handleLevel.
].
handleStyle == #iris ifTrue:[
- self paint:handleColor.
- self fillDeviceRectangleX:(xm + 2)
- y:(hy - barWidthInt + 2)
- width:w - 4
- height:(barWidthInt + barWidthInt - 4)
+ gc paint:handleColor.
+ gc fillDeviceRectangleX:(xm + 2) y:(hy - barWidthInt + 2)
+ width:w - 4 height:(barWidthInt + barWidthInt - 4)
].
].
]
@@ -1627,24 +1614,24 @@
].
handleStyle == #st80 ifTrue:[
x := hx - 1.
- self paint:lightColor.
- self displayLineFromX:x y:mar toX:x y:(height - mar).
- self displayLineFromX:hx y:0 toX:(hx + barHeightInt - 1) y:0.
+ gc paint:lightColor.
+ gc displayLineFromX:x y:mar toX:x y:(height - mar).
+ gc displayLineFromX:hx y:0 toX:(hx + barHeightInt - 1) y:0.
x := hx + barHeightInt - 2.
- self paint:shadowColor.
- self displayLineFromX:x y:mar toX:x y:(height - mar).
+ gc paint:shadowColor.
+ gc displayLineFromX:x y:mar toX:x y:(height - mar).
"uncomment the -1 if you dont like the notch at the bottom end"
" VVV"
- self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeightInt - 1) y:height-1.
+ gc displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeightInt - 1) y:height-1.
].
] ifFalse:[
x := hx + barHeightInt - 1.
- self paint:handleColor.
+ gc paint:handleColor.
separatingLine ifTrue:[
- self displayLineFromX:hx+1 y:0 toX:hx+1 y:height.
- self displayLineFromX:x y:0 toX:x y:height.
+ gc displayLineFromX:hx+1 y:0 toX:hx+1 y:height.
+ gc displayLineFromX:x y:0 toX:x y:height.
].
- self fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt
+ gc fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt
]
]
].
@@ -1653,17 +1640,17 @@
!
drawHandleFormAtX:hx y:hy
- "draw a handles bitmap at hx/hy"
+ "draw a handle's bitmap at hx/hy"
shadowForm notNil ifTrue:[
- self paint:shadowColor.
- self displayForm:shadowForm x:hx y:hy.
+ gc paint:shadowColor.
+ gc displayForm:shadowForm x:hx y:hy.
].
lightForm notNil ifTrue:[
- self paint:lightColor.
- self displayForm:lightForm x:hx y:hy.
+ gc paint:lightColor.
+ gc displayForm:lightForm x:hx y:hy.
].
- self paint:viewBackground
+ gc paint:viewBackground
"Modified: 7.11.1996 / 20:25:33 / cg"
!
@@ -1707,12 +1694,12 @@
paint := viewBackground.
].
- self paint:paint.
+ gc paint:paint.
"/ level == 0 ifTrue:[
"/ ].
- self fillRectangleX:left+1 y:top+1 width:width-2 height:height-2.
+ gc fillRectangleX:left+1 y:top+1 width:width-2 height:height-2.
level ~~ 0 ifTrue:[
leftEdge := left + 1.
@@ -1790,15 +1777,15 @@
trackLine == #dashedLine ifTrue:[
oldStyle := gc lineStyle.
- self lineStyle:#dashed.
+ gc lineStyle:#dashed.
] ifFalse:[
trackLine == #dottedLine ifTrue:[
oldStyle := gc lineStyle.
- self lineStyle:#dotted.
+ gc lineStyle:#dotted.
]
].
- self clippedByChildren:false.
+ gc clippedByChildren:false.
self xoring:[
|yL xL halfHeight|
@@ -1808,23 +1795,23 @@
orientation == #vertical ifTrue:[
yL := hy + halfHeight.
doLine ifTrue:[
- self displayLineFromX:0 y:yL toX:width y:yL.
+ gc displayLineFromX:0 y:yL toX:width y:yL.
] ifFalse:[
- self fillRectangleX:0 y:hy width:width height:barHeight
+ gc fillRectangleX:0 y:hy width:width height:barHeight
]
] ifFalse:[
xL := hx + halfHeight.
doLine ifTrue:[
- self displayLineFromX:xL y:0 toX:xL y:height.
+ gc displayLineFromX:xL y:0 toX:xL y:height.
] ifFalse:[
- self fillRectangleX:hx y:0 width:barHeight height:height
+ gc fillRectangleX:hx y:0 width:barHeight height:height
]
].
].
- self clippedByChildren:true.
+ gc clippedByChildren:true.
oldStyle notNil ifTrue:[
- self lineStyle:oldStyle.
+ gc lineStyle:oldStyle.
].
"Modified: / 28.4.1997 / 14:56:26 / dq"