new (abstract) class for multiple sync-scrolled textviews
authorClaus Gittinger <cg@exept.de>
Mon, 20 Nov 1995 14:21:37 +0100
changeset 92 ca6389321c2a
parent 91 ef89e1292812
child 93 f3158d8e67d0
new (abstract) class for multiple sync-scrolled textviews (preparation for Diff3View ...)
2ColTxtV.st
SyncMCTxtV.st
SyncedMultiColumnTextView.st
TwoColumnTextView.st
--- a/2ColTxtV.st	Sat Nov 18 18:03:34 1995 +0100
+++ b/2ColTxtV.st	Mon Nov 20 14:21:37 1995 +0100
@@ -10,8 +10,12 @@
  hereby transferred.
 "
 
-SimpleView subclass:#TwoColumnTextView
-	 instanceVariableNames:'textView1 textView2'
+    "Created: 20.11.1995 / 13:21:17 / cg"
+
+'From Smalltalk/X, Version:2.10.8 on 20-nov-1995 at 14:12:35'                   !
+
+SyncedMultiColumnTextView subclass:#TwoColumnTextView
+	 instanceVariableNames:''
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Views-Text'
@@ -19,6 +23,22 @@
 
 !TwoColumnTextView class methodsFor:'documentation'!
 
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+	      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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+    "Created: 20.11.1995 / 13:21:17 / cg"
+!
+
 documentation
 "
     a view showing two texts side-by-side.
@@ -33,25 +53,40 @@
     see ChangesBrowsers compare operation for a real application
     of this kind of views.
 "
+
+    "Created: 20.11.1995 / 13:21:17 / cg"
 !
 
-copyright
+examples
 "
- COPYRIGHT (c) 1994 by Claus Gittinger
-	      All Rights Reserved
+     TwoColumnTextView are currently not directly used by the system.
+     However, it is used as an abstract superclass for DiffTextView.
+     See more examples there.
+     (you may find nice uses for it anyway ...)
+
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        and:('display.rc' asFilename contentsOfEntireFile)
+
 
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
- be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
- hereby transferred.
+     TwoColumnTextView
+        openOn:('display.rc' asFilename contentsOfEntireFile)
+        and:('smalltalk.rc' asFilename contentsOfEntireFile)
+
+
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        label:'smalltalk.rc'
+        and:('display.rc' asFilename contentsOfEntireFile)
+        label:'display.rc'
 "
+
+    "Created: 20.11.1995 / 13:21:42 / cg"
+    "Modified: 20.11.1995 / 13:23:12 / cg"
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.9 1995-11-18 17:03:34 cg Exp $'
-! !
+^ '$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.10 1995-11-20 13:21:37 cg Exp $'! !
 
 !TwoColumnTextView class methodsFor:'instance creation'!
 
@@ -60,154 +95,74 @@
 
     |top v|
 
-    top := StandardSystemView label:'differences'.
+    top := StandardSystemView label:'two texts'.
     v := HVScrollableView 
-	       for:self 
-	       miniScrollerH:true miniScrollerV:false
-	       in:top.
+               for:self 
+               miniScrollerH:true miniScrollerV:false
+               in:top.
     v origin:0.0 @ 0.0 corner:1.0 @ 1.0.
     v scrolledView text1:firstText text2:secondText.
     ^ top open
 
     "
      TwoColumnTextView
-	openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
-	and:('display.rc' asFilename contentsOfEntireFile)
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        and:('display.rc' asFilename contentsOfEntireFile)
 
 
      TwoColumnTextView
-	openOn:('display.rc' asFilename contentsOfEntireFile)
-	and:('smalltalk.rc' asFilename contentsOfEntireFile)
+        openOn:('display.rc' asFilename contentsOfEntireFile)
+        and:('smalltalk.rc' asFilename contentsOfEntireFile)
     "
 
