Scroller.st
changeset 4908 bc2630136762
parent 4874 4b2eedd37770
child 4911 fb84639b995e
--- a/Scroller.st	Tue Feb 18 16:09:53 2014 +0100
+++ b/Scroller.st	Tue Feb 18 16:12:59 2014 +0100
@@ -570,7 +570,7 @@
             ] ifFalse:[
                 nBg := DefaultViewBackground
             ].
-            nBg := nBg onDevice:device.
+            nBg := nBg onDevice:self graphicsDevice.
             nBg ~~ viewBackground ifTrue:[
                 self viewBackground:nBg.
                 self invalidate.
@@ -813,7 +813,7 @@
                 ] ifFalse:[
                     nBg := DefaultViewBackground
                 ].
-                nBg := nBg onDevice:device.
+                nBg := nBg onDevice:self graphicsDevice.
                 nBg ~~ viewBackground ifTrue:[
                     self viewBackground:nBg.
                 ]
@@ -990,15 +990,16 @@
 
     <resource: #style (#name)>
 
-    |avgColor|
-
-    thumbColor := aColor onDevice:device.
+    |avgColor graphicsDevice|
+
+    graphicsDevice := self graphicsDevice.
+    thumbColor := aColor onDevice:self graphicsDevice.
     (styleSheet name ~~ #normal) ifTrue:[
-	avgColor := aColor averageColorIn:(0@0 corner:7@7).
-	thumbShadowColor := avgColor darkened onDevice:device.
-	thumbLightColor := avgColor lightened onDevice:device.
-	thumbHalfShadowColor := thumbShadowColor darkened onDevice:device.
-	thumbHalfLightColor := thumbLightColor lightened onDevice:device.
+        avgColor := aColor averageColorIn:(0@0 corner:7@7).
+        thumbShadowColor := avgColor darkened onDevice:graphicsDevice.
+        thumbLightColor := avgColor lightened onDevice:graphicsDevice.
+        thumbHalfShadowColor := thumbShadowColor darkened onDevice:graphicsDevice.
+        thumbHalfLightColor := thumbLightColor lightened onDevice:graphicsDevice.
     ].
     self invalidate
 
@@ -1104,12 +1105,12 @@
 drawHandleFormAtX:x y:y
     "styles with a handle in the middle (NeXT) use this"
 
-    thumbShadowColor := thumbShadowColor onDevice:device.
+    thumbShadowColor := thumbShadowColor onDevice:self graphicsDevice.
 
     self paint:thumbShadowColor.
     self displayForm:shadowForm x:x y:y.
     lightForm notNil ifTrue:[
-        thumbLightColor := thumbLightColor onDevice:device.
+        thumbLightColor := thumbLightColor onDevice:self graphicsDevice.
         self paint:thumbLightColor.
         self displayForm:lightForm x:x y:y.
     ].
@@ -1166,7 +1167,7 @@
         xL := l + lvl - 1 + DefaultTallyInset.
         xR := l + w - lvl "+ 1" - DefaultTallyInset.
 
