changed: #openAt:withExtent:andType: expeccoNET_1_5_1rc1
authorClaus Gittinger <cg@exept.de>
Tue, 19 Oct 2010 12:12:49 +0200
changeset 2871 e9df4227a57d
parent 2870 7ba0a201bbc6
child 2872 ea7e6fe01727
changed: #openAt:withExtent:andType:
WindowBuilder.st
--- a/WindowBuilder.st	Mon Oct 11 11:07:28 2010 +0200
+++ b/WindowBuilder.st	Tue Oct 19 12:12:49 2010 +0200
@@ -1413,9 +1413,9 @@
      windows origin and/or extent.
      The type argument may be #dialog, #popup or #normal,
      and specifies if the view should be opened as a
-	modal view (blocking interaction to the currently active view),
-	as popUp (also blocking)
-	or as a normal view."
+        modal view (blocking interaction to the currently active view),
+        as popUp (also blocking)
+        or as a normal view."
 
     |appWinClass device wg mainWin x y monitorBounds|
 
@@ -1426,105 +1426,107 @@
     wg := WindowGroup activeGroup.
 
     wg notNil ifTrue:[
-	|mainGroup focusView|
+        |mainGroup focusView|
 
-	mainGroup := wg mainGroup ? wg.
-	focusView := mainGroup focusView.
-	focusView notNil ifTrue:[
-	    mainWin := focusView topView
-	] ifFalse:[
-	    mainWin := mainGroup topViews firstIfEmpty:nil
-	].
+        mainGroup := wg mainGroup ? wg.
+        focusView := mainGroup focusView.
+        focusView notNil ifTrue:[
+            mainWin := focusView topView
+        ] ifFalse:[
+            mainGroup notNil ifTrue:[
+                mainWin := (mainGroup topViews ? #())  firstIfEmpty:nil
+            ].
+        ].
     ].
 
     origin isPoint ifTrue:[
-	monitorBounds := device monitorBoundsAt:origin.
-	window origin:origin.
+        monitorBounds := device monitorBoundsAt:origin.
+        window origin:origin.
     ] ifFalse:[
-	mainWin isNil ifTrue:[
-	    monitorBounds := device monitorBoundsAt:(device pointerPosition).
-	] ifFalse:[
-	    monitorBounds := device monitorBoundsAt:(mainWin origin).
-	].
+        mainWin isNil ifTrue:[
+            monitorBounds := device monitorBoundsAt:(device pointerPosition).
+        ] ifFalse:[
+            monitorBounds := device monitorBoundsAt:(mainWin origin).
+        ].
     ].
 
     ext notNil ifTrue:[
-	window extent:ext.
+        window extent:ext.
     ] ifFalse:[
-	((type == #dialog) or:[type == #toolDialog]) ifTrue:[
-	    window fixSize
-	]
+        ((type == #dialog) or:[type == #toolDialog]) ifTrue:[
+            window fixSize
+        ]
     ].
 
     ((type == #dialog) or:[type == #toolDialog]) ifTrue:[
-	|newOrigin|
+        |newOrigin|
 
-	((origin isNil and:[window class forceModalBoxesToOpenAtCenter])
-	 or:[origin == #center]) ifTrue:[
-	    newOrigin := nil.
-	] ifFalse:[
-	    origin isPoint ifTrue:[
-		newOrigin := origin
-	    ] ifFalse:[
-		mainWin notNil ifTrue:[
-		    newOrigin := mainWin bounds center rounded - (window extent // 2).
-		]
-	    ]
-	].
+        ((origin isNil and:[window class forceModalBoxesToOpenAtCenter])
+         or:[origin == #center]) ifTrue:[
+            newOrigin := nil.
+        ] ifFalse:[
+            origin isPoint ifTrue:[
+                newOrigin := origin
+            ] ifFalse:[
+                mainWin notNil ifTrue:[
+                    newOrigin := mainWin bounds center rounded - (window extent // 2).
+                ]
+            ]
+        ].
 
-	newOrigin isNil ifTrue:[
-	    newOrigin := monitorBounds center rounded - (window extent // 2).
-	].
-	window origin:newOrigin.
+        newOrigin isNil ifTrue:[
+            newOrigin := monitorBounds center rounded - (window extent // 2).
+        ].
+        window origin:newOrigin.
 
-	window corner y > monitorBounds bottom ifTrue:[
-	    y := monitorBounds bottom - window height.
-	    window origin:(window origin x @ y).
-	].
-	^ window openModal.
+        window corner y > monitorBounds bottom ifTrue:[
+            y := monitorBounds bottom - window height.
+            window origin:(window origin x @ y).
+        ].
+        ^ window openModal.
     ].
 
     (type == #normal or:[type = #slave or:[type = #partner]]) ifTrue:[
-	window isNil ifTrue:[
-	    application notNil ifTrue:[
-		appWinClass := application applicationWindowClass
-	    ] ifFalse:[
-		appWinClass := ApplicationWindow
-	    ].
-	    self setupWindowFor:appWinClass new.
-	].
-	origin isPoint ifFalse:[
-	    |windowExtent newOrg|
+        window isNil ifTrue:[
+            application notNil ifTrue:[
+                appWinClass := application applicationWindowClass
+            ] ifFalse:[
+                appWinClass := ApplicationWindow
+            ].
+            self setupWindowFor:appWinClass new.
+        ].
+        origin isPoint ifFalse:[
+            |windowExtent newOrg|
 
-	    windowExtent := window extent.
+            windowExtent := window extent.
 
-	    mainWin notNil ifTrue:[
-		(windowExtent x > mainWin extent x or:[windowExtent y > mainWin extent y]) ifFalse:[
-		    newOrg := mainWin bounds center - (windowExtent // 2).
-		].
-	    ].
-	    newOrg isNil ifTrue:[
-		newOrg := monitorBounds center - (windowExtent // 2).
-	    ].
-	    window origin:newOrg rounded.
-	].
-	y := window origin y.
-	x := window origin x.
+            mainWin notNil ifTrue:[
+                (windowExtent x > mainWin extent x or:[windowExtent y > mainWin extent y]) ifFalse:[
+                    newOrg := mainWin bounds center - (windowExtent // 2).
+                ].
+            ].
+            newOrg isNil ifTrue:[
+                newOrg := monitorBounds center - (windowExtent // 2).
+            ].
+            window origin:newOrg rounded.
+        ].
+        y := window origin y.
+        x := window origin x.
 
-	window corner y > monitorBounds bottom ifTrue:[
-	    y := (monitorBounds bottom - window height) max:(monitorBounds top).
+        window corner y > monitorBounds bottom ifTrue:[
+            y := (monitorBounds bottom - window height) max:(monitorBounds top).
 
-	].
-	window corner x > monitorBounds right ifTrue:[
-	    x := (monitorBounds right - window width) max:(monitorBounds left).
-	].
-	window origin:(x @ y ).
+        ].
+        window corner x > monitorBounds right ifTrue:[
+            x := (monitorBounds right - window width) max:(monitorBounds left).
+        ].
+        window origin:(x @ y ).
 
 
-	"/ the following code creates a master-slave relationship, if
-	"/ the masterApplication is not nil.
-	"/ Disabled, because: the masterApplication is used to fulfill missing aspects,
-	"/ which has nothing to do with a window master-slave relationship.
+        "/ the following code creates a master-slave relationship, if
+        "/ the masterApplication is not nil.
+        "/ Disabled, because: the masterApplication is used to fulfill missing aspects,
+        "/ which has nothing to do with a window master-slave relationship.
 
 "/        application masterApplication notNil ifTrue:[
 "/            masterWindow := application masterApplication window.
@@ -1536,22 +1538,22 @@
 "/            window beSlave.
 "/        ].
 
-	"/ must be done explicit, by passing an appropriate windowType
+        "/ must be done explicit, by passing an appropriate windowType
 
-	type = #slave ifTrue:[
-	    window beSlave.
-	].
-	type = #partner ifTrue:[
-	    window bePartner.
-	].
+        type = #slave ifTrue:[
+            window beSlave.
+        ].
+        type = #partner ifTrue:[
+            window bePartner.
+        ].
 
-	((type = #slave or:[type = #partner])
-	and:[ window windowGroup isNil ])
-	ifTrue:[
-	    window openInGroup:(WindowGroup activeGroup).
-	] ifFalse:[
-	    window open.
-	].
+        ((type = #slave or:[type = #partner])
+        and:[ window windowGroup isNil ])
+        ifTrue:[
+            window openInGroup:(WindowGroup activeGroup).
+        ] ifFalse:[
+            window open.
+        ].
 
 "/ the following automatism is probably too cryptic and has too much of a side effect.
 "/ I prefer to leave things as they are: i.e. enforce the programmer to
@@ -1560,12 +1562,12 @@
 "/        type = #slave ifTrue:[
 "/            window windowGroup topViews first beMaster
 "/        ].
-	^ self
+        ^ self
     ].
 
     type == #popUp ifTrue:[
-	window fixPosition:(device pointerPosition).
-	^ window openAsPopUp.
+        window fixPosition:(device pointerPosition).
+        ^ window openAsPopUp.
     ].
 
     "
@@ -1573,8 +1575,8 @@
     "
     self shouldImplement
 
-    "Created: / 14.2.1997 / 20:22:24 / cg"
-    "Modified: / 18.6.1998 / 19:10:07 / cg"
+    "Created: / 14-02-1997 / 20:22:24 / cg"
+    "Modified: / 19-10-2010 / 12:09:03 / cg"
 ! !
 
 !WindowBuilder methodsFor:'translating'!
@@ -1592,9 +1594,9 @@
 !WindowBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.143 2010-10-11 09:07:28 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.144 2010-10-19 10:12:49 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.143 2010-10-11 09:07:28 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.144 2010-10-19 10:12:49 cg Exp $'
 ! !