client:spec:builder again
authortm
Wed, 22 Nov 2000 15:19:33 +0100
changeset 3382 9cbadc6538b2
parent 3381 5deef9b7da86
child 3383 111b54361247
client:spec:builder again
SimpleView.st
--- a/SimpleView.st	Fri Nov 17 20:17:34 2000 +0100
+++ b/SimpleView.st	Wed Nov 22 15:19:33 2000 +0100
@@ -3280,33 +3280,53 @@
      the given windowSpec, using the given builder.
      ATTENTION: this is a low level interface; postBuild is NOT invoked"
 
-    |builder subSpec notAnAppModel savedView|
+    |builder subSpec notAnAppModel savedView savApp savedBuilder|
 
     aWindowSpecOrSpecSymbol isNil ifTrue:[^ self].
 
     (builder := aBuilder) isNil ifTrue:[
-	"/ problem: anApplication could have no builder
-	"/          or anApplication could be a non-appModel (theoretically - only providing a spec)
-	notAnAppModel := false.
-	builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil].
-	builder isNil ifTrue:[
-	    notAnAppModel ifTrue:[
-		 builder := UIBuilder new.    
-	    ] ifFalse:[
-		 anApplication createBuilder.
-		 builder := anApplication builder
-	    ]
-	]
+        "/ problem: anApplication could have no builder
+        "/          or anApplication could be a non-appModel (theoretically - only providing a spec)
+        notAnAppModel := false.
+        builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil].
+        builder isNil ifTrue:[
+            notAnAppModel ifTrue:[
+                 builder := UIBuilder new.    
+            ] ifFalse:[
+                 anApplication createBuilder.
+                 builder := anApplication builder
+            ]
+        ]
     ].
 
     (subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[
-	anApplication isNil ifTrue:[^ self].
-	subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol.
-	subSpec isNil ifTrue:[
-	    ^ self
-	].
-    ].
-    builder buildFromSpec:subSpec in:self.
+        anApplication isNil ifTrue:[^ self].
+        subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol.
+        subSpec isNil ifTrue:[
+            ^ self
+        ].
+    ].
+
+    "/ if the appl is not the master, but the masters builder is used,
+    "/ we have to (temporarily change the builders app)
+    anApplication ~~ builder application ifTrue:[
+        anApplication masterApplication ~~ builder application ifTrue:[self halt:'should not happen'].
+        builder application:anApplication.
+
+        savedView := builder window.
+        builder window:self.
+        [
+            anApplication buildSubCanvas:subSpec withBuilder:builder.
+        ] valueNowOrOnUnwindDo:[
+            savedView notNil ifTrue:[
+                builder window:savedView.
+            ].
+        ].
+
+"/        builder buildFromSpec:subSpec in:self.
+    ] ifFalse:[
+        builder buildFromSpec:subSpec in:self.
+    ].
 
 "/    postBuildWith: will be called twice if code below is enabled
 "/    notAnAppModel isNil ifTrue:[
@@ -9025,6 +9045,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.398 2000-11-13 10:56:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.399 2000-11-22 14:19:33 tm Exp $'
 ! !
 SimpleView initialize!