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