ShadowView.st
changeset 6274 e37dc412eb6a
parent 5415 d6e243f99770
child 7267 15f4a39b25fd
--- a/ShadowView.st	Tue Feb 18 17:44:47 2014 +0100
+++ b/ShadowView.st	Tue Feb 18 17:49:08 2014 +0100
@@ -124,8 +124,8 @@
     shadowClr := StyleSheet at:#popUpShadowColor.
 
     "the length of the shadow from myView"
-    shadowLength := (device pixelPerMillimeter * 1.0) rounded.
-    "/ shadowLength := (device pixelPerMillimeter * 2.0) rounded.
+    shadowLength := self graphicsDevice pixelPerMillimeter.
+    "/ shadowLength := (self graphicsDevice pixelPerMillimeter * 2.0) rounded.
 !
 
 realize
@@ -133,9 +133,10 @@
      get the pixels under the shadow from the screen"
 
     |root shW shH right bot kludge clr1 clr0 org blackIs0 img
-     rS gS bS rM gM bM rSN gSN bSN pix r g b|
+     rS gS bS rM gM bM rSN gSN bSN pix r g b graphicsDevice|
 
     myView notNil ifTrue:[
+        graphicsDevice := self graphicsDevice.
 
         self origin:(myView origin + (myView borderWidth * 2) + shadowLength) 
              extent:(myView extent).
@@ -145,7 +146,7 @@
              get the pixels under the shadow 
              (copy from root-view into the 'imageUnderShadow'-form)
             "
-            imageUnderShadow := Form width:width height:height depth:device depth onDevice:device.
+            imageUnderShadow := Form width:width height:height depth:graphicsDevice depth onDevice:graphicsDevice.
             imageUnderShadow clippedByChildren:false.
 
             shW := shadowLength x.
@@ -153,13 +154,13 @@
             right := width - shW.
             bot := height - shH.
 
-            root := device rootView.
+            root := graphicsDevice rootView.
 
             clr0 := Color colorId:0.
             clr1 := Color colorId:1.
 
-            kludge := device depth == 1.
-            blackIs0 := (device blackpixel == 0).
+            kludge := graphicsDevice depth == 1.
+            blackIs0 := (graphicsDevice blackpixel == 0).
             (kludge and:[blackIs0]) ifTrue:[
                 imageUnderShadow foreground:clr0 background:clr1.
             ].
@@ -172,7 +173,7 @@
             imageUnderShadow copyFrom:root x:org x y:(org y + bot) 
                                          toX:0 y:bot width:width height:shH.
 
-            false "device visualType == #TrueColor" ifTrue:[
+            false "graphicsDevice visualType == #TrueColor" ifTrue:[
                 "
                  grey out the image (by darkening the pixels)
                  (thats expensive ...)
@@ -221,7 +222,7 @@
                         img pixelAtX:x y:y put:pix.
                     ].
                 ].
-                imageUnderShadow := img asFormOn:device.
+                imageUnderShadow := img asFormOn:graphicsDevice.
             ] ifFalse:[
                 "
                  grey out the image (by oring-in a grey pattern)
@@ -230,20 +231,20 @@
 
                 (kludge and:[blackIs0]) ifFalse:[
                     imageUnderShadow foreground:clr0 background:(Color colorId:-1).
-                    imageUnderShadow mask:(Form mediumGreyFormOn:device).
+                    imageUnderShadow mask:(Form mediumGreyFormOn:graphicsDevice).
                     imageUnderShadow function:#and.
                     imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
                     imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
 
                     blackIs0 ifFalse:[
-                        imageUnderShadow foreground:(Color black onDevice:device) background:clr0.
+                        imageUnderShadow foreground:(Color black onDevice:graphicsDevice) background:clr0.
                         imageUnderShadow function:#or.
                         imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
                         imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
                     ]
                 ] ifTrue:[
                     imageUnderShadow foreground:clr1 background:clr0.
-                    imageUnderShadow mask:(Form mediumGreyFormOn:device).
+                    imageUnderShadow mask:(Form mediumGreyFormOn:graphicsDevice).
                     imageUnderShadow function:#or.
                     imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
                     imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
@@ -261,11 +262,11 @@
     "sent after a snapin or a migration, reinit for new device"
 
     shadowClr notNil ifTrue:[
-        shadowClr := shadowClr onDevice:device
+        shadowClr := shadowClr onDevice:self graphicsDevice
     ].
 
     "the length of the shadow from myView"
-    shadowLength := (device pixelPerMillimeter * 1.0) rounded.
+    shadowLength := self graphicsDevice pixelPerMillimeter.
 
     super recreate.
     self backingStore:false.
@@ -286,9 +287,10 @@
 !ShadowView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.36 2009-10-24 13:59:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.37 2014-02-18 16:49:08 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.36 2009-10-24 13:59:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.37 2014-02-18 16:49:08 stefan Exp $'
 ! !
+