TwoColumnTextView.st
changeset 92 ca6389321c2a
parent 91 ef89e1292812
child 158 431e38dfc5ab
--- 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"
 ! !
+