-    "Modified: 18.11.1995 / 15:27:25 / cg"
-! !
-
-!TwoColumnTextView methodsFor:'queries'!
-
-heightOfContents
-    ^ textView1 heightOfContents max:textView2 heightOfContents
-!
-
-widthOfContents
-    ^ textView1 widthOfContents max:textView2 widthOfContents
-!
-
-xOriginOfContents
-    ^ textView1 xOriginOfContents max:textView2 xOriginOfContents
-!
-
-yOriginOfContents
-    ^ textView1 yOriginOfContents max:textView2 yOriginOfContents
-!
-
-innerWidth
-    ^ textView1 innerWidth
-!
-
-innerHeight
-    ^ textView1 innerHeight
-! !
-
-!TwoColumnTextView methodsFor:'scrolling'!
-
-scrollVerticalToPercent:p
-    |master slave|
-
-    textView1 heightOfContents > textView2 heightOfContents ifTrue:[
-	master := textView1.
-	slave := textView2.
-    ] ifFalse:[
-	master := textView2.
-	slave := textView1.
-    ].
-
-    master scrollVerticalToPercent:p.
-    slave scrollToLine:master firstLineShown.
-
-    "Modified: 18.11.1995 / 15:25:53 / cg"
-!
-
-scrollHorizontalToPercent:p
-    textView1 scrollHorizontalToPercent:p.
-    textView2 scrollHorizontalTo:textView1 xOriginOfContents.
-!
-
-scrollDown:nLines
-    textView1 scrollDown:nLines.
-    textView2 scrollDown:nLines
+    "Modified: 20.11.1995 / 13:36:15 / cg"
 !
 
-scrollDown
-    self scrollDown:1.
-!
+openOn:firstText label:firstLabel and:secondText label:secondLabel
+    "open up a view showing firstText and secondText side-by-side,
+     and labels for both views."
 
-scrollUp
-    self scrollUp:1.
-!
+    |top v l1 l2|
 
-scrollUp:nLines
-    textView1 scrollUp:nLines.
-    textView2 scrollUp:nLines
-!
-
-scrollLeft:nPixels
-    textView1 scrollLeft:nPixels.
-    textView2 scrollLeft:nPixels
-!
+    top := StandardSystemView label:'two texts'.
+    l1 := Label label:firstLabel in:top.
+    l1 origin:0.0@0.0 corner:0.5@(l1 height).
+    l2 := Label label:secondLabel in:top.
+    l2 origin:0.5@0.0 corner:1.0@(l1 height).
 
-scrollRight:nPixels
-    textView1 scrollRight:nPixels.
-    textView2 scrollRight:nPixels
-!
+    v := HVScrollableView 
+               for:self 
+               miniScrollerH:true miniScrollerV:false
+               in:top.
+    v origin:0.0 @ (l1 height + ViewSpacing) corner:1.0 @ 1.0.
+    v scrolledView text1:firstText text2:secondText.
+    ^ top open
 
-scrollRight
-    textView1 scrollRight.
-    textView2 scrollRight
-!
+    "
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        label:'smalltalk.rc'
+        and:('display.rc' asFilename contentsOfEntireFile)
+        label:'display.rc'
+    "
 
-scrollToLine:lineNr
-    textView1 scrollToLine:lineNr.
-    textView2 scrollToLine:lineNr
-!
-
-scrollLeft
-    textView1 scrollLeft.
-    textView2 scrollLeft
+    "Modified: 20.11.1995 / 13:36:20 / cg"
 ! !
 
-!TwoColumnTextView methodsFor:'initialization'!
-
-initialize
-    super initialize.
-
-    textView1 := TextView origin:0.0 @ 0.0
-			  corner:0.5 @ 1.0
-			      in:self.
-
-    textView1 borderWidth:1.
-    textView1 level:0. 
+!TwoColumnTextView class methodsFor:'specification'!
 
-    textView2 := TextView origin:0.5 @ 0.0
-			  corner:1.0 @ 1.0
-			      in:self.
-
-    textView2 borderWidth:1.
-    textView2 level:0. 
+numberOfViews
+    ^ 2
 
-    "
-     |v|
-
-     v := HVScrollableView for:TwoColumnTextView.
-     v scrolledView text1:('smalltalk.rc' asFilename readStream contents)
-		    text2:('smalltalk_r.rc' asFilename readStream contents).
-     v open
-    "
+    "Created: 20.11.1995 / 13:17:00 / cg"
 ! !
 
 !TwoColumnTextView methodsFor:'accessing'!
 
 text1:t1 text2:t2
-    textView1 list:t1 asText.
-    textView2 list:t2 asText.
+    (textViews at:1) list:t1 asText.
+    (textViews at:2) list:t2 asText.
+
+    "Created: 20.11.1995 / 13:20:39 / cg"
 ! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SyncMCTxtV.st	Mon Nov 20 14:21:37 1995 +0100
