ScrView.st
changeset 814 5b80bc44f52b
parent 799 64f8700489a4
child 819 32ac89843fa8
--- a/ScrView.st	Thu Aug 01 18:24:25 1996 +0200
+++ b/ScrView.st	Thu Aug 01 18:25:33 1996 +0200
@@ -543,87 +543,83 @@
     |halfMargin twoMargins isOpenwin|
 
     scrolledView notNil ifTrue:[
-	scrolledView destroy.
-	scrolledView := nil.
+        scrolledView destroy.
+        scrolledView := nil.
     ].
     scrolledView := aView.
 
 "/    ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
     styleSheet is3D ifTrue:[
-	"3D look"
+        "3D look"
 
-	isOpenwin := styleSheet name = #openwin.
+        isOpenwin := styleSheet name = #openwin.
 
-	twoMargins := innerMargin * 2.
-	halfMargin := innerMargin // 2.
+        twoMargins := innerMargin * 2.
+        halfMargin := innerMargin // 2.
 
-	isOpenwin ifTrue:[
-	    scrolledView level:0.
-	    scrolledView borderWidth:1
-	] ifFalse:[
-	    scrolledView level:DefaultScrolledViewLevel.
+        isOpenwin ifTrue:[
+            scrolledView level:0.
+            scrolledView borderWidth:1
+        ] ifFalse:[
+            scrolledView level:DefaultScrolledViewLevel.
 "/            scrolledView level:-1
-	].
+        ].
 
-	(scrollBarPosition == #right) ifTrue:[
-	    scrolledView 
-		origin:halfMargin asPoint
-		extent:[(width - 
-			 scrollBar width - 
-			 twoMargins) 
-			@ 
-			(height - innerMargin)
-		       ].
-	] ifFalse:[
-	    scrolledView 
-		origin:((scrollBar origin x 
-			 + scrollBar width 
-			 + innerMargin)
-			@
-			halfMargin)
-		extent:[(width 
-			 - scrollBar width 
-			 - twoMargins) 
-			@ 
-			(height - innerMargin)
-		       ].
-	]
+        (scrollBarPosition == #right) ifTrue:[
+            scrolledView 
+                origin:halfMargin asPoint
+                extent:[(width - 
+                         scrollBar width - 
+                         twoMargins) 
+                        @ 
+                        (height - innerMargin)
+                       ].
+        ] ifFalse:[
+            scrolledView 
+                origin:((scrollBar origin x 
+                         + scrollBar width 
+                         + innerMargin)
+                        @
+                        halfMargin)
+                extent:[(width 
+                         - scrollBar width 
+                         - twoMargins) 
+                        @ 
+                        (height - innerMargin)
+                       ].
+        ]
     ] ifFalse:[
-	"non 3D look"
-	(scrollBarPosition == #right) ifTrue:[
-	    scrolledView 
-		origin:scrolledView borderWidth negated asPoint
-	] ifFalse:[
-	    scrolledView 
-		origin:((scrollBar width 
-			 + scrollBar borderWidth 
-			 - scrolledView borderWidth) 
-			@ 
-			scrolledView borderWidth negated)
-	].
-	scrolledView 
-	    extent:[
-		    (width 
-		     - scrollBar width 
-		     - scrolledView borderWidth) 
-		    @ 
-		    (height + (scrollBar borderWidth))
-		   ]
+        "non 3D look"
+        (scrollBarPosition == #right) ifTrue:[
+            scrolledView 
+                origin:scrolledView borderWidth negated asPoint
+        ] ifFalse:[
+            scrolledView 
+                origin:((scrollBar width 
+                         + scrollBar borderWidth 
+                         - scrolledView borderWidth) 
+                        @ 
+                        scrolledView borderWidth negated)
+        ].
+        scrolledView 
+            extent:[
+                    (width 
+                     - scrollBar width 
+                     - scrolledView borderWidth) 
+                    @ 
+                    (height + (scrollBar borderWidth))
+                   ]
     ].
 
     super addSubView:scrolledView.
     self setScrollActions.
 
