#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Mon, 01 Oct 2018 17:17:08 +0200
changeset 8488 5a9e025bf373
parent 8487 a11f6587c29c
child 8489 f10b9fff9139
#FEATURE by cg class: SimpleView comment/format in: #computePreferredExtent #hide #unmap changed: #openModal:inGroup: class: SimpleView class added: #closeBoxNotificationSignal class: SimpleView::CloseBoxNotificationSignal class definition added: #box class: SimpleView::CloseBoxNotificationSignal class
SimpleView.st
--- a/SimpleView.st	Mon Oct 01 14:18:55 2018 +0200
+++ b/SimpleView.st	Mon Oct 01 17:17:08 2018 +0200
@@ -65,6 +65,13 @@
 	privateIn:SimpleView
 !
 
+ProceedingNotification subclass:#CloseBoxNotificationSignal
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:SimpleView
+!
+
 SimpleView::ViewShape subclass:#RoundViewShape
 	instanceVariableNames:''
 	classVariableNames:''
@@ -1039,6 +1046,23 @@
      this is raised right after closing..."
 
     ^ BoxClosedNotificationSignal
+!
+
+closeBoxNotificationSignal
+    "this can be used (by some) to force closing a box 
+     without terminating the modal action.
+     
+     Special: useful only if another modal box is shown from inside a modal box,
+     where the second opened box wants to hide the first one.
+     This cannot be done via abort, as that would close both boxes.
+     Instead, use this signal to hide the first box, while the second is shown,
+     and still handled by a still-alive windowGroup.
+     Currently, the only box which supports this is the ProgressIndicator;
+     code will be moved to support all dialog boxes in the near future."
+
+    ^ CloseBoxNotificationSignal
+
+    "Created: / 01-10-2018 / 16:39:39 / Claus Gittinger"
 ! !
 
 !SimpleView class methodsFor:'change & update'!
@@ -9214,21 +9238,23 @@
 !
 
 computePreferredExtent
-    "compute answer the preferred extent, disregarding
-     an explicit or cached preferred extent for the computation"
+    "compute answer the preferred extent, 
+     ignoring any explicit or cached preferred extent for the computation"
 
     |savedPref savedExplicit computedPref|
 
     savedPref := preferredExtent.
     savedExplicit := explicitExtent.
     [
-	preferredExtent := explicitExtent := nil.
-	computedPref := self preferredExtent.
+        preferredExtent := explicitExtent := nil.
+        computedPref := self preferredExtent.
     ] ensure:[
-	preferredExtent := savedPref.
-	explicitExtent := savedExplicit.
+        preferredExtent := savedPref.
+        explicitExtent := savedExplicit.
     ].
     ^ computedPref
+
+    "Modified (comment): / 01-10-2018 / 16:21:02 / Claus Gittinger"
 !
 
 cornerChangedFlag
@@ -9953,28 +9979,30 @@
 
     realized ifFalse:[^ self].
     (windowGroup notNil and:[windowGroup isModal]) ifTrue:[
-	masterGroup := windowGroup previousGroup.
-	windowGroup focusView:nil.
+        masterGroup := windowGroup previousGroup.
+        windowGroup focusView:nil.
     ].
 
     self unmap.
     self flush.
 
     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.
-	"
-	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 scrollbar's 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.
+        "
+        Delay waitForSeconds:0.05.
+        masterGroup processExposeEvents
     ].
 
 "/    WindowGroup leaveSignal raise.
 "/    "/ not reached
+
+    "Modified (format): / 01-10-2018 / 16:49:48 / Claus Gittinger"
 !
 
 hideForAction
@@ -10492,27 +10520,28 @@
 !
 
 unmap
-    "unmap the view - the view stays created (but invisible), and can be remapped again later."
+    "unmap the view - the view stays created (but invisible), 
+     and can be remapped again later."
 
     realized ifTrue:[
-	realized := false.
-	self drawableId notNil ifTrue:[
-	    device unmapWindow:self drawableId.
-
-	    "/ make it go away immediately
-	    "/ (this hides the subview killing)
-	    self flush.
-	].
-
-	"/ Normally, this is not correct with X, where the
-	"/ unmap is an asynchronous operation.
-	"/ (shown is cleared also in unmapped event)
-	"/ Do it anyway, to avoid synchronisation problems.
-
-	shown ifTrue:[
-	    shown := false.
-	    dependents notNil ifTrue:[ self changed:#visibility ].
-	]
+        realized := false.
+        self drawableId notNil ifTrue:[
+            device unmapWindow:self drawableId.
+
+            "/ make it go away immediately
+            "/ (this hides the subview killing)
+            self flush.
+        ].
+
+        "/ Normally, this is not correct with X, where the
+        "/ unmap is an asynchronous operation.
+        "/ (shown is cleared also in unmapped event)
+        "/ Do it anyway, to avoid synchronisation problems.
+
+        shown ifTrue:[
+            shown := false.
+            dependents notNil ifTrue:[ self changed:#visibility ].
+        ]
     ].
 
     "
@@ -10522,9 +10551,9 @@
      top extent:200@200.
 
      sub := View
-		origin:0.2@0.2
-		corner:0.8@0.8
-		in:top.
+                origin:0.2@0.2
+                corner:0.8@0.8
+                in:top.
 
      sub viewBackground:Color red.
      sub hiddenOnRealize:true.
@@ -10539,7 +10568,8 @@
      sub map.
     "
 
-    "Modified: / 22.2.1999 / 20:10:58 / cg"
+    "Modified: / 22-02-1999 / 20:10:58 / cg"
+    "Modified (comment): / 01-10-2018 / 17:01:58 / Claus Gittinger"
 !
 
 unrealize
@@ -11700,7 +11730,7 @@
          This is currently used for X, to tell the Window Manager
          That this view should be always on top of the mainView"
         self drawableId isNil ifTrue:[self create].
-        device setTransient:self drawableId for:transientFor id.
+        device setTransient:self drawableId for:transientFor drawableId.
     ].
 
     self raise.
@@ -11788,6 +11818,7 @@
     "Modified: / 29-08-2013 / 16:17:10 / cg"
     "Modified (format): / 24-08-2017 / 15:04:06 / cg"
     "Modified: / 15-05-2018 / 19:59:38 / stefan"
+    "Modified: / 01-10-2018 / 17:03:49 / Claus Gittinger"
 !
 
 openModalAt:aPoint
@@ -12221,6 +12252,12 @@
     ^ parameter
 ! !
 
+!SimpleView::CloseBoxNotificationSignal methodsFor:'accessing'!
+
+box
+    ^ parameter
+! !
+
 !SimpleView::RoundViewShape methodsFor:'queries'!
 
 isRoundShape