SimpleView.st
changeset 4139 6acf2874394b
parent 4131 30e53fab0bc0
child 4150 9a7c1160bbd5
--- a/SimpleView.st	Fri Apr 02 18:21:46 2004 +0200
+++ b/SimpleView.st	Fri Apr 02 18:49:34 2004 +0200
@@ -6551,25 +6551,26 @@
 
     |m2 nX nY nW nH|
 
+    margin isNil ifTrue:[margin := 0].
     (margin ~~ 0) ifTrue:[
-	m2 := margin + margin.
-	nX := nY := margin.
-	nW := width - m2.
-	nH := height - m2.
+        m2 := margin + margin.
+        nX := nY := margin.
+        nW := width - m2.
+        nH := height - m2.
 "/        transformation notNil ifTrue:[
 "/            nX := transformation applyInverseToX:nX.
 "/            nY := transformation applyInverseToY:nY.
 "/            nW := transformation applyInverseScaleX:nW.
 "/            nH := transformation applyInverseScaleY:nH.
 "/        ].
-	innerClipRect := Rectangle 
-				 left:nX 
-				 top:nY 
-				 width:nW 
-				 height:nH
+        innerClipRect := Rectangle 
+                                 left:nX 
+                                 top:nY 
+                                 width:nW 
+                                 height:nH
     ] ifFalse:[
-	"no clipping"
-	innerClipRect := nil
+        "no clipping"
+        innerClipRect := nil
     ]
 
     "Modified: / 22.5.1999 / 16:50:58 / cg"
@@ -7053,6 +7054,11 @@
     "Modified: / 25.5.1999 / 14:45:53 / cg"
 !
 
+setShown:aState
+    shown := aState
+
+!
+
 setViewShape
     |form|
 
@@ -7064,6 +7070,10 @@
     ].
 
     "Created: 18.9.1997 / 11:09:00 / cg"
+!
+
+windowGroupClass
+        ^ WindowGroup
 ! !
 
 !SimpleView methodsFor:'queries'!
@@ -7608,14 +7618,16 @@
      slowly migrating to use layoutObjects ...
     "
     layout notNil ifTrue:[
-	(self originOrExtentOrCornerChanged) ifTrue:[
-	    r := (layout rectangleRelativeTo:(superView viewRectangle)
-				   preferred:[self preferredBounds]).
-	    org := r origin rounded.
-	    ext := r extent rounded.
-	    self pixelOrigin:org extent:ext.
-	].
-	^ self.
+        superView notNil ifTrue:[
+            (self originOrExtentOrCornerChanged) ifTrue:[
+                r := (layout rectangleRelativeTo:(superView viewRectangle)
+                                       preferred:[self preferredBounds]).
+                org := r origin rounded.
+                ext := r extent rounded.
+                self pixelOrigin:org extent:ext.
+            ].
+        ].
+        ^ self.
     ].
 
     "if the extent is not the one we created the window with ..."
@@ -7627,20 +7639,20 @@
     self originChangedFlag ifTrue:[
 "/        org := self computeOrigin.
 "/        self pixelOrigin:org.    
-	originRule notNil ifTrue:[
-	    self pixelOrigin:self computeOrigin
-	] ifFalse:[
-	    relativeOrigin notNil ifTrue:[
-		self originFromRelativeOrigin:relativeOrigin
-	    ] ifFalse:[
-		shown ifTrue:[
-		    device moveWindow:drawableId x:left y:top.
-		] ifFalse:[
-		    self pixelOrigin:left@top
-		].
-	    ].
-	].
-	self originChangedFlag:false
+        originRule notNil ifTrue:[
+            self pixelOrigin:self computeOrigin
+        ] ifFalse:[
+            relativeOrigin notNil ifTrue:[
+                self originFromRelativeOrigin:relativeOrigin
+            ] ifFalse:[
+                shown ifTrue:[
+                    device moveWindow:drawableId x:left y:top.
+                ] ifFalse:[
+                    self pixelOrigin:left@top
+                ].
+            ].
+        ].
+        self originChangedFlag:false
     ]
 
     "Modified: 18.6.1996 / 21:44:03 / cg"
@@ -8994,19 +9006,19 @@
      The view will be handled by its own process, effectively running in
      parallel. 
      Notice:
-	This entry is for NON-topviews, which want to be served
-	autonomous from their real topview. 
-	(see the fileBrowsers kill-button
-	 when executing unix commands as an example)"
+        This entry is for NON-topviews, which want to be served
+        autonomous from their real topview. 
+        (see the fileBrowsers kill-button
+         when executing unix commands as an example)"
 
     |wg mainGroup|
 
-    wg := WindowGroup new.
+    wg := self windowGroupClass new.
     self windowGroup:wg.
 
     mainGroup := WindowGroup activeGroup.
     mainGroup notNil ifTrue:[
-	mainGroup := mainGroup mainGroup.
+        mainGroup := mainGroup mainGroup.
     ].
 
     wg isForModalSubview:true.        "/ make it handle update events for the main group
