more checks
authorClaus Gittinger <cg@exept.de>
Tue, 28 Oct 1997 20:37:54 +0100
changeset 351 7cb9f9c9a872
parent 350 28128eeb98f0
child 352 088174fc1e71
more checks
UIPainter.st
--- a/UIPainter.st	Tue Oct 28 19:40:01 1997 +0100
+++ b/UIPainter.st	Tue Oct 28 20:37:54 1997 +0100
@@ -11,8 +11,6 @@
 "
 
 
-'From Smalltalk/X, Version:3.2.1 on 23-oct-1997 at 6:02:55 pm'                  !
-
 ApplicationModel subclass:#UIPainter
 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
@@ -658,7 +656,7 @@
                                                          #(#ActionButtonSpec
                                                             #'name:' 'acceptButton'
                                                             #'activeHelpKey:' #accept
-                                                            #'label:' 'ok'
+                                                            #'label:' 'accept'
                                                             #'tabable:' true
                                                             #'model:' #accept
                                                             #'enableChannel:' #modifiedChannel
@@ -694,6 +692,8 @@
               )
           )
       )
+
+    "Modified: / 26.10.1997 / 15:57:00 / cg"
 ! !
 
 !UIPainter class methodsFor:'menu specs'!
@@ -1239,6 +1239,10 @@
                           #'value:' #doBrowseAppClass
                           #'enabled:' #hasSpecClass
                       )
+                       #(#MenuItem
+                          #'label:' 'browse aspect methods'
+                          #'value:' #doBrowseAspectMethods
+                      )
                     ) nil
                     nil
                 )
@@ -1252,7 +1256,7 @@
                     
                      #(
                        #(#MenuItem
-                          #'label:' 'test mode'
+                          #'label:' 'geometry test mode'
                           #'indication:' #'testMode:'
                       )
                     ) nil
@@ -1294,6 +1298,8 @@
           ) nil
           nil
       )
+
+    "Modified: / 26.10.1997 / 14:34:13 / cg"
 ! !
 
 !UIPainter methodsFor:'actions'!
@@ -1493,6 +1499,22 @@
             self accept
         ]
     ]
+!
+
+setMaxExtent
+    "set the windows maxExtent from its current extent"
+
+    self painter setMaxExtent
+
+    "Modified: / 27.10.1997 / 03:22:58 / cg"
+!
+
+setMinExtent
+    "set the windows minExtent from its current extent"
+
+    self painter setMinExtent
+
+    "Modified: / 27.10.1997 / 03:23:10 / cg"
 ! !
 
 !UIPainter methodsFor:'aspects'!
@@ -1934,20 +1956,31 @@
 tabSelection:something
     "the tab selection of the notebook changed
     "
+
+    |whatToDo|
+
     (something isNil or:[tabSelection = something]) ifTrue:[
         ^ self
     ].
 
     self isModified ifTrue:[
-        (self confirm:'accept change made in ' , tabSelection printString , ' section ?') ifFalse:[
-            ^ self
-        ].
-        self accept
+        whatToDo := DialogBox 
+                        confirmWithCancel:'accept change made in ' , tabSelection printString , ' section ?'
+                        labels:#('cancel' 'ignore' 'accept')
+                        default:3.
+        whatToDo isNil ifTrue:[^self].
+        whatToDo == true ifTrue:[
+            self accept
+        ] ifFalse:[
+            self cancel
+        ]
     ].
 
     tabSelection := something.
     self raiseTabView.
     self cancel.
+
+    "Modified: / 26.10.1997 / 15:54:15 / cg"
 !
 
 treeSelection
@@ -2031,9 +2064,11 @@
     selectionPanel := nil.
     treeView       := nil.
 
+    ActiveHelp stopFor:self.
+
     super closeRequest.
 
-    "Modified: 28.7.1997 / 18:28:37 / cg"
+    "Modified: / 27.10.1997 / 00:01:30 / cg"
 !
 
 closeRequestFor:aTopView
@@ -2124,7 +2159,9 @@
     selectionPanel window iconLabel:'GUI Painter'.
     selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
 
-    "Modified: 1.8.1997 / 14:22:10 / cg"
+    ActiveHelp startFor:self.
+
+    "Modified: / 27.10.1997 / 00:01:12 / cg"
 !
 
 openNewWindowCanvas
@@ -2148,7 +2185,8 @@
     |painter|
 
     aClass isNil ifTrue:[
-        self warn:'nil class given (class was probably renamed ?)'.
+        (self confirm:'nil class given to UIPainter (class was probably renamed ?)\\Open anyway (to create a new interface) ?' withCRs)
+        ifFalse:[^ nil].
     ].
 
     self openInterface.
@@ -2175,7 +2213,7 @@
         ]
     ]
 
-    "Modified: 1.7.1997 / 19:18:54 / cg"
+    "Modified: / 25.10.1997 / 19:11:51 / cg"
 ! !
 
 !UIPainter methodsFor:'user interaction - dialog'!