@@ -0,0 +1,219 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+'From Smalltalk/X, Version:2.10.8 on 20-nov-1995 at 14:11:21'                   !
+
+SimpleView subclass:#SyncedMultiColumnTextView
+	 instanceVariableNames:'textViews'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Views-Text'
+!
+
+!SyncedMultiColumnTextView class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    abstract superclass for multi-col textviews.
+    Scrolling is synced, by always scrolling all views.
+    This type of view is especially useful to show diff-lists,
+    code-versions, or other one-by-one viewable texts.
+
+    Usually, it does not make much sense, to put totally different
+    or unrelated texts into this kind of view.
+
+    See concrete examples as TwoColumnTextView, DiffTextView etc.
+"
+!
+
+version
+^ '$Header: /cvs/stx/stx/libwidg2/Attic/SyncMCTxtV.st,v 1.1 1995-11-20 13:21:37 cg Exp $'
+! !
+
+!SyncedMultiColumnTextView methodsFor:'initialization'!
+
+initialize
+    |n wEach org crn|
+
+    super initialize.
+
+    n := self class numberOfViews.
+    textViews := Array new:n.
+    wEach := (1 / n) asFloat.
+    org := 0.0.
+    1 to:n do:[:i |
+        |textView|
+
+        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
+    ].
+
+    "Created: 20.11.1995 / 13:06:16 / cg"
+    "Modified: 20.11.1995 / 13:20:01 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'queries'!
+
+heightOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView heightOfContents)]
+
+    "Created: 20.11.1995 / 13:08:25 / cg"
+!
+
+innerHeight 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView innerHeight)]
+
+    "Created: 20.11.1995 / 13:08:42 / cg"
+!
+
+innerWidth 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView innerWidth)]
+
+    "Created: 20.11.1995 / 13:08:49 / cg"
+!
+
+widthOfContents 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView widthOfContents)]
+
+    "Created: 20.11.1995 / 13:08:59 / cg"
+!
+
+xOriginOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView xOriginOfContents)]
+
+    "Created: 20.11.1995 / 13:09:11 / cg"
+!
+
+yOriginOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView yOriginOfContents)]
+
+    "Created: 20.11.1995 / 13:09:18 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'scrolling'!
+
+scrollDown
+    self scrollDown:1.
+
+    "Created: 20.11.1995 / 13:01:16 / cg"
+!
+
+scrollDown:nLines
+    textViews do:[:thisView | thisView scrollDown:nLines].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+!
+
+scrollHorizontalToPercent:p
+    |v1|
+
+    (v1 := textViews at:1) scrollHorizontalToPercent:p.
+    textViews from:2 to:(textViews size) do:[:thisView | thisView scrollHorizontalTo:v1 xOriginOfContents]
+
+    "Created: 20.11.1995 / 13:12:16 / cg"
+!
+
+scrollLeft
+    textViews do:[:thisView | thisView scrollLeft].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:45 / cg"
+!
+
+scrollLeft:nPixels
+    textViews do:[:thisView | thisView scrollLeft:nPixels].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:49 / cg"
+!
+
+scrollRight
+    textViews do:[:thisView | thisView scrollRight].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:39 / cg"
+!
+
+scrollRight:nPixels
+    textViews do:[:thisView | thisView scrollRight:nPixels].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:27 / cg"
+!
+
+scrollToLine:lineNr
+    textViews do:[:thisView | thisView scrollToLine:lineNr].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:07 / cg"
+!
+
+scrollUp
+    self scrollUp:1.
+
+    "Created: 20.11.1995 / 13:01:16 / cg"
+!
+
+scrollUp:nLines
+    textViews do:[:thisView | thisView scrollUp:nLines].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:14:51 / cg"
+!
+
+scrollVerticalToPercent:p
+    |master max|
+
+    max := 0.
+    textViews do:[:thisView |
+        thisView heightOfContents > max ifTrue:[
+            max := thisView heightOfContents.
+            master := thisView
+        ]
+    ].
+    textViews do:[:v |
+        v == master ifTrue:[
+            master scrollVerticalToPercent:p.
+        ] ifFalse:[
+            v scrollToLine:master firstLineShown.
+        ]
+    ]
+
+    "Created: 20.11.1995 / 13:14:41 / cg"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SyncedMultiColumnTextView.st	Mon Nov 20 14:21:37 1995 +0100
@@ -0,0 +1,219 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+'From Smalltalk/X, Version:2.10.8 on 20-nov-1995 at 14:11:21'                   !
+
+SimpleView subclass:#SyncedMultiColumnTextView
+	 instanceVariableNames:'textViews'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Views-Text'
+!
+
+!SyncedMultiColumnTextView class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    abstract superclass for multi-col textviews.
+    Scrolling is synced, by always scrolling all views.
+    This type of view is especially useful to show diff-lists,
+    code-versions, or other one-by-one viewable texts.
+
+    Usually, it does not make much sense, to put totally different
+    or unrelated texts into this kind of view.
+
+    See concrete examples as TwoColumnTextView, DiffTextView etc.
+"
+!
+
+version
+^ '$Header: /cvs/stx/stx/libwidg2/SyncedMultiColumnTextView.st,v 1.1 1995-11-20 13:21:37 cg Exp $'
+! !
+
+!SyncedMultiColumnTextView methodsFor:'initialization'!
+
+initialize
+    |n wEach org crn|
+
+    super initialize.
+
+    n := self class numberOfViews.
+    textViews := Array new:n.
+    wEach := (1 / n) asFloat.
+    org := 0.0.
+    1 to:n do:[:i |
+        |textView|
+
+        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
+    ].
+
+    "Created: 20.11.1995 / 13:06:16 / cg"
+    "Modified: 20.11.1995 / 13:20:01 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'queries'!
+
+heightOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView heightOfContents)]
+
+    "Created: 20.11.1995 / 13:08:25 / cg"
+!
+
+innerHeight 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView innerHeight)]
+
+    "Created: 20.11.1995 / 13:08:42 / cg"
+!
+
+innerWidth 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView innerWidth)]
+
+    "Created: 20.11.1995 / 13:08:49 / cg"
+!
+
+widthOfContents 
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView widthOfContents)]
+
+    "Created: 20.11.1995 / 13:08:59 / cg"
+!
+
+xOriginOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView xOriginOfContents)]
+
+    "Created: 20.11.1995 / 13:09:11 / cg"
+!
+
+yOriginOfContents
+    ^ textViews inject:0 into:[:maxSoFar :thisView | maxSoFar max:(thisView yOriginOfContents)]
+
+    "Created: 20.11.1995 / 13:09:18 / cg"
+! !
+
+!SyncedMultiColumnTextView methodsFor:'scrolling'!
+
+scrollDown
+    self scrollDown:1.
+
+    "Created: 20.11.1995 / 13:01:16 / cg"
+!
+
+scrollDown:nLines
+    textViews do:[:thisView | thisView scrollDown:nLines].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+!
+
+scrollHorizontalToPercent:p
+    |v1|
+
+    (v1 := textViews at:1) scrollHorizontalToPercent:p.
+    textViews from:2 to:(textViews size) do:[:thisView | thisView scrollHorizontalTo:v1 xOriginOfContents]
+
+    "Created: 20.11.1995 / 13:12:16 / cg"
+!
+
+scrollLeft
+    textViews do:[:thisView | thisView scrollLeft].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:45 / cg"
+!
+
+scrollLeft:nPixels
+    textViews do:[:thisView | thisView scrollLeft:nPixels].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:49 / cg"
+!
+
+scrollRight
+    textViews do:[:thisView | thisView scrollRight].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:39 / cg"
+!
+
+scrollRight:nPixels
+    textViews do:[:thisView | thisView scrollRight:nPixels].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:27 / cg"
+!
+
+scrollToLine:lineNr
+    textViews do:[:thisView | thisView scrollToLine:lineNr].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:15:07 / cg"
+!
+
+scrollUp
+    self scrollUp:1.
+
+    "Created: 20.11.1995 / 13:01:16 / cg"
+!
+
+scrollUp:nLines
+    textViews do:[:thisView | thisView scrollUp:nLines].
+
+    "Created: 20.11.1995 / 13:09:40 / cg"
+    "Modified: 20.11.1995 / 13:14:51 / cg"
+!
+
+scrollVerticalToPercent:p
+    |master max|
+
+    max := 0.
+    textViews do:[:thisView |
+        thisView heightOfContents > max ifTrue:[
+            max := thisView heightOfContents.
+            master := thisView
+        ]
+    ].
+    textViews do:[:v |
+        v == master ifTrue:[
+            master scrollVerticalToPercent:p.
+        ] ifFalse:[
+            v scrollToLine:master firstLineShown.
+        ]
+    ]
+
+    "Created: 20.11.1995 / 13:14:41 / cg"
+! !
+
--- a/TwoColumnTextView.st	Sat Nov 18 18:03:34 1995 +0100
+++ b/TwoColumnTextView.st	Mon Nov 20 14:21:37 1995 +0100
@@ -10,8 +10,12 @@
  hereby transferred.
 "
 
