author | Claus Gittinger <cg@exept.de> |
Wed, 08 Oct 2003 17:35:44 +0200 | |
changeset 2569 | bfe9e33b545e |
parent 2568 | 67bd475ec002 |
child 2595 | 1ab5dc7d4796 |
permissions | -rw-r--r-- |
1431 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
2265 | 3 |
All Rights Reserved |
1431 | 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 |
||
13 |
||
1752 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
1390 | 16 |
View subclass:#ListModelView |
17 |
instanceVariableNames:'list listHolder textStartLeft viewOrigin enabled fgColor bgColor |
|
1399 | 18 |
lineSpacing widthOfContents computeWidthInRange startOfLinesY |
2329 | 19 |
autoScroll autoScrollBlock scrollWhenUpdating hasConstantHeight |
2352 | 20 |
constantHeight previousExtent renderer' |
1390 | 21 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultShadowColor |
22 |
DefaultLightColor StopRedrawSignal' |
|
23 |
poolDictionaries:'' |
|
1430 | 24 |
category:'Views-Lists' |
1390 | 25 |
! |
26 |
||
2352 | 27 |
Object subclass:#Renderer |
28 |
instanceVariableNames:'view' |
|
29 |
classVariableNames:'' |
|
30 |
poolDictionaries:'' |
|
31 |
privateIn:ListModelView |
|
32 |
! |
|
33 |
||
1390 | 34 |
!ListModelView class methodsFor:'documentation'! |
35 |
||
1431 | 36 |
copyright |
37 |
" |
|
38 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
2265 | 39 |
All Rights Reserved |
1431 | 40 |
|
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
" |
|
48 |
||
49 |
! |
|
50 |
||
1390 | 51 |
documentation |
52 |
" |
|
1431 | 53 |
This widget is a new improved revision of the good-old ListView. |
54 |
In contrast to ListView, this one reacts on changes of the |
|
55 |
underlying model and performs optimized redraws. |
|
56 |
It requires a List (or alike) as model. |
|
57 |
||
1390 | 58 |
This class can only passively display collections of elements. |
59 |
The class doesn't keep its own list, it works directly on |
|
60 |
the model( List or HierarchicalList ). |
|
61 |
||
62 |
Each list item is obligated to provide 3 services: |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
63 |
- heightOn:aGC |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
64 |
- widthOn:aGC |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
65 |
- displayOn:aGC x:x y:y |
1390 | 66 |
|
67 |
[Instance variables:] |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
68 |
list <List-Model> List or HierarchicalList ... |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
69 |
listHolder <Model> Model, which keeps a List |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
70 |
textStartLeft <Number> left inset of text |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
71 |
viewOrigin <Point> the current origin |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
72 |
enabled <Boolean> widget is enabled/disabeled |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
73 |
fgColor <Color> color to draw characters |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
74 |
bgColor <Color> the background |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
75 |
lineSpacing <Number> pixels between lines |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
76 |
widthOfContents <Number> cached width of widest line |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
77 |
computeWidthInRange <Point> used for recompute width of contents |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
78 |
startOfLinesY <Collection> keeps all the absolute Y-start positions |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
79 |
for each line in the list. The first |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
80 |
entry into the list is the top Y inset. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
81 |
supportsDisplayInRange <Boolean> set to true if the list elements |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
82 |
supports the service: |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
83 |
#displayOn:x:y:h: |
1535
872422bc0e81
support frames (views) within the list
Claus Gittinger <cg@exept.de>
parents:
1534
diff
changeset
|
84 |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
85 |
hasConstantHeight <Boolean> true, than each line has the same height |
1554 | 86 |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
87 |
constantHeight <SmallInteger> hasConstantHeight is turned on, this |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
88 |
is the used line height |
2264 | 89 |
|
1390 | 90 |
[author:] |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
91 |
Claus Atzkern |
1390 | 92 |
|
93 |
[see also:] |
|
94 |
||
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
95 |
SelectionInListModelView |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
96 |
HierarchicalListView |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
97 |
List |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
98 |
HierarchicalList |
1390 | 99 |
" |
100 |
! |
|
101 |
||
102 |
examples |
|
103 |
" |
|
2265 | 104 |
[exBegin] |
1390 | 105 |
|top list view up index| |
106 |
||
107 |
list := List new. |
|
108 |
||
109 |
top := StandardSystemView new; extent:300@300. |
|
110 |
view := ScrollableView for:ListModelView miniScroller:true |
|
2265 | 111 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
1827 | 112 |
|
1390 | 113 |
view list:list. |
114 |
top openAndWait. |
|
115 |
up := true. |
|
116 |
||
117 |
[top shown] whileTrue:[ |
|
2265 | 118 |
Delay waitForSeconds:0.2. |
1390 | 119 |
|
2265 | 120 |
up ifTrue:[ |
121 |
index := 1 + (list size). |
|
122 |
list add:('element: ', index printString). |
|
123 |
up := index < 20 |
|
124 |
] ifFalse:[ |
|
125 |
list removeIndex:1. |
|
126 |
up := list isEmpty. |
|
127 |
] |
|
1390 | 128 |
]. |
2265 | 129 |
[exEnd] |
1390 | 130 |
|
131 |
" |
|
132 |
||
133 |
! ! |
|
134 |
||
135 |
!ListModelView class methodsFor:'initialization'! |
|
136 |
||
137 |
initialize |
|
1409 | 138 |
"setup the signals |
139 |
" |
|
2552
7f6a07978018
notifications are proceedable
Claus Gittinger <cg@exept.de>
parents:
2551
diff
changeset
|
140 |
StopRedrawSignal := Notification newSignalMayProceed:true. |
2551 | 141 |
StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
1390 | 142 |
! ! |
143 |
||
144 |
!ListModelView class methodsFor:'Signal constants'! |
|
145 |
||
146 |
stopRedrawSignal |
|
147 |
^ StopRedrawSignal |
|
148 |
! ! |
|
149 |
||
150 |
!ListModelView class methodsFor:'defaults'! |
|
151 |
||
2352 | 152 |
defaultRenderer |
153 |
^ Renderer |
|
154 |
! |
|
155 |
||
1390 | 156 |
updateStyleCache |
157 |
"extract values from the styleSheet and cache them in class variables" |
|
158 |
||
159 |
<resource: #style ( |
|
2265 | 160 |
#'text.backgroundColor' #'text.foregroundColor' |
161 |
#'selection.shadowColor' #'selection.lightColor' |
|
162 |
#'text.font' |
|
163 |
)> |
|
1390 | 164 |
|
165 |
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black. |
|
166 |
DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor'. |
|
167 |
DefaultShadowColor := StyleSheet colorAt:'selection.shadowColor'. |
|
168 |
DefaultLightColor := StyleSheet colorAt:'selection.lightColor'. |
|
169 |
DefaultFont := StyleSheet fontAt:'text.font'. |
|
170 |
||
171 |
" |
|
172 |
self updateStyleCache |
|
173 |
" |
|
174 |
||
175 |
||
176 |
! ! |
|
177 |
||
178 |
!ListModelView methodsFor:'accessing'! |
|
179 |
||
180 |
list |
|
181 |
"get the list of items |
|
182 |
" |
|
183 |
^ list |
|
184 |
||
185 |
||
186 |
! |
|
187 |
||
188 |
list:aList |
|
189 |
"set the list of items |
|
190 |
" |
|
2264 | 191 |
|negatedOrg| |
1443 | 192 |
|
1452 | 193 |
list ~~ aList ifTrue:[ |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
194 |
list removeDependent:self. |
1390 | 195 |
]. |
1452 | 196 |
(list := aList) notNil ifTrue:[ |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
197 |
list addDependent:self |
1452 | 198 |
]. |
2264 | 199 |
preferredExtent := nil. |
200 |
widthOfContents := nil. |
|
201 |
||
202 |
self realized ifFalse:[^ self]. |
|
203 |
||
1390 | 204 |
self recomputeHeightOfContents. |
205 |
||
206 |
||
1827 | 207 |
scrollWhenUpdating == #beginOfText ifTrue:[ |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
208 |
viewOrigin = (0@0) ifFalse:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
209 |
self originWillChange. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
210 |
negatedOrg := viewOrigin negated. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
211 |
viewOrigin := (0@0). |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
212 |
self originChanged:negatedOrg. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
213 |
]. |
1827 | 214 |
] ifFalse:[ |
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
215 |
scrollWhenUpdating == #endOfText ifTrue:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
216 |
self scrollTo:(0 @ self heightOfContents - self innerHeight) redraw:false |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
217 |
] |
1422 | 218 |
]. |
1827 | 219 |
|
1422 | 220 |
self invalidate. |
1457 | 221 |
self contentsChanged |
1390 | 222 |
! ! |
223 |
||
1818 | 224 |
!ListModelView methodsFor:'accessing-behavior'! |
1390 | 225 |
|
1748 | 226 |
autoScroll |
227 |
"returns true if auto scrolling is enabled |
|
228 |
" |
|
229 |
^ autoScroll |
|
230 |
! |
|
231 |
||
232 |
autoScroll:aBool |
|
233 |
"returns true if auto scrolling is enabled |
|
234 |
" |
|
235 |
autoScroll := aBool ? true. |
|
236 |
! |
|
237 |
||
1390 | 238 |
enabled |
239 |
"returns the enabled state |
|
240 |
" |
|
241 |
^ enabled |
|
242 |
||
243 |
||
244 |
! |
|
245 |
||
246 |
enabled:aBoolean |
|
247 |
"set the enabled state |
|
248 |
" |
|
249 |
enabled := aBoolean |
|
250 |
||
251 |
||
1742 | 252 |
! |
253 |
||
2261 | 254 |
hasConstantHeight |
255 |
"user configured; true if each line has the same lineHeight |
|
256 |
optimize for scroller update |
|
257 |
" |
|
258 |
^ hasConstantHeight |
|
259 |
! |
|
260 |
||
261 |
hasConstantHeight:aBool |
|
262 |
"user configured; true if each line has the same lineHeight |
|
263 |
optimize for scroller update |
|
264 |
" |
|
265 |
aBool == hasConstantHeight ifTrue:[ |
|
2265 | 266 |
^ self |
2261 | 267 |
]. |
2264 | 268 |
constantHeight := nil. |
2261 | 269 |
hasConstantHeight := aBool. |
270 |
||
271 |
self lostSynchronisation. |
|
272 |
! |
|
273 |
||
1742 | 274 |
scrollWhenUpdating:aSymbolOrNil |
275 |
"define how to scroll, when I get a new text |
|
276 |
(via the model or the #contents/#list) |
|
277 |
Allowed arguments are: |
|
2265 | 278 |
#keep / nil -> no change |
279 |
#endOfText -> scroll to the end |
|
280 |
#beginOfText -> scroll to the top |
|
1742 | 281 |
The default is #beginOfText. |
282 |
This may be useful for fields which get new values assigned from |
|
283 |
the program (i.e. not from the user) |
|
284 |
" |
|
285 |
||
1827 | 286 |
scrollWhenUpdating := aSymbolOrNil |
1742 | 287 |
|
288 |
||
1390 | 289 |
! ! |
290 |
||
1818 | 291 |
!ListModelView methodsFor:'accessing-items'! |
1390 | 292 |
|
293 |
at:anIndex |
|
294 |
"return the list element at an index |
|
295 |
" |
|
296 |
^ list at:anIndex |
|
297 |
! |
|
298 |
||
299 |
at:anIndex ifAbsent:exceptionBlock |
|
300 |
"return the list element at an index if valid. |
|
301 |
If the index is invalid, return the result of evaluating |
|
302 |
the exceptionblock. |
|
303 |
" |
|
304 |
list notNil ifTrue:[ |
|
2408 | 305 |
^ list at:anIndex ifAbsent:exceptionBlock |
1390 | 306 |
]. |
2408 | 307 |
^ exceptionBlock value |
308 |
! |
|
309 |
||
310 |
findLast:aOneArgBlock |
|
311 |
"find the last list entry, for which evaluation of the argument, aOneArgBlock |
|
312 |
returns true; return its index or 0 if none detected. |
|
313 |
" |
|
314 |
list notNil ifTrue:[ |
|
315 |
^ list findLast:aOneArgBlock |
|
316 |
]. |
|
317 |
^ 0 |
|
1390 | 318 |
! |
319 |
||
320 |
identityIndexOf:anElement |
|
321 |
"returns the index of an element or nil |
|
322 |
" |
|
2408 | 323 |
list notNil ifTrue:[ |
324 |
^ list identityIndexOf:anElement |
|
325 |
]. |
|
326 |
^ 0 |
|
327 |
! |
|
1390 | 328 |
|
2408 | 329 |
last |
330 |
"returns the last list entry |
|
331 |
" |
|
332 |
^ list last |
|
1390 | 333 |
! ! |
334 |
||
1818 | 335 |
!ListModelView methodsFor:'accessing-look'! |
1390 | 336 |
|
337 |
backgroundColor |
|
338 |
"get the background color |
|
339 |
" |
|
340 |
^ bgColor |
|
341 |
||
342 |
||
343 |
! |
|
344 |
||
345 |
backgroundColor:aColor |
|
346 |
"set the background color |
|
347 |
" |
|
348 |
(aColor notNil and:[bgColor ~~ aColor]) ifTrue:[ |
|
2265 | 349 |
super viewBackground:bgColor. |
1390 | 350 |
|
2265 | 351 |
self realized ifTrue:[ |
352 |
bgColor := aColor onDevice:device. |
|
353 |
self invalidate |
|
354 |
] ifFalse:[ |
|
355 |
bgColor := aColor |
|
356 |
] |
|
1390 | 357 |
] |
358 |
! |
|
359 |
||
360 |
font:aFont |
|
361 |
"set a new font |
|
362 |
" |
|
363 |
|oldWidth oldHeight| |
|
364 |
||
365 |
(aFont isNil or:[aFont = font]) ifFalse:[ |
|
2265 | 366 |
oldWidth := font width. |
367 |
oldHeight := font height. |
|
1390 | 368 |
|
2265 | 369 |
super font:aFont. |
1390 | 370 |
|
2265 | 371 |
(font widthOn:device) ~~ oldWidth ifTrue:[ "/ force a recomputation |
372 |
preferredExtent := nil. |
|
373 |
widthOfContents := nil. |
|
374 |
]. |
|
375 |
oldHeight ~~ (font heightOn:device) ifTrue:[ |
|
376 |
self recomputeHeightOfContents. |
|
377 |
]. |
|
378 |
shown ifTrue:[ self invalidate ] |
|
1390 | 379 |
]. |
380 |
! |
|
381 |
||
382 |
foregroundColor |
|
383 |
"get the foreground color |
|
384 |
" |
|
385 |
^ fgColor |
|
386 |
||
387 |
! |
|
388 |
||
389 |
foregroundColor:aColor |
|
390 |
"set the foreground color |
|
391 |
" |
|
392 |
(aColor notNil and:[fgColor ~~ aColor]) ifTrue:[ |
|
2265 | 393 |
self realized ifTrue:[ |
394 |
fgColor := aColor onDevice:device. |
|
395 |
self invalidate |
|
396 |
] ifFalse:[ |
|
397 |
fgColor := aColor |
|
398 |
] |
|
1390 | 399 |
] |
1945 | 400 |
! |
401 |
||
402 |
lineSpacing |
|
403 |
"get the lineSpacing - thats an additional number of pixels, |
|
404 |
by which lines are vertically separated. |
|
405 |
" |
|
406 |
^ lineSpacing |
|
407 |
! |
|
408 |
||
409 |
lineSpacing:aNumber |
|
410 |
"set the lineSpacing - thats an additional number of pixels, |
|
411 |
by which lines are vertically separated. |
|
412 |
" |
|
413 |
lineSpacing ~= aNumber ifTrue:[ |
|
2265 | 414 |
lineSpacing := aNumber. |
1945 | 415 |
|
2265 | 416 |
self recomputeHeightOfContents. |
1945 | 417 |
|
2265 | 418 |
shown ifTrue:[ |
419 |
self invalidate |
|
420 |
] |
|
1945 | 421 |
] |
1390 | 422 |
! ! |
423 |
||
1818 | 424 |
!ListModelView methodsFor:'accessing-mvc'! |
1390 | 425 |
|
426 |
listHolder |
|
427 |
"returns the listHolder or nil |
|
428 |
" |
|
429 |
^ listHolder |
|
430 |
! |
|
431 |
||
432 |
listHolder:aListHolder |
|
433 |
"set a new listHolder |
|
434 |
" |
|
435 |
listHolder removeDependent:self. |
|
436 |
||
437 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
2265 | 438 |
listHolder addDependent:self. |
1390 | 439 |
]. |
440 |
self list:(listHolder value). |
|
441 |
! ! |
|
442 |
||
443 |
!ListModelView methodsFor:'change & update'! |
|
444 |
||
445 |
lineChangedAt:aLnNr with:arg |
|
2548 | 446 |
"line changed at position; check whether line height changed" |
447 |
||
448 |
|cache |
|
1390 | 449 |
oldHeight "{ Class:SmallInteger }" |
2548 | 450 |
dltHeight "{ Class:SmallInteger }" | |
451 |
||
452 |
(arg == #icon or:[arg == #hierarchy]) ifTrue:[ |
|
2385 | 453 |
^ self |
1390 | 454 |
]. |
2264 | 455 |
hasConstantHeight ifTrue:[ |
2385 | 456 |
self invalidateLineAt:aLnNr. |
457 |
^ self |
|
2264 | 458 |
]. |
459 |
||
1390 | 460 |
oldHeight := (self yVisibleOfLine:(aLnNr + 1)) - (self yVisibleOfLine:aLnNr). |
461 |
dltHeight := (self heightOfLineAt:aLnNr) - oldHeight. |
|
462 |
||
463 |
dltHeight == 0 ifTrue:[ |
|
2385 | 464 |
self invalidateLineAt:aLnNr. |
465 |
^ self |
|
1390 | 466 |
]. |
2548 | 467 |
cache := startOfLinesY. |
1390 | 468 |
|
2548 | 469 |
aLnNr + 1 to:cache size do:[:i| |
470 |
cache at:i put:((cache at:i) + dltHeight) |
|
1390 | 471 |
]. |
472 |
self invalidate. |
|
473 |
! |
|
474 |
||
475 |
listChangedInsert:start nItems:nLines |
|
476 |
"list changed; items are added |
|
477 |
" |
|
2385 | 478 |
|newLines |
1390 | 479 |
run "{ Class: SmallInteger }" |
1457 | 480 |
newSz "{ Class: SmallInteger }" |
1390 | 481 |
cpyHg "{ Class: SmallInteger }" |
482 |
absY0 "{ Class: SmallInteger }" |
|
483 |
absY1 "{ Class: SmallInteger }" |
|
484 |
visY0 "{ Class: SmallInteger }" |
|
485 |
visY1 "{ Class: SmallInteger }" |
|
486 |
orgY "{ Class: SmallInteger }" |
|
487 |
dltY "{ Class: SmallInteger }" |
|
488 |
maxHg "{ Class: SmallInteger }" |
|
489 |
| |
|
490 |
||
491 |
nLines == 0 ifTrue:[^ self ]. |
|
492 |
self listSizeChanged:start nLines:nLines. |
|
2569 | 493 |
shown ifFalse:[^ self]. |
1390 | 494 |
|
1457 | 495 |
newSz := startOfLinesY size + nLines. |
496 |
||
2408 | 497 |
(newSz - 1) ~~ self size ifTrue:[ |
2385 | 498 |
"/ |
499 |
"/ no longer synchrounous |
|
500 |
"/ |
|
501 |
^ self lostSynchronisation |
|
1451 | 502 |
]. |
2385 | 503 |
newLines := startOfLinesY copy. |
504 |
newLines addAll:(Array new:nLines) beforeIndex:start + 1. |
|
505 |
absY0 := newLines at:start. |
|
1390 | 506 |
absY1 := absY0. |
507 |
run := start. |
|
508 |
||
509 |
nLines timesRepeat:[ |
|
2385 | 510 |
absY1 := absY1 + (self heightOfLineAt:run). |
511 |
run := run + 1. |
|
512 |
newLines at:run put:absY1. |
|
1390 | 513 |
]. |
514 |
dltY := absY1 - absY0. |
|
1457 | 515 |
|
516 |
run + 1 to:newSz do:[:i||v| |
|
2385 | 517 |
newLines at:i put:((newLines at:i) + dltY) |
1390 | 518 |
]. |
2385 | 519 |
startOfLinesY := newLines. |
1390 | 520 |
|
521 |
orgY := viewOrigin y. |
|
522 |
absY1 := absY0 + dltY. |
|
523 |
visY0 := absY0 - orgY. |
|
524 |
visY1 := absY1 - orgY. |
|
525 |
maxHg := height - margin. |
|
526 |
||
527 |
absY0 < orgY ifTrue:[ |
|
2385 | 528 |
self originWillChange. |
529 |
viewOrigin y:(dltY + orgY). |
|
530 |
self originChanged:(0 @ dltY). |
|
1390 | 531 |
]. |
1457 | 532 |
|
1390 | 533 |
(visY0 >= maxHg or:[visY1 <= margin]) ifTrue:[ |
2385 | 534 |
^ self contentsChanged |
1390 | 535 |
]. |
536 |
visY0 := visY0 max:margin. |
|
537 |
visY1 := visY1 min:maxHg. |
|
538 |
||
1773
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
539 |
self hasDamage ifTrue:[ |
2385 | 540 |
self invalidate:(Rectangle left:0 |
541 |
top:visY0 |
|
542 |
width:width |
|
543 |
height:height - visY0). |
|
1773
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
544 |
|
2385 | 545 |
^ self contentsChanged. |
1773
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
546 |
]. |
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
547 |
|
2408 | 548 |
(start == self size or:[(cpyHg := maxHg - visY1) < 20]) ifTrue:[ |
2385 | 549 |
visY1 := maxHg |
1390 | 550 |
] ifFalse:[ |
2385 | 551 |
self catchExpose. |
1390 | 552 |
|
2385 | 553 |
self copyFrom:self x:0 y:visY0 |
554 |
toX:0 y:visY1 |
|
555 |
width:width height:cpyHg async:true. |
|
1390 | 556 |
|
2385 | 557 |
self waitForExpose |
1390 | 558 |
]. |
559 |
||
1457 | 560 |
self invalidateX:margin |
2385 | 561 |
y:visY0 |
562 |
width:width - margin - margin |
|
563 |
height:(visY1 - visY0). |
|
1457 | 564 |
|
1390 | 565 |
self contentsChanged. |
566 |
! |
|
567 |
||
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
568 |
listChangedRemove:aStart toIndex:aStop |
1390 | 569 |
"list changed; items are removed |
570 |
" |
|
2385 | 571 |
|noRedraw newLines |
1390 | 572 |
size "{ Class: SmallInteger }" |
573 |
absY0 "{ Class: SmallInteger }" |
|
574 |
absY1 "{ Class: SmallInteger }" |
|
575 |
visY0 "{ Class: SmallInteger }" |
|
576 |
visY1 "{ Class: SmallInteger }" |
|
577 |
orgY "{ Class: SmallInteger }" |
|
578 |
orgX "{ Class: SmallInteger }" |
|
579 |
dltY "{ Class: SmallInteger }" |
|
580 |
cpyHg "{ Class: SmallInteger }" |
|
581 |
maxHg "{ Class: SmallInteger }" |
|
1444
0b7cd00e2537
check range before delete lines
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
582 |
stop "{ Class: SmallInteger }" |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
583 |
start "{ Class: SmallInteger }" |
1457 | 584 |
newSz "{ Class: SmallInteger }" |
1390 | 585 |
| |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
586 |
stop := aStop. |
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
587 |
start := aStart. |
1390 | 588 |
|
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
589 |
(size := stop - start + 1) == 0 ifTrue:[ |
2385 | 590 |
^ self |
1390 | 591 |
]. |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
592 |
|
1390 | 593 |
self listSizeChanged:start nLines:(size negated). |
2569 | 594 |
shown ifFalse:[^ self]. |
1451 | 595 |
|
1457 | 596 |
newSz := startOfLinesY size - size. |
597 |
||
2408 | 598 |
(newSz - 1) ~~ self size ifTrue:[ |
2385 | 599 |
"/ |
600 |
"/ no longer synchrounous |
|
601 |
"/ |
|
602 |
^ self lostSynchronisation |
|
1451 | 603 |
]. |
604 |
||
1390 | 605 |
absY0 := self yAbsoluteOfLine:start. |
1457 | 606 |
absY1 := self yAbsoluteOfLine:stop + 1. |
1390 | 607 |
dltY := absY1 - absY0. |
608 |
||
2385 | 609 |
newLines := startOfLinesY copy. |
610 |
newLines removeFromIndex:(start + 1) toIndex:(stop + 1). |
|
1390 | 611 |
|
1457 | 612 |
(start + 1) to:newSz do:[:i| |
2385 | 613 |
absY0 := newLines at:i. |
614 |
newLines at:i put:(absY0 - dltY). |
|
1390 | 615 |
]. |
2385 | 616 |
startOfLinesY := newLines. |
1390 | 617 |
|
618 |
orgY := viewOrigin y. |
|
619 |
orgX := viewOrigin x. |
|
620 |
||
621 |
absY0 := self yAbsoluteOfLine:start. |
|
622 |
absY1 := absY0 + dltY. |
|
623 |
visY0 := absY0 - orgY. |
|
624 |
visY1 := absY1 - orgY. |
|
625 |
maxHg := height - margin. |
|
626 |
||
2408 | 627 |
(self size == 0 or:[(orgY ~~ 0 and:[self maxViewOriginY == 0])]) ifTrue:[ |
2385 | 628 |
(orgX ~~ 0 or:[orgY ~~ 0]) ifTrue:[ |
629 |
self originWillChange. |
|
630 |
viewOrigin := 0@0. |
|
631 |
self originChanged:((orgX @ orgY) negated). |
|
632 |
]. |
|
633 |
self invalidate. |
|
634 |
^ self contentsChanged |
|
1390 | 635 |
]. |
636 |
||
637 |
visY0 < margin ifTrue:[ |
|
2385 | 638 |
noRedraw := visY1 <= margin. |
639 |
noRedraw ifTrue:[dltY := dltY negated] ifFalse:[dltY := visY0]. |
|
1390 | 640 |
|
2385 | 641 |
self originWillChange. |
642 |
viewOrigin y:(dltY + orgY). |
|
643 |
self originChanged:(0 @ dltY). |
|
1390 | 644 |
] ifFalse:[ |
2385 | 645 |
noRedraw := visY0 >= maxHg |
1390 | 646 |
]. |
1773
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
647 |
visY0 := visY0 max:margin. |
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
648 |
|
1457 | 649 |
self hasDamage ifTrue:[ |
2385 | 650 |
self invalidate:(Rectangle left:0 |
651 |
top:visY0 |
|
652 |
width:width |
|
653 |
height:height - visY0). |
|
1773
9dba0f0dda0e
invalidate uptoend not all if a damage exists (insert/remove)
ca
parents:
1753
diff
changeset
|
654 |
|
2385 | 655 |
noRedraw := true |
1457 | 656 |
]. |
1390 | 657 |
|
1457 | 658 |
noRedraw ifFalse:[ |
2385 | 659 |
cpyHg := maxHg - visY1. |
1390 | 660 |
|
2385 | 661 |
cpyHg > 20 ifTrue:[ |
662 |
self catchExpose. |
|
663 |
self copyFrom:self x:0 y:visY1 toX:0 y:visY0 |
|
664 |
width:width height:cpyHg async:true. |
|
665 |
self waitForExpose. |
|
666 |
visY0 := visY0 + cpyHg. |
|
667 |
]. |
|
1390 | 668 |
|
2385 | 669 |
self invalidateX:margin |
670 |
y:visY0 |
|
671 |
width:width - margin - margin |
|
672 |
height:(maxHg - visY0). |
|
1390 | 673 |
]. |
674 |
self contentsChanged. |
|
675 |
! |
|
676 |
||
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
677 |
update:what with:aPara from:chgObj |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
678 |
"catch and handle any notification raised from the list model |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
679 |
or list holder |
1390 | 680 |
" |
1443 | 681 |
|a1 a2| |
1390 | 682 |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
683 |
chgObj ~~ list ifTrue:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
684 |
chgObj == listHolder ifTrue:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
685 |
self list:(listHolder value). |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
686 |
] ifFalse:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
687 |
super update:what with:aPara from:chgObj |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
688 |
]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
689 |
^ self |
1995 | 690 |
]. |
1390 | 691 |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
692 |
aPara isCollection ifFalse:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
693 |
what == #at: ifTrue:[self lineChangedAt:aPara with:nil. ^ self]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
694 |
what == #insert: ifTrue:[self listChangedInsert:aPara nItems:1. ^ self]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
695 |
what == #remove: ifTrue:[self listChangedRemove:aPara toIndex:aPara. ^ self]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
696 |
^ self. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
697 |
]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
698 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
699 |
a1 := aPara at:1. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
700 |
a2 := aPara at:2. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
701 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
702 |
(a1 == 1 and:[a2 == list size]) ifTrue:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
703 |
self list:list. "/ reload full list |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
704 |
^ self |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
705 |
]. |
1390 | 706 |
|
1995 | 707 |
what == #at: ifTrue:[self lineChangedAt:a1 with:a2. ^ self]. |
708 |
what == #insertCollection: ifTrue:[self listChangedInsert:a1 nItems:a2. ^ self]. |
|
709 |
what == #removeFrom: ifTrue:[self listChangedRemove:a1 toIndex:a2. ^ self]. |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
710 |
|
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
711 |
what == #replace: ifTrue:[ |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
712 |
a1 to:a2 do:[:i|self lineChangedAt:i with:nil]. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
713 |
^ self |
1995 | 714 |
]. |
1390 | 715 |
! ! |
716 |
||
717 |
!ListModelView methodsFor:'drawing'! |
|
718 |
||
2304 | 719 |
drawFrom:start to:stop x:x y:y w:w |
720 |
"draw lines from start to stop. |
|
721 |
clipping and clearing the background is already done |
|
1399 | 722 |
" |
2304 | 723 |
|item |
724 |
y0 "{ Class:SmallInteger }" |
|
725 |
y1 "{ Class:SmallInteger }" |
|
726 |
x0 "{ Class:SmallInteger }" |
|
727 |
| |
|
728 |
self paint:fgColor on:bgColor. |
|
729 |
||
730 |
x0 := textStartLeft - viewOrigin x. |
|
731 |
y1 := y. |
|
732 |
||
733 |
start to:stop do:[:i| |
|
2408 | 734 |
item := self at:i ifAbsent:self. "/ list changed during draw |
2304 | 735 |
item == self ifTrue:[^ self]. |
736 |
||
737 |
y0 := y1. |
|
738 |
y1 := self yVisibleOfLine:(i + 1). |
|
739 |
||
740 |
item notNil ifTrue:[ |
|
2352 | 741 |
renderer display:item atX:x0 y:y0 lineHeight:(y1 - y0). |
2304 | 742 |
] |
743 |
] |
|
1390 | 744 |
! |
745 |
||
2304 | 746 |
invalidateLineAt:aLineNr |
747 |
"add a damage to redraw a line specified by its line number to the |
|
748 |
input event queue. |
|
1390 | 749 |
" |
2322 | 750 |
^ self invalidateLineAt:aLineNr fromX:0. |
751 |
! |
|
752 |
||
753 |
invalidateLineAt:aLineNr fromX:x |
|
754 |
"add a damage to redraw a line specified by its line number to the |
|
755 |
input event queue. |
|
756 |
" |
|
1390 | 757 |
|y0 "{ Class:SmallInteger }" |
758 |
y1 "{ Class:SmallInteger }" |
|
759 |
yB "{ Class:SmallInteger }" |
|
2322 | 760 |
x0 "{ Class:SmallInteger }" |
761 |
xR "{ Class:SmallInteger }" |
|
1390 | 762 |
| |
763 |
||
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
764 |
(shown and:[aLineNr notNil and:[aLineNr > 0]]) ifFalse:[ |
2304 | 765 |
^ self |
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
766 |
]. |
1390 | 767 |
|
2322 | 768 |
xR := width - margin. |
769 |
x0 := x max:margin. |
|
770 |
x0 < xR ifFalse:[ ^ self]. |
|
771 |
||
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
772 |
yB := height - margin. |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
773 |
y0 := (self yVisibleOfLine:aLineNr) max:margin. |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
774 |
|
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
775 |
y0 < yB ifTrue:[ |
2304 | 776 |
y1 := (self yVisibleOfLine:(aLineNr + 1)) min:yB. |
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
777 |
|
2304 | 778 |
y1 > y0 ifTrue:[ |
2322 | 779 |
self invalidateX:x0 y:y0 width:(xR - x0) height:(y1 - y0) repairNow:false. |
2304 | 780 |
] |
781 |
]. |
|
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
782 |
! |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
783 |
|
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
784 |
redraw |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
785 |
"redraw complete view |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
786 |
" |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
787 |
self redrawX:0 y:0 width:width height:height. |
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
788 |
|
1390 | 789 |
|
790 |
! |
|
791 |
||
792 |
redrawX:x y:y width:w height:h |
|
793 |
"redraw part of myself immediately, given logical coordinates |
|
794 |
" |
|
2304 | 795 |
|start stop yAbs drawFailed| |
1390 | 796 |
|
797 |
shown ifFalse:[^ self]. |
|
798 |
||
799 |
self paint:bgColor. |
|
800 |
self fillRectangleX:x y:y width:w height:h. |
|
801 |
||
2304 | 802 |
widthOfContents isNil ifTrue:[ |
803 |
self preferredExtent |
|
2188 | 804 |
]. |
1390 | 805 |
|
2304 | 806 |
start := self yVisibleToLineNr:y. |
807 |
start isNil ifTrue:[ ^ self ]. |
|
808 |
||
809 |
yAbs := y + h. |
|
810 |
stop := self yVisibleToLineNr:yAbs. |
|
811 |
||
812 |
stop isNil ifTrue:[ |
|
2408 | 813 |
stop := self size. |
2304 | 814 |
] ifFalse:[ |
815 |
yAbs == (startOfLinesY at:stop) ifTrue:[ |
|
816 |
stop := (stop - 1) max:start |
|
817 |
]. |
|
818 |
]. |
|
1390 | 819 |
|
2304 | 820 |
drawFailed := true. |
1390 | 821 |
|
2304 | 822 |
"/ test whether list changed during redraw |
823 |
stop >= start ifTrue:[ |
|
824 |
StopRedrawSignal handle:[:ex| ] |
|
825 |
do:[ self drawFrom:start to:stop x:x |
|
826 |
y:(self yVisibleOfLine:start) w:w. |
|
827 |
||
828 |
drawFailed := false. "/ success drawn |
|
829 |
] |
|
830 |
]. |
|
831 |
||
832 |
drawFailed ifTrue:[ self invalidate ]. |
|
1390 | 833 |
! ! |
834 |
||
835 |
!ListModelView methodsFor:'event handling'! |
|
836 |
||
837 |
keyPress:aKey x:x y:y |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
838 |
"a key was pressed - handle page-keys here" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
839 |
|
1390 | 840 |
<resource: #keyboard( #PreviousPage #NextPage #HalfPageUp #HalfPageDown |
2408 | 841 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
842 |
)> |
|
1390 | 843 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
844 |
|n| |
1390 | 845 |
|
2408 | 846 |
self size ~~ 0 ifTrue:[ |
847 |
(aKey == #PreviousPage) ifTrue:[^ self pageUp]. |
|
848 |
(aKey == #NextPage) ifTrue:[^ self pageDown]. |
|
849 |
(aKey == #HalfPageUp) ifTrue:[^ self halfPageUp]. |
|
850 |
(aKey == #HalfPageDown) ifTrue:[^ self halfPageDown]. |
|
851 |
(aKey == #BeginOfText) ifTrue:[^ self scrollToTop]. |
|
852 |
(aKey == #EndOfText) ifTrue:[^ self scrollToBottom]. |
|
1390 | 853 |
|
2408 | 854 |
(aKey == #ScrollUp or:[aKey == #ScrollDown]) ifTrue:[ |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
855 |
n := 1 + (self sensor compressKeyPressEventsWithKey:aKey). |
2408 | 856 |
n := n * self verticalScrollStep. |
1390 | 857 |
|
2408 | 858 |
aKey == #ScrollUp ifTrue:[self scrollUp:n] |
859 |
ifFalse:[self scrollDown:n]. |
|
860 |
^ self |
|
861 |
]. |
|
1390 | 862 |
]. |
863 |
super keyPress:aKey x:x y:y |
|
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
864 |
! |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
865 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
866 |
sizeChanged:how |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
867 |
previousExtent := self extent. |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
868 |
super sizeChanged:how. |
1390 | 869 |
! ! |
870 |
||
1554 | 871 |
!ListModelView methodsFor:'event simulation'! |
872 |
||
873 |
syncronizeEvents |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
874 |
self obsoleteMethodWarning:'no longer supported'. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
875 |
^ false |
1554 | 876 |
! |
877 |
||
878 |
syncronizeEvents:aBoolean |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
879 |
self obsoleteMethodWarning:'no longer supported'. |
1554 | 880 |
! ! |
881 |
||
1390 | 882 |
!ListModelView methodsFor:'fetch resources'! |
883 |
||
884 |
colorOnDevice:aColor |
|
885 |
"fetch a device colors |
|
886 |
" |
|
2097 | 887 |
^ aColor notNil ifTrue:[aColor onDevice:device] ifFalse:[nil] |
1390 | 888 |
! |
889 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
890 |
imageOnMyDevice:anImage |
1390 | 891 |
"associate image to device and clear pixel mask |
892 |
returns the new image. |
|
893 |
" |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
894 |
|deviceImage| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
895 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
896 |
anImage isNil ifTrue:[^ anImage]. |
1390 | 897 |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
898 |
deviceImage := anImage onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
899 |
deviceImage isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
900 |
deviceImage clearMaskedPixels. |
1390 | 901 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
902 |
^ deviceImage |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
903 |
"/ |image| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
904 |
"/ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
905 |
"/ (image := anImage) notNil ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
906 |
"/ image device ~~ device ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
907 |
"/ image := image copy. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
908 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
909 |
"/ image := image onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
910 |
"/ image := image clearMaskedPixels. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
911 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
912 |
"/ ^ image |
1390 | 913 |
! ! |
914 |
||
1417 | 915 |
!ListModelView methodsFor:'focus handling'! |
916 |
||
917 |
wantsFocusWithButtonPress |
|
918 |
"catch the keyboard focus on button click |
|
919 |
" |
|
920 |
^ true |
|
921 |
||
922 |
||
923 |
! |
|
924 |
||
925 |
wantsFocusWithPointerEnter |
|
926 |
"views which like to take the keyboard focus |
|
927 |
when the pointer enters can do so by redefining this |
|
928 |
to return true" |
|
929 |
||
930 |
^ true |
|
931 |
||
932 |
! ! |
|
933 |
||
2501 | 934 |
!ListModelView methodsFor:'initialization & release'! |
1390 | 935 |
|
936 |
create |
|
937 |
"fetch device dependent resources |
|
938 |
" |
|
939 |
super create. |
|
940 |
self fetchResources. |
|
941 |
! |
|
942 |
||
943 |
initStyle |
|
944 |
"setup viewStyle specifics |
|
945 |
" |
|
946 |
super initStyle. |
|
947 |
||
1595 | 948 |
DefaultForegroundColor isNil ifTrue:[ |
2265 | 949 |
self updateStyleCache |
1595 | 950 |
]. |
951 |
||
1390 | 952 |
DefaultBackgroundColor notNil ifTrue:[ |
2265 | 953 |
viewBackground := DefaultBackgroundColor |
1390 | 954 |
]. |
955 |
lineSpacing := 0. |
|
956 |
textStartLeft := 2. |
|
957 |
fgColor := DefaultForegroundColor. |
|
958 |
bgColor := viewBackground. |
|
959 |
startOfLinesY := OrderedCollection new. |
|
960 |
||
961 |
startOfLinesY add:(2 + margin). "/ top inset of first line |
|
962 |
||
963 |
DefaultShadowColor notNil ifTrue:[ |
|
2265 | 964 |
shadowColor := DefaultShadowColor |
1390 | 965 |
]. |
966 |
||
967 |
DefaultLightColor notNil ifTrue:[ |
|
2265 | 968 |
lightColor := DefaultLightColor |
1390 | 969 |
]. |
970 |
! |
|
971 |
||
972 |
initialize |
|
973 |
"setup default attributes |
|
974 |
" |
|
975 |
super initialize. |
|
976 |
||
2261 | 977 |
viewOrigin := 0@0. |
978 |
bitGravity := #NorthWest. |
|
979 |
enabled := true. |
|
980 |
autoScroll := true. |
|
1827 | 981 |
scrollWhenUpdating := #beginOfText. |
2261 | 982 |
hasConstantHeight := false. |
2352 | 983 |
|
984 |
renderer isNil ifTrue:[ |
|
985 |
renderer := self class defaultRenderer forView:self. |
|
986 |
]. |
|
1390 | 987 |
! |
988 |
||
1562 | 989 |
mapped |
990 |
"recompute list |
|
991 |
" |
|
992 |
shown ifFalse:[ |
|
2265 | 993 |
self recomputeHeightOfContents. |
994 |
self contentsChanged. |
|
1562 | 995 |
]. |
996 |
super mapped |
|
997 |
||
998 |
! |
|
999 |
||
1390 | 1000 |
recreate |
1832 | 1001 |
"sent after a snapin or a migration, reinit for new device" |
1828 | 1002 |
|
1390 | 1003 |
super recreate. |
1004 |
self fetchResources. |
|
1796
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1005 |
! |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1006 |
|
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1007 |
reinitialize |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1008 |
"reinit after snapIn (font geometry might be different) |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1009 |
" |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1010 |
super reinitialize. |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1011 |
self recomputeHeightOfContents. |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1012 |
self contentsChanged. |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1773
diff
changeset
|
1013 |
|
2156 | 1014 |
! |
1015 |
||
1016 |
release |
|
1017 |
"remove dependencies |
|
1018 |
" |
|
1019 |
listHolder removeDependent:self. |
|
1020 |
list removeDependent:self. |
|
1021 |
||
1022 |
super release |
|
1390 | 1023 |
! ! |
1024 |
||
1025 |
!ListModelView methodsFor:'private'! |
|
1026 |
||
1457 | 1027 |
hasDamage |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
1028 |
"return true, if any damage events (i.e. expose or resize) are pending" |
1457 | 1029 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2464
diff
changeset
|
1030 |
^ self sensor hasDamageFor:self |
1457 | 1031 |
! |
1032 |
||
1390 | 1033 |
yAbsoluteOfLine:aLineNr |
1034 |
"given a lineNr, return y-coordinate absolute |
|
1035 |
" |
|
1744 | 1036 |
|y y2 y1 cash| |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
1037 |
|
1744 | 1038 |
cash := startOfLinesY. |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
1039 |
|
1744 | 1040 |
(y := cash at:aLineNr ifAbsent:nil) notNil ifTrue:[ |
2265 | 1041 |
^ y |
1446
fb46beba2d0c
startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
1042 |
]. |
1744 | 1043 |
|
1044 |
"/ recompute a y position |
|
1045 |
y1 := startOfLinesY at:1 ifAbsent:2. |
|
1046 |
y2 := startOfLinesY at:2 ifAbsent:10. |
|
1047 |
^ aLineNr * (y2 - y1) + y1 |
|
1390 | 1048 |
! |
1049 |
||
1050 |
yVisibleOfLine:aLineNr |
|
1051 |
"given a lineNr, return y-coordinate in view |
|
1052 |
" |
|
1744 | 1053 |
^ (self yAbsoluteOfLine:aLineNr) - viewOrigin y |
1390 | 1054 |
|
1055 |
||
1056 |
! |
|
1057 |
||
1058 |
yVisibleToLineNr:yVisible |
|
2301 | 1059 |
"returns the line number assigned to a physical y or nil if out of list |
1390 | 1060 |
" |
2301 | 1061 |
|cash |
1062 |
yAbs "{ Class: SmallInteger}" |
|
1063 |
size "{ Class: SmallInteger}" |
|
1064 |
ictr "{ Class: SmallInteger}" |
|
1065 |
yRun "{ Class: SmallInteger}" |
|
1390 | 1066 |
| |
1643 | 1067 |
cash := startOfLinesY. |
1390 | 1068 |
|
2301 | 1069 |
(size := cash size) < 2 ifTrue:[^ nil]. "/ empty list |
1390 | 1070 |
|
2301 | 1071 |
yAbs := yVisible + viewOrigin y. |
1072 |
yRun := cash at:size. |
|
1390 | 1073 |
|
2301 | 1074 |
yAbs >= yRun ifTrue:[ |
1075 |
yAbs == yRun ifTrue:[ ^ size - 1]. |
|
1076 |
^ nil "/ out of list |
|
1077 |
]. |
|
1390 | 1078 |
|
2301 | 1079 |
constantHeight notNil ifTrue:[ |
1080 |
yAbs := yAbs - (cash at:1). |
|
1081 |
yAbs < constantHeight ifTrue:[ ^ 1 ]. |
|
1082 |
^ yAbs // constantHeight + 1 |
|
1390 | 1083 |
]. |
1084 |
||
2301 | 1085 |
ictr := yAbs // (cash at:2). |
1086 |
ictr < 1 ifTrue:[ ictr := 1 ] |
|
1087 |
ifFalse:[ ictr := ictr min:size ]. |
|
1088 |
||
1089 |
yRun := cash at:ictr. |
|
1090 |
||
1091 |
yRun > yAbs ifTrue:[ |
|
1092 |
[(ictr := ictr - 1) > 0 ] whileTrue:[ |
|
1093 |
yRun := cash at:ictr. |
|
1094 |
yRun <= yAbs ifTrue:[ ^ ictr ]. |
|
1095 |
]. |
|
1096 |
^ 1 |
|
1390 | 1097 |
]. |
2301 | 1098 |
|
1099 |
[ yRun ~~ yAbs ] whileTrue:[ |
|
1100 |
ictr := ictr + 1. |
|
1101 |
yRun := cash at:ictr. |
|
1102 |
yRun > yAbs ifTrue:[ ^ ictr - 1 ]. |
|
1390 | 1103 |
]. |
2301 | 1104 |
^ ictr |
2464
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1105 |
! |
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1106 |
|
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1107 |
yVisibleToRowNr:yVisible |
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1108 |
"for protocol compatibility with DSVColumnView" |
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1109 |
|
2fcd6ccdaa7b
+yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
2458
diff
changeset
|
1110 |
^ self yVisibleToLineNr:yVisible |
1390 | 1111 |
! ! |
1112 |
||
1113 |
!ListModelView methodsFor:'protocol'! |
|
1114 |
||
1115 |
fetchResources |
|
1116 |
"fetch device colors and ..., to avoid reallocation at redraw time; |
|
1117 |
*** called after a create or snapin to fetch all device resources |
|
1118 |
" |
|
1119 |
fgColor := self colorOnDevice:fgColor. |
|
1120 |
bgColor := self colorOnDevice:bgColor. |
|
2097 | 1121 |
font := font onDevice:device. |
1390 | 1122 |
! |
1123 |
||
2352 | 1124 |
lineHeightFor:anItem |
1125 |
"returns the computed line height for an item |
|
1390 | 1126 |
" |
2352 | 1127 |
^ lineSpacing + (renderer heightFor:anItem) |
1390 | 1128 |
! |
1129 |
||
1130 |
listSizeChanged:anIndex nLines:noLines |
|
1131 |
"list size changed; information is stored to recompute the |
|
1132 |
width if required( preferredExtent, horizontal scroller ... ). |
|
1133 |
see: widthOfContents |
|
1134 |
*** if nLines is negative, lines are removed otherwise added. |
|
1135 |
" |
|
1136 |
|start "{ Class:SmallInteger }" |
|
1137 |
stop "{ Class:SmallInteger }" |
|
1138 |
size "{ Class:SmallInteger }" |
|
1139 |
| |
|
1140 |
preferredExtent := nil. |
|
1141 |
||
1142 |
widthOfContents isNil ifTrue:[ "/ recompute whole list |
|
2408 | 1143 |
^ self |
1390 | 1144 |
]. |
1145 |
||
2408 | 1146 |
(noLines < 0 or:[(size := self size) <= noLines]) ifTrue:[ |
1147 |
widthOfContents := nil. "/ force recompute whole list |
|
1148 |
^ self |
|
1390 | 1149 |
]. |
1150 |
||
1151 |
stop := anIndex + noLines - 1. "/ recompute a range |
|
1152 |
start := anIndex. |
|
1153 |
||
1154 |
computeWidthInRange notNil ifTrue:[ |
|
2408 | 1155 |
start := computeWidthInRange y. |
1156 |
stop < start ifTrue:[stop := start min:size]. |
|
1157 |
start := (computeWidthInRange x) min:anIndex. |
|
1390 | 1158 |
]. |
1159 |
computeWidthInRange := start@stop |
|
1160 |
! |
|
1161 |
||
1457 | 1162 |
lostSynchronisation |
1163 |
"called when the changes derived from the model are faster than the handling |
|
1164 |
" |
|
1165 |
shown ifTrue:[ |
|
2302
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
1166 |
self recomputeHeightOfContents. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
1167 |
self invalidate. |
5a2a1d5d09f8
remove asynchronous handling of changes; always disabled because doesn't work
ca
parents:
2301
diff
changeset
|
1168 |
self contentsChanged |
1457 | 1169 |
]. |
1170 |
! |
|
1171 |
||
1390 | 1172 |
widthOfWidestLineBetween:firstLine and:lastLine |
1173 |
"return the width in pixels of the widest line in a range |
|
1174 |
" |
|
2265 | 1175 |
|item |
1390 | 1176 |
width "{ Class: SmallInteger }" |
1177 |
| |
|
1178 |
width := textStartLeft. |
|
1179 |
||
1180 |
firstLine to:lastLine do:[:anIndex| |
|
2408 | 1181 |
item := self at:anIndex ifAbsent:nil. |
1508
9c54f2e53da1
check whether #at:ifAbsent returns nil.
Claus Gittinger <cg@exept.de>
parents:
1457
diff
changeset
|
1182 |
|
2352 | 1183 |
item isNil ifTrue:[^ width + textStartLeft]. |
1508
9c54f2e53da1
check whether #at:ifAbsent returns nil.
Claus Gittinger <cg@exept.de>
parents:
1457
diff
changeset
|
1184 |
|
2352 | 1185 |
width := (renderer widthFor:item) max:width |
1390 | 1186 |
]. |
1187 |
^ width + textStartLeft |
|
1188 |
! ! |
|
1189 |
||
1820 | 1190 |
!ListModelView methodsFor:'queries'! |
1191 |
||
2274
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1192 |
isLineVisible:aLineNr |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1193 |
"returns true if the line is visible" |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1194 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1195 |
^ self isLineVisible:aLineNr in:self extent |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1196 |
! |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1197 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1198 |
isLineVisible:aLineNr in:anExtentPoint |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1199 |
"returns true if the line is visible" |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1200 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1201 |
|y| |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1202 |
y := self yVisibleOfLine:aLineNr. |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1203 |
|
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1204 |
^ (y between:margin and:(anExtentPoint y - margin)) |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1205 |
! |
c973acbc021d
only make selection visible after a resize, if it was visible before
ca
parents:
2265
diff
changeset
|
1206 |
|
1820 | 1207 |
size |
1208 |
"returns number of raws |
|
1209 |
" |
|
1210 |
^ list size |
|
1211 |
||
1212 |
||
1213 |
! ! |
|
1214 |
||
1390 | 1215 |
!ListModelView methodsFor:'recomputation'! |
1216 |
||
1217 |
preferredExtent |
|
1218 |
"returns the preferred extent |
|
1219 |
" |
|
1220 |
|x y| |
|
1221 |
||
1222 |
preferredExtent isNil ifTrue:[ |
|
2265 | 1223 |
y := self heightOfContents. |
1224 |
x := self widthOfContents. |
|
1225 |
preferredExtent := x@y |
|
1390 | 1226 |
]. |
1227 |
^ preferredExtent |
|
1228 |
||
1229 |
||
1230 |
! |
|
1231 |
||
1232 |
recomputeHeightOfContents |
|
1233 |
"recompute all the y positions |
|
1234 |
" |
|
1643 | 1235 |
|newList |
1236 |
yAbs "{ Class: SmallInteger }" |
|
1390 | 1237 |
lnHg "{ Class: SmallInteger }" |
1643 | 1238 |
size "{ Class: SmallInteger }" |
1390 | 1239 |
| |
1240 |
||
1643 | 1241 |
yAbs := startOfLinesY at:1. "/ top inset of first line |
2408 | 1242 |
size := self size. |
1643 | 1243 |
newList := OrderedCollection new:(size + 1). |
1244 |
||
1245 |
newList add:yAbs. |
|
1390 | 1246 |
|
2264 | 1247 |
size == 0 ifTrue:[ |
2408 | 1248 |
startOfLinesY := newList. |
1249 |
^ self |
|
2264 | 1250 |
]. |
1251 |
||
1252 |
hasConstantHeight ifTrue:[ |
|
2408 | 1253 |
constantHeight notNil ifTrue:[ lnHg := constantHeight ] |
1254 |
ifFalse:[ lnHg := self heightOfLineAt:1 ]. |
|
2265 | 1255 |
|
2408 | 1256 |
1 to:size do:[:anIndex| |
1257 |
newList add:(yAbs := yAbs + lnHg) |
|
1258 |
]. |
|
1259 |
startOfLinesY := newList. |
|
1260 |
^ self |
|
2264 | 1261 |
]. |
1262 |
||
1643 | 1263 |
1 to:size do:[:anIndex| |
2408 | 1264 |
lnHg := self heightOfLineAt:anIndex. |
1265 |
newList add:(yAbs := yAbs + lnHg) |
|
1390 | 1266 |
]. |
1643 | 1267 |
startOfLinesY := newList. |
1390 | 1268 |
! ! |
1269 |
||
1270 |
!ListModelView methodsFor:'scroller interface'! |
|
1271 |
||
1272 |
heightOfContents |
|
1273 |
"return the height of the contents in pixels |
|
1274 |
" |
|
2257
6d59932d078d
avoid returning nil heightOfContents
Claus Gittinger <cg@exept.de>
parents:
2244
diff
changeset
|
1275 |
^ startOfLinesY last ? 0 |
1390 | 1276 |
! |
1277 |
||
2261 | 1278 |
heightOfLineAt:aLineNr |
1279 |
"returns the total height for a line at an index( including lineSpacing ... ) |
|
1280 |
" |
|
1281 |
|item| |
|
1282 |
||
1283 |
hasConstantHeight ifTrue:[ |
|
2352 | 1284 |
constantHeight notNil ifTrue:[ ^ constantHeight ]. |
2408 | 1285 |
item := self at:1 ifAbsent:nil. |
2264 | 1286 |
|
2352 | 1287 |
item notNil ifTrue:[ |
1288 |
constantHeight := self lineHeightFor:item. |
|
1289 |
^ constantHeight |
|
1290 |
] |
|
2264 | 1291 |
] ifFalse:[ |
2408 | 1292 |
item := self at:aLineNr ifAbsent:nil. |
2264 | 1293 |
|
2352 | 1294 |
item notNil ifTrue:[ |
1295 |
^ self lineHeightFor:item |
|
1296 |
] |
|
2261 | 1297 |
]. |
2264 | 1298 |
^ 4 |
2261 | 1299 |
! |
1300 |
||
1390 | 1301 |
innerHeight |
1302 |
"returns the inner height of the contents shown |
|
1303 |
" |
|
1304 |
^ height - margin - margin |
|
1305 |
||
1306 |
! |
|
1307 |
||
1308 |
innerWidth |
|
1309 |
"returns the inner width of the contents shown |
|
1310 |
" |
|
1311 |
^ width - margin - margin |
|
1312 |
||
1313 |
! |
|
1314 |
||
1315 |
maxViewOriginY |
|
1316 |
"returns the maximum possible y of the view origin |
|
1317 |
" |
|
1318 |
^ (self heightOfContents - self innerHeight) max:0 |
|
1319 |
||
1320 |
||
1321 |
! |
|
1322 |
||
1323 |
verticalScrollStep |
|
1324 |
"return the amount to scroll when stepping up/down. |
|
1325 |
" |
|
1326 |
^ 10 |
|
1327 |
||
1328 |
! |
|
1329 |
||
1330 |
viewOrigin |
|
1331 |
"return the viewOrigin; thats the coordinate of the contents |
|
1332 |
which is shown topLeft in the view. |
|
1333 |
" |
|
1334 |
^ viewOrigin |
|
1335 |
||
1336 |
! |
|
1337 |
||
1338 |
widthOfContents |
|
1339 |
"return the width of the contents in pixels |
|
1340 |
" |
|
1341 |
|range |
|
1342 |
size "{ Class:SmallInteger }" |
|
1343 |
start "{ Class:SmallInteger }" |
|
1344 |
stop "{ Class:SmallInteger }" |
|
1345 |
| |
|
1346 |
(widthOfContents notNil and:[computeWidthInRange isNil]) ifTrue:[ |
|
2384 | 1347 |
^ widthOfContents + textStartLeft |
1390 | 1348 |
]. |
1349 |
range := computeWidthInRange. |
|
1350 |
computeWidthInRange := nil. |
|
1351 |
preferredExtent := nil. |
|
2384 | 1352 |
|
1353 |
shown ifFalse:[ ^ 60 ]. |
|
1354 |
||
2408 | 1355 |
size := self size. |
1390 | 1356 |
|
1357 |
size == 0 ifTrue:[ |
|
2384 | 1358 |
widthOfContents := 20. |
1390 | 1359 |
] ifFalse:[ |
2384 | 1360 |
widthOfContents isNil ifTrue:[ |
1361 |
widthOfContents := self widthOfWidestLineBetween:1 and:size |
|
1362 |
] ifFalse:[ |
|
1363 |
start := range x. |
|
1364 |
stop := range y min:size. |
|
1390 | 1365 |
|
2384 | 1366 |
start > stop ifFalse:[ |
1367 |
size := self widthOfWidestLineBetween:start and:stop. |
|
1390 | 1368 |
|
2384 | 1369 |
widthOfContents < size ifTrue:[ |
1370 |
widthOfContents := size |
|
1371 |
] |
|
1372 |
] |
|
1373 |
] |
|
1390 | 1374 |
]. |
1375 |
^ widthOfContents + textStartLeft |
|
1376 |
! |
|
1377 |
||
1378 |
xOriginOfContents |
|
1379 |
"return the horizontal origin of the contents in pixels |
|
1380 |
" |
|
1381 |
^ viewOrigin x |
|
1382 |
||
1383 |
! |
|
1384 |
||
1385 |
yOriginOfContents |
|
1386 |
"return the vertical origin of the contents in pixels |
|
1387 |
" |
|
1388 |
^ viewOrigin y |
|
1389 |
||
1390 |
! ! |
|
1391 |
||
1392 |
!ListModelView methodsFor:'scrolling'! |
|
1393 |
||
1394 |
halfPageDown |
|
1395 |
"scroll down half a page |
|
1396 |
" |
|
1827 | 1397 |
self scrollDown:(height // 2). |
1390 | 1398 |
|
1399 |
! |
|
1400 |
||
1401 |
halfPageUp |
|
1402 |
"scroll up half a page |
|
1403 |
" |
|
1827 | 1404 |
self scrollUp:(height // 2). |
1390 | 1405 |
|
1406 |
! |
|
1407 |
||
2367 | 1408 |
makeLineVisible:aLnNr |
1409 |
"make the line visible |
|
1410 |
" |
|
1411 |
aLnNr notNil ifTrue:[ |
|
1412 |
self scrollToLine:aLnNr |
|
1413 |
]. |
|
1414 |
! |
|
1415 |
||
1390 | 1416 |
scrollTo:anOrigin redraw:doRedraw |
1417 |
"change origin to have newOrigin be visible at the top-left. |
|
1418 |
" |
|
1538 | 1419 |
|newOrg dltOrg winGrp |
1390 | 1420 |
innerWT "{ Class:SmallInteger }" |
1421 |
innerHG "{ Class:SmallInteger }" |
|
1422 |
h "{ Class:SmallInteger }" |
|
1423 |
x "{ Class:SmallInteger }" |
|
1424 |
x0 "{ Class:SmallInteger }" |
|
1425 |
x1 "{ Class:SmallInteger }" |
|
1426 |
y "{ Class:SmallInteger }" |
|
1427 |
w "{ Class:SmallInteger }" |
|
1428 |
y0 "{ Class:SmallInteger }" |
|
1429 |
y1 "{ Class:SmallInteger }" |
|
1430 |
dX "{ Class:SmallInteger }" |
|
1431 |
dY "{ Class:SmallInteger }" |
|
1432 |
| |
|
1531 | 1433 |
|
1580 | 1434 |
realized ifFalse:[ |
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1435 |
^ self |
1390 | 1436 |
]. |
1580 | 1437 |
|
1390 | 1438 |
innerWT := self innerWidth. |
1439 |
innerHG := self innerHeight. |
|
1440 |
||
1441 |
h := viewOrigin y. |
|
1442 |
||
1443 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1444 |
y > (dY := self maxViewOriginY) ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1445 |
y := dY max:h |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1446 |
] |
1390 | 1447 |
] ifFalse:[ |
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1448 |
y := y max:0. |
1390 | 1449 |
]. |
1450 |
||
1451 |
(x := anOrigin x) > 0 ifTrue:[ |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1452 |
x := x min:(self widthOfContents - innerWT). |
1390 | 1453 |
]. |
1454 |
x := x max:0. |
|
1455 |
newOrg := (x @ y). |
|
1456 |
dltOrg := newOrg - viewOrigin. |
|
1457 |
dX := dltOrg x. |
|
1458 |
dY := dltOrg y. |
|
1459 |
||
1460 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1461 |
^ self |
1390 | 1462 |
]. |
1534 | 1463 |
dY := dY abs. |
1464 |
dX := dX abs. |
|
1390 | 1465 |
|
1534 | 1466 |
( (dX ~~ 0 and:[dY ~~ 0]) "/ scroll vertical & horizontal |
1467 |
or:[(innerHG - dY < 20 or:[innerWT - dX < 20])] "/ faster to invalidate screen |
|
1468 |
) ifTrue:[ |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1469 |
viewOrigin := newOrg. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1470 |
self originChanged:dltOrg. |
1534 | 1471 |
^ self invalidate |
1472 |
]. |
|
1753
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1473 |
|
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1474 |
(winGrp := self windowGroup) notNil ifTrue:[ |
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1475 |
winGrp processRealExposeEventsFor:self. |
1753
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1476 |
]. |
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1477 |
|
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1478 |
self originWillChange. |
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1479 |
|
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1480 |
doRedraw ifFalse:[ |
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1481 |
viewOrigin := newOrg. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1482 |
^ self originChanged:dltOrg |
1753
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1483 |
]. |
17769f8df493
#scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents:
1752
diff
changeset
|
1484 |
|
1531 | 1485 |
self catchExpose. |
1486 |
viewOrigin := newOrg. |
|
1487 |
||
1390 | 1488 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1489 |
y0 := y1 := margin + dY. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1490 |
h := innerHG - dY. |
1390 | 1491 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1492 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1493 |
ifFalse:[y1 := margin. y := y1 + h]. |
1390 | 1494 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1495 |
self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:true. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1496 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
1390 | 1497 |
|
1498 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1499 |
x0 := x1 := dX + margin. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1500 |
w := innerWT - dX. |
1390 | 1501 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1502 |
dltOrg x < 0 ifTrue:[x0 := x := margin ] |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1503 |
ifFalse:[x1 := margin. x := w]. |
1390 | 1504 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1505 |
self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:true. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1506 |
self invalidateX:x y:margin width:(width - w) height:innerHG. |
1390 | 1507 |
]. |
1508 |
self originChanged:dltOrg. |
|
1531 | 1509 |
self waitForExpose. |
1510 |
||
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1511 |
winGrp notNil ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1512 |
winGrp processRealExposeEventsFor:self. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1513 |
]. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2408
diff
changeset
|
1514 |
|
1390 | 1515 |
! |
1516 |
||
1517 |
scrollToLine:aLineNumber |
|
1518 |
"make line visible |
|
1519 |
" |
|
1744 | 1520 |
|inHg "{ Class:SmallInteger }" |
1521 |
yTop "{ Class:SmallInteger }" |
|
1522 |
orgY "{ Class:SmallInteger }" |
|
1523 |
yBot "{ Class:SmallInteger }" |
|
1390 | 1524 |
| |
2408 | 1525 |
(shown and:[aLineNumber notNil and:[aLineNumber between:1 and:(self size)]]) ifFalse:[ |
1526 |
^ self |
|
1390 | 1527 |
]. |
1528 |
||
1744 | 1529 |
yTop := self yAbsoluteOfLine:aLineNumber. |
1530 |
inHg := self innerHeight. |
|
1531 |
orgY := viewOrigin y. |
|
1532 |
||
1533 |
yTop > orgY ifTrue:[ |
|
2408 | 1534 |
yBot := self yAbsoluteOfLine:(aLineNumber + 1). |
1390 | 1535 |
|
2408 | 1536 |
yBot <= (orgY + inHg) ifTrue:[ |
1537 |
^ self |
|
1538 |
]. |
|
1390 | 1539 |
]. |
1744 | 1540 |
yTop := (yTop - (inHg // 2)) max:0. |
1541 |
self scrollTo:(viewOrigin x @ yTop). |
|
1390 | 1542 |
! ! |
1543 |
||
1748 | 1544 |
!ListModelView methodsFor:'scrolling auto'! |
1545 |
||
1546 |
startAutoScroll:aBlock distance:aDistance |
|
1547 |
"setup for auto-scroll (when button-press-moving below view); |
|
1548 |
- timeDelta for scroll is computed from distance |
|
1549 |
" |
|
1550 |
|timeDelta| |
|
1551 |
||
1552 |
(autoScroll and:[aBlock notNil]) ifFalse:[ |
|
2265 | 1553 |
^ self stopAutoScroll |
1748 | 1554 |
]. |
1555 |
autoScrollBlock notNil ifTrue:[ |
|
2265 | 1556 |
Processor removeTimedBlock:autoScrollBlock. |
1748 | 1557 |
] ifFalse:[ |
2265 | 1558 |
self compressMotionEvents:false. |
1748 | 1559 |
]. |
1560 |
||
1561 |
timeDelta := 0.5 / (aDistance abs). |
|
1562 |
||
1563 |
autoScrollBlock := [ |
|
2265 | 1564 |
aBlock value. |
1565 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
|
1748 | 1566 |
]. |
1567 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
|
1568 |
||
1569 |
! |
|
1570 |
||
1571 |
stopAutoScroll |
|
1572 |
"stop any autoScroll |
|
1573 |
" |
|
1574 |
autoScrollBlock notNil ifTrue:[ |
|
2265 | 1575 |
Processor removeTimedBlock:autoScrollBlock. |
1576 |
autoScrollBlock := nil. |
|
1577 |
self compressMotionEvents:true. |
|
1748 | 1578 |
]. |
1579 |
! ! |
|
1580 |
||
2352 | 1581 |
!ListModelView::Renderer class methodsFor:'documentation'! |
1582 |
||
1583 |
documentation |
|
1584 |
" |
|
1585 |
prepared for ListItemRenderer |
|
1586 |
.... SelectionItemRenderer ... |
|
1587 |
||
1588 |
goal: |
|
1589 |
allow the user to redefine the display operation and the dimesion queries |
|
1590 |
" |
|
1591 |
! ! |
|
1592 |
||
1593 |
!ListModelView::Renderer class methodsFor:'instance creation'! |
|
1594 |
||
1595 |
forView:aView |
|
1596 |
|renderer| |
|
1597 |
||
1598 |
renderer := self basicNew initialize. |
|
1599 |
renderer forView:aView. |
|
1600 |
^ renderer |
|
1601 |
! ! |
|
1602 |
||
1603 |
!ListModelView::Renderer methodsFor:'displaying'! |
|
1604 |
||
1605 |
display:anItem atX:xLeft y:yTop lineHeight:h |
|
1606 |
"display the item on the view |
|
1607 |
" |
|
1608 |
|x0 y0 label| |
|
1609 |
||
1610 |
x0 := xLeft. |
|
1611 |
y0 := yTop. |
|
1612 |
||
1613 |
anItem isHierarchicalItem ifTrue:[ |
|
1614 |
anItem displayOn:view x:x0 y:y0 h:h |
|
1615 |
] ifFalse:[ |
|
1616 |
anItem isNil ifTrue:[^ self]. |
|
1617 |
||
1618 |
y0 := y0 - ((self heightFor:anItem) + 1 - h // 2). |
|
1619 |
label := anItem. |
|
1620 |
||
1621 |
label isImageOrForm ifFalse:[ |
|
1622 |
label isNumber ifTrue:[ |
|
1623 |
label := label printString |
|
1624 |
]. |
|
1625 |
y0 := y0 + view font ascent |
|
1626 |
]. |
|
1627 |
label displayOn:view x:x0 y:y0 |
|
1628 |
]. |
|
1629 |
! ! |
|
1630 |
||
1631 |
!ListModelView::Renderer methodsFor:'instance creation'! |
|
1632 |
||
1633 |
forView:aView |
|
1634 |
view := aView. |
|
1635 |
! ! |
|
1636 |
||
1637 |
!ListModelView::Renderer methodsFor:'queries-dimensions'! |
|
1638 |
||
1639 |
heightFor:anItem |
|
1640 |
"returns the height of an item on the view |
|
1641 |
" |
|
1642 |
^ anItem heightOn:view |
|
1643 |
! |
|
1644 |
||
1645 |
widthFor:anItem |
|
1646 |
"returns the width of an item on the view |
|
1647 |
" |
|
1648 |
^ anItem widthOn:view |
|
1649 |
! ! |
|
1650 |
||
1390 | 1651 |
!ListModelView class methodsFor:'documentation'! |
1652 |
||
1653 |
version |
|
2569 | 1654 |
^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.83 2003-10-08 15:35:03 cg Exp $' |
1390 | 1655 |
! ! |
2244
c9a195d28e72
change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents:
2188
diff
changeset
|
1656 |
|
1390 | 1657 |
ListModelView initialize! |