ModalBox.st
changeset 6269 703a7c20f524
parent 5968 2fa02aa1b5a3
child 6777 8527109b401d
--- a/ModalBox.st	Tue Feb 18 15:42:08 2014 +0100
+++ b/ModalBox.st	Tue Feb 18 15:59:11 2014 +0100
@@ -307,55 +307,55 @@
 "/    label := 'Popup'.
 
     UseTransientViews ifFalse:[
-	(PopUpView shadowsOnDevice:device) ifTrue:[
-	    shadowView := (ShadowView onDevice:device) for:self
-	].
+        (PopUpView shadowsOnDevice:self graphicsDevice) ifTrue:[
+            shadowView := (ShadowView onDevice:self graphicsDevice) for:self
+        ].
 
-	form := Form width:8 height:8
-		     fromArray:#[2r00000000
-				 2r00000000
-				 2r00000000
-				 2r00000001
-				 2r00000011
-				 2r00000111
-				 2r00001111
-				 2r00011111
-				]
-		     onDevice:device.
-	resizeButton := Button label:form in:self.
-	resizeButton origin:1.0 @ 1.0 corner:1.0@1.0.
-	resizeButton activeForegroundColor:(resizeButton foregroundColor).
-	resizeButton activeBackgroundColor:(resizeButton backgroundColor).
-	resizeButton enteredBackgroundColor:(resizeButton backgroundColor).
-	resizeButton leftInset:-8; topInset:-8.
-	resizeButton releaseAction:[].
-	resizeButton pressAction:[resizeButton turnOff; redraw. self doResize].
-	resizeButton borderWidth:0.
-	resizeButton activeLevel:0; passiveLevel:0.
-	resizeButton cursor:(Cursor corner).
+        form := Form width:8 height:8
+                     fromArray:#[2r00000000
+                                 2r00000000
+                                 2r00000000
+                                 2r00000001
+                                 2r00000011
+                                 2r00000111
+                                 2r00001111
+                                 2r00011111
+                                ]
+                     onDevice:self graphicsDevice.
+        resizeButton := Button label:form in:self.
+        resizeButton origin:1.0 @ 1.0 corner:1.0@1.0.
+        resizeButton activeForegroundColor:(resizeButton foregroundColor).
+        resizeButton activeBackgroundColor:(resizeButton backgroundColor).
+        resizeButton enteredBackgroundColor:(resizeButton backgroundColor).
+        resizeButton leftInset:-8; topInset:-8.
+        resizeButton releaseAction:[].
+        resizeButton pressAction:[resizeButton turnOff; redraw. self doResize].
+        resizeButton borderWidth:0.
+        resizeButton activeLevel:0; passiveLevel:0.
+        resizeButton cursor:(Cursor corner).
 
-	form := Form width:8 height:8
-		     fromArray:#[2r11111000
-				 2r11110000
-				 2r11100000
-				 2r11000000
-				 2r10000000
-				 2r00000000
-				 2r00000000
-				 2r00000000
-				]
-		     onDevice:device.
-	moveButton := Button label:form in:self.
-	moveButton origin:0.0 @ 0.0 corner:0.0@0.0.
-	moveButton activeForegroundColor:(moveButton foregroundColor).
-	moveButton activeBackgroundColor:(moveButton backgroundColor).
-	moveButton enteredBackgroundColor:(moveButton backgroundColor).
-	moveButton rightInset:-8; bottomInset:-8.
-	moveButton releaseAction:[].
-	moveButton pressAction:[moveButton turnOff; redraw. self doMove].
-	moveButton borderWidth:0.
-	moveButton activeLevel:0; passiveLevel:0.
-	moveButton cursor:(Cursor origin)
+        form := Form width:8 height:8
+                     fromArray:#[2r11111000
+                                 2r11110000
+                                 2r11100000
+                                 2r11000000
+                                 2r10000000
+                                 2r00000000
+                                 2r00000000
+                                 2r00000000
+                                ]
+                     onDevice:self graphicsDevice.
+        moveButton := Button label:form in:self.
+        moveButton origin:0.0 @ 0.0 corner:0.0@0.0.
+        moveButton activeForegroundColor:(moveButton foregroundColor).
+        moveButton activeBackgroundColor:(moveButton backgroundColor).
+        moveButton enteredBackgroundColor:(moveButton backgroundColor).
+        moveButton rightInset:-8; bottomInset:-8.
+        moveButton releaseAction:[].
+        moveButton pressAction:[moveButton turnOff; redraw. self doMove].
+        moveButton borderWidth:0.
+        moveButton activeLevel:0; passiveLevel:0.
+        moveButton cursor:(Cursor origin)
     ].
 
     "Modified: 24.7.1997 / 16:08:11 / cg"