-SimpleView subclass:#TwoColumnTextView
-	 instanceVariableNames:'textView1 textView2'
+    "Created: 20.11.1995 / 13:21:17 / cg"
+
+'From Smalltalk/X, Version:2.10.8 on 20-nov-1995 at 14:12:35'                   !
+
+SyncedMultiColumnTextView subclass:#TwoColumnTextView
+	 instanceVariableNames:''
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Views-Text'
@@ -19,6 +23,22 @@
 
 !TwoColumnTextView class methodsFor:'documentation'!
 
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+	      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
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+    "Created: 20.11.1995 / 13:21:17 / cg"
+!
+
 documentation
 "
     a view showing two texts side-by-side.
@@ -33,25 +53,40 @@
     see ChangesBrowsers compare operation for a real application
     of this kind of views.
 "
+
+    "Created: 20.11.1995 / 13:21:17 / cg"
 !
 
-copyright
+examples
 "
- COPYRIGHT (c) 1994 by Claus Gittinger
-	      All Rights Reserved
+     TwoColumnTextView are currently not directly used by the system.
+     However, it is used as an abstract superclass for DiffTextView.
+     See more examples there.
+     (you may find nice uses for it anyway ...)
+
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        and:('display.rc' asFilename contentsOfEntireFile)
+
 
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
- be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
- hereby transferred.
+     TwoColumnTextView
+        openOn:('display.rc' asFilename contentsOfEntireFile)
+        and:('smalltalk.rc' asFilename contentsOfEntireFile)
+
+
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        label:'smalltalk.rc'
+        and:('display.rc' asFilename contentsOfEntireFile)
+        label:'display.rc'
 "
