LetterPrinter now works, after changing #rebuild.
authorStefan Vogel <sv@exept.de>
Mon, 11 Oct 1999 19:45:57 +0200
changeset 1584 f020416e00ae
parent 1583 f5118b115b68
child 1585 b4f60b1a025b
LetterPrinter now works, after changing #rebuild.
SubCanvas.st
--- a/SubCanvas.st	Fri Oct 08 15:13:03 1999 +0200
+++ b/SubCanvas.st	Mon Oct 11 19:45:57 1999 +0200
@@ -179,16 +179,7 @@
 
 !SubCanvas methodsFor:'building'!
 
-container:aView
-    super container:aView.
-    lateBuild == true ifTrue:[
-        lateBuild := false.
-        self rebuild
-    ].
-
-!
-
-rebuild
+XXrebuild
     "rebuild
     "
     |v subSpec savedView builderClass boundsOrLayout|
@@ -253,6 +244,75 @@
     "Modified: / 20.6.1998 / 14:29:00 / cg"
 !
 
+container:aView
+    super container:aView.
+    lateBuild == true ifTrue:[
+        lateBuild := false.
+        self rebuild
+    ].
+
+!
+
+rebuild
+    "rebuild
+    "
+    |v subSpec savedView builderClass|
+
+    superView isNil ifTrue:[
+        lateBuild := true.
+        ^ self
+    ].
+
+    clientView notNil ifTrue:[
+        clientView destroySubViews
+    ].
+
+    spec notNil ifTrue:[
+        (subSpec := spec) isSymbol ifTrue:[
+            client isNil ifTrue:[
+                'SubCanvas [warning]: no client - cannot build spec' infoPrintCR.
+                ^ self
+            ].
+            (subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[
+                "/ Transcript showCR:'SubCanvas: nil spec'.
+                ^ self
+            ]
+        ].
+
+        builder isNil ifTrue:[
+            client isNil ifTrue:[
+                builderClass := UIBuilder
+            ] ifFalse:[
+                builderClass := client builderClass
+            ].
+            builder := builderClass new.
+        ].
+
+        "/ old:
+        "/  builder buildFromSpec:subSpec in:clientView.
+
+        "/ new (let app know (somehow) that this is a build
+        "/ for a subcanvas (i.e. it can redefine the buildSubCanvas-method):
+
+        savedView := builder window.
+        builder window:clientView.
+        [
+            client buildSubCanvas:subSpec withBuilder:builder.
+        ] valueNowOrOnUnwindDo:[
+            builder window:savedView.
+        ].
+        clientViewIsScrolled ifTrue:[
+            clientView extent:((subSpec window layout) ? (subSpec window bounds)) extent.
+        ].
+
+        self realized ifTrue:[
+            clientView realizeAllSubViews
+        ]
+    ]
+
+    "Modified: / 20.6.1998 / 14:29:00 / cg"
+!
+
 releaseAllComponents
     clientView destroySubViews.
     builder := nil.
@@ -345,5 +405,5 @@
 !SubCanvas class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.19 1999-10-04 20:32:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.20 1999-10-11 17:45:57 stefan Exp $'
 ! !