#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 16 May 2018 08:35:01 +0200
changeset 8365 3c439d6037f5
parent 8364 d5cdbd177a03
child 8366 ceaa8f7035a5
#REFACTORING by stefan class: SimpleView changed: #openModal:inGroup: class: SimpleView::AboutToOpenBoxNotificationSignal class comment/format in: #documentation class: SimpleView::BoxClosedNotificationSignal class comment/format in: #documentation
SimpleView.st
--- a/SimpleView.st	Tue May 15 18:15:30 2018 +0200
+++ b/SimpleView.st	Wed May 16 08:35:01 2018 +0200
@@ -11484,14 +11484,14 @@
      however, other views (in other windowgroups) still work."
 
     |tops mainView previousGroup mainGroup cursorChanged 
-     isPopup inSystemProcess makeTransient transientFor|
+     isPopup inSystemProcess transientFor|
 
     StandardSystemView cancelAutoRaise.
 
     isPopup := self isPopUpView.
     activeWindowGroup notNil ifTrue:[
         mainGroup := activeWindowGroup mainGroup.
-        mainView := mainGroup mainView.
+        transientFor := mainView := mainGroup mainView.
     ].
 
     "/ set the windowgroup BEFORE sending the aboutToOpen notification
@@ -11530,12 +11530,10 @@
         ].
     ].
 
-    makeTransient := true.
-    transientFor := mainView.
     isPopup 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 class aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
             ^ self
         ].
         windowGroup isNil ifTrue:[
@@ -11564,20 +11562,16 @@
                 self tracePoint:#cg message:'activate'.
                 self debuggingCodeFor:#cg is:[ Transcript showCR:transientFor; showCR:transientFor windowGroup. ].
                 transientFor activate; setForegroundWindow.
-"/            ] ifTrue:[
-"/                makeTransient := false.
             ]
         ].
     ].
-    "/ makeTransient ifTrue:[
-        transientFor notNil ifTrue:[
-            "set the transient property.
-             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.
-        ].
-    "/ ].
+    transientFor notNil ifTrue:[
+        "set the transient property.
+         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.
+    ].
 
     self raise.
 
@@ -11656,14 +11650,14 @@
                     ].
                 ].
             ].
-            Dialog boxClosedNotificationSignal raiseRequestWith:self.
+            self class boxClosedNotificationSignal raiseRequestWith:self.
         ].
     ].
 
     "Created: / 10-12-1995 / 14:06:14 / cg"
     "Modified: / 29-08-2013 / 16:17:10 / cg"
-    "Modified: / 20-02-2017 / 17:10:34 / stefan"
     "Modified (format): / 24-08-2017 / 15:04:06 / cg"
+    "Modified: / 15-05-2018 / 19:59:38 / stefan"
 !
 
 openModalAt:aPoint
@@ -11967,71 +11961,71 @@
     be customized by additional widgets.
 
     i.e. its typical use is like:
-	|doNotShowHolder|
-
-	doNotShowHolder := false asValue.
-	Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
-	    |box|
-
-	    box := ex box.
-	    box verticalPanel
-		add:(CheckBox label:('Do not show this information in the future.')
-			      model:doNotShowHolder).
-	] do:[
-	    Dialog information:'This is a standard information box.\(but has an additional check toggle in it)' withCRs.
-	].
+        |doNotShowHolder|
+
+        doNotShowHolder := false asValue.
+        DialogBox aboutToOpenBoxNotificationSignal handle:[:ex |
+            |box|
+
+            box := ex box.
+            box verticalPanel
+                add:(CheckBox label:('Do not show this information in the future.')
+                              model:doNotShowHolder).
+        ] do:[
+            Dialog information:'This is a standard information box.\(but has an additional check toggle in it)' withCRs.
+        ].
 
     Another application is to suppress dialogs, by returning #abort from the query
     (of course, in real life, the Dialog call is deeply nested below the handler and done elsewhere):
 
-	Dialog aboutToOpenBoxNotificationSignal
-	    answer:#abort
-	    do:[
-		Dialog information:'This box is not shown.'
-	    ].
+        DialogBox aboutToOpenBoxNotificationSignal
+            answer:#abort
+            do:[
+                Dialog information:'This box is not shown.'
+            ].
 
     or to automatically answer all dialogs by simulating user entering a return:
 