+
+    "Created: 20.11.1995 / 13:21:42 / cg"
+    "Modified: 20.11.1995 / 13:23:12 / cg"
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.9 1995-11-18 17:03:34 cg Exp $'
-! !
+^ '$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.10 1995-11-20 13:21:37 cg Exp $'! !
 
 !TwoColumnTextView class methodsFor:'instance creation'!
 
@@ -60,154 +95,74 @@
 
     |top v|
 
-    top := StandardSystemView label:'differences'.
+    top := StandardSystemView label:'two texts'.
     v := HVScrollableView 
-	       for:self 
-	       miniScrollerH:true miniScrollerV:false
-	       in:top.
+               for:self 
+               miniScrollerH:true miniScrollerV:false
+               in:top.
     v origin:0.0 @ 0.0 corner:1.0 @ 1.0.
     v scrolledView text1:firstText text2:secondText.
     ^ top open
 
     "
      TwoColumnTextView
-	openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
-	and:('display.rc' asFilename contentsOfEntireFile)
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        and:('display.rc' asFilename contentsOfEntireFile)
 
 
      TwoColumnTextView
-	openOn:('display.rc' asFilename contentsOfEntireFile)
-	and:('smalltalk.rc' asFilename contentsOfEntireFile)
+        openOn:('display.rc' asFilename contentsOfEntireFile)
+        and:('smalltalk.rc' asFilename contentsOfEntireFile)
     "
 
