UIPainter.st
changeset 50 fb4359c9bdc4
parent 46 8301d6b9e67c
child 54 d0b5a33e6df0
--- a/UIPainter.st	Sat Feb 15 19:14:01 1997 +0100
+++ b/UIPainter.st	Sat Feb 15 19:15:25 1997 +0100
@@ -19,7 +19,8 @@
 		rightFractionHolder rightOffsetHolder topFractionHolder
 		topOffsetHolder bottomFractionHolder bottomOffsetHolder specClass
 		specSelector leftAlignmentFractionHolder
-		topAlignmentFractionHolder propertyShown specShown'
+		topAlignmentFractionHolder classNameHolder methodNameHolder
+		aspectHolders propertyShown specShown'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -861,6 +862,96 @@
               #'bounds:' #(#Rectangle 0 0 255 292)
           )
       )
+!
+
+nameAndSelectorSpec
+    "this window spec was automatically generated by the ST/X UIPainter"
+
+    "do not manually edit this - the painter/builder may not be able to
+     handle the specification if its corrupted."
+
+    "UIPainter new openOnClass:NewApplication andSelector:#windowSpec"
+    "NewApplication new openInterface:#windowSpec"
+    "NewApplication open"
+
+    <resource: #canvas>
+
+    ^
+
+       #(#FullSpec
+          #'window:' 
+           #(#WindowSpec
+              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+              #'label:' 'unnamed'
+              #'bounds:' #(#Rectangle 0 0 300 300)
+          )
+          #'component:' 
+           #(#SpecCollection
+              #'collection:' 
+               #(
+                 #(#LabelSpec
+                    #'name:' 'label1'
+                    #'layout:' #(#LayoutFrame 10 0 50 0 110 0 70 0)
+                    #'label:' 'class:'
+                    #'adjust:' #right
+                )
+                 #(#LabelSpec
+                    #'name:' 'label2'
+                    #'layout:' #(#LayoutFrame 10 0 90 0 110 0 110 0)
+                    #'label:' 'superclass:'
+                    #'adjust:' #right
+                )
+                 #(#LabelSpec
+                    #'name:' 'label3'
+                    #'layout:' #(#LayoutFrame 10 0 130 0 110 0 150 0)
+                    #'label:' 'selector:'
+                    #'adjust:' #right
+                )
+                 #(#InputFieldSpec
+                    #'name:' 'classNameField'
+                    #'layout:' #(#LayoutFrame 120 0 50 0 289 0 69 0)
+                    #'model:' #classNameChannel
+                    #'immediateAccept:' false
+                    #'acceptOnLeave:' true
+                    #'acceptOnReturn:' true
+                    #'acceptOnTab:' true
+                )
+                 #(#InputFieldSpec
+                    #'name:' 'superclassNameField'
+                    #'layout:' #(#LayoutFrame 120 0 90 0 289 0 109 0)
+                    #'model:' #superclassNameChannel
+                    #'immediateAccept:' false
+                    #'acceptOnLeave:' true
+                    #'acceptOnReturn:' true
+                    #'acceptOnTab:' true
+                )
+                 #(#InputFieldSpec
+                    #'name:' 'methodNameField'
+                    #'layout:' #(#LayoutFrame 120 0 130 0 289 0 149 0)
+                    #'model:' #methodNameChannel
+                    #'immediateAccept:' false
+                    #'acceptOnLeave:' true
+                    #'acceptOnReturn:' true
+                    #'acceptOnTab:' true
+                )
+                 #(#ActionButtonSpec
+                    #'name:' 'button1'
+                    #'layout:' #(#LayoutFrame 30 0 250 0 129 0 279 0)
+                    #'label:' 'cancel'
+                    #'model:' #cancelClicked
+                )
+                 #(#ActionButtonSpec
+                    #'name:' 'button2'
+                    #'layout:' #(#LayoutFrame 160 0 250 0 259 0 279 0)
+                    #'label:' 'ok'
+                    #'model:' #okClicked
+                )
+              )
+          )
+      )
+
+
+
 ! !
 
 !UIPainter methodsFor:'BuilderView interface'!
@@ -917,10 +1008,8 @@
 
 !UIPainter methodsFor:'aspects'!
 
