12
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
24
|
3 |
All Rights Reserved
|
12
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
49
|
13 |
SimpleView subclass:#TwoColumnTextView
|
24
|
14 |
instanceVariableNames:'textView1 textView2'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Text'
|
12
|
18 |
!
|
|
19 |
|
|
20 |
TwoColumnTextView comment:'
|
|
21 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
24
|
22 |
All Rights Reserved
|
12
|
23 |
|
49
|
24 |
$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.5 1995-05-03 00:42:17 claus Exp $
|
12
|
25 |
'!
|
|
26 |
|
|
27 |
!TwoColumnTextView class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
documentation
|
|
30 |
"
|
|
31 |
a view showing two texts side-by-side.
|
|
32 |
Scrolling is synced, by always scrolling both views.
|
|
33 |
This type of view is especially useful to show diff-lists,
|
14
|
34 |
code-versions, or other one-by-one vievable texts.
|
12
|
35 |
|
|
36 |
Usually, it does not make much sense, to put totally different
|
24
|
37 |
or unrelated texts into this kind of view.
|
|
38 |
|
|
39 |
See subclass DiffTextView for a real class;
|
|
40 |
see ChangesBrowsers compare operation for a real application
|
|
41 |
of this kind of views.
|
12
|
42 |
"
|
34
|
43 |
!
|
|
44 |
|
|
45 |
copyright
|
|
46 |
"
|
|
47 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
|
48 |
All Rights Reserved
|
|
49 |
|
|
50 |
This software is furnished under a license and may be used
|
|
51 |
only in accordance with the terms of that license and with the
|
|
52 |
inclusion of the above copyright notice. This software may not
|
|
53 |
be provided or otherwise made available to, or used by, any
|
|
54 |
other person. No title to or ownership of the software is
|
|
55 |
hereby transferred.
|
|
56 |
"
|
|
57 |
!
|
|
58 |
|
|
59 |
version
|
|
60 |
"
|
49
|
61 |
$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.5 1995-05-03 00:42:17 claus Exp $
|
34
|
62 |
"
|
12
|
63 |
! !
|
|
64 |
|
|
65 |
!TwoColumnTextView class methodsFor:'instance creation'!
|
|
66 |
|
|
67 |
openOn:firstText and:secondText
|
24
|
68 |
"open up a view showing firstText and secondText side-by-side"
|
12
|
69 |
|
|
70 |
|top v|
|
|
71 |
|
|
72 |
top := StandardSystemView label:'differences'.
|
24
|
73 |
v := HVScrollableView
|
|
74 |
for:self
|
|
75 |
miniScrollerH:true miniScrollerV:false
|
|
76 |
in:top.
|
12
|
77 |
v origin:0.0 @ 0.0 corner:1.0 @ 1.0.
|
|
78 |
v scrolledView text1:firstText text2:secondText.
|
|
79 |
^ top open
|
|
80 |
! !
|
|
81 |
|
|
82 |
!TwoColumnTextView methodsFor:'queries'!
|
|
83 |
|
|
84 |
heightOfContents
|
|
85 |
^ textView1 heightOfContents
|
|
86 |
!
|
|
87 |
|
|
88 |
widthOfContents
|
|
89 |
^ textView1 widthOfContents
|
|
90 |
!
|
|
91 |
|
|
92 |
xOriginOfContents
|
|
93 |
^ textView1 xOriginOfContents
|
|
94 |
!
|
|
95 |
|
|
96 |
yOriginOfContents
|
|
97 |
^ textView1 yOriginOfContents
|
|
98 |
!
|
|
99 |
|
|
100 |
innerWidth
|
|
101 |
^ textView1 innerWidth
|
|
102 |
!
|
|
103 |
|
|
104 |
innerHeight
|
|
105 |
^ textView1 innerHeight
|
|
106 |
! !
|
|
107 |
|
|
108 |
!TwoColumnTextView methodsFor:'scrolling'!
|
|
109 |
|
|
110 |
scrollVerticalToPercent:p
|
|
111 |
textView1 scrollVerticalToPercent:p.
|
|
112 |
textView2 scrollToLine:textView1 firstLineShown.
|
|
113 |
!
|
|
114 |
|
|
115 |
scrollDown:nLines
|
|
116 |
textView1 scrollDown:nLines.
|
|
117 |
textView2 scrollDown:nLines
|
|
118 |
!
|
|
119 |
|
|
120 |
scrollDown
|
|
121 |
self scrollDown:1.
|
|
122 |
!
|
|
123 |
|
|
124 |
scrollUp
|
|
125 |
self scrollUp:1.
|
|
126 |
!
|
|
127 |
|
|
128 |
scrollUp:nLines
|
|
129 |
textView1 scrollUp:nLines.
|
|
130 |
textView2 scrollUp:nLines
|
|
131 |
!
|
|
132 |
|
|
133 |
scrollLeft:nPixels
|
|
134 |
textView1 scrollLeft:nPixels.
|
|
135 |
textView2 scrollLeft:nPixels
|
|
136 |
!
|
|
137 |
|
|
138 |
scrollRight:nPixels
|
|
139 |
textView1 scrollRight:nPixels.
|
|
140 |
textView2 scrollRight:nPixels
|
|
141 |
!
|
|
142 |
|
|
143 |
scrollRight
|
|
144 |
textView1 scrollRight.
|
|
145 |
textView2 scrollRight
|
|
146 |
!
|
|
147 |
|
|
148 |
scrollToLine:lineNr
|
|
149 |
textView1 scrollToLine:lineNr.
|
|
150 |
textView2 scrollToLine:lineNr
|
|
151 |
!
|
|
152 |
|
|
153 |
scrollHorizontalToPercent:p
|
|
154 |
textView1 scrollHorizontalToPercent:p.
|
|
155 |
textView2 scrollHorizontalTo:textView1 xOriginOfContents.
|
|
156 |
!
|
|
157 |
|
|
158 |
scrollLeft
|
|
159 |
textView1 scrollLeft.
|
|
160 |
textView2 scrollLeft
|
|
161 |
! !
|
|
162 |
|
|
163 |
!TwoColumnTextView methodsFor:'initialization'!
|
|
164 |
|
|
165 |
initialize
|
|
166 |
|panel|
|
|
167 |
|
|
168 |
super initialize.
|
|
169 |
|
|
170 |
textView1 := TextView origin:0.0 @ 0.0
|
24
|
171 |
corner:0.5 @ 1.0
|
|
172 |
in:self.
|
12
|
173 |
|
|
174 |
textView1 borderWidth:1.
|
|
175 |
textView1 level:0.
|
|
176 |
|
|
177 |
textView2 := TextView origin:0.5 @ 0.0
|
24
|
178 |
corner:1.0 @ 1.0
|
|
179 |
in:self.
|
12
|
180 |
|
|
181 |
textView2 borderWidth:1.
|
|
182 |
textView2 level:0.
|
|
183 |
|
|
184 |
"
|
|
185 |
|v|
|
|
186 |
|
|
187 |
v := HVScrollableView for:TwoColumnTextView.
|
|
188 |
v scrolledView text1:('smalltalk.rc' asFilename readStream contents)
|
24
|
189 |
text2:('smalltalk_r.rc' asFilename readStream contents).
|
12
|
190 |
v open
|
|
191 |
"
|
|
192 |
! !
|
|
193 |
|
|
194 |
!TwoColumnTextView methodsFor:'accessing'!
|
|
195 |
|
|
196 |
text1:t1 text2:t2
|
|
197 |
textView1 list:t1 asText.
|
|
198 |
textView2 list:t2 asText.
|
|
199 |
! !
|