my logical size-of-contents changes if any subview changes its contents
authorClaus Gittinger <cg@exept.de>
Fri, 24 Nov 1995 11:29:44 +0100
changeset 101 85422b262e51
parent 100 3d33433f459c
child 102 f85d1c7ca56f
my logical size-of-contents changes if any subview changes its contents
SyncMCTxtV.st
SyncedMultiColumnTextView.st
--- a/SyncMCTxtV.st	Thu Nov 23 19:18:39 1995 +0100
+++ b/SyncMCTxtV.st	Fri Nov 24 11:29:44 1995 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -24,7 +24,7 @@
 copyright
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -50,7 +50,7 @@
 !
 
 version
-^ '$Header: /cvs/stx/stx/libwidg2/Attic/SyncMCTxtV.st,v 1.1 1995-11-20 13:21:37 cg Exp $'
+^ '$Header: /cvs/stx/stx/libwidg2/Attic/SyncMCTxtV.st,v 1.2 1995-11-24 10:29:44 cg Exp $'
 ! !
 
 !SyncedMultiColumnTextView methodsFor:'initialization'!
@@ -65,26 +65,42 @@
     wEach := (1 / n) asFloat.
     org := 0.0.
     1 to:n do:[:i |
-        |textView|
+	|textView|
 
-        i == n ifTrue:[
-            crn := 1.0
-        ] ifFalse:[
-            crn := org + wEach
-        ].
-        textView:= TextView 
-                        origin:org @ 0.0
-                        corner:crn @ 1.0
-                            in:self.
+	i == n ifTrue:[
+	    crn := 1.0
+	] ifFalse:[
+	    crn := org + wEach
+	].
+	textView:= TextView 
+			origin:org @ 0.0
+			corner:crn @ 1.0
+			    in:self.
 
-        textView borderWidth:1.
-        textView level:0.
-        textViews at:i put:textView.
-        org := org + wEach
+	textView borderWidth:1.
+	textView level:0.
+	textView addDependent:self.
+	textViews at:i put:textView.
+	org := org + wEach
     ].
 
     "Created: 20.11.1995 / 13:06:16 / cg"
-    "Modified: 20.11.1995 / 13:20:01 / cg"
+    "Modified: 24.11.1995 / 11:08:31 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'change & update'!
+
+update:something with:someArgument from:changedObject
+    "/
+    "/ if any of my views changes its contents,
+    "/ I have logically changed my contents -> to give scrollbar
+    "/ a chance to update
+    "/
+    something == #sizeOfContents ifTrue:[
+	self changed:something
+    ].
+
+    "Created: 24.11.1995 / 11:11:22 / cg"
 ! !
 
 !SyncedMultiColumnTextView methodsFor:'queries'!
@@ -201,17 +217,17 @@
 
     max := 0.
     textViews do:[:thisView |
-        thisView heightOfContents > max ifTrue:[
-            max := thisView heightOfContents.
-            master := thisView
-        ]
+	thisView heightOfContents > max ifTrue:[
+	    max := thisView heightOfContents.
+	    master := thisView
+	]
     ].
     textViews do:[:v |
-        v == master ifTrue:[
-            master scrollVerticalToPercent:p.
-        ] ifFalse:[
-            v scrollToLine:master firstLineShown.
-        ]
+	v == master ifTrue:[
+	    master scrollVerticalToPercent:p.
+	] ifFalse:[
+	    v scrollToLine:master firstLineShown.
+	]
     ]
 
     "Created: 20.11.1995 / 13:14:41 / cg"
--- a/SyncedMultiColumnTextView.st	Thu Nov 23 19:18:39 1995 +0100
+++ b/SyncedMultiColumnTextView.st	Fri Nov 24 11:29:44 1995 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -24,7 +24,7 @@
 copyright
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -50,7 +50,7 @@
 !
 
 version
-^ '$Header: /cvs/stx/stx/libwidg2/SyncedMultiColumnTextView.st,v 1.1 1995-11-20 13:21:37 cg Exp $'
+^ '$Header: /cvs/stx/stx/libwidg2/SyncedMultiColumnTextView.st,v 1.2 1995-11-24 10:29:44 cg Exp $'
 ! !
 
 !SyncedMultiColumnTextView methodsFor:'initialization'!
@@ -65,26 +65,42 @@
     wEach := (1 / n) asFloat.
     org := 0.0.
     1 to:n do:[:i |
-        |textView|
+	|textView|
 
-        i == n ifTrue:[
-            crn := 1.0
-        ] ifFalse:[
-            crn := org + wEach
-        ].
-        textView:= TextView 
-                        origin:org @ 0.0
-                        corner:crn @ 1.0
-                            in:self.
+	i == n ifTrue:[
+	    crn := 1.0
+	] ifFalse:[
+	    crn := org + wEach
+	].
+	textView:= TextView 
+			origin:org @ 0.0
+			corner:crn @ 1.0
+			    in:self.
 
-        textView borderWidth:1.
-        textView level:0.
-        textViews at:i put:textView.
-        org := org + wEach
+	textView borderWidth:1.
+	textView level:0.
+	textView addDependent:self.
+	textViews at:i put:textView.
+	org := org + wEach
     ].
 
     "Created: 20.11.1995 / 13:06:16 / cg"
-    "Modified: 20.11.1995 / 13:20:01 / cg"
+    "Modified: 24.11.1995 / 11:08:31 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'change & update'!
+
+update:something with:someArgument from:changedObject
+    "/
+    "/ if any of my views changes its contents,
+    "/ I have logically changed my contents -> to give scrollbar
+    "/ a chance to update
+    "/
+    something == #sizeOfContents ifTrue:[
+	self changed:something
+    ].
+
+    "Created: 24.11.1995 / 11:11:22 / cg"
 ! !
 
 !SyncedMultiColumnTextView methodsFor:'queries'!
@@ -201,17 +217,17 @@
 
     max := 0.
     textViews do:[:thisView |
-        thisView heightOfContents > max ifTrue:[
-            max := thisView heightOfContents.
-            master := thisView
-        ]
+	thisView heightOfContents > max ifTrue:[
+	    max := thisView heightOfContents.
+	    master := thisView
+	]
     ].
     textViews do:[:v |
-        v == master ifTrue:[
-            master scrollVerticalToPercent:p.
-        ] ifFalse:[
-            v scrollToLine:master firstLineShown.
-        ]
+	v == master ifTrue:[
+	    master scrollVerticalToPercent:p.
+	] ifFalse:[
+	    v scrollToLine:master firstLineShown.
+	]
     ]
 
     "Created: 20.11.1995 / 13:14:41 / cg"