UIPainter.st
changeset 155 575239b7ad0b
parent 152 2261aa2fa21d
child 156 b332d7117c40
--- a/UIPainter.st	Mon Jun 16 19:00:00 1997 +0200
+++ b/UIPainter.st	Tue Jun 17 12:34:33 1997 +0200
@@ -157,7 +157,7 @@
                         #(#Menu #(
                                  #(#MenuItem
                                         #'label:' 'new'
-                                        #'value:' #removeAll
+                                        #'value:' #doNew
                                   )
                                  #(#MenuItem
                                         #'label:' 'from class ...'
@@ -236,7 +236,7 @@
                 #'submenu:'
                         #(#Menu #(
                                 #(#MenuItem
-                                        #'label:' 'class && method'
+                                        #'label:' 'class && method ...'
                                         #'value:' #defineClassAndSelector
                                  )
                                  #(#MenuItem
@@ -252,7 +252,7 @@
                                         #'value:' #doInstallAspects
                                   )
                                  #(#MenuItem
-                                        #'label:' 'windowSpec'
+                                        #'label:' 'show windowSpec'
                                         #'value:' #doWindowSpec
                                    )
                                 #(#MenuItem
@@ -288,6 +288,7 @@
         nil
       )
 
+    "Modified: 17.6.1997 / 12:30:17 / cg"
 !
 
 nameAndSelectorSpec
@@ -1125,59 +1126,66 @@
 !
 
 doFromClass
-        |className methodName cls sel accepted failed spec s painter|
-
-        className  := '' asValue.
-        methodName := '' asValue.
-        painter    := self painter.
+    |className methodName cls sel accepted failed spec s painter|
 
-        (s := painter className) notNil ifTrue:[
-            className value:s
-        ].
-        (s := painter methodName) notNil ifTrue:[
-            methodName value:s
-        ].
+    objectList painter isModified ifTrue:[
+        (self confirm:'edit another interface without saving your modifications ?') ifFalse:[
+            ^ self
+        ]
+    ].
 
-        failed := false.
-        [
-            accepted :=
-                (DialogBox new
-                    addTextLabel:'Classes name:';
-                    addInputFieldOn:className; 
-                    addVerticalSpace;
-                    addTextLabel:'methods name:';
-                    addInputFieldOn:methodName; 
-                    addAbortButton; 
-                    addOkButton; 
-                    open
-                ) accepted.
+    className  := '' asValue.
+    methodName := '' asValue.
+    painter    := self painter.
+
+    (s := painter className) notNil ifTrue:[
+        className value:s
+    ].
+    (s := painter methodName) notNil ifTrue:[
+        methodName value:s
+    ].
 
-             accepted ifTrue:[
-                cls := Smalltalk classNamed:className value.
-                cls isNil ifTrue:[
+    failed := false.
+    [
+        accepted :=
+            (DialogBox new
+                addTextLabel:'Classes name:';
+                addInputFieldOn:className; 
+                addVerticalSpace;
+                addTextLabel:'methods name:';
+                addInputFieldOn:methodName; 
+                addAbortButton; 
+                addOkButton; 
+                open
+            ) accepted.
+
+         accepted ifTrue:[
+            cls := Smalltalk classNamed:className value.
+            cls isNil ifTrue:[
+                failed := true.
+                self warn:'no such class'.
+            ] ifFalse:[
+                sel := methodName value asSymbol.
+                (cls respondsTo:sel ) ifFalse:[
                     failed := true.
-                    self warn:'no such class'.
-                ] ifFalse:[
-                    sel := methodName value asSymbol.
-                    (cls respondsTo:sel ) ifFalse:[
+                    self warn:'no such method'
+                ] ifTrue:[
+                    spec := cls perform:sel.
+                    spec isArray ifFalse:[
                         failed := true.
-                        self warn:'no such method'
-                    ] ifTrue:[
-                        spec := cls perform:sel.
-                        spec isArray ifFalse:[
-                            failed := true.
-                            self warn:'not a windowSpec method'    
-                        ].
-                        "/ ok, got it
-                        painter className:className value.
-                        painter methodName:methodName value.
-                        painter setupFromSpec:spec.
-                      ^ self
-                     ]
-                ]
-             ]
-        ] doWhile:[accepted and:[failed]].
+                        self warn:'not a windowSpec method'    
+                    ].
+                    "/ ok, got it
+                    painter className:className value.
+                    painter methodName:methodName value.
+                    painter setupFromSpec:spec.
+                  ^ self
+                 ]
+            ]
+         ]
+    ] doWhile:[accepted and:[failed]].
 
+    "Modified: 17.6.1997 / 12:33:36 / cg"
 !
 
 doInstallAspects
@@ -1263,6 +1271,18 @@
 
 !
 
+doNew
+    objectList painter isModified ifTrue:[
+        (self confirm:'new interface without saving your modifications ?') ifFalse:[
+            ^ self
+        ]
+    ].
+
+    self removeAll
+
+    "Modified: 17.6.1997 / 12:33:31 / cg"
+!
+
 doOpen
     |box|
 
@@ -1278,6 +1298,12 @@
 doPickAView
     |painter view className methodName cls sel accepted spec s|
 
+    objectList painter isModified ifTrue:[
+        (self confirm:'pick another interface without saving your modifications ?') ifFalse:[
+            ^ self
+        ]
+    ].
+
     (view := Display viewFromUser) notNil ifTrue:[
         painter := self painter.
 
@@ -1288,6 +1314,8 @@
         painter className:view class name.
         painter methodName:#newSpec.
     ]
+
+    "Modified: 17.6.1997 / 12:33:23 / cg"
 !
 
 doRaise