-    "
-     pass my keyboard input (and other subviews input) 
-     to the scrolled view ...
-    "
-    self delegate:(KeyboardForwarder toView:scrolledView).
+    realized ifTrue:[
+        self sizeChanged:nil.
+        scrolledView realize
+    ].
 
-    realized ifTrue:[
-	self sizeChanged:nil.
-	scrolledView realize
-    ].
+    "Modified: 1.8.1996 / 12:44:27 / cg"
 ! !
 
 !ScrollableView methodsFor:'changes '!
@@ -721,22 +717,22 @@
     is3D := styleSheet is3D.
 
     isST80 ifTrue:[
-	innerMargin := 0
+        innerMargin := 0
     ] ifFalse:[
-	is3D ifTrue:[
-	    innerMargin := ViewSpacing.
-	] ifFalse:[
-	    innerMargin := 0    
-	]
+        is3D ifTrue:[
+            innerMargin := ViewSpacing.
+        ] ifFalse:[
+            innerMargin := 0    
+        ]
     ].
     negativeOffset := borderWidth negated.
 
     "create the scrollbar"
 
     isST80 ifTrue:[
-	cls := ScrollBar
+        cls := ScrollBar
     ] ifFalse:[
-	cls := miniV ifTrue:[MiniScroller] ifFalse:[ScrollBar].
+        cls := miniV ifTrue:[MiniScroller] ifFalse:[ScrollBar].
     ].
 
     scrollBar := cls in:self.