@@ -380,8 +380,8 @@
 
 reinitialize
     "if I have already been reinited - return"
-    drawableId notNil ifTrue:[
-	^ self
+    self drawableId notNil ifTrue:[
+        ^ self
     ].
     "physically create the view & subviews"
     self recreate.
@@ -399,7 +399,7 @@
     |newExtent maxExtent|
 
     newExtent := self preferredExtent.
-    newExtent := newExtent min:(device extent).
+    newExtent := newExtent min:(self graphicsDevice extent).
 
     maxExtent := self maxExtent.
     maxExtent notNil ifTrue:[
@@ -431,26 +431,26 @@
     newExtent = self extent ifTrue:[^ self].
 
     shown ifTrue:[
-	delta := width - newExtent x.
-	newLeft := left + delta.
-	(((newLeft @ top) extent:newExtent)
-	    containsPoint:device pointerPosition)
-	ifFalse:[newLeft := left].
-	newLeft < 0 ifTrue:[newLeft := 0].
-	screenWidth := device usableWidth.
-	newLeft + newExtent x > screenWidth ifTrue:[
-	    newLeft := screenWidth - newExtent x
-	].
-	shadowView notNil ifTrue:[
-	    shadowView unmap.
-	].
-	self origin:(newLeft @ top) extent:newExtent.
-	shadowView notNil ifTrue:[
-	    shadowView realize.
-	    self raise.
-	].
+        delta := width - newExtent x.
+        newLeft := left + delta.
+        (((newLeft @ top) extent:newExtent)
+            containsPoint:self graphicsDevice pointerPosition)
+        ifFalse:[newLeft := left].
+        newLeft < 0 ifTrue:[newLeft := 0].
+        screenWidth := self graphicsDevice usableWidth.
+        newLeft + newExtent x > screenWidth ifTrue:[
+            newLeft := screenWidth - newExtent x
+        ].
+        shadowView notNil ifTrue:[
+            shadowView unmap.
+        ].
+        self origin:(newLeft @ top) extent:newExtent.
+        shadowView notNil ifTrue:[
+            shadowView realize.
+            self raise.
+        ].
     ] ifFalse:[
-	self extent:newExtent.
+        self extent:newExtent.
     ].
 
     "Modified: 6.9.1995 / 15:31:21 / claus"
@@ -466,14 +466,14 @@
 
     |r|
 
-    r := device rectangleFromUser:(self origin corner:self corner) keepExtent:true.
+    r := self graphicsDevice rectangleFromUser:(self origin corner:self corner) keepExtent:true.
     shadowView notNil ifTrue:[
-	shadowView unmap
+        shadowView unmap
     ].
     self origin:r origin extent:(self extent).
     shadowView notNil ifTrue:[
-	shadowView realize.
-	self raise.
+        shadowView realize.
+        self raise.
     ].
 
     "Modified: 3.5.1996 / 23:47:38 / stefan"
@@ -487,14 +487,14 @@
 
     |r|
 
-    r := device rectangleFromUser:(self origin corner:self corner).
+    r := self graphicsDevice rectangleFromUser:(self origin corner:self corner).
     shadowView notNil ifTrue:[
-	shadowView unmap
+        shadowView unmap
     ].
     self origin:r origin extent:(r extent max:(100@100)).
     shadowView notNil ifTrue:[
-	shadowView realize.
-	self raise
+        shadowView realize.
+        self raise
     ].
 
     "Modified: 3.5.1996 / 23:47:47 / stefan"
@@ -572,28 +572,28 @@
 
     shadowView notNil ifTrue:[shadowView unmap].
     windowGroup notNil ifTrue:[
-	windowGroup focusView:nil.
-	masterGroup := windowGroup previousGroup.
+        windowGroup focusView:nil.
+        masterGroup := windowGroup previousGroup.
     ].
 
     exclusiveKeyboard ifTrue:[
-	self forceUngrabKeyboard
+        self forceUngrabKeyboard
     ].
 
     self unmap.
 
     masterGroup notNil ifTrue:[
-	"
-	 this is a kludge for IRIS and others which do not provide backingstore:
-	 when we hide a modalbox (such as a searchbox) which covered
-	 a scrollbar, the scrollbars bitblt-method will copy from the
-	 not-yet redrawn area - effectively clearing the scroller.
-	 We need a short delay here, since at this time, the expose event has
-	 not yet arrived.
-	"
-	device sync.     "/ thats a round trip, to ensure that all expose events are present..."
-	Delay waitForSeconds:0.05.
-	masterGroup processExposeEvents
+        "
+         this is a kludge for IRIS and others which do not provide backingstore:
+         when we hide a modalbox (such as a searchbox) which covered
+         a scrollbar, the scrollbars bitblt-method will copy from the
+         not-yet redrawn area - effectively clearing the scroller.
+         We need a short delay here, since at this time, the expose event has
+         not yet arrived.
+        "
+        self graphicsDevice sync.     "/ thats a round trip, to ensure that all expose events are present..."
+        Delay waitForSeconds:0.05.
+        masterGroup processExposeEvents
     ].
 
     "Modified: 3.5.1996 / 23:47:57 / stefan"
@@ -759,7 +759,7 @@
 showAtCenter
     "make myself visible at the screen center."
 
-    self showAt:(device centerOfMonitorHavingPointer) center:true
+    self showAt:(self graphicsDevice centerOfMonitorHavingPointer) center:true
 
     "
      |b|
@@ -779,14 +779,14 @@
 
     "/ ****** MULTI SCREEN
 
-    pointerPosition := device pointerPosition.
+    pointerPosition := self graphicsDevice pointerPosition.
 
     self fixSize.
     positionOffset := self positionOffset.
     pos := alignedPos := pointerPosition - positionOffset.
 
     UserPreferences current forceWindowsIntoMonitorBounds ifTrue:[
-        monitorBounds := device monitorBoundsAt:pointerPosition.
+        monitorBounds := self graphicsDevice monitorBoundsAt:pointerPosition.
         alignedPos := (pos x max:monitorBounds left) @ (pos y max:monitorBounds top).
     ].
 
@@ -814,7 +814,7 @@
     ].
 
     "/ cannot use:
-    "/    self showAt:(device pointerPosition - self positionOffset).
+    "/    self showAt:(self graphicsDevice pointerPosition - self positionOffset).
     "/ because the resizing must be done before the
     "/ positionOffset is grabbed (it may change due to the resize)
 
@@ -836,33 +836,33 @@
 
     |pos newX|
 
-    pos := device pointerPosition - self positionOffset.
+    pos := self graphicsDevice pointerPosition - self positionOffset.
 
     ((Rectangle origin:pos extent:self extent)
-	intersects: (aView origin corner: aView corner))
+        intersects: (aView origin corner: aView corner))
     ifTrue:[
-	"
-	 try to the right of the untouchable view
-	"
-	newX := (aView origin x + aView width).
-	newX + width > device usableWidth ifTrue:[
-	    newX := device usableWidth - width
-	].
-	pos x:newX.
+        "
+         try to the right of the untouchable view
+        "
+        newX := (aView origin x + aView width).
+        newX + width > self graphicsDevice usableWidth ifTrue:[
+            newX := self graphicsDevice usableWidth - width
+        ].
+        pos x:newX.
 
 
-	((Rectangle origin:pos extent:self extent)
-	    intersects: (aView origin corner: aView corner))
-	ifTrue:[
-	    "
-	     try to the left of the untouchable view
-	    "
-	    newX := aView origin x - width.
-	    "
-	     should look for vertical possibilities too ...
-	    "
-	    pos x:newX.
-	]
+        ((Rectangle origin:pos extent:self extent)
+            intersects: (aView origin corner: aView corner))
+        ifTrue:[
+            "
+             try to the left of the untouchable view
+            "
+            newX := aView origin x - width.
+            "
+             should look for vertical possibilities too ...
+            "
+            pos x:newX.
+        ]
 
     ].
     self showAt:pos
@@ -904,11 +904,12 @@
 !ModalBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.110 2012-12-14 09:03:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.111 2014-02-18 14:59:11 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.110 2012-12-14 09:03:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.111 2014-02-18 14:59:11 stefan Exp $'
 ! !
 
+
 ModalBox initialize!