@@ -9089,120 +9101,120 @@
     |tops mainView mainViewID previousGroup |
 
     self isPopUpView ifFalse:[
-	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"
+        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"
         
-	    mainGroup notNil ifTrue:[
-		(tops := mainGroup topViews) notNil ifTrue:[
-		    tops notEmpty ifTrue:[
-			mainView := tops detect:[:v| v shown] ifNone:nil.
-			mainView notNil ifTrue:[
-			    mainViewID := mainView id.
-			]
-		    ]
-		].
-	    ].
-
-	    mainViewID isNil ifTrue:[
-		self origin:(device center - (self extent//2))
-	    ].
-
-	    drawableId isNil ifTrue:[self create].
-	    mainView notNil ifTrue:[
-		device setTransient:drawableId for:mainViewID.
-	    ].
-	].
+            mainGroup notNil ifTrue:[
+                (tops := mainGroup topViews) notNil ifTrue:[
+                    tops notEmpty ifTrue:[
+                        mainView := tops detect:[:v| v shown] ifNone:nil.
+                        mainView notNil ifTrue:[
+                            mainViewID := mainView id.
+                        ]
+                    ]
+                ].
+            ].
+
+            mainViewID isNil ifTrue:[
+                self origin:(device center - (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 := mainGroup.
-	mainGroup notNil ifTrue:[mainGroup 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 := mainGroup.
+        mainGroup notNil ifTrue:[mainGroup addTopView:self].
+        self realize
     ] ifFalse:[
-	previousGroup := WindowGroup activeGroup.
-
-	"
-	 show a stop-cursor in the main group
-	"
-	mainGroup notNil ifTrue:[
-	    self isPopUpView ifFalse:[
-		mainGroup showCursor:(Cursor stop).
-		(previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
-		    previousGroup showCursor:(Cursor stop).
-		].
-	    ]
-	].
-
-	"
-	 create a new window group and put myself into it
-	"
-	windowGroup := WindowGroup 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 normally place themself into the superviews group)
-	    "/        
-	    windowGroup isForModalSubview:true.
-	].
-
-	"
-	 go dispatch events in this new group
-	 (thus current windowgroup is blocked from interaction)
-	"
-	AbortSignal handle:[:ex |
-	    self hide.
-	    ex return.
-	] do:[
-	    [
-		[
-		    windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
-		] ifCurtailed:[
-		    self hide.
-		]
-	    ] ensure:[
-		mainGroup notNil ifTrue:[
-		    mainGroup graphicsDevice sync.  "thats a round trip - make sure that all drawing has been processed"
-		    "/ ensure that eventListener runs here ...
-		    Delay waitForSeconds:0.05.    
-		    mainGroup processExposeEvents.
-
-		    ReturnFocusWhenClosingModalBoxes ifTrue:[
-			"
-			 return input focus to previously active groups top.
-			 This helps with windowmanagers which need an explicit click
-			 on the view for the focus.
-			"
-			tops := mainGroup topViews.
-			(tops notNil and:[tops notEmpty]) ifTrue:[
-			    tops first getKeyboardFocus
-			].
-		    ].
-
-		    "
-		     restore cursors in the main group & flush its buffered key & mouse events
-		    "
-		    mainGroup restoreCursors.
-		    (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
-			previousGroup restoreCursors.
-		    ].
+        previousGroup := WindowGroup activeGroup.
+
+        "
+         show a stop-cursor in the main group
+        "
+        mainGroup notNil ifTrue:[
+            self isPopUpView ifFalse:[
+                mainGroup showCursor:(Cursor stop).
+                (previousGroup notNil and:[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 normally place themself into the superviews group)
+            "/        
+            windowGroup isForModalSubview:true.
+        ].
+
+        "
+         go dispatch events in this new group
+         (thus current windowgroup is blocked from interaction)
+        "
+        AbortSignal handle:[:ex |
+            self hide.
+            ex return.
+        ] do:[
+            [
+                [
+                    windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
+                ] ifCurtailed:[
+                    self hide.
+                ]
+            ] ensure:[
+                mainGroup notNil ifTrue:[
+                    mainGroup graphicsDevice sync.  "thats a round trip - make sure that all drawing has been processed"
+                    "/ ensure that eventListener runs here ...
+                    Delay waitForSeconds:0.05.    
+                    mainGroup processExposeEvents.
+
+                    ReturnFocusWhenClosingModalBoxes ifTrue:[
+                        "
+                         return input focus to previously active groups top.
+                         This helps with windowmanagers which need an explicit click
+                         on the view for the focus.
+                        "
+                        tops := mainGroup topViews.
+                        (tops notNil and:[tops notEmpty]) ifTrue:[
+                            tops first getKeyboardFocus
+                        ].
+                    ].
+
+                    "
+                     restore cursors in the main group & flush its buffered key & mouse events
+                    "
+                    mainGroup restoreCursors.
+                    (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
+                        previousGroup restoreCursors.
+                    ].
 "/                    mainGroup sensor flushUserEvents.
-		]
-	    ]
-	].
+                ]
+            ]
+        ].
     ]
 
     "Created: 10.12.1995 / 14:06:14 / cg"
@@ -9308,21 +9320,21 @@
     drawableId isNil ifTrue:[self create].
 
     windowGroup isNil ifTrue:[
-	newGroup := true.
-	windowGroup := WindowGroup new.
+        newGroup := true.
+        windowGroup := self windowGroupClass new.
     ] ifFalse:[
-	newGroup := false.
+        newGroup := false.
     ].
 
     windowGroup addTopView:self.
     newGroup ifTrue:[
-	(aPoint isNil and:[iconified not]) ifTrue:[
-	    windowGroup startupWith:[self realize].
-	] ifFalse:[
-	    windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified].
-	].
+        (aPoint isNil and:[iconified not]) ifTrue:[
+            windowGroup startupWith:[self realize].
+        ] ifFalse:[
+            windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified].
+        ].
     ] ifFalse:[
-	self realizeInGroup.
+        self realizeInGroup.
     ].
 
     "
@@ -9485,7 +9497,7 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.497 2004-03-30 21:17:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.498 2004-04-02 16:49:34 werner Exp $'
 ! !
 
 SimpleView initialize!