SimpleView.st
changeset 5729 a2d13b74741a
parent 5727 d0b9ef9c0cc0
child 5749 aad1af079611
--- a/SimpleView.st	Fri Mar 04 17:09:07 2011 +0100
+++ b/SimpleView.st	Tue Mar 22 13:33:40 2011 +0100
@@ -2884,8 +2884,7 @@
 
 makeFullyVisible
     "make sure, that the view is fully visible by shifting it
-     into the visible screen area if nescessary.
-     This method will be moved to StandardSystemView ..."
+     into the visible screen area if nescessary."
 
     |originVisible cornerVisible newTop newLeft deviceBounds
      deviceLeft deviceRight deviceTop deviceBottom origin corner|
@@ -2900,19 +2899,19 @@
     cornerVisible := device pointIsVisible:corner.
 
     (device pointsAreOnSameMonitor:origin and:corner) ifTrue:[
-	deviceBounds := device monitorBoundsAt:origin.
+        deviceBounds := device monitorBoundsAt:origin.
     ] ifFalse:[
-	originVisible ifTrue:[
-	    "origin is visible"
-	    deviceBounds := device monitorBoundsAt:origin.
-	] ifFalse:[
-	    cornerVisible notNil ifTrue:[
-		"corner is visible"
-		deviceBounds := device monitorBoundsAt:corner.
-	    ] ifFalse:[
-		deviceBounds := device monitorBoundsAt:1@1.
-	    ].
-	].
+        originVisible ifTrue:[
+            "origin is visible"
+            deviceBounds := device monitorBoundsAt:origin.
+        ] ifFalse:[
+            cornerVisible notNil ifTrue:[
+                "corner is visible"
+                deviceBounds := device monitorBoundsAt:corner.
+            ] ifFalse:[
+                deviceBounds := device monitorBoundsAt:1@1.
+            ].
+        ].
     ].
 
     deviceLeft := deviceBounds left.
@@ -2924,43 +2923,43 @@
     cornerVisible ifTrue:[ deviceBottom := deviceBottom min:(device usableHeightAt:corner) ].
 
     corner y > deviceBottom ifTrue:[
-	cornerVisible := false.
+        cornerVisible := false.
     ].
 
     UserPreferences current forceWindowsIntoMonitorBounds ifFalse:[
-	(originVisible and:[cornerVisible]) ifTrue:[^ self].
+        (originVisible and:[cornerVisible]) ifTrue:[^ self].
     ].
 
     "/ deviceRight := deviceRight min:device usableWidth.
     originVisible ifFalse:[
-	cornerVisible ifFalse:[
-	    newTop := deviceBottom - height.
-	    newLeft := deviceRight - width.
-	    newLeft := newLeft max:deviceLeft.
-	    newTop := newTop max:deviceTop.
-	] ifTrue:[
-	    "/ origin is not; corner is in
-	    newLeft := (deviceLeft max:newLeft).
-	    newTop := (deviceTop max:newTop).
-	].
+        cornerVisible ifFalse:[
+            newTop := deviceBottom - height.
+            newLeft := deviceRight - width.
+            newLeft := newLeft max:deviceLeft.
+            newTop := newTop max:deviceTop.
+        ] ifTrue:[
+            "/ origin is not; corner is in
+            newLeft := (deviceLeft max:newLeft).
+            newTop := (deviceTop max:newTop).
+        ].
     ] ifTrue:[
-	"/ notice, the position-dependent query: if there is a higher secondary screen,
-	"/ this makes a difference in where a popUpMenu is allowed...
-	(corner y > deviceBottom) ifTrue:[
-	    newTop := deviceBottom - height
-	].
-	(corner x > deviceRight) ifTrue:[
-	    newLeft := deviceRight - width
-	].
-	newLeft := newLeft max:deviceLeft.
-	newTop := newTop max:deviceTop.
+        "/ notice, the position-dependent query: if there is a higher secondary screen,
+        "/ this makes a difference in where a popUpMenu is allowed...
+        (corner y > deviceBottom) ifTrue:[
+            newTop := deviceBottom - height
+        ].
+        (corner x > deviceRight) ifTrue:[
+            newLeft := deviceRight - width
+        ].
+        newLeft := newLeft max:deviceLeft.
+        newTop := newTop max:deviceTop.
     ].
 
     ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
-	self origin:newLeft @ newTop
-    ].
-
-    "Modified: / 22-10-2010 / 15:38:33 / cg"
+        self origin:newLeft @ newTop
+    ].
+
+    "Modified: / 22-03-2011 / 13:14:06 / cg"
 !
 
 makeRoundViewShapeWithBorder:bw
