author | Claus Gittinger <cg@exept.de> |
Mon, 27 May 2019 18:28:14 +0200 | |
changeset 6056 | 9698742110a7 |
parent 6031 | 608583d9fea7 |
permissions | -rw-r--r-- |
6031 | 1 |
"{ Encoding: utf8 }" |
2 |
||
12 | 3 |
" |
4 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
24 | 5 |
All Rights Reserved |
12 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1979 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
5833 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
18 |
SyncedMultiColumnTextView subclass:#TwoColumnTextView |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
19 |
instanceVariableNames:'nextPrevButtonPanel' |
158 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
category:'Views-Text' |
|
12 | 23 |
! |
24 |
||
261 | 25 |
!TwoColumnTextView class methodsFor:'documentation'! |
12 | 26 |
|
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
27 |
copyright |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
28 |
" |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
29 |
COPYRIGHT (c) 1994 by Claus Gittinger |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
30 |
All Rights Reserved |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
31 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
32 |
This software is furnished under a license and may be used |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
33 |
only in accordance with the terms of that license and with the |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
34 |
inclusion of the above copyright notice. This software may not |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
35 |
be provided or otherwise made available to, or used by, any |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
36 |
other person. No title to or ownership of the software is |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
37 |
hereby transferred. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
38 |
" |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
39 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
40 |
"Created: 20.11.1995 / 13:21:17 / cg" |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
41 |
! |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
42 |
|
12 | 43 |
documentation |
44 |
" |
|
45 |
a view showing two texts side-by-side. |
|
46 |
Scrolling is synced, by always scrolling both views. |
|
47 |
This type of view is especially useful to show diff-lists, |
|
91
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
48 |
code-versions, or other one-by-one viewable texts. |
12 | 49 |
|
50 |
Usually, it does not make much sense, to put totally different |
|
24 | 51 |
or unrelated texts into this kind of view. |
52 |
||
53 |
See subclass DiffTextView for a real class; |
|
54 |
see ChangesBrowsers compare operation for a real application |
|
55 |
of this kind of views. |
|
162 | 56 |
|
57 |
[see also:] |
|
58 |
DiffTextView |
|
59 |
TextView EditTextView |
|
60 |
||
61 |
[author:] |
|
62 |
Claus Gittinger |
|
12 | 63 |
" |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
64 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
65 |
"Created: 20.11.1995 / 13:21:17 / cg" |
34 | 66 |
! |
67 |
||
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
68 |
examples |
34 | 69 |
" |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
70 |
TwoColumnTextView are currently not directly used by the system. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
71 |
However, it is used as an abstract superclass for DiffTextView. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
72 |
See more examples there. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
73 |
(you may find nice uses for it anyway ...) |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
74 |
|
161 | 75 |
[exBegin] |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
76 |
TwoColumnTextView |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
77 |
openOn:('smalltalk.rc' asFilename contents) |
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
78 |
and:('display.rc' asFilename contents) |
161 | 79 |
[exEnd] |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
80 |
|
34 | 81 |
|
161 | 82 |
[exBegin] |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
83 |
TwoColumnTextView |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
84 |
openOn:('display.rc' asFilename contents) |
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
85 |
and:('smalltalk.rc' asFilename contents) |
161 | 86 |
[exEnd] |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
87 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
88 |
|
161 | 89 |
[exBegin] |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
90 |
TwoColumnTextView |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
91 |
openOn:('smalltalk.rc' asFilename contents) |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
92 |
label:'smalltalk.rc' |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
93 |
and:('display.rc' asFilename contents) |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
94 |
label:'display.rc' |
161 | 95 |
[exEnd] |
34 | 96 |
" |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
97 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
98 |
"Created: 20.11.1995 / 13:21:42 / cg" |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
99 |
"Modified: 20.11.1995 / 13:23:12 / cg" |
158 | 100 |
! ! |
12 | 101 |
|
261 | 102 |
!TwoColumnTextView class methodsFor:'instance creation'! |
12 | 103 |
|
104 |
openOn:firstText and:secondText |
|
162 | 105 |
"open up a view showing firstText and secondText side-by-side. |
106 |
This does not make much sense for unrelated texts - of course." |
|
12 | 107 |
|
3760 | 108 |
^ self openOn:firstText and:secondText title:'Two Texts' |
12 | 109 |
|
91
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
110 |
" |
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
111 |
TwoColumnTextView |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
112 |
openOn:('smalltalk.rc' asFilename contentsOfEntireFile) |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
113 |
and:('display.rc' asFilename contentsOfEntireFile) |
91
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
114 |
|
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
115 |
|
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
116 |
TwoColumnTextView |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
117 |
openOn:('display.rc' asFilename contentsOfEntireFile) |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
118 |
and:('smalltalk.rc' asFilename contentsOfEntireFile) |
91
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
119 |
" |
ef89e1292812
fixes for different text sizes
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
120 |
|
162 | 121 |
"Modified: 25.4.1996 / 13:31:03 / cg" |
12 | 122 |
! |
123 |
||
2705 | 124 |
openOn:firstText and:secondText in:aView |
261 | 125 |
"open up a view showing firstText and secondText side-by-side. |
126 |
This does not make much sense for unrelated texts - of course." |
|
2705 | 127 |
|
128 |
self |
|
129 |
openOn:firstText |
|
130 |
label:nil |
|
131 |
and:secondText |
|
132 |
label:nil |
|
133 |
in:aView. |
|
261 | 134 |
! |
135 |
||
3760 | 136 |
openOn:firstText and:secondText title:titleOrNil |
137 |
"open up a view showing firstText and secondText side-by-side. |
|
138 |
This does not make much sense for unrelated texts - of course." |
|
139 |
||
140 |
|top| |
|
141 |
||
142 |
top := StandardSystemView new. |
|
143 |
titleOrNil notNil ifTrue:[ top label:titleOrNil ]. |
|
144 |
self openOn:firstText and:secondText in:top. |
|
145 |
^ top open |
|
146 |
||
147 |
" |
|
148 |
TwoColumnTextView |
|
149 |
openOn:('smalltalk.rc' asFilename contentsOfEntireFile) |
|
150 |
and:('display.rc' asFilename contentsOfEntireFile) |
|
151 |
||
152 |
||
153 |
TwoColumnTextView |
|
154 |
openOn:('display.rc' asFilename contentsOfEntireFile) |
|
155 |
and:('smalltalk.rc' asFilename contentsOfEntireFile) |
|
156 |
" |
|
157 |
||
158 |
"Modified: 25.4.1996 / 13:31:03 / cg" |
|
159 |
! |
|
160 |
||
2705 | 161 |
openOn:firstText label:firstLabel and:secondText label:secondLabel |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
162 |
"open up a view showing firstText and secondText side-by-side, |
162 | 163 |
and labels for both views. |
164 |
This does not make much sense for unrelated texts - of course." |
|
2705 | 165 |
|
3760 | 166 |
^ self |
6031 | 167 |
openOn:firstText label:firstLabel |
168 |
and:secondText label:secondLabel |
|
3760 | 169 |
title:'Two Texts' |
12 | 170 |
|
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
171 |
" |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
172 |
TwoColumnTextView |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
173 |
openOn:('smalltalk.rc' asFilename contentsOfEntireFile) |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
174 |
label:'smalltalk.rc' |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
175 |
and:('display.rc' asFilename contentsOfEntireFile) |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
176 |
label:'display.rc' |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
177 |
" |
6031 | 178 |
|
179 |
"Modified: / 15-08-1996 / 19:46:38 / cg" |
|
180 |
"Modified (format): / 07-03-2019 / 10:24:29 / Claus Gittinger" |
|
261 | 181 |
! |
182 |
||
3903
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
183 |
openOn:firstText label:firstLabel and:secondText label:secondLabel title:titleOrNil |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
184 |
"open up a view showing firstText and secondText side-by-side, |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
185 |
and labels for both views. |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
186 |
This does not make much sense for unrelated texts - of course." |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
187 |
|
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
188 |
|top v| |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
189 |
|
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
190 |
top := StandardSystemView new. |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
191 |
titleOrNil notNil ifTrue:[ top label:titleOrNil ]. |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
192 |
v := self |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
193 |
openOn:firstText |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
194 |
label:firstLabel |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
195 |
and:secondText |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
196 |
label:secondLabel |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
197 |
in:top. |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
198 |
top open. |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
199 |
^ v |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
200 |
|
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
201 |
" |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
202 |
TwoColumnTextView |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
203 |
openOn:('smalltalk.rc' asFilename contentsOfEntireFile) |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
204 |
label:'smalltalk.rc' |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
205 |
and:('display.rc' asFilename contentsOfEntireFile) |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
206 |
label:'display.rc' |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
207 |
" |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
208 |
"Modified: 15.8.1996 / 19:46:38 / cg" |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
209 |
! ! |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
210 |
|
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
211 |
!TwoColumnTextView class methodsFor:'instance creation-basic'! |
403f2d950895
category of: #openOn:label:and:label:in:
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
212 |
|
261 | 213 |
openOn:firstText label:firstLabel and:secondText label:secondLabel in:aView |
214 |
"open up a view showing firstText and secondText side-by-side, |
|
1504 | 215 |
and labels for both views. Return the (wrapped) diff-view. |
261 | 216 |
This does not make much sense for unrelated texts - of course." |
217 |
||
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
218 |
|hvs scr l1 l2| |
261 | 219 |
|
220 |
hvs := HVScrollableView |
|
221 |
for:self |
|
222 |
miniScrollerH:true miniScrollerV:false |
|
223 |
in:aView. |
|
224 |
||
225 |
scr := hvs scrolledView. |
|
226 |
||
227 |
(firstLabel notNil and:[secondLabel notNil]) ifTrue:[ |
|
228 |
l1 := Label label:firstLabel in:aView. |
|
229 |
l1 origin:0.0@0.0 corner:0.5@(l1 height). |
|
230 |
l1 borderWidth:0. |
|
231 |
l2 := Label label:secondLabel in:aView. |
|
232 |
l2 origin:0.5@0.0 corner:1.0@(l1 height). |
|
233 |
l2 borderWidth:0. |
|
234 |
||
235 |
hvs origin:0.0 @ (l1 height + ViewSpacing) corner:1.0 @ 1.0. |
|
236 |
] ifFalse:[ |
|
237 |
hvs origin:0.0 @ 0.0 corner:1.0 @ 1.0 |
|
238 |
]. |
|
239 |
scr text1:firstText text2:secondText. |
|
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
240 |
scr addNextPreviousButtons. |
261 | 241 |
scr moveToNextChanged. |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
242 |
|
1504 | 243 |
^ scr. |
12 | 244 |
! ! |
245 |
||
261 | 246 |
!TwoColumnTextView class methodsFor:'specification'! |
12 | 247 |
|
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
248 |
numberOfViews |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
249 |
^ 2 |
12 | 250 |
|
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
251 |
"Created: 20.11.1995 / 13:17:00 / cg" |
12 | 252 |
! ! |
253 |
||
254 |
!TwoColumnTextView methodsFor:'accessing'! |
|
255 |
||
1629 | 256 |
leftTextView |
257 |
^ textViews at:1 |
|
258 |
! |
|
259 |
||
631 | 260 |
numberOfChanges |
261 |
|start numberOfChanges| |
|
262 |
||
263 |
textViews first contents size == textViews last contents size ifTrue: [^0]. |
|
264 |
start := 1. |
|
265 |
numberOfChanges := 0. |
|
266 |
textViews do:[:v||list max lnNr| |
|
267 |
list := v list. |
|
268 |
max := list size. |
|
269 |
lnNr := start. |
|
270 |
[(lnNr < max)] whileTrue: [ |
|
271 |
(lnNr < max and: [ (list at: lnNr - 1 ifAbsent: [list at:1]) isText not and: [(list at:lnNr) isText]]) |
|
272 |
ifTrue: [numberOfChanges := numberOfChanges + 1]. |
|
273 |
lnNr := lnNr + 1 |
|
274 |
]. |
|
275 |
]. |
|
276 |
||
277 |
^numberOfChanges |
|
278 |
! |
|
279 |
||
1629 | 280 |
rightTextView |
281 |
^ textViews at:2 |
|
282 |
! |
|
283 |
||
12 | 284 |
text1:t1 text2:t2 |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
285 |
(textViews at:1) list:t1 asText. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
286 |
(textViews at:2) list:t2 asText. |
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
287 |
|
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
288 |
"Created: 20.11.1995 / 13:20:39 / cg" |
12 | 289 |
! ! |
92
ca6389321c2a
new (abstract) class for multiple sync-scrolled textviews
Claus Gittinger <cg@exept.de>
parents:
91
diff
changeset
|
290 |
|
261 | 291 |
!TwoColumnTextView methodsFor:'actions'! |
292 |
||
293 |
moveToLine:aLineNr |
|
294 |
|lnNr view nLinesShown| |
|
295 |
||
296 |
view := textViews at:1. |
|
297 |
||
298 |
view shown ifTrue:[ |
|
299 |
lnNr := (view lastLineShown - view firstLineShown) // 3. |
|
300 |
] ifFalse:[ |
|
301 |
lnNr := 5. |
|
302 |
]. |
|
303 |
||
304 |
(lnNr := aLineNr - lnNr) < 1 ifTrue:[ |
|
305 |
lnNr := 1 |
|
306 |
]. |
|
307 |
self scrollToLine:lnNr. |
|
308 |
! |
|
309 |
||
310 |
moveToNextChanged |
|
5833 | 311 |
self moveToNextChangedAfter:((textViews at:1) lastLineShown) |
312 |
||
313 |
"Modified: / 23-07-2018 / 09:47:10 / Claus Gittinger" |
|
314 |
! |
|
315 |
||
316 |
moveToNextChangedAfter:startLine |
|
261 | 317 |
|start end| |
318 |
||
5833 | 319 |
start := startLine + 1. |
261 | 320 |
|
321 |
textViews do:[:v||list max lnNr| |
|
322 |
list := v list. |
|
323 |
max := list size. |
|
324 |
lnNr := start. |
|
325 |
||
5833 | 326 |
"/ find the first line which is not a plain string |
261 | 327 |
[(lnNr > max or:[(list at:lnNr) isText]) |
328 |
] whileFalse:[ |
|
329 |
lnNr := lnNr + 1 |
|
330 |
]. |
|
331 |
||
332 |
(lnNr <= max) ifTrue:[ |
|
333 |
(end isNil or:[lnNr < end]) ifTrue:[ |
|
334 |
end := lnNr. |
|
335 |
] |
|
336 |
]. |
|
337 |
]. |
|
338 |
||
339 |
end notNil ifTrue:[ |
|
340 |
self moveToLine:end |
|
341 |
]. |
|
5833 | 342 |
|
343 |
"Created: / 23-07-2018 / 09:47:00 / Claus Gittinger" |
|
261 | 344 |
! |
345 |
||
346 |
moveToPreviousChanged |
|
347 |
|start end found| |
|
348 |
||
349 |
start := ((textViews at:1) firstLineShown) - 1. |
|
350 |
end := 1. |
|
351 |
found := false. |
|
352 |
||
353 |
start > 1 ifTrue:[ |
|
354 |
textViews do:[:v||lnNr list| |
|
355 |
list := v list. |
|
356 |
lnNr := list size. |
|
357 |
||
358 |
lnNr >= start ifTrue:[ |
|
359 |
lnNr := start |
|
360 |
]. |
|
361 |
||
362 |
[(lnNr == end or:[(list at:lnNr) isText]) |
|
363 |
] whileFalse:[ |
|
364 |
lnNr := lnNr - 1 |
|
365 |
]. |
|
366 |
(list at:lnNr) isText ifTrue:[ |
|
367 |
end := lnNr. |
|
368 |
found := true |
|
369 |
] |
|
370 |
] |
|
371 |
]. |
|
372 |
found ifTrue:[ |
|
373 |
self moveToLine:end |
|
374 |
]. |
|
375 |
! ! |
|
376 |
||
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
377 |
!TwoColumnTextView methodsFor:'initialization'! |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
378 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
379 |
addNextPreviousButtons |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
380 |
"set up-down buttons" |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
381 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
382 |
|panel buttonPrev buttonNext| |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
383 |
|
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
384 |
panel := nextPrevButtonPanel := VerticalPanelView in:self. |
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
385 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
386 |
buttonPrev := Button label:'-' in:panel. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
387 |
buttonNext := Button label:'+' in:panel. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
388 |
buttonPrev extent:15@22. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
389 |
buttonNext extent:15@22. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
390 |
panel origin:0.0 @ 1.0 corner:(15 + SimpleView viewSpacing) @ 1.0. |
3419
d6b3ec58fdb8
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2705
diff
changeset
|
391 |
panel topInset:(2 * (buttonPrev preferredHeight)) negated. |
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
392 |
panel level:1. |
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
393 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
394 |
"set actions" |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
395 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
396 |
buttonPrev pressAction:[ |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
397 |
buttonPrev turnOff. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
398 |
self moveToPreviousChanged |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
399 |
]. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
400 |
|
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
401 |
buttonNext pressAction:[ |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
402 |
buttonNext turnOff. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
403 |
self moveToNextChanged |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
404 |
]. |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
405 |
|
1441
115a022e6cdd
hide next/prev buttons by default
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
406 |
panel beInvisible. |
1429
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
407 |
! ! |
ec837032e254
made button setup a separate method
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
408 |
|
261 | 409 |
!TwoColumnTextView class methodsFor:'documentation'! |
158 | 410 |
|
411 |
version |
|
5833 | 412 |
^ '$Header$' |
3760 | 413 |
! |
414 |
||
415 |
version_CVS |
|
5833 | 416 |
^ '$Header$' |
1979 | 417 |
! ! |
5833 | 418 |