-	Dialog aboutToOpenBoxNotificationSignal
-	    handle:[:ex |
-		ex box windowGroup sensor
-		    pushEvent:
-			(WindowEvent
-				keyPress:#Return
-				rawKey:#Return
-				hasShift:false ctrl:false alt:false meta:false
-				button1:false button2:false button3:false
-				x:1 y:1 view:ex box).
-	    ] do:[
-		Transcript showCR:(Dialog confirm:'Please confirm.')
-	    ].
+        DialogBox aboutToOpenBoxNotificationSignal
+            handle:[:ex |
+                ex box windowGroup sensor
+                    pushEvent:
+                        (WindowEvent
+                                keyPress:#Return
+                                rawKey:#Return
+                                hasShift:false ctrl:false alt:false meta:false
+                                button1:false button2:false button3:false
+                                x:1 y:1 view:ex box).
+            ] do:[
+                Transcript showCR:(Dialog confirm:'Please confirm.')
+            ].
 
     or an escape:
 
-	Dialog aboutToOpenBoxNotificationSignal
-	    handle:[:ex |
-		ex box windowGroup sensor
-		    pushEvent:
-			(WindowEvent
-				keyPress:#Escape
-				rawKey:#Escape
-				hasShift:false ctrl:false alt:false meta:false
-				button1:false button2:false button3:false
-				x:1 y:1 view:ex box).
-	    ] do:[
-		Transcript showCR:(Dialog confirm:'Please confirm.')
-	    ].
+        DialogBox aboutToOpenBoxNotificationSignal
+            handle:[:ex |
+                ex box windowGroup sensor
+                    pushEvent:
+                        (WindowEvent
+                                keyPress:#Escape
+                                rawKey:#Escape
+                                hasShift:false ctrl:false alt:false meta:false
+                                button1:false button2:false button3:false
+                                x:1 y:1 view:ex box).
+            ] do:[
+                Transcript showCR:(Dialog confirm:'Please confirm.')
+            ].
 
     Finally, a recorder may want to keep track of which dialogs have been opened:
     (of course, again, the Dialog calls are deeply nested below the handler and done elsewhere):
 
-	Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
-	    Transcript showCR:ex box topView label
-	] do:[
-	    Dialog information:'box #1.'.
-	    Dialog information:'box #2.'.
-	    Dialog confirm:'bla'.
-	].
+        DialogBox aboutToOpenBoxNotificationSignal handle:[:ex |
+            Transcript showCR:ex box topView label
+        ] do:[
+            Dialog information:'box #1.'.
+            Dialog information:'box #2.'.
+            Dialog confirm:'bla'.
+        ].
 
 "
 ! !
@@ -12069,25 +12063,25 @@
     be wrapped by other programs.
 
     i.e. its typical use is like:
-	Dialog boxClosedNotificationSignal handle:[:ex |
-	    Transcript showCR:'box closed'
-	] do:[
-	    Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
-		Transcript showCR:'box about to open'
-	    ] do:[
-		Dialog information:'This is a standard information box.'.
-	    ].
-	].
-
-	Dialog boxClosedNotificationSignal handle:[:ex |
-	    Transcript showCR:'box closed'
-	] do:[
-	    Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
-		Transcript showCR:'box about to open'
-	    ] do:[
-		Dialog confirm:'Yes or No.'.
-	    ].
-	].
+        DialogBox boxClosedNotificationSignal handle:[:ex |
+            Transcript showCR:'box closed'
+        ] do:[
+            DialogBox aboutToOpenBoxNotificationSignal handle:[:ex |
+                Transcript showCR:'box about to open'
+            ] do:[
+                Dialog information:'This is a standard information box.'.
+            ].
+        ].
+
+        DialogBox boxClosedNotificationSignal handle:[:ex |
+            Transcript showCR:'box closed'
+        ] do:[
+            DialogBox aboutToOpenBoxNotificationSignal handle:[:ex |
+                Transcript showCR:'box about to open'
+            ] do:[
+                Dialog confirm:'Yes or No.'.
+            ].
+        ].
 "
 ! !