UseViewScroller
authorClaus Gittinger <cg@exept.de>
Tue, 11 Dec 2007 16:05:06 +0100
changeset 2213 cb1e13d68761
parent 2212 7224d23c4a37
child 2214 c31fd43cbac3
UseViewScroller
UIPainter.st
--- a/UIPainter.st	Tue Dec 11 16:05:04 2007 +0100
+++ b/UIPainter.st	Tue Dec 11 16:05:06 2007 +0100
@@ -14,7 +14,7 @@
 ResourceSpecEditor subclass:#UIPainter
 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
 		helpTool painterView painter'
-	classVariableNames:''
+	classVariableNames:'UseViewScroller'
 	poolDictionaries:''
 	category:'Interface-UIPainter'
 !
@@ -2807,7 +2807,7 @@
 !UIPainter methodsFor:'initialization'!
 
 initialize
-    |name|
+    |name scroller viewScroller|
 
     super initialize.
 
@@ -2828,8 +2828,22 @@
     painterView name:name.
     painterView label:name.
     painterView extent:(treeView windowSpecClass defaultExtentInUIPainter).
-    painter := UIPainterView in:painterView.
-    painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
+
+    UseViewScroller == true ifTrue:[
+        scroller := HVScrollableView for:ViewScroller in:painterView.
+        scroller
+            horizontalScrollable:true miniScroller:true;
+            verticalScrollable:true; verticalMini:true;
+            autoHideScrollBars:false;
+            layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
+        viewScroller := scroller scrolledView.
+        painter := UIPainterView new.
+        painter extent:300@300.
+        viewScroller scrolledView:painter.
+    ] ifFalse:[
+        painter := UIPainterView in:painterView.
+        painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
+    ].
     treeView := treeView canvas:painter specName:name.
     painter treeView:treeView.
     treeView model addDependent:self.
@@ -3103,10 +3117,13 @@
     |type|
 
     self painter topView == aView ifTrue:[
-	type := #Extent
+        type := #Extent
+    ] ifFalse:[
+        self canvas == aView ifTrue:[
+            type := #Extent
+        ]
     ].
     self layoutTool layoutView:aView type:type spec:aSpec
-
 !
 
 specClass
@@ -3138,6 +3155,19 @@
 
 !UIPainter methodsFor:'private-tools'!
 
+canvas
+    "returns the canvas view"
+
+    UseViewScroller == true ifTrue:[
+        ^ painter.
+    ].
+
+    ^ painter topView.
+"/    ^ treeView canvas
+
+    "Modified: / 05-09-2006 / 18:36:32 / cg"
+!
+
 helpTool
     "returns the help tool"
 
@@ -3256,7 +3286,7 @@
 
     treeView isCanvasSelected ifTrue:[
         spec := treeView canvasSpec.
-        view := self painter topView.
+        view := self canvas. "/ self painter topView.
     ] ifFalse:[
         (property := treeView propertySelected) notNil ifTrue:[
             treeView canResizeSelectedWidget ifTrue:[
@@ -3751,8 +3781,11 @@
             layoutTool layoutType == #Extent ifTrue:[
                 layoutView := layoutTool layoutView.
 
-                layoutView == painter topView ifTrue:[
-                    layoutView extent:layout
+                layoutView == self canvas ifTrue:[
+                    layoutView extent:layout.
+                    UseViewScroller == true ifTrue:[
+                        layoutView container container sizeChanged:nil.
+                    ].
                 ] ifFalse:[
                     spec useDefaultExtent:(layoutTool aspectFor:#useDefaultExtent) value.
                     spec useDefaultExtent ifTrue:[
@@ -4270,7 +4303,7 @@
 doSave
     "saves the window spec"
     
-    |code painter specClass|
+    |code painter specClass extentUsed|
 
     self askForSectionModification.
     self hasSpecClassAndSelector ifFalse:[
@@ -4293,11 +4326,12 @@
 
 "/    Transcript showCR:'generating windowSpec code...'.
 
-    (painter topView extent > (800 @ 600)) ifTrue:[
+    extentUsed := self canvas extent.
+    (extentUsed > (800 @ 600)) ifTrue:[
         Dialog 
             warn:(resources
                 stringWithCRs:'The application''s default window-size is taken from the current size and will be %1.\\This may be too small on some displays - if required, resize and save again.'
-                with:painter topView extent printString allBold)
+                with:extentUsed printString allBold)
     ].
 
     code := painter generateWindowSpecMethodSource withCRs.
@@ -4532,7 +4566,7 @@
     spec  menu:nil.
     spec flags:nil.
 
-    spec setAttributesIn:(self canvas topView) with:(UIBuilder new isEditing:true).
+    spec setAttributesIn:(self canvas "topView") with:(UIBuilder new isEditing:true).
 !
 
 exportedAspects
@@ -4664,16 +4698,15 @@
     fullSpec := FullSpec new.
     fullSpec name:specNameSymbol.
 
-    fullSpec fromBuilder:(self canvas topView)
-	      components:(SpecCollection new collection:aSpecArray).
+    fullSpec fromBuilder:(self canvas)
+              components:(SpecCollection new collection:aSpecArray).
 
     windowSpec notNil ifTrue:[
-	winSpec := fullSpec window.
-	winSpec copyValuesFromSpec:windowSpec.
-	winSpec name: winSpec label.
+        winSpec := fullSpec window.
+        winSpec copyValuesFromSpec:windowSpec.
+        winSpec name: winSpec label.
     ].    
     ^ fullSpec literalArrayEncoding.
-
 !
 
 setAttributesFromWindowSpec:aWindowSpec