@@ -10434,138 +10433,138 @@
     |tops mainView mainViewID previousGroup mainGroup|
 
     self isPopUpView ifFalse:[
-	"/ the following allows for knowledgable programmers to suppress dialog boxes,
-	"/ or to patch common controls right before opening...
-	(Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
-	    ^ self
-	].
-	"/ the following allows for hooks to add a bell sound or other whenever a dialog opens
-	device modalWindowListenersDo:[:listener | listener aboutToOpenWindow:self].
-
-	mainView notNil ifTrue:[
-	    mainView activate; setForegroundWindow.
-	].
-
-	ModalBox usingTransientViews ifTrue:[
-	    "make view only transient, if there is a visible topView.
-	     If none of them is visible, we do want an icon for ourself"
-
-	    mainViewID isNil ifTrue:[
-		"/ MULTI SCREEN
-		|monitorBounds|
-
-		monitorBounds := device monitorBoundsAt:(device pointerPosition).
-		self origin:(monitorBounds center rounded - (self extent//2))
-	    ].
-
-	    drawableId isNil ifTrue:[self create].
-	    mainView notNil ifTrue:[
-		device setTransient:drawableId for:mainViewID.
-	    ].
-	].
+        "/ the following allows for knowledgable programmers to suppress dialog boxes,
+        "/ or to patch common controls right before opening...
+        (Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
+            ^ self
+        ].
+        "/ the following allows for hooks to add a bell sound or other whenever a dialog opens
+        device modalWindowListenersDo:[:listener | listener aboutToOpenWindow:self].
+
+        mainView notNil ifTrue:[
+            mainView activate; setForegroundWindow.
+        ].
+
+        ModalBox usingTransientViews ifTrue:[
+            "make view only transient, if there is a visible topView.
+             If none of them is visible, we do want an icon for ourself"
+
+"/            mainViewID isNil ifTrue:[
+"/                "/ MULTI SCREEN
+"/                |monitorBounds|
+"/
+"/                monitorBounds := device monitorBoundsAt:(device pointerPosition).
+"/                self origin:(monitorBounds center rounded - (self extent//2))
+"/            ].
+
+            drawableId isNil ifTrue:[self create].
+            mainView notNil ifTrue:[
+                device setTransient:drawableId for:mainViewID.
+            ].
+        ].
     ].
 
     self raise.
 
     Processor activeProcessIsSystemProcess ifTrue:[
-	"
-	 put myself into the modal group, let it handle events for
-	 me as well. This is only a half way solution, since the view
-	 is not modal at all ... however, the only situation
-	 where this happens is with modal boxes popped while in a
-	 modal browser. You will forgive me for that inconvenience.
-	"
-	windowGroup := aWindowGroup.
-	aWindowGroup notNil ifTrue:[aWindowGroup addTopView:self].
-	self realize
+        "
+         put myself into the modal group, let it handle events for
+         me as well. This is only a half way solution, since the view
+         is not modal at all ... however, the only situation
+         where this happens is with modal boxes popped while in a
+         modal browser. You will forgive me for that inconvenience.
+        "
+        windowGroup := aWindowGroup.
+        aWindowGroup notNil ifTrue:[aWindowGroup addTopView:self].
+        self realize
     ] ifFalse:[
-	previousGroup := WindowGroup activeGroup.
-
-	"
-	 show a stop-cursor in the suspended window groups
-	"
-	(aWindowGroup notNil and:[self isPopUpView not]) ifTrue:[
-	    mainGroup := aWindowGroup mainGroup.
-	    mainGroup showCursor:(Cursor stop).
-	    previousGroup ~~ mainGroup ifTrue:[
-		previousGroup showCursor:(Cursor stop).
-	    ].
-	].
-
-	"
-	 create a new window group and put myself into it
-	"
-	windowGroup := self windowGroupClass new.
-	windowGroup addTopView:self.
-	windowGroup setPreviousGroup:previousGroup.
-
-	superView notNil ifTrue:[
-	    "/
-	    "/ special: this is a modal subview,
-	    "/ prevent the view from reassigning its windowGroup when realized
-	    "/ (subviews normaly place themself into the superviews group)
-	    "/
-	    windowGroup isForModalSubview:true.
-	].
-
-	"
-	 go dispatch events in this new group
-	 (thus current windowgroup is blocked from interaction)
-	"
-	AbortOperationRequest handle:[:ex |
-	    AbortOperationRequest handle:[:ex2 |
-		"/ an aborted hide (user confirmation ?)
-		self breakPoint:#cg.
-		ex proceed
-	    ] do:[
-		self hide.
-		self realized ifTrue:[
-		    "/ self halt. "/ hide handled and closeRequest not wanted:
-		    ex proceed
-		].
-	    ].
-	] do:[
-	    [
-		[
-		    windowGroup startupModal:[realized and:aBlock] forGroup:aWindowGroup
-		] ifCurtailed:[
-		    self hide.
-		]
-	    ] ensure:[
-		aWindowGroup notNil ifTrue:[
-		    aWindowGroup graphicsDevice sync.  "thats a round trip - make sure that all drawing has been processed"
-		    "/ ensure that eventListener runs here ...
-		    Delay waitForSeconds:0.05.
-		    aWindowGroup processExposeEvents.
-
-		    ReturnFocusWhenClosingModalBoxes ifTrue:[
-			"
-			 return the input focus to the previously active group's top.
-			 This helps with windowmanagers which need an explicit click
-			 on the view for the focus.
-			"
-			tops := aWindowGroup topViews.
-			(tops notEmptyOrNil) ifTrue:[
-			    tops first getKeyboardFocus
-			].
-		    ].
-
-		    "
-		     restore cursors in the changed groups
-		    "
-		    mainGroup notNil ifTrue:[
-			mainGroup restoreCursors.
-			previousGroup ~~ mainGroup ifTrue:[
-			    previousGroup restoreCursors.
-			].
-		    ].
-		]
-	    ]
-	].
+        previousGroup := WindowGroup activeGroup.
+
+        "
+         show a stop-cursor in the suspended window groups
+        "
+        (aWindowGroup notNil and:[self isPopUpView not]) ifTrue:[
+            mainGroup := aWindowGroup mainGroup.
+            mainGroup showCursor:(Cursor stop).
+            previousGroup ~~ mainGroup ifTrue:[
+                previousGroup showCursor:(Cursor stop).
+            ].
+        ].
+
+        "
+         create a new window group and put myself into it
+        "
+        windowGroup := self windowGroupClass new.
+        windowGroup addTopView:self.
+        windowGroup setPreviousGroup:previousGroup.
+
+        superView notNil ifTrue:[
+            "/
+            "/ special: this is a modal subview,
+            "/ prevent the view from reassigning its windowGroup when realized
+            "/ (subviews normaly place themself into the superviews group)
+            "/
+            windowGroup isForModalSubview:true.
+        ].
+
+        "
+         go dispatch events in this new group
+         (thus current windowgroup is blocked from interaction)
+        "
+        AbortOperationRequest handle:[:ex |
+            AbortOperationRequest handle:[:ex2 |
+                "/ an aborted hide (user confirmation ?)
+                self breakPoint:#cg.
+                ex proceed
+            ] do:[
+                self hide.
+                self realized ifTrue:[
+                    "/ self halt. "/ hide handled and closeRequest not wanted:
+                    ex proceed
+                ].
+            ].
+        ] do:[
+            [
+                [
+                    windowGroup startupModal:[realized and:aBlock] forGroup:aWindowGroup
+                ] ifCurtailed:[
+                    self hide.
+                ]
+            ] ensure:[
+                aWindowGroup notNil ifTrue:[
+                    aWindowGroup graphicsDevice sync.  "thats a round trip - make sure that all drawing has been processed"
+                    "/ ensure that eventListener runs here ...
+                    Delay waitForSeconds:0.05.
+                    aWindowGroup processExposeEvents.
+
+                    ReturnFocusWhenClosingModalBoxes ifTrue:[
+                        "
+                         return the input focus to the previously active group's top.
+                         This helps with windowmanagers which need an explicit click
+                         on the view for the focus.
+                        "
+                        tops := aWindowGroup topViews.
+                        (tops notEmptyOrNil) ifTrue:[
+                            tops first getKeyboardFocus
+                        ].
+                    ].
+
+                    "
+                     restore cursors in the changed groups
+                    "
+                    mainGroup notNil ifTrue:[
+                        mainGroup restoreCursors.
+                        previousGroup ~~ mainGroup ifTrue:[
+                            previousGroup restoreCursors.
+                        ].
+                    ].
+                ]
+            ]
+        ].
     ]
 
     "Created: / 10-12-1995 / 14:06:14 / cg"
-    "Modified: / 24-10-2010 / 15:22:58 / cg"
+    "Modified: / 22-03-2011 / 13:24:46 / cg"
 !
 
 openModalAt:aPoint
@@ -10602,7 +10601,7 @@
      View new openModalAtCenter
     "
 
-    "Modified: 24.7.1997 / 13:27:37 / cg"
+    "Modified: / 22-03-2011 / 13:33:10 / cg"
 !
 
 openModeless
@@ -10712,7 +10711,8 @@
      View new openModelessAtCenter
     "
 
-    "Created: 18.9.1995 / 23:21:42 / claus"
+    "Created: / 18-09-1995 / 23:21:42 / claus"
+    "Modified: / 22-03-2011 / 13:33:13 / cg"
 !
 
 waitUntilVisible
@@ -10856,11 +10856,11 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.693 2011-03-04 07:58:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.694 2011-03-22 12:33:40 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.693 2011-03-04 07:58:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.694 2011-03-22 12:33:40 cg Exp $'
 ! !
 
 SimpleView initialize!