SubCanvas.st
changeset 1895 a1b2502c91d7
parent 1894 f0469313b9f8
child 1905 20ff18462cc6
--- a/SubCanvas.st	Wed Nov 22 18:00:20 2000 +0100
+++ b/SubCanvas.st	Wed Nov 22 18:30:13 2000 +0100
@@ -15,7 +15,8 @@
 
 ScrollableView subclass:#SubCanvas
 	instanceVariableNames:'builder spec client clientHolder specHolder clientView
-		clientViewIsScrolled lateBuild'
+		clientViewIsScrolled lateBuild useApplicationSubView
+		keepClientView useOwnBuilder'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Basic'
@@ -42,10 +43,17 @@
 "
     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
+    which are meant to be separate stand-alone applications.
+    Play with the settings:
+        keepClientView          (default: true)
+        useApplicationSubView   (default: false)
+        useOwnBuilder           (default: false)
+
     [author:]
         Claus Atzkern
 "
-
 ! !
 
 !SubCanvas class methodsFor:'defaults'!
@@ -111,7 +119,11 @@
 
     aBoolean ~~ clientViewIsScrolled ifTrue:[
         clientView isNil ifTrue:[
-            clientView := ApplicationSubView new.
+            useApplicationSubView ifTrue:[
+                clientView := ApplicationSubView new.
+            ] ifFalse:[
+                clientView := View new.
+            ]
         ].
         aBoolean ifTrue:[
             self scrolledView:(vs := ViewScroller new).
@@ -153,6 +165,20 @@
     "Created: / 10.3.1998 / 16:20:52 / stefan"
 ! !
 
+!SubCanvas methodsFor:'accessing - canvasView handling'!
+
+keepClientView:aBoolean
+    keepClientView := aBoolean
+!
+
+useApplicationSubView:aBoolean
+    useApplicationSubView := aBoolean
+!
+
+useOwnBuilder:aBoolean
+    useOwnBuilder := aBoolean
+! !
+
 !SubCanvas methodsFor:'accessing-channels'!
 
 clientHolder
@@ -319,20 +345,29 @@
         "/ new (let app know (somehow) that this is a build
         "/ for a subcanvas (i.e. it can redefine the buildSubCanvas-method):
 
-        (clientView notNil and:[clientView application ~~ client]) ifTrue:[
-            clientView destroy.
-            clientView := nil.
+        keepClientView ifFalse:[
+            (clientView notNil and:[clientView application ~~ client]) ifTrue:[
+                clientView destroy.
+                clientView := nil.
+            ].
         ].
 
         clientView isNil ifTrue:[
-            clientView := ApplicationSubView new.
-            clientView application:client.
+            useApplicationSubView ifTrue:[
+                clientView := ApplicationSubView new.
+                clientView application:client.
+            ] ifFalse:[
+                clientView := View new.
+            ]
         ].
 
         savedView := builder window.
-        savedBuilder := client builder.
         builder window:clientView.
-        client builder:builder.
+        useOwnBuilder ifTrue:[
+            savedBuilder := client builder.
+            client builder:builder.
+        ].
+
         [
             client buildSubCanvas:subSpec withBuilder:builder.
 
@@ -341,8 +376,10 @@
             savedView notNil ifTrue:[
                 builder window:savedView.
             ].
-            savedBuilder notNil ifTrue:[
-                client builder:savedBuilder.
+            useOwnBuilder ifTrue:[
+                savedBuilder notNil ifTrue:[
+                    client builder:savedBuilder.
+                ]
             ]
         ].
 
@@ -439,6 +476,12 @@
 "/    self scrolledView:(clientView := ApplicationSubView new).
     clientViewIsScrolled := false.
 
+    "/ these defaults make subCanvas compatible with VW;
+    "/ however, they make our life difficult sometimes.
+    keepClientView := true.
+    useApplicationSubView := false.
+    useOwnBuilder := false.
+
     spec := #windowSpec.
 
     "Modified: / 31.1.2000 / 16:56:31 / cg"
@@ -480,5 +523,5 @@
 !SubCanvas class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.30 2000-11-22 17:00:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.31 2000-11-22 17:30:13 cg Exp $'
 ! !