SubCanvas.st
changeset 3354 1f993ecf2265
parent 3352 4ccd30154ced
child 3392 0d0461a20004
--- a/SubCanvas.st	Fri Feb 29 11:20:38 2008 +0100
+++ b/SubCanvas.st	Fri Feb 29 14:19:07 2008 +0100
@@ -42,9 +42,10 @@
     a view for a subApplication.
 
     Made to be VW compatible as much as possible (try opening a RefactoringBrowser ...).
-    However, the default setup is not very useful, to embedd arbitrary applications
+    However, the default setup is not very useful to embed arbitrary applications
     which are meant to be separate stand-alone applications.
-    Play with the settings:
+
+    Use the settings:
         keepClientView          (default: true)
         useApplicationSubView   (default: false)
         useOwnBuilder           (default: false)
@@ -71,8 +72,6 @@
 !SubCanvas methodsFor:'accessing'!
 
 builder
-    "return the value of the instance variable 'builder' (automatically generated)"
-
     ^ builder
 !
 
@@ -81,8 +80,6 @@
 !
 
 client
-    "return the value of the instance variable 'client' (automatically generated)"
-
     ^ client
 !
 
@@ -120,10 +117,10 @@
     ^ clientView
 !
 
-makeClientViewScrollable:aBoolean
+makeClientViewScrollable:shouldBeScrollable
     |vs|
 
-    aBoolean ~~ clientViewIsScrolled ifTrue:[
+    shouldBeScrollable ~~ clientViewIsScrolled ifTrue:[
         clientView isNil ifTrue:[
             useApplicationSubView ifTrue:[
                 clientView := ApplicationSubView new.
@@ -131,13 +128,13 @@
                 clientView := View new.
             ]
         ].
-        aBoolean ifTrue:[
+        shouldBeScrollable ifTrue:[
             self scrolledView:(vs := ViewScroller new).
             vs scrolledView:clientView.
         ] ifFalse:[
             self scrolledView:clientView.
         ].
-        clientViewIsScrolled := aBoolean.
+        clientViewIsScrolled := shouldBeScrollable.
     ]
 
     "Modified: / 30.1.2000 / 21:36:29 / cg"
@@ -150,14 +147,10 @@
 !
 
 spec
-    "return the value of the instance variable 'spec' (automatically generated)"
-
     ^ spec
 !
 
 spec:something
-    "set the value of the instance variable 'spec' (automatically generated)"
-
     spec := something.
     self rebuild.
 !
@@ -256,71 +249,6 @@
 
 !SubCanvas methodsFor:'building'!
 
-XXrebuild
-    "rebuild
-    "
-"/    | subSpec savedView builderClass boundsOrLayout|
-"/
-"/    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 buildSubCanvase-method
-"/        "/:
-"/        savedView := builder window.
-"/        builder window:clientView.
-"/        [
-"/            client buildSubCanvas:subSpec withBuilder:builder.
-"/        ] ensure:[
-"/            builder window:savedView.
-"/        ].
-"/        clientViewIsScrolled ifTrue:[
-"/            boundsOrLayout := builder spec window layout.
-"/            boundsOrLayout isNil ifTrue:[
-"/                 boundsOrLayout := builder spec window bounds
-"/            ].
-"/            clientView
-"/                extent:(boundsOrLayout rectangleRelativeTo:self bounds preferred:nil) extent.
-"/        ].
-"/
-"/        self realized ifTrue:[
-"/            clientView realizeAllSubViews
-"/        ]
-"/    ]
-"/
-"/    "Modified: / 20.6.1998 / 14:29:00 / cg"
-!
-
 container:aView
     super container:aView.
 
@@ -351,7 +279,8 @@
     ].
 
     spec notNil ifTrue:[
-        (subSpec := spec) isSymbol ifTrue:[
+        subSpec := spec.
+        subSpec isSymbol ifTrue:[
             client isNil ifTrue:[
                 clientHolder isNil ifTrue:[
                     ('SubCanvas [warning]: no client - cannot build spec: ' , spec) infoPrintCR.
@@ -410,7 +339,8 @@
             client builder:builder.
         ].
 
-        [   |savedSuperView|
+        [   
+            |savedSuperView|
 
             "/ kludge: need superView to be set correctly, in order for
             "/ postBuildAsSubCanvas to be invoked (instead of postBuild)
@@ -418,7 +348,10 @@
             savedSuperView := clientView superView.
             savedSuperView isNil ifTrue:[clientView setContainer:self].
             client buildSubCanvas:subSpec withBuilder:builder.
-            savedSuperView isNil ifTrue:[clientView setContainer:nil. self removeSubView:clientView. ].
+            savedSuperView isNil ifTrue:[
+                clientView setContainer:nil. 
+                self removeSubView:clientView.
+            ].
 
             keepClientView ifFalse:[    
                 (scrolledView notNil and:[clientView isComponentOf:scrolledView]) ifTrue:[
@@ -476,8 +409,6 @@
 !SubCanvas methodsFor:'change & update'!
 
 update:something with:aParameter from:changedObject
-    "one of my models changed its value
-    "
     (changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[
         self updateFromChannels.
         ^ self
@@ -486,14 +417,14 @@
 !
 
 updateFromChannels
-    "update canvas from channel
-    "
-    |newClient newSpec bldr|
+    "some of our channels (clientHolder, specHolder) changed"
+
+    |newClient newSpec uiBuilder|
 
     clientHolder isNil ifTrue:[
         newClient := self application.
-        bldr := UIBuilder new.
-        bldr isSubBuilder:true.
+        uiBuilder := UIBuilder new.
+        uiBuilder isSubBuilder:true.
     ] ifFalse:[
         newClient := clientHolder value
     ].
@@ -512,7 +443,7 @@
         newClient := nil.
         newSpec := #windowSpec.  "/ is that true ?
     ].
-    self client:newClient spec:newSpec builder:bldr
+    self client:newClient spec:newSpec builder:uiBuilder
 
     "Modified: / 5.8.1999 / 13:35:26 / cg"
 ! !
@@ -520,9 +451,7 @@
 !SubCanvas methodsFor:'initialization'!
 
 initialize
-
     super initialize.
-"/    self scrolledView:(clientView := ApplicationSubView new).
     clientViewIsScrolled := false.
 
     "/ these defaults make subCanvas compatible with VW;
@@ -581,18 +510,13 @@
 !SubCanvas methodsFor:'queries'!
 
 application
-    "return the application, under which this view was opened,
-    "
+    "return the application, under which this view was opened"
 
-    client notNil ifTrue:[
-        ^ client
-    ].
-    ^ super application
-
+    ^ client ? super application
 ! !
 
 !SubCanvas class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.59 2008-02-28 16:23:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.60 2008-02-29 13:19:07 stefan Exp $'
 ! !