@@ -2329,6 +2367,30 @@
 
 !
 
+doBrowseAspectMethods
+    "open a browser on the aspect methods"
+
+    |cls methods|
+
+    self painter isModified ifTrue:[
+        self warn:'the changes have not yet been reinstalled.\\The browser may show old code.' withCRs.
+    ].
+    cls := self resolveName:specClass.
+
+    cls notNil ifTrue:[
+        methods := self painter aspectMethods.
+        methods isEmpty ifTrue:[
+            self warn:'no aspect methods have been installed yet.'.
+            ^ self.
+        ].
+        SystemBrowser browseMethods:methods title:'aspect methods'.
+    ] ifFalse:[
+        self information:'no class yet'.
+    ].
+
+    "Created: / 25.10.1997 / 19:07:55 / cg"
+!
+
 doFromClass
     "setup new specification from a class and selector accessed through
      to a dialog
@@ -2438,6 +2500,17 @@
     self checkClassAndSelector ifFalse:[
         ^ self
     ].
+
+    self isModified ifTrue:[
+        (self confirm:'accept change made in ' , tabSelection printString , ' section ?') ifTrue:[
+            self accept
+        ] ifFalse:[
+            (self confirm:'install old specification ?') ifFalse:[
+                ^ self
+            ]
+        ]
+    ].
+
     painter := self painter.
 
     painter className:specClass
@@ -2448,6 +2521,7 @@
     painter resetModification.
     (ReadStream on:code) fileIn.
 
+    "Modified: / 26.10.1997 / 15:47:48 / cg"
 !
 
 doNew
@@ -2496,8 +2570,18 @@
 doStartApplication
     "start current edited application
     "
-    |cls|
-
+    |cls app infoMessage|
+
+    self isModified ifTrue:[
+        (self confirm:'accept change made in ' , tabSelection printString , ' section ?') ifTrue:[
+            self accept.
+            self painter isModified ifTrue:[
+                (self confirm:'reinstall the new spec ?' withCRs) ifTrue:[
+                    self doInstallSpec
+                ]
+            ].
+        ]
+    ].
     self painter isModified ifTrue:[
         (self confirm:'the changed spec has not yet been reinstalled.\\Start anyway (based upon the previous interface) ?' withCRs) ifFalse:[
             ^ self
@@ -2505,23 +2589,31 @@
     ].
 
     (specClass isNil or:[specSelector size < 2]) ifTrue:[
-        ^ self information:'no class or selector defined'.
-    ].
-
-    cls := self resolveName:specClass.
-
-    cls isNil ifTrue:[
-        ^ self information:'class not existant'.
+        infoMessage := 'no class or selector defined'.
+    ] ifFalse:[
+        cls := self resolveName:specClass.
+
+        cls isNil ifTrue:[
+            infoMessage := 'class not existant'.
+        ] ifFalse:[
+            (cls respondsTo:specSelector) ifFalse:[
+                infoMessage := ('no method for: #' 
+                                , specSelector , ' in ' , cls name
+                                , '\\(did you install the spec ?)') withCRs.
+            ]
+        ]
     ].
 
-    (cls respondsTo:specSelector) ifFalse:[
-        ^ self information:('no method for: #' 
-                             , specSelector , ' in ' , cls name ,
-                             '\\(did you install the spec ?)') withCRs.
+    infoMessage notNil ifTrue:[
+        ^ self information:infoMessage
     ].
-    cls new openInterface:specSelector
-
-    "Modified: 28.7.1997 / 18:30:25 / cg"
+    app := cls new.
+    (app respondsTo:#openInterface:) ifFalse:[
+        ^ self warn:('The application does not respond to the ''openInterface:'' message.\\(maybe its supposed to be used as subApplication/subCanvas)') withCRs.
+    ].        
+    app openInterface:specSelector
+
+    "Modified: / 26.10.1997 / 22:57:30 / cg"
 !
 
 doWindowSpec
@@ -2756,9 +2848,9 @@
 !UIPainter::TreeView methodsFor:'building'!
 
 generateFullSpecForComponents:aSpecArray
-    "generates an full spec for components
+    "generates a full spec for components
     "
-    |fullSpec|
+    |fullSpec winSpec|
 
     fullSpec := FullSpec new.
 
@@ -2766,11 +2858,15 @@
               components:(SpecCollection new collection:aSpecArray).
 
     windowSpec notNil ifTrue:[
-        fullSpec window menu:(windowSpec menu).
-        fullSpec window performer:(windowSpec performer).
-        fullSpec window flags:(windowSpec flags).
+        winSpec := fullSpec window.
+        winSpec menu:(windowSpec menu).
+        winSpec performer:(windowSpec performer).
+        winSpec flags:(windowSpec flags).
+winSpec forceRecursiveBackground:(windowSpec forceRecursiveBackground).
     ].    
     ^ fullSpec literalArrayEncoding.
+
+    "Modified: / 26.10.1997 / 22:41:51 / cg"
 !
 
 setAttributesFromWindowSpec:aWindowSpec