#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Tue, 20 Mar 2018 15:58:08 +0100
changeset 8314 3754b8e6f755
parent 8313 0fcbc07d8f35
child 8315 d28a7b7f19e7
#REFACTORING by stefan class: WindowGroup changed: #closeDownViews #mainView
WindowGroup.st
--- a/WindowGroup.st	Tue Mar 20 12:56:13 2018 +0100
+++ b/WindowGroup.st	Tue Mar 20 15:58:08 2018 +0100
@@ -888,15 +888,14 @@
 mainView
     "return the mainview. That's the first topView by default"
 
-    |nonModalViews|
-
-    topViews size == 0 ifTrue:[ ^ nil].
-    nonModalViews := topViews reject:[:t | t isModal].
-    nonModalViews notEmpty ifTrue:[ 
-        ^ nonModalViews first
+    topViews isNil ifTrue:[ 
+        ^ nil
     ].
-    "/ mhmh - a modal application
-    ^ topViews first
+    ^ topViews 
+        detect:[:t | t isModal not] 
+        ifNone:[topViews first "a modal application"]
+
+    "Modified: / 20-03-2018 / 14:53:23 / stefan"
 !
 
 removeView:aView
@@ -950,15 +949,18 @@
 closeDownViews
     "destroy all views associated to this window group"
 
+    |list|
+
     topViews notNil ifTrue:[
-        topViews copy do:[:aTopView | 
-            aTopView notNil ifTrue:[
-                aTopView destroy
-            ]
+        list := topViews.
+        topViews := nil.
+        list do:[:eachTopView | 
+            eachTopView notNil ifTrue:[
+                eachTopView destroy
+            ].
         ]
     ].
     views := nil.
-    topViews := nil.
 
     "/ keep the sensor in case there are pending incoming events;
     "/ otherwise there is a chance that we end up in a debugger in the
@@ -967,7 +969,8 @@
     mySensor flushAllEvents.
     "/ mySensor := nil.
 
-    "Modified: / 6.5.1999 / 09:47:18 / cg"
+    "Modified: / 06-05-1999 / 09:47:18 / cg"
+    "Modified: / 20-03-2018 / 14:45:29 / stefan"
 !
 
 hideTopViews