#REFACTORING
authorClaus Gittinger <cg@exept.de>
Sat, 02 Apr 2016 17:06:38 +0200
changeset 5624 a93aea30f0fb
parent 5623 7ad855aa8093
child 5625 9cf655566741
#REFACTORING class: ObjectView changed:9 methods device access
ObjectView.st
--- a/ObjectView.st	Sat Apr 02 17:05:57 2016 +0200
+++ b/ObjectView.st	Sat Apr 02 17:06:38 2016 +0200
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libwidg' }"
 
+"{ NameSpace: Smalltalk }"
+
 View subclass:#ObjectView
 	instanceVariableNames:'contents sorted lastButt pressAction releaseAction
 		shiftPressAction ctrlPressAction doublePressAction motionAction
@@ -674,7 +676,7 @@
 
     sel := self getClipboardObject.
     ((Screen current platformName ~= 'X11')
-     or:[(self graphicsDevice getSelectionOwnerOf:#CLIPBOARD) == self drawableId])
+     or:[(device getSelectionOwnerOf:#CLIPBOARD) == self drawableId])
     ifTrue:[
         "
          a local selection - paste with some offset
@@ -731,17 +733,17 @@
         "
          translate to screen
         "
-        offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
         rootPoint := rootPoint + offs.
 
         "search view the drop is in"
         viewId := rootView id.
         [viewId notNil] whileTrue:[
-            destinationId := self graphicsDevice viewIdFromPoint:rootPoint in:viewId.
+            destinationId := device viewIdFromPoint:rootPoint in:viewId.
             lastViewId := viewId.
             viewId := destinationId
         ].
-        destinationView := self graphicsDevice viewFromId:lastViewId.
+        destinationView := device viewFromId:lastViewId.
         destinationId := lastViewId.
         inMySelf := (destinationView == self).
         rootMotion := false
@@ -758,7 +760,7 @@
     ] ifFalse:[
         "into another one"
         destinationView notNil ifTrue:[
-            destinationPoint := self graphicsDevice translatePoint:rootPoint fromView:rootView toView:destinationView.
+            destinationPoint := device translatePoint:rootPoint fromView:rootView toView:destinationView.
             (transformation2 := destinationView transformation) notNil ifTrue:[
                 destinationPoint := transformation2 applyInverseTo:destinationPoint
             ].
@@ -805,7 +807,7 @@
         "
          translate to screen
         "
-        offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
         p1 := p1 + offs.
         p2 := p2 + offs.
     ] ifFalse:[
@@ -948,16 +950,16 @@
             "
              translate to screen
             "
-            rootPoint := p + (self graphicsDevice translatePoint:0@0 fromView:self toView:rootView).
+            rootPoint := p + (device translatePoint:0@0 fromView:self toView:rootView).
 
             "search view the drop is in"
             viewId := rootView id.
             [viewId notNil] whileTrue:[
-                destinationId := self graphicsDevice viewIdFromPoint:rootPoint in:viewId.
+                destinationId := device viewIdFromPoint:rootPoint in:viewId.
                 lastViewId := viewId.
                 viewId := destinationId
             ].
-            destinationView := self graphicsDevice viewFromId:lastViewId.
+            destinationView := device viewFromId:lastViewId.
             destinationId := lastViewId.
             inMySelf := (destinationView == self).
             rootMotion := false
@@ -969,7 +971,7 @@
             "simple move"
             self move:movedObject by:moveDelta
         ] ifFalse:[
-            destinationPoint := self graphicsDevice translatePoint:rootPoint        "/ use id here - could be alian view
+            destinationPoint := device translatePoint:rootPoint        "/ use id here - could be alian view
                                                  from:(rootView id) 
                                                    to:destinationId.
             destinationView notNil ifTrue:[
@@ -1014,7 +1016,7 @@
         "
          translate to screen
         "
-        offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
         p := p + offs.
         "
          p is where we want it ...
@@ -1672,8 +1674,8 @@
             "
              up to next full unit
             "
-            gridW := ((gridW // bigStepH) + 1 * bigStepH) asInteger.
-            gridH := ((gridH // bigStepV) + 1 * bigStepV) asInteger.
+            gridW := (((gridW // bigStepH) + 1) * bigStepH) asInteger.
+            gridH := (((gridH // bigStepV) + 1) * bigStepV) asInteger.
         ].
 
         gridPixmap := Form width:gridW height:gridH depth:1.
@@ -1761,10 +1763,10 @@
             gridPixmap displayLineFromX:0 y:gridH-1 toX:gridW-1 y:gridH-1.
         ].
 
-        self graphicsDevice isWindowsPlatform ifTrue:[
+        device isWindowsPlatform ifTrue:[
             "/ kludge - needs a deep form
             colorMap := gridPixmap colorMap.
-            devPixmap := Form width:gridW height:gridH depth:self graphicsDevice depth onDevice:self graphicsDevice.
+            devPixmap := Form width:gridW height:gridH depth:device depth onDevice:device.
             devPixmap notNil ifTrue:[
                 devPixmap paint:(colorMap at:1).
                 devPixmap fillRectangleX:0 y:0 width:gridW height:gridH.
@@ -1930,7 +1932,7 @@
     gridShown := false.
 
     canDragOutOfView := false.
-    rootView := self graphicsDevice rootView.
+    rootView := device rootView.
     rootView clippedByChildren:false.
     rootMotion := false.
     self setInitialDocumentFormat.
@@ -2781,9 +2783,9 @@
      Redefined to scroll by inches or centimeters."
 
     scaleMetric == #inch ifTrue:[
-        ^ (self graphicsDevice horizontalPixelPerInch * (1/2)) asInteger
+        ^ (device horizontalPixelPerInch * (1/2)) asInteger
     ].
-    ^ (self graphicsDevice horizontalPixelPerMillimeter * 20) asInteger
+    ^ (device horizontalPixelPerMillimeter * 20) asInteger
 !
 
 verticalScrollStep
@@ -2791,9 +2793,9 @@
      Redefined to scroll by inches or centimeters."
 
     scaleMetric == #inch ifTrue:[
-        ^ (self graphicsDevice verticalPixelPerInch * (1/2)) asInteger
+        ^ (device verticalPixelPerInch * (1/2)) asInteger
     ].
-    ^ (self graphicsDevice verticalPixelPerMillimeter * 20) asInteger
+    ^ (device verticalPixelPerMillimeter * 20) asInteger
 ! !
 
 !ObjectView methodsFor:'selection & handles'!
@@ -3532,10 +3534,10 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.145 2014-12-21 23:32:07 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.145 2014-12-21 23:32:07 cg Exp $'
+    ^ '$Header$'
 ! !