-    "Modified: 18.11.1995 / 15:27:25 / cg"
-! !
-
-!TwoColumnTextView methodsFor:'queries'!
-
-heightOfContents
-    ^ textView1 heightOfContents max:textView2 heightOfContents
-!
-
-widthOfContents
-    ^ textView1 widthOfContents max:textView2 widthOfContents
-!
-
-xOriginOfContents
-    ^ textView1 xOriginOfContents max:textView2 xOriginOfContents
-!
-
-yOriginOfContents
-    ^ textView1 yOriginOfContents max:textView2 yOriginOfContents
-!
-
-innerWidth
-    ^ textView1 innerWidth
-!
-
-innerHeight
-    ^ textView1 innerHeight
-! !
-
-!TwoColumnTextView methodsFor:'scrolling'!
-
-scrollVerticalToPercent:p
-    |master slave|
-
-    textView1 heightOfContents > textView2 heightOfContents ifTrue:[
-	master := textView1.
-	slave := textView2.
-    ] ifFalse:[
-	master := textView2.
-	slave := textView1.
-    ].
-
-    master scrollVerticalToPercent:p.
-    slave scrollToLine:master firstLineShown.
-
-    "Modified: 18.11.1995 / 15:25:53 / cg"
-!
-
-scrollHorizontalToPercent:p
-    textView1 scrollHorizontalToPercent:p.
-    textView2 scrollHorizontalTo:textView1 xOriginOfContents.
-!
-
-scrollDown:nLines
-    textView1 scrollDown:nLines.
-    textView2 scrollDown:nLines
+    "Modified: 20.11.1995 / 13:36:15 / cg"
 !
 
-scrollDown
-    self scrollDown:1.
-!
+openOn:firstText label:firstLabel and:secondText label:secondLabel
+    "open up a view showing firstText and secondText side-by-side,
+     and labels for both views."
 
-scrollUp
-    self scrollUp:1.
-!
+    |top v l1 l2|
 
-scrollUp:nLines
-    textView1 scrollUp:nLines.
-    textView2 scrollUp:nLines
-!
-
-scrollLeft:nPixels
-    textView1 scrollLeft:nPixels.
-    textView2 scrollLeft:nPixels
-!
+    top := StandardSystemView label:'two texts'.
+    l1 := Label label:firstLabel in:top.
+    l1 origin:0.0@0.0 corner:0.5@(l1 height).
+    l2 := Label label:secondLabel in:top.
+    l2 origin:0.5@0.0 corner:1.0@(l1 height).
 
-scrollRight:nPixels
-    textView1 scrollRight:nPixels.
-    textView2 scrollRight:nPixels
-!
+    v := HVScrollableView 
+               for:self 
+               miniScrollerH:true miniScrollerV:false
+               in:top.
+    v origin:0.0 @ (l1 height + ViewSpacing) corner:1.0 @ 1.0.
+    v scrolledView text1:firstText text2:secondText.
+    ^ top open
 
-scrollRight
-    textView1 scrollRight.
-    textView2 scrollRight
-!
+    "
+     TwoColumnTextView
+        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
+        label:'smalltalk.rc'
+        and:('display.rc' asFilename contentsOfEntireFile)
+        label:'display.rc'
+    "
 
-scrollToLine:lineNr
-    textView1 scrollToLine:lineNr.
-    textView2 scrollToLine:lineNr
-!
-
-scrollLeft
-    textView1 scrollLeft.
-    textView2 scrollLeft
+    "Modified: 20.11.1995 / 13:36:20 / cg"
 ! !
 
-!TwoColumnTextView methodsFor:'initialization'!
-
-initialize
-    super initialize.
-
-    textView1 := TextView origin:0.0 @ 0.0
-			  corner:0.5 @ 1.0
-			      in:self.
-
-    textView1 borderWidth:1.
-    textView1 level:0. 
+!TwoColumnTextView class methodsFor:'specification'!
 
-    textView2 := TextView origin:0.5 @ 0.0
-			  corner:1.0 @ 1.0
-			      in:self.
-
-    textView2 borderWidth:1.
-    textView2 level:0. 
+numberOfViews
+    ^ 2
 
-    "
-     |v|
-
-     v := HVScrollableView for:TwoColumnTextView.
-     v scrolledView text1:('smalltalk.rc' asFilename readStream contents)
-		    text2:('smalltalk_r.rc' asFilename readStream contents).
-     v open
-    "
+    "Created: 20.11.1995 / 13:17:00 / cg"
 ! !
 
 !TwoColumnTextView methodsFor:'accessing'!
 
 text1:t1 text2:t2
-    textView1 list:t1 asText.
-    textView2 list:t2 asText.
+    (textViews at:1) list:t1 asText.
+    (textViews at:2) list:t2 asText.
+
+    "Created: 20.11.1995 / 13:20:39 / cg"
 ! !
+