76 "/ if any of my views changes its contents, |
76 "/ if any of my views changes its contents, |
77 "/ I have logically changed my contents -> to give scrollbar |
77 "/ I have logically changed my contents -> to give scrollbar |
78 "/ a chance to update |
78 "/ a chance to update |
79 "/ |
79 "/ |
80 something == #sizeOfContents ifTrue:[ |
80 something == #sizeOfContents ifTrue:[ |
81 self changed:something |
81 self changed:something |
|
82 ]. |
|
83 |
|
84 "/ |
|
85 "/ if any of my views' changes the origin its contents, |
|
86 "/ I have logically changed my origin -> give the scrollbar |
|
87 "/ a chance to update and sync my views. |
|
88 "/ |
|
89 something == #originOfContents ifTrue:[ |
|
90 "/ beware of recursive calls |
|
91 scrollLock == true ifFalse:[ |
|
92 scrollLock := true. |
|
93 textViews do:[:v| |
|
94 v ~~ changedObject ifTrue:[ |
|
95 v scrollTo:changedObject viewOrigin. |
|
96 ]. |
|
97 ]. |
|
98 self changed:something. |
|
99 scrollLock := false. |
|
100 ]. |
82 ]. |
101 ]. |
83 |
102 |
84 "Created: 24.11.1995 / 11:11:22 / cg" |
103 "Created: 24.11.1995 / 11:11:22 / cg" |
|
104 "Modified: 25.9.1997 / 11:46:32 / stefan" |
85 ! ! |
105 ! ! |
86 |
106 |
87 !SyncedMultiColumnTextView methodsFor:'initialization'! |
107 !SyncedMultiColumnTextView methodsFor:'initialization'! |
88 |
108 |
89 initialize |
109 initialize |
166 |
186 |
167 "Created: 20.11.1995 / 13:01:16 / cg" |
187 "Created: 20.11.1995 / 13:01:16 / cg" |
168 ! |
188 ! |
169 |
189 |
170 scrollDown:nLines |
190 scrollDown:nLines |
171 textViews do:[:thisView | thisView scrollDown:nLines]. |
191 textViews first scrollDown:nLines. |
172 |
192 |
173 "Created: 20.11.1995 / 13:09:40 / cg" |
193 "Created: 20.11.1995 / 13:09:40 / cg" |
|
194 "Modified: 25.9.1997 / 11:39:59 / stefan" |
174 ! |
195 ! |
175 |
196 |
176 scrollHorizontalToPercent:p |
197 scrollHorizontalToPercent:p |
177 "since the percentage given is based on the widest text |
198 "since the percentage given is based on the widest text |
178 of my subvies, scroll the view containing the widest first, |
199 of my subvies, scroll the view containing the widest first, |
179 and take that scroll-offset for the others." |
200 and take that scroll-offset for the others." |
180 |
201 |
181 |master max x| |
202 |master max| |
182 |
203 |
183 max := 0. |
204 max := 0. |
184 textViews do:[:thisView | |
205 textViews do:[:thisView | |
185 |wThis| |
206 |wThis| |
186 |
207 |
187 (wThis := thisView widthOfContents) > max ifTrue:[ |
208 (wThis := thisView widthOfContents) > max ifTrue:[ |
188 max := wThis. |
209 max := wThis. |
189 master := thisView |
210 master := thisView |
190 ] |
211 ] |
191 ]. |
212 ]. |
192 master scrollHorizontalToPercent:p. |
213 master scrollHorizontalToPercent:p. |
193 x := master viewOrigin x. |
|
194 textViews do:[:v | |
|
195 v ~~ master ifTrue:[ |
|
196 v scrollHorizontalTo:x. |
|
197 ] |
|
198 ] |
|
199 |
214 |
200 "Created: 20.11.1995 / 13:14:41 / cg" |
215 "Created: 20.11.1995 / 13:14:41 / cg" |
201 "Modified: 24.11.1995 / 14:22:27 / cg" |
216 "Modified: 24.11.1995 / 14:22:27 / cg" |
|
217 "Modified: 25.9.1997 / 11:42:46 / stefan" |
202 ! |
218 ! |
203 |
219 |
204 scrollLeft |
220 scrollLeft |
205 textViews do:[:thisView | thisView scrollLeft]. |
221 textViews first scrollLeft. |
206 |
222 |
207 "Created: 20.11.1995 / 13:09:40 / cg" |
223 "Created: 20.11.1995 / 13:09:40 / cg" |
208 "Modified: 20.11.1995 / 13:15:45 / cg" |
224 "Modified: 20.11.1995 / 13:15:45 / cg" |
|
225 "Modified: 25.9.1997 / 11:41:04 / stefan" |
209 ! |
226 ! |
210 |
227 |
211 scrollLeft:nPixels |
228 scrollLeft:nPixels |
212 textViews do:[:thisView | thisView scrollLeft:nPixels]. |
229 textViews first scrollLeft:nPixels. |
213 |
230 |
214 "Created: 20.11.1995 / 13:09:40 / cg" |
231 "Created: 20.11.1995 / 13:09:40 / cg" |
215 "Modified: 20.11.1995 / 13:15:49 / cg" |
232 "Modified: 20.11.1995 / 13:15:49 / cg" |
|
233 "Modified: 25.9.1997 / 11:41:17 / stefan" |
216 ! |
234 ! |
217 |
235 |
218 scrollRight |
236 scrollRight |
219 textViews do:[:thisView | thisView scrollRight]. |
237 textViews first scrollRight. |
220 |
238 |
221 "Created: 20.11.1995 / 13:09:40 / cg" |
239 "Created: 20.11.1995 / 13:09:40 / cg" |
222 "Modified: 20.11.1995 / 13:15:39 / cg" |
240 "Modified: 20.11.1995 / 13:15:39 / cg" |
|
241 "Modified: 25.9.1997 / 11:41:30 / stefan" |
223 ! |
242 ! |
224 |
243 |
225 scrollRight:nPixels |
244 scrollRight:nPixels |
226 textViews do:[:thisView | thisView scrollRight:nPixels]. |
245 textViews first scrollRight:nPixels. |
227 |
246 |
228 "Created: 20.11.1995 / 13:09:40 / cg" |
247 "Created: 20.11.1995 / 13:09:40 / cg" |
229 "Modified: 20.11.1995 / 13:15:27 / cg" |
248 "Modified: 20.11.1995 / 13:15:27 / cg" |
|
249 "Modified: 25.9.1997 / 11:41:43 / stefan" |
230 ! |
250 ! |
231 |
251 |
232 scrollToLine:lineNr |
252 scrollToLine:lineNr |
233 textViews do:[:thisView | thisView scrollToLine:lineNr]. |
253 textViews first scrollToLine:lineNr. |
234 |
254 |
235 "Created: 20.11.1995 / 13:09:40 / cg" |
255 "Created: 20.11.1995 / 13:09:40 / cg" |
236 "Modified: 20.11.1995 / 13:15:07 / cg" |
256 "Modified: 20.11.1995 / 13:15:07 / cg" |
|
257 "Modified: 25.9.1997 / 11:41:56 / stefan" |
237 ! |
258 ! |
238 |
259 |
239 scrollUp |
260 scrollUp |
240 self scrollUp:1. |
261 self scrollUp:1. |
241 |
262 |
242 "Created: 20.11.1995 / 13:01:16 / cg" |
263 "Created: 20.11.1995 / 13:01:16 / cg" |
243 ! |
264 ! |
244 |
265 |
245 scrollUp:nLines |
266 scrollUp:nLines |
246 textViews do:[:thisView | thisView scrollUp:nLines]. |
267 textViews first scrollUp:nLines. |
247 |
268 |
248 "Created: 20.11.1995 / 13:09:40 / cg" |
269 "Created: 20.11.1995 / 13:09:40 / cg" |
249 "Modified: 20.11.1995 / 13:14:51 / cg" |
270 "Modified: 20.11.1995 / 13:14:51 / cg" |
|
271 "Modified: 25.9.1997 / 11:42:10 / stefan" |
250 ! |
272 ! |
251 |
273 |
252 scrollVerticalToPercent:p |
274 scrollVerticalToPercent:p |
253 "since the percentage given is based on the longest text |
275 "since the percentage given is based on the longest text |
254 of my subvies, scroll the view containing the longest first, |
276 of my subvies, scroll the view containing the longest first, |
255 and take that scroll-offset for the others." |
277 and take that scroll-offset for the others." |
256 |
278 |
257 |master max y| |
279 |master max| |
258 |
280 |
259 max := 0. |
281 max := 0. |
260 textViews do:[:thisView | |
282 textViews do:[:thisView | |
261 |hThis| |
283 |hThis| |
262 |
284 |
263 (hThis := thisView heightOfContents) > max ifTrue:[ |
285 (hThis := thisView heightOfContents) > max ifTrue:[ |
264 max := hThis. |
286 max := hThis. |
265 master := thisView |
287 master := thisView |
266 ] |
288 ] |
267 ]. |
289 ]. |
268 |
290 |
269 master scrollVerticalToPercent:p. |
291 master scrollVerticalToPercent:p. |
270 y := master firstLineShown. |
|
271 |
|
272 textViews do:[:v | |
|
273 v ~~ master ifTrue:[ |
|
274 v scrollToLine:y. |
|
275 ] |
|
276 ] |
|
277 |
292 |
278 "Created: 20.11.1995 / 13:14:41 / cg" |
293 "Created: 20.11.1995 / 13:14:41 / cg" |
279 "Modified: 24.11.1995 / 14:22:19 / cg" |
294 "Modified: 24.11.1995 / 14:22:19 / cg" |
|
295 "Modified: 25.9.1997 / 11:42:34 / stefan" |
280 ! ! |
296 ! ! |
281 |
297 |
282 !SyncedMultiColumnTextView class methodsFor:'documentation'! |
298 !SyncedMultiColumnTextView class methodsFor:'documentation'! |
283 |
299 |
284 version |
300 version |
285 ^ '$Header: /cvs/stx/stx/libwidg2/SyncedMultiColumnTextView.st,v 1.5 1996-05-08 15:00:54 cg Exp $' |
301 ^ '$Header: /cvs/stx/stx/libwidg2/SyncedMultiColumnTextView.st,v 1.6 1997-09-25 11:12:39 stefan Exp $' |
286 ! ! |
302 ! ! |