use new #translatePoint:fromView:toView:
authorClaus Gittinger <cg@exept.de>
Wed, 10 Oct 2001 16:08:49 +0200
changeset 1501 f760ccab7a35
parent 1500 36c0b4b268b8
child 1502 f5baa791b8cb
use new #translatePoint:fromView:toView:
UIGalleryView.st
--- a/UIGalleryView.st	Wed Oct 10 15:11:42 2001 +0200
+++ b/UIGalleryView.st	Wed Oct 10 16:08:49 2001 +0200
@@ -538,29 +538,28 @@
 findObjectAtX:x y:y
     "find the origin/corner of the currentWidget
     "
-    |point id p|
+    |point p|
 
     point := Point x:x y:y.
-    id    := inputView id.
 
     subViews do:[:v|
-	|pX pY|
+        |pX pY|
 
-	v ~~ inputView ifTrue:[
-	    p := device translatePoint:point from:id to:(v id).
-	    pX := p x.
-	    pY := p y.
-	    (     pX >= 0 and:[pX <= v width
-	     and:[pY >= 0 and:[pY <= v height
-	     and:[(self findSpecFor:v) notNil]]]]
-	    ) ifTrue:[
-		^ v
-	    ]
-	]
+        v ~~ inputView ifTrue:[
+            p := device translatePoint:point fromView:inputView toView:v.
+            pX := p x.
+            pY := p y.
+            (     pX >= 0 and:[pX <= v width
+             and:[pY >= 0 and:[pY <= v height
+             and:[(self findSpecFor:v) notNil]]]]
+            ) ifTrue:[
+                ^ v
+            ]
+        ]
     ].
   ^ nil
 
-
+    "Modified: / 10.10.2001 / 14:02:08 / cg"
 !
 
 findSpecFor:anObject
@@ -691,38 +690,40 @@
 for:aView specification:aSpec
     "create drop object for a view derived from a specification
     "
-    |point extent root device inst displayObject|
+    |point extent rootView device inst displayObject|
 
-    device := aView device.
-    root   := device rootView.
-    extent := aView extent.
-    point  := device translatePoint:0@0 from:(aView id) to:(root id).
+    device   := aView device.
+    rootView := device rootView.
+    extent   := aView extent.
+    point    := device translatePoint:0@0 fromView:aView toView:rootView.
 
     (point x > 0 and:[point y > 0]) ifTrue:[
-	point := point + extent.
-	(point x < root width and:[point y < root height]) ifTrue:[
-	    aView topView raise.
-	    device sync.
-	    aView invalidate.
-	    aView windowGroup processExposeEvents.
-	    displayObject := Image fromView:aView grab:false.
-	]
+        point := point + extent.
+        (point x < rootView width and:[point y < rootView height]) ifTrue:[
+            aView topView raise.
+            device sync.
+            aView invalidate.
+            aView windowGroup processExposeEvents.
+            displayObject := Image fromView:aView grab:false.
+        ]
     ].
     displayObject isNil ifTrue:[
-	displayObject := Form extent:extent depth:1.
-	displayObject colorMap:(Array with:Color white with:Color black).
-	displayObject fill:(Color colorId:0).
-	displayObject paint:(Color colorId:1).
-	displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
+        displayObject := Form extent:extent depth:1.
+        displayObject colorMap:(Array with:Color white with:Color black).
+        displayObject fill:(Color colorId:0).
+        displayObject paint:(Color colorId:1).
+        displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
     ].
     aSpec class == UISubSpecification ifTrue:[
-	aSpec layout:(LayoutOrigin fromPoint:0@0)
+        aSpec layout:(LayoutOrigin fromPoint:0@0)
     ].
 
     inst := self new.
     inst displayObject:displayObject.
     inst theObject:aSpec.
   ^ inst.
+
+    "Modified: / 10.10.2001 / 14:03:00 / cg"
 ! !
 
 !UIGalleryView class methodsFor:'documentation'!