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