UIPainter.st
changeset 533 dde823aeca4c
parent 527 6dc446339dc2
child 538 3d75219adb32
--- a/UIPainter.st	Fri Jan 30 12:49:54 1998 +0100
+++ b/UIPainter.st	Fri Jan 30 14:58:10 1998 +0100
@@ -162,6 +162,9 @@
 #fileLoad
 'Opens dialog to load an interface from a class.'
 
+#fileLoadSubspec
+'Opens dialog to load an subspec interface from a class.'
+
 #fileNew
 'Creates new interface.'
 
@@ -662,7 +665,7 @@
                     #'name:' 'infoBarSubSpec'
                     #'layout:' #(#LayoutFrame 0 0.0 -22 1 0 1.0 0 1.0)
                     #'majorKey:' #ToolApplicationModel
-                    #'minorKey:' #windowSpecForInfoBar
+                    #'minorKey:' #windowSpecForInfoBarWithClock
                 )
               )
           )
@@ -716,6 +719,11 @@
                           #'activeHelpKey:' #fileLoad
                       )
                        #(#MenuItem
+                          #'label:' 'Load Subspec...'
+                          #'value:' #loadSubspec
+                          #'activeHelpKey:' #fileLoadSubspec
+                      )
+                       #(#MenuItem
                           #'label:' '-'
                       )
                        #(#MenuItem
@@ -1468,6 +1476,30 @@
     self modifiedChannel value:false.
 !
 
+addWidgetOfSpec: aSpec
+
+    |newSel|
+    (newSel := self pasteSpecifications:aSpec keepLayout:false at:0@0) notNil
+    ifTrue:
+    [
+        self select: newSel
+    ]
+    ifFalse:
+    [   
+        treeView selection size = 0
+        ifTrue:
+        [                          
+            treeView selection: #(1).
+        ]
+        ifFalse:
+        [
+            treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
+        ].
+        self addWidgetOfSpec: aSpec
+    ]
+
+!
+
 cancel
     "cancel all changes done to the specification; reread attributes from the
      assigned component
@@ -2400,7 +2432,13 @@
 
 doFromClass
 
-    self loadFromInClassesOf: #Object
+    self loadFromMessage: 
+        (ResourceSelectionBrowser
+            request: 'Load Interface From Class'
+            onSuperclass: nil
+            andClass: specClass
+            andSelector: specSelector
+            withResourceTypes: #(canvas))
 !
 
 doInstallAspects
@@ -2594,17 +2632,6 @@
 
 !
 
-loadFromInClassesOf: aSuperclassOrSymbol
-
-    self loadFromMessage: 
-        (ResourceSelectionBrowser
-            request: 'Load Interface From Class'
-            onSuperclass: aSuperclassOrSymbol
-            andClass: specClass
-            andSelector: specSelector
-            withResourceTypes: #(canvas))
-!
-
 loadFromMessage: aMessage
 
     ((aMessage size > 0) and: [self checkModified])
@@ -2625,6 +2652,33 @@
         ]
     ]
 
+!
+
+loadSubspec
+
+    |subSpecMessage|
+    (subSpecMessage := ResourceSelectionBrowser
+            request: 'Load Subspec From Class'
+            onSuperclass: nil
+            andClass: specClass
+            andSelector: specSelector
+            withResourceTypes: #(canvas)) notNil
+    ifTrue:
+    [
+        |readStream aClass aSelector|
+        readStream := subSpecMessage readStream.
+        (aClass := Smalltalk at: (readStream upTo: $ ) asSymbol) notNil
+        ifTrue:
+        [
+            aSelector :=  readStream upToEnd asSymbol.
+            (aClass name == specClass and: [aSelector == specSelector]) ifTrue: [^self warn: 'Current interface as subspec not allowed!!'].
+            (aClass respondsTo:aSelector) 
+            ifTrue:
+            [
+                self addWidgetOfSpec: (Array with: (UISubSpecification new majorKey: aClass name; minorKey: aSelector))
+            ]
+        ]
+    ]
 ! !
 
 !UIPainter methodsFor:'user interactions - dialog'!
@@ -2934,7 +2988,7 @@
 addProperty:aProperty
     "add a new item
     "
-    |parent|
+    |parent| 
 
     parent := self detectItemRespondsToView:(aProperty view superView).