popup box caused by a closeRequest with still open
authorca
Wed, 28 May 1997 12:25:20 +0200
changeset 133 e12f82d3afb7
parent 132 8649766ce095
child 134 d5ab85ec27fd
popup box caused by a closeRequest with still open modifications
UIPainter.st
--- a/UIPainter.st	Tue May 27 15:16:55 1997 +0200
+++ b/UIPainter.st	Wed May 28 12:25:20 1997 +0200
@@ -174,18 +174,6 @@
                                         #'value:' #doPickAView
                                   )
                                  #(#MenuItem
-                                        #'label:' 'load'
-                                        #'value:' #doOpen
-                                  )
-                                 #(#MenuItem
-                                        #'label:' 'save'
-                                        #'value:' #doSave
-                                  )
-                                 #(#MenuItem
-                                        #'label:' 'save as ...'
-                                        #'value:' #doSaveAs
-                                  )
-                                 #(#MenuItem
                                         #'label:' 'raise'
                                         #'value:' #doRaise
                                   )
@@ -194,7 +182,7 @@
                                         #'value:' #closeRequest
                                   )
                                  )
-                                #(3 3 1)
+                                #(3 1)
                                 nil
                        )
          )
@@ -310,7 +298,7 @@
                 #'submenu:'
                         #(#Menu #(
                                 #(#MenuItem
-                                        #'label:' 'class & method'
+                                        #'label:' 'class && method'
                                         #'value:' #defineClassAndSelector
                                  )
                                  #(#MenuItem
@@ -325,8 +313,12 @@
                                         #'label:' 'windowSpec'
                                         #'value:' #doWindowSpec
                                    )
+                                #(#MenuItem
+                                        #'label:' 'browse'
+                                        #'value:' #browseAppClass
+                                 )
                                 )
-                                #( 1 2 )
+                                #( 1 2 1)
                                 nil
                           )
          )
@@ -731,6 +723,7 @@
 
     menu menuItems do:[:anItem| 
         anItem nameKey ~~ #test ifTrue:[anItem enabled:channel]
+                               ifFalse:[anItem value:channel].
     ].
   ^ menu
 !
@@ -944,6 +937,14 @@
 closeRequest
     "close all windows open by builder
     "
+    |anyUnsavedChanges|
+
+    objectList painter isModified ifTrue:[
+        (self confirm:'quit without saving ?') ifFalse:[
+            ^ self
+        ]
+    ].
+
     objectList removeDependent:self.
     objectList painter release.
     objectList := nil.
@@ -965,21 +966,15 @@
     topView == aTopView ifTrue:[
         super closeRequestFor:aTopView
     ] ifFalse:[
-        (selectionPanel notNil and:[aTopView == selectionPanel window]) ifTrue:[
-            aTopView application:nil.
-            aTopView terminate.
-            selectionPanel := nil.
-        ] ifFalse:[
-            topView raise.
-            topView device beep
-        ]
+        topView raise.
+        topView device beep
     ].
 !
 
 openInterface
     "open interfaces
     "
-    |painterView painter cls topView|
+    |cls painter|
 
     aspects := IdentityDictionary new.
 
@@ -1002,32 +997,12 @@
         (specSelector notNil ifTrue:[specSelector]
                             ifFalse:[#windowSpec]) asValue
     ).
-
-    painterView := StandardSystemView new.
-    painterView label:'unnamed canvas'.
-    painterView extent:300@300.
-
-    painter := UIPainterView in:painterView.
+    painter := UIPainterView new.
     painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
-
     objectList := painter listHolder.
     objectList addDependent:self.
-
     super openInterface.
 
-    topView := self window.
-    topView label:'Interface Builder'.
-    topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100).
-
-    painterView openInGroup:(topView windowGroup).
-
-    topView beMaster.
-    painterView beSlave.
-    painterView application:self.
-    painterView open.
-    selectionPanel := UISelectionPanel open.
-    selectionPanel window beSlave.
-    selectionPanel window application:self.
 !
 
 openNewWindowCanvas
@@ -1061,10 +1036,64 @@
     painter methodName:aSelector.
     painter setupFromSpec:(aClass perform:aSelector).
 
+!
+
+postOpenWith:aBuilder
+    "open all subApplications
+    "
+    |pview window|
+
+    window := self window.
+    window bePartner.
+    window label:'Interface Builder'.
+    window icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100).
+
+    selectionPanel := UISelectionPanel newDefault.
+    selectionPanel allButOpenInterface:#windowSpec.
+    selectionPanel window openInGroup:(window windowGroup).
+    selectionPanel window bePartner.
+    selectionPanel openWindow.
+    selectionPanel window application:self.
+
+    pview := StandardSystemView new.
+    pview label:'unnamed canvas'.
+    pview extent:300@300.
+    pview add:(self painter).
+    pview openInGroup:(window windowGroup).
+    pview bePartner.
+    pview open.
+    pview application:self.
+
 ! !
 
 !UIPainter methodsFor:'user interaction - dialog'!
 
+browseAppClass
+    "open a browser on the class"
+
+    |cls|
+
+    specClass isNil ifTrue:[
+        self information:'no class yet'.
+        ^ self
+    ].
+
+    specClass isBehavior ifFalse:[
+        cls := Smalltalk at:specClass asSymbol
+    ] ifTrue:[
+        cls := specClass
+    ].
+
+    cls isNil ifTrue:[
+        self information:'no class yet'.
+        ^ self
+    ].
+
+    SystemBrowser openInClass:cls
+
+
+!
+
 checkClassAndSelector
     "check for class & superclass"