-aspectChannel
-    ^ aspectChannel
-
-    "Modified: 6.9.1995 / 01:00:30 / claus"
+aspectFor:aKey
+    ^ aspectHolders at:aKey ifAbsent:[super aspectFor:aKey]
 !
 
 backgroundChannel
@@ -936,12 +1025,6 @@
 
 !
 
-changeChannel
-    ^ changeChannel
-
-    "Modified: 6.9.1995 / 01:00:33 / claus"
-!
-
 foregroundChannel
     ^ fgChannel
 !
@@ -1108,6 +1191,18 @@
 !
 
 initChannels
+    aspectHolders := IdentityDictionary new.
+
+    aspectHolders at:#classNameChannel put:((specClass notNil ifTrue:[specClass name] ifFalse:['NewApplication']) asValue).
+    aspectHolders at:#superclassNameChannel put:((specClass notNil ifTrue:[specClass superclass] ifFalse:[ApplicationModel]) name asValue).
+    aspectHolders at:#methodNameChannel put:(specSelector asValue).
+
+    aspectHolders at:#aspectChannel put:(ValueHolder new).
+    aspectHolders at:#changeChannel put:(ValueHolder new).
+
+    aspectHolders at:#foregroundChannel put:(ValueHolder new).
+    aspectHolders at:#backgroundChannel put:(ValueHolder new).
+
 
     bottomFractionHolder        := nil asValue.
     bottomOffsetHolder          := nil asValue.
@@ -1120,12 +1215,6 @@
     leftAlignmentFractionHolder := nil asValue.
     topAlignmentFractionHolder  := nil asValue.
 
-    fgChannel := nil asValue.
-    bgChannel := nil asValue.
-
-    aspectChannel := nil asValue.
-    changeChannel := nil asValue.
-
 !
 
 initPullDownMenu
@@ -1343,14 +1432,10 @@
 
     menu at:#code 
             putLabels:(resources  array:#(
-                        'class' 
-                        'method' 
-"/                        'variables' 
+                        'class & method' 
                        ) )
             selectors:#(
-                        changeClass
-                        changeMethod
-"/                        changeVariables
+                        defineClassAndSelector
                        )
              receiver:self.
 
@@ -1506,6 +1591,7 @@
 
     specClass := aClass.
     specSelector :=  aSelector.
+
     self openInterface.
     workView className:aClass name.
     workView methodName:aSelector.
@@ -1836,8 +1922,8 @@
 !
 
 fetchModelAspectsFrom:aView
-    aspectChannel value:(workView aspectSelectorForView:aView).
-    changeChannel value:(workView changeSelectorForView:aView).
+    (self aspectFor:#aspectChannel) value:(workView aspectSelectorForView:aView).
+    (self aspectFor:#changeChannel) value:(workView changeSelectorForView:aView).
 
 ! !
 
@@ -2057,11 +2143,7 @@
 !UIPainter methodsFor:'user interaction'!
 
 closeRequest
-    workView  notNil ifTrue:[workView  release].
-    fileBox   notNil ifTrue:[fileBox   destroy].
-    stringBox notNil ifTrue:[stringBox destroy].
-    actionBox notNil ifTrue:[actionBox destroy].
-    listBox   notNil ifTrue:[listBox   destroy].
+    workView  notNil ifTrue:[workView  release. workView := nil].
     super closeRequest
 !
 
@@ -2574,7 +2656,7 @@
 
     |aspectSymbol|
 
-    aspectSymbol := aspectChannel value.
+    aspectSymbol := (self aspectFor:#aspectChannel) value.
     (aspectSymbol notNil and:[aspectSymbol notEmpty]) ifTrue:[
         aspectSymbol := aspectSymbol asSymbol.
         workView singleSelectionDo:[:selectedView |
@@ -2719,6 +2801,16 @@
     workView testMode:t
 ! !
 
+!UIPainter methodsFor:'user interaction - dialogs'!
+
+defineClassAndSelector
+    "launch a dialog to define class, superclass and method"
+
+    |dialog|
+
+    self openDialogInterface:#nameAndSelectorSpec.
+! !
+
 !UIPainter class methodsFor:'documentation'!
 
 version