-        dist := DefaultTallyDistance ? device verticalPixelPerMillimeter rounded.
+        dist := DefaultTallyDistance ? self graphicsDevice verticalPixelPerMillimeter rounded.
 
         tallyMarks even ifTrue:[
             yTop := y - (dist // 2).   
@@ -1192,7 +1193,7 @@
         yB := t + h - lvl "+ 1" - DefaultTallyInset.
 
 
-        dist := DefaultTallyDistance ? device horizontalPixelPerMillimeter rounded.
+        dist := DefaultTallyDistance ? self graphicsDevice horizontalPixelPerMillimeter rounded.
 
         tallyMarks even ifTrue:[
             xLeft := x - (dist // 2).   
@@ -1818,9 +1819,9 @@
      redraw thumb if enteredColor ~~ thumbColor"
 
     scrolling ifTrue:[
-	(state bitAnd:(device anyButtonMotionMask)) == 0 ifTrue: [
-	    self buttonRelease:1 x:x y:y
-	].
+        (state bitAnd:(self graphicsDevice anyButtonMotionMask)) == 0 ifTrue: [
+            self buttonRelease:1 x:x y:y
+        ].
     ].
     super pointerEnter:state x:x y:y
 
@@ -1831,12 +1832,12 @@
     "mouse-button left view
      redraw thumb if enteredColor ~~ thumbColor"
 
-    (entered and:[(state bitAnd:(device anyButtonMotionMask)) == 0]) ifTrue: [
-	entered := false.
-	thumbEnteredColor ~= thumbColor ifTrue:[
-	    self invalidate.
-	    "/ self drawThumb
-	]
+    (entered and:[(state bitAnd:(self graphicsDevice anyButtonMotionMask)) == 0]) ifTrue: [
+        entered := false.
+        thumbEnteredColor ~= thumbColor ifTrue:[
+            self invalidate.
+            "/ self drawThumb
+        ]
     ].
 
     "Created: / 6.3.1996 / 17:31:16 / cg"
@@ -2123,16 +2124,19 @@
 fetchDeviceResources
     "fetch device colors, to avoid reallocation at redraw time"
 
+    |graphicsDevice|
+
     super fetchDeviceResources.
-
-    thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor onDevice:device].
-    thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor onDevice:device].
-    thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor onDevice:device].
-    thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor onDevice:device].
-
-    thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor onDevice:device].
-    ghostColor notNil ifTrue:[ghostColor := ghostColor onDevice:device].
-    ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor onDevice:device].
+    graphicsDevice := self graphicsDevice.
+
+    thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor onDevice:graphicsDevice].
+    thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor onDevice:graphicsDevice].
+    thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor onDevice:graphicsDevice].
+    thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor onDevice:graphicsDevice].
+
+    thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor onDevice:graphicsDevice].
+    ghostColor notNil ifTrue:[ghostColor := ghostColor onDevice:graphicsDevice].
+    ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor onDevice:graphicsDevice].
 
     "Modified: 13.1.1997 / 21:56:38 / cg"
 !
@@ -2151,18 +2155,19 @@
                        #'scroller.initialRepeatDelay'
                        #'scroller.repeatDelay')>
 
-    |nm|
+    |nm graphicsDevice|
 
     super initStyle.
+    graphicsDevice := self graphicsDevice.
 
     DefaultViewBackground notNil ifTrue:[
-        viewBackground := DefaultViewBackground onDevice:device.
+        viewBackground := DefaultViewBackground onDevice:graphicsDevice.
     ].
     DefaultShadowColor notNil ifTrue:[
-        shadowColor := DefaultShadowColor onDevice:device.
+        shadowColor := DefaultShadowColor onDevice:graphicsDevice.
     ].
     DefaultLightColor notNil ifTrue:[
-        lightColor := DefaultLightColor onDevice:device.
+        lightColor := DefaultLightColor onDevice:graphicsDevice.
     ].
 
     tallyMarks := DefaultTallyMarks.
