fixes for different text sizes
authorClaus Gittinger <cg@exept.de>
Sat, 18 Nov 1995 18:03:34 +0100
changeset 91 ef89e1292812
parent 90 3c7a3015e178
child 92 ca6389321c2a
fixes for different text sizes
2ColTxtV.st
TwoColumnTextView.st
--- a/2ColTxtV.st	Fri Nov 17 18:38:51 1995 +0100
+++ b/2ColTxtV.st	Sat Nov 18 18:03:34 1995 +0100
@@ -24,7 +24,7 @@
     a view showing two texts side-by-side.
     Scrolling is synced, by always scrolling both views.
     This type of view is especially useful to show diff-lists,
-    code-versions, or other one-by-one vievable texts.
+    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.
@@ -50,7 +50,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.8 1995-11-11 16:28:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.9 1995-11-18 17:03:34 cg Exp $'
 ! !
 
 !TwoColumnTextView class methodsFor:'instance creation'!
@@ -58,34 +58,47 @@
 openOn:firstText and:secondText
     "open up a view showing firstText and secondText side-by-side"
 
-     |top v|
+    |top v|
+
+    top := StandardSystemView label:'differences'.
+    v := HVScrollableView 
+	       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
 
-     top := StandardSystemView label:'differences'.
-     v := HVScrollableView 
-		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)
+
+
+     TwoColumnTextView
+	openOn:('display.rc' asFilename contentsOfEntireFile)
+	and:('smalltalk.rc' asFilename contentsOfEntireFile)
+    "
+
+    "Modified: 18.11.1995 / 15:27:25 / cg"
 ! !
 
 !TwoColumnTextView methodsFor:'queries'!
 
 heightOfContents
-    ^ textView1 heightOfContents
+    ^ textView1 heightOfContents max:textView2 heightOfContents
 !
 
 widthOfContents
-    ^ textView1 widthOfContents
+    ^ textView1 widthOfContents max:textView2 widthOfContents
 !
 
 xOriginOfContents
-    ^ textView1 xOriginOfContents
+    ^ textView1 xOriginOfContents max:textView2 xOriginOfContents
 !
 
 yOriginOfContents
-    ^ textView1 yOriginOfContents
+    ^ textView1 yOriginOfContents max:textView2 yOriginOfContents
 !
 
 innerWidth
@@ -99,8 +112,25 @@
 !TwoColumnTextView methodsFor:'scrolling'!
 
 scrollVerticalToPercent:p
-    textView1 scrollVerticalToPercent:p.
-    textView2 scrollToLine:textView1 firstLineShown.
+    |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
@@ -141,11 +171,6 @@
     textView2 scrollToLine:lineNr
 !
 
-scrollHorizontalToPercent:p
-    textView1 scrollHorizontalToPercent:p.
-    textView2 scrollHorizontalTo:textView1 xOriginOfContents.
-!
-
 scrollLeft
     textView1 scrollLeft.
     textView2 scrollLeft
--- a/TwoColumnTextView.st	Fri Nov 17 18:38:51 1995 +0100
+++ b/TwoColumnTextView.st	Sat Nov 18 18:03:34 1995 +0100
@@ -24,7 +24,7 @@
     a view showing two texts side-by-side.
     Scrolling is synced, by always scrolling both views.
     This type of view is especially useful to show diff-lists,
-    code-versions, or other one-by-one vievable texts.
+    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.
@@ -50,7 +50,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.8 1995-11-11 16:28:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.9 1995-11-18 17:03:34 cg Exp $'
 ! !
 
 !TwoColumnTextView class methodsFor:'instance creation'!
@@ -58,34 +58,47 @@
 openOn:firstText and:secondText
     "open up a view showing firstText and secondText side-by-side"
 
-     |top v|
+    |top v|
+
+    top := StandardSystemView label:'differences'.
+    v := HVScrollableView 
+	       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
 
-     top := StandardSystemView label:'differences'.
-     v := HVScrollableView 
-		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)
+
+
+     TwoColumnTextView
+	openOn:('display.rc' asFilename contentsOfEntireFile)
+	and:('smalltalk.rc' asFilename contentsOfEntireFile)
+    "
+
+    "Modified: 18.11.1995 / 15:27:25 / cg"
 ! !
 
 !TwoColumnTextView methodsFor:'queries'!
 
 heightOfContents
-    ^ textView1 heightOfContents
+    ^ textView1 heightOfContents max:textView2 heightOfContents
 !
 
 widthOfContents
-    ^ textView1 widthOfContents
+    ^ textView1 widthOfContents max:textView2 widthOfContents
 !
 
 xOriginOfContents
-    ^ textView1 xOriginOfContents
+    ^ textView1 xOriginOfContents max:textView2 xOriginOfContents
 !
 
 yOriginOfContents
-    ^ textView1 yOriginOfContents
+    ^ textView1 yOriginOfContents max:textView2 yOriginOfContents
 !
 
 innerWidth
@@ -99,8 +112,25 @@
 !TwoColumnTextView methodsFor:'scrolling'!
 
 scrollVerticalToPercent:p
-    textView1 scrollVerticalToPercent:p.
-    textView2 scrollToLine:textView1 firstLineShown.
+    |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
@@ -141,11 +171,6 @@
     textView2 scrollToLine:lineNr
 !
 
-scrollHorizontalToPercent:p
-    textView1 scrollHorizontalToPercent:p.
-    textView2 scrollHorizontalTo:textView1 xOriginOfContents.
-!
-
 scrollLeft
     textView1 scrollLeft.
     textView2 scrollLeft