@@ -746,17 +742,17 @@
 
     "create the subview"
     is3D ifTrue:[
-	twoMargins := innerMargin * 2.
-	halfMargin := innerMargin // 2.
+        twoMargins := innerMargin * 2.
+        halfMargin := innerMargin // 2.
 
-	aViewClass notNil ifTrue:[
-	    scrolledView := aViewClass in:self.
-	    isOpenWin ifTrue:[
-		lvl := 0.
-		"/ scrolledView level:0.
-		scrolledView borderWidth:1.
-	    ] ifFalse:[
-		lvl := DefaultScrolledViewLevel.
+        aViewClass notNil ifTrue:[
+            scrolledView := aViewClass in:self.
+            isOpenWin ifTrue:[
+                lvl := 0.
+                "/ scrolledView level:0.
+                scrolledView borderWidth:1.
+            ] ifFalse:[
+                lvl := DefaultScrolledViewLevel.
 "/                isST80 ifTrue:[
 "/                    "/ scrolledView level:1.
 "/                    lvl := 1.
@@ -764,80 +760,77 @@
 "/                    "/ scrolledView level:-1
 "/                     lvl := -1
 "/                ]
-	    ].
-	    scrolledView level:lvl.
-	    extra := scrolledView borderWidth * 2.
-	].
+            ].
+            scrolledView level:lvl.
+            extra := scrolledView borderWidth * 2.
+        ].
 
-	scrollBar extent:[scrollBar extent x
-			  @ 
-			  (height - innerMargin "new:" + extra)].
-	scrolledView notNil ifTrue:[
-	    scrolledView
-		extent:[(width 
-			 - scrollBar width 
-			 - twoMargins) 
-			@ 
-			(height - innerMargin)].
-	].
+        scrollBar extent:[scrollBar extent x
+                          @ 
+                          (height - innerMargin "new:" + extra)].
+        scrolledView notNil ifTrue:[
+            scrolledView
+                extent:[(width 
+                         - scrollBar width 
+                         - twoMargins) 
+                        @ 
+                        (height - innerMargin)].
+        ].
 
-	(scrollBarPosition == #right) ifTrue:[
-	    scrollBar origin:[width - scrollBar extent x 
-				    - (scrollBar borderWidth * 2)
-				    - halfMargin
-			      @
-			      halfMargin].
+        (scrollBarPosition == #right) ifTrue:[
+            scrollBar origin:[width - scrollBar extent x 
+                                    - (scrollBar borderWidth * 2)
+                                    - halfMargin
+                              @
+                              halfMargin].
 
-	    scrolledView notNil ifTrue:[
-		scrolledView origin:halfMargin asPoint
-		]
-	] ifFalse:[
-	    scrollBar origin:halfMargin asPoint.
+            scrolledView notNil ifTrue:[
+                scrolledView origin:halfMargin asPoint
+                ]
+        ] ifFalse:[
+            scrollBar origin:halfMargin asPoint.
 
-	    scrolledView notNil ifTrue:[
-		scrolledView origin:((scrollBar origin x + scrollBar width + innerMargin)
-				     @
-				     halfMargin)
-	    ]
-	].
+            scrolledView notNil ifTrue:[
+                scrolledView origin:((scrollBar origin x + scrollBar width + innerMargin)
+                                     @
+                                     halfMargin)
+            ]
+        ].
     ] ifFalse:[
-	(scrollBarPosition == #right) ifTrue:[
-	    scrollBar origin:[width - scrollBar extent x 
-				    - scrollBar borderWidth
-			      @
-			      negativeOffset]
-	] ifFalse:[
-	    scrollBar origin:negativeOffset asPoint
-	].
-	scrollBar extent:[scrollBar extent x 
-			  @ 
-			  (height "+ (scrollBar borderWidth * 1)")].
+        (scrollBarPosition == #right) ifTrue:[
+            scrollBar origin:[width - scrollBar extent x 
+                                    - scrollBar borderWidth
+                              @
+                              negativeOffset]
+        ] ifFalse:[
+            scrollBar origin:negativeOffset asPoint
+        ].
+        scrollBar extent:[scrollBar extent x 
+                          @ 
+                          (height "+ (scrollBar borderWidth * 1)")].
 
-	aViewClass notNil ifTrue:[
-	    scrolledView := aViewClass in:self.
-	    (scrollBarPosition == #right) ifTrue:[
-		scrolledView origin:scrolledView borderWidth negated asPoint
-	    ] ifFalse:[
-		scrolledView origin:((scrollBar width + 
-				      scrollBar borderWidth - 
-				      scrolledView borderWidth) 
-				    @ 
-				    scrolledView borderWidth negated)
-	    ].
-	    scrolledView extent:[(width - scrollBar width - scrolledView borderWidth) 
-				 @ 
-				 (height + (scrollBar borderWidth))
-				]
-	].
+        aViewClass notNil ifTrue:[
+            scrolledView := aViewClass in:self.
+            (scrollBarPosition == #right) ifTrue:[
+                scrolledView origin:scrolledView borderWidth negated asPoint
+            ] ifFalse:[
+                scrolledView origin:((scrollBar width + 
+                                      scrollBar borderWidth - 
+                                      scrolledView borderWidth) 
+                                    @ 
+                                    scrolledView borderWidth negated)
+            ].
+            scrolledView extent:[(width - scrollBar width - scrolledView borderWidth) 
+                                 @ 
+                                 (height + (scrollBar borderWidth))
+                                ]
+        ].
     ].
     scrolledView notNil ifTrue:[
-	self setScrollActions.
-	"
-	 pass my keyboard input (and other subviews input) 
-	 to the scrolled view ...
-	"
-	self delegate:(KeyboardForwarder toView:scrolledView).
+        self setScrollActions.
     ]
+
+    "Modified: 1.8.1996 / 12:44:32 / cg"
 !
 
 realize
@@ -866,14 +859,22 @@
     lockUpdates := false.
 
     scrollBar scrollAction:[:position |
-	lockUpdates := true.
-	scrolledView scrollVerticalToPercent:position.
-	lockUpdates := false
+        lockUpdates := true.
+        scrolledView scrollVerticalToPercent:position.
+        lockUpdates := false
     ].
     scrollBar scrollUpAction:[scrolledView scrollUp].
     scrollBar scrollDownAction:[scrolledView scrollDown].
 
     scrolledView addDependent:self.
+
+    "
+     pass my keyboard input (and other subviews input) 
+     to the scrolled view ...
+    "
+    self delegate:(KeyboardForwarder toView:scrolledView).
+
+    "Modified: 1.8.1996 / 12:44:21 / cg"
 ! !
 
 !ScrollableView methodsFor:'queries'!
@@ -985,5 +986,5 @@
 !ScrollableView  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.37 1996-07-19 18:55:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ScrView.st,v 1.38 1996-08-01 16:25:33 cg Exp $'
 ! !