@@ -2181,15 +2186,15 @@
     thumbEdgeStyle := DefaultEdgeStyle.
 
     DefaultGhostColor notNil ifTrue:[
-        ghostColor := DefaultGhostColor onDevice:device.
+        ghostColor := DefaultGhostColor onDevice:graphicsDevice.
     ].
     DefaultGhostFrameColor notNil ifTrue:[
-        ghostFrameColor := DefaultGhostFrameColor onDevice:device.
+        ghostFrameColor := DefaultGhostFrameColor onDevice:graphicsDevice.
     ].
     ghostLevel := DefaultGhostLevel.
 
     DefaultThumbFrameColor notNil ifTrue:[
-        thumbFrameColor := DefaultThumbFrameColor onDevice:device.
+        thumbFrameColor := DefaultThumbFrameColor onDevice:graphicsDevice.
     ].
     DefaultThumbShadowColor notNil ifTrue:[
         thumbShadowColor := DefaultThumbShadowColor
@@ -2214,7 +2219,7 @@
 
     nm := styleSheet name.
 
-    device hasGrayscales ifFalse:[
+    graphicsDevice hasGrayscales ifFalse:[
         thumbEdgeStyle notNil ifTrue:[
             thumbHalfShadowColor := Color darkGray.
             thumbHalfLightColor := White
@@ -2231,37 +2236,37 @@
     ].
 
     DefaultThumbColor notNil ifTrue:[
-        thumbColor := DefaultThumbColor onDevice:device
+        thumbColor := DefaultThumbColor onDevice:graphicsDevice
     ] ifFalse:[
         thumbColor := White.
         nm ~= #normal ifTrue:[
-            device hasGrayscales ifFalse:[
+            graphicsDevice hasGrayscales ifFalse:[
                 thumbColor := Color grey
             ].
         ].
     ].
 
-    thumbColor := thumbColor onDevice:device.
+    thumbColor := thumbColor onDevice:graphicsDevice.
     thumbShadowColor notNil ifTrue:[
-        thumbShadowColor := thumbShadowColor onDevice:device.
+        thumbShadowColor := thumbShadowColor onDevice:graphicsDevice.
     ].
     thumbLightColor notNil ifTrue:[
-        thumbLightColor := thumbLightColor onDevice:device.
+        thumbLightColor := thumbLightColor onDevice:graphicsDevice.
     ].
     thumbHalfShadowColor notNil ifTrue:[
-        thumbHalfShadowColor := thumbHalfShadowColor onDevice:device.
+        thumbHalfShadowColor := thumbHalfShadowColor onDevice:graphicsDevice.
     ].
     thumbHalfLightColor notNil ifTrue:[
-        thumbHalfLightColor := thumbHalfLightColor onDevice:device.
+        thumbHalfLightColor := thumbHalfLightColor onDevice:graphicsDevice.
     ].
     thumbEdgeStyle notNil ifTrue:[
         thumbHalfShadowColor isNil ifTrue:[
-            thumbHalfShadowColor := thumbShadowColor lightened onDevice:device
+            thumbHalfShadowColor := thumbShadowColor lightened onDevice:graphicsDevice
         ]
     ].
 
     DefaultThumbEnteredColor notNil ifTrue:[
-        thumbEnteredColor := DefaultThumbEnteredColor onDevice:device.
+        thumbEnteredColor := DefaultThumbEnteredColor onDevice:graphicsDevice.
     ] ifFalse:[
         thumbEnteredColor := thumbColor.
     ].
@@ -2272,21 +2277,21 @@
     ].
 
     DefaultThumbImage notNil ifTrue:[
-        thumbImage := DefaultThumbImage onDevice:device.
+        thumbImage := DefaultThumbImage onDevice:graphicsDevice.
         fixThumbHeight := true.
     ].
 
     HandleImage notNil ifTrue:[
-        shadowForm := HandleImage onDevice:device.
+        shadowForm := HandleImage onDevice:graphicsDevice.
     ] ifFalse:[
         nm = #next ifTrue:[
-            shadowForm := self class handleShadowFormOn:device.
-            lightForm := self class handleLightFormOn:device
+            shadowForm := self class handleShadowFormOn:graphicsDevice.
+            lightForm := self class handleLightFormOn:graphicsDevice
         ] ifFalse:[
             shadowForm := lightForm := nil
         ].
     ].
-    drawableId notNil ifTrue:[
+    self drawableId notNil ifTrue:[
         self computeThumbFrame
     ].
 
@@ -2752,10 +2757,10 @@
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.202 2014-02-05 13:31:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.203 2014-02-18 15:12:59 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.202 2014-02-05 13:31:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.203 2014-02-18 15:12:59 stefan Exp $'
 ! !