author | Claus Gittinger <cg@exept.de> |
Fri, 06 Sep 2013 14:24:53 +0200 | |
changeset 4380 | 0c043b8a8b4b |
parent 4272 | 7372fb880713 |
child 4516 | 1e8e11a8465c |
permissions | -rw-r--r-- |
444 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
" |
|
1813 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
444 | 14 |
SelectionInListView subclass:#SelectionInTreeView |
847 | 15 |
instanceVariableNames:'validateDoubleClickBlock selectionHolder rootHolder imageWidth |
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
16 |
showLines showLinesForRoot listOfNodes imageInset textInset |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
17 |
labelOffsetY lineMask itemClass lineColor computeResources |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
18 |
showRoot showDirectoryIndicator closeIndicator openIndicator |
1171 | 19 |
showDirectoryIndicatorForRoot imageOpened imageClosed imageItem |
20 |
discardMotionEvents registeredImages supportsExpandAll |
|
21 |
buildInArray drawVLinesFromLevel highlightMode editorWidget |
|
1202
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
22 |
editorIndex editValueFgColor validateExpandabilityBlock' |
1171 | 23 |
classVariableNames:'DefaultHilightMode SelectionInset' |
847 | 24 |
poolDictionaries:'' |
1233 | 25 |
category:'Views-Trees' |
444 | 26 |
! |
27 |
||
28 |
!SelectionInTreeView class methodsFor:'documentation'! |
|
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
||
43 |
! |
|
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
somewhat like a SelectionInListView; but specialized for hierarchical (i.e. tree-like) |
|
48 |
lists and adds the functions to show/hide subtrees. |
|
456 | 49 |
Requires SelectionInTree as model and TreeItem (or compatible) list entries. |
444 | 50 |
|
1431 | 51 |
Notice: |
52 |
This class obsoletes SelectionInHierarchyView, which is no longer |
|
53 |
maintained but kept for backward compatibility. |
|
54 |
||
55 |
Notice2: |
|
56 |
Even for this class, an improved replacement now exists: |
|
57 |
HierarchicalListView. |
|
58 |
Please consider using that one. |
|
59 |
(however, this class is kept for backward compatibility). |
|
446 | 60 |
|
444 | 61 |
[see also:] |
456 | 62 |
SelectionInTree |
63 |
TreeItem |
|
444 | 64 |
SelectionInListView |
494 | 65 |
FileSelectionTree |
444 | 66 |
|
67 |
[author:] |
|
68 |
Claus Atzkern |
|
69 |
" |
|
70 |
! |
|
71 |
||
72 |
examples |
|
73 |
" |
|
74 |
shows the tree of smalltalk classes: |
|
75 |
[exBegin] |
|
514 | 76 |
|top sel| |
456 | 77 |
|
514 | 78 |
top := StandardSystemView new; extent:300@300. |
456 | 79 |
sel := SelectionInTreeView new. |
514 | 80 |
sel root:(TreeItem newAsTreeFromSmalltalkClass:Object). |
456 | 81 |
sel action:[:nr | Transcript show:'selected:'; showCR:nr]. |
82 |
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)). |
|
83 |
top open. |
|
84 |
[exEnd] |
|
85 |
||
86 |
||
485 | 87 |
|
456 | 88 |
same, including nil-subclasses (i.e. really all classes): |
89 |
[exBegin] |
|
514 | 90 |
|top sel| |
444 | 91 |
|
514 | 92 |
top := StandardSystemView new; extent:300@300. |
456 | 93 |
sel := SelectionInTreeView new. |
514 | 94 |
sel root:(TreeItem newAsTreeFromSmalltalkClass:nil). |
456 | 95 |
sel action:[:nr | Transcript show:'selected:'; showCR:nr]. |
685 | 96 |
sel lineColor:(Color red). |
456 | 97 |
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)). |
98 |
top open. |
|
99 |
[exEnd] |
|
100 |
||
485 | 101 |
|
483 | 102 |
|
485 | 103 |
shows the tree of smalltalk classes; show directory indication and no |
104 |
lines. |
|
105 |
[exBegin] |
|
514 | 106 |
|top sel| |
483 | 107 |
|
514 | 108 |
top := StandardSystemView new; extent:300@300. |
483 | 109 |
sel := SelectionInTreeView new. |
485 | 110 |
sel showLines:false. |
111 |
sel showDirectoryIndicator:true. |
|
514 | 112 |
sel root:(TreeItem newAsTreeFromSmalltalkClass:Object). |
485 | 113 |
sel action:[:nr | Transcript show:'selected:'; showCR:nr]. |
483 | 114 |
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)). |
115 |
top open. |
|
485 | 116 |
[exEnd] |
117 |
" |
|
118 |
||
514 | 119 |
|
444 | 120 |
! ! |
121 |
||
122 |
!SelectionInTreeView class methodsFor:'constants'! |
|
123 |
||
494 | 124 |
minImageInset |
125 |
"returns minimum inset from directory indication to image |
|
471 | 126 |
" |
494 | 127 |
^ 6 |
490 | 128 |
|
129 |
||
130 |
! ! |
|
131 |
||
900 | 132 |
!SelectionInTreeView class methodsFor:'defaults'! |
133 |
||
1171 | 134 |
defaultModelClass |
135 |
"returns the default model |
|
136 |
" |
|
137 |
^ SelectionInTree |
|
138 |
! |
|
139 |
||
900 | 140 |
updateStyleCache |
141 |
"extract values from the styleSheet and cache them in class variables" |
|
142 |
||
143 |
<resource: #style (#'selection.highlightMode')> |
|
144 |
||
1171 | 145 |
SelectionInset := 4. |
900 | 146 |
DefaultHilightMode := StyleSheet at:'selection.highlightMode' default:#line. |
147 |
" |
|
148 |
self updateStyleCache |
|
149 |
" |
|
150 |
||
151 |
||
152 |
! ! |
|
153 |
||
811 | 154 |
!SelectionInTreeView class methodsFor:'resources'! |
490 | 155 |
|
156 |
closeIndicator |
|
1278 | 157 |
"returns a little [+] bitmap" |
158 |
||
1624 | 159 |
^ HierarchicalListView closeIndicator |
811 | 160 |
|
589 | 161 |
|
811 | 162 |
|
163 |
||
164 |
||
165 |
||
471 | 166 |
! |
167 |
||
444 | 168 |
imageClosed |
1278 | 169 |
"returns a closed file-directory bitmap" |
170 |
||
1624 | 171 |
^ HierarchicalListView collapsedIcon |
444 | 172 |
|
173 |
! |
|
174 |
||
175 |
imageItem |
|
1278 | 176 |
"returns a regular file bitmap" |
177 |
||
1624 | 178 |
^ HierarchicalListView emptyIcon |
444 | 179 |
|
811 | 180 |
|
444 | 181 |
|
811 | 182 |
|
183 |
||
444 | 184 |
! |
185 |
||
186 |
imageOpened |
|
1278 | 187 |
"returns an opened file-directory bitmap" |
188 |
||
1624 | 189 |
^ HierarchicalListView expandedIcon |
444 | 190 |
|
490 | 191 |
! |
192 |
||
193 |
openIndicator |
|
1278 | 194 |
"returns a little [-] bitmap" |
195 |
||
1624 | 196 |
^ HierarchicalListView openIndicator |
490 | 197 |
|
811 | 198 |
|
444 | 199 |
! ! |
200 |
||
201 |
!SelectionInTreeView methodsFor:'accessing'! |
|
202 |
||
900 | 203 |
highlightMode |
204 |
"get the mode how to draw a selected line: |
|
205 |
#line draw whole line selected |
|
206 |
#label draw label selected |
|
207 |
" |
|
208 |
^ highlightMode |
|
209 |
! |
|
210 |
||
211 |
highlightMode:aMode |
|
212 |
"set the mode how to draw a selected line: |
|
213 |
#line draw whole line selected |
|
214 |
#label draw label selected |
|
215 |
" |
|
216 |
|mode| |
|
217 |
||
218 |
(mode := aMode) == #label ifFalse:[ |
|
219 |
mode := #line |
|
220 |
]. |
|
221 |
||
222 |
mode ~~ highlightMode ifTrue:[ |
|
223 |
highlightMode := mode. |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
224 |
self invalidate |
900 | 225 |
] |
226 |
! |
|
227 |
||
1171 | 228 |
itemClass |
229 |
"returns current itemClass used |
|
230 |
" |
|
231 |
^ itemClass |
|
232 |
||
233 |
||
234 |
! |
|
235 |
||
236 |
itemClass:anItemClass |
|
237 |
"set itemClass to be used |
|
238 |
" |
|
239 |
||
240 |
(anItemClass notNil and:[anItemClass ~~ itemClass]) ifTrue:[ |
|
241 |
itemClass := anItemClass. |
|
242 |
computeResources := true. |
|
243 |
self refetchDeviceResources. |
|
244 |
]. |
|
245 |
||
246 |
! |
|
247 |
||
685 | 248 |
lineColor |
249 |
"returns user configured line color or nil |
|
250 |
" |
|
251 |
^ lineColor |
|
252 |
||
253 |
! |
|
254 |
||
255 |
lineColor:aColor |
|
256 |
"returns user configured line color or nil |
|
257 |
" |
|
258 |
|col| |
|
259 |
||
260 |
col := aColor = fgColor ifTrue:[nil] ifFalse:[aColor]. |
|
261 |
||
262 |
col = lineColor ifFalse:[ |
|
263 |
lineColor := col. |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
264 |
lineColor notNil ifTrue:[lineColor := lineColor onDevice:device]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
265 |
self invalidate |
685 | 266 |
] |
267 |
! |
|
268 |
||
490 | 269 |
nodeAtIndex:anIndex |
270 |
"returns node at an index or nil |
|
271 |
" |
|
785 | 272 |
(anIndex notNil and:[anIndex between:1 and:listOfNodes size]) ifTrue:[ |
490 | 273 |
^ listOfNodes at:anIndex |
274 |
]. |
|
275 |
^ nil |
|
276 |
! |
|
277 |
||
507 | 278 |
root |
279 |
"gets the root of the model; the first item into list. |
|
280 |
" |
|
281 |
^ self nodeAtIndex:1 |
|
282 |
! |
|
283 |
||
284 |
root:aRoot |
|
285 |
"sets the root of the model; the first item into list. |
|
286 |
" |
|
514 | 287 |
aRoot notNil ifTrue:[aRoot expand]. |
507 | 288 |
model root:aRoot |
289 |
! |
|
290 |
||
490 | 291 |
textInset |
292 |
"get the left inset of the text label |
|
293 |
" |
|
294 |
^ textInset |
|
295 |
! |
|
296 |
||
297 |
textInset:anInset |
|
298 |
"set the left inset of the text label |
|
299 |
" |
|
300 |
anInset ~~ textInset ifTrue:[ |
|
301 |
anInset >= 0 ifTrue:[ |
|
302 |
textInset := anInset. |
|
303 |
self invalidate |
|
304 |
] ifFalse:[ |
|
305 |
self error |
|
306 |
] |
|
307 |
]. |
|
308 |
! ! |
|
309 |
||
310 |
!SelectionInTreeView methodsFor:'accessing-behavior'! |
|
311 |
||
855 | 312 |
drawVLinesFromLevel |
313 |
"returns the level vertical lines are drawn from; |
|
314 |
starting at 1 up to n |
|
315 |
" |
|
316 |
^ drawVLinesFromLevel |
|
317 |
! |
|
318 |
||
319 |
drawVLinesFromLevel:aLevel |
|
320 |
"set the level vertical lines are drawn from; |
|
321 |
starting at 1 up to n |
|
322 |
" |
|
323 |
|lv| |
|
324 |
||
325 |
lv := (aLevel ? 1) max:1. |
|
326 |
||
327 |
lv ~~ drawVLinesFromLevel ifTrue:[ |
|
328 |
drawVLinesFromLevel := lv. |
|
329 |
self invalidate |
|
330 |
] |
|
331 |
! |
|
332 |
||
835 | 333 |
supportsExpandAll |
334 |
^ supportsExpandAll |
|
335 |
! |
|
336 |
||
337 |
supportsExpandAll:aBool |
|
338 |
||
339 |
supportsExpandAll := aBool |
|
340 |
! |
|
341 |
||
517 | 342 |
validateDoubleClickBlock |
1202
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
343 |
"return the conditionBlock; this block is evaluated before a doubleClick action |
517 | 344 |
on a node will be performed. In case of returning false, the doubleClick will |
345 |
not be handled. |
|
346 |
" |
|
347 |
^ validateDoubleClickBlock |
|
348 |
||
349 |
||
350 |
! |
|
351 |
||
352 |
validateDoubleClickBlock:aOneArgBlock |
|
353 |
"set the conditionBlock; this block is evaluated before a doubleClick action |
|
354 |
on a node will be performed. In case of returning false, the doubleClick will |
|
355 |
not be handled. |
|
356 |
" |
|
357 |
validateDoubleClickBlock := aOneArgBlock |
|
358 |
||
359 |
||
1202
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
360 |
! |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
361 |
|
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
362 |
validateExpandabilityBlock |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
363 |
"return the expand conditionBlock; this block is evaluated before an expand due to |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
364 |
a doubleClick on a node will be performed. In case of returning false, |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
365 |
the node will not be expanded. |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
366 |
" |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
367 |
^ validateExpandabilityBlock |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
368 |
|
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
369 |
|
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
370 |
! |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
371 |
|
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
372 |
validateExpandabilityBlock:aOneArgBlock |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
373 |
"set the expand conditionBlock; this block is evaluated before an expand due to |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
374 |
a doubleClick on a node will be performed. In case of returning false, |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
375 |
the node will not be expanded. |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
376 |
" |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
377 |
validateExpandabilityBlock := aOneArgBlock |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
378 |
|
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
379 |
|
514 | 380 |
! ! |
381 |
||
382 |
!SelectionInTreeView methodsFor:'accessing-channels'! |
|
383 |
||
384 |
rootHolder |
|
385 |
"get the holder which keeps the hierarchical list entry or nil |
|
386 |
" |
|
387 |
^ rootHolder |
|
388 |
! |
|
389 |
||
390 |
rootHolder:aValueHolder |
|
391 |
"set the holder which keeps the hierarchical list entry or nil |
|
392 |
" |
|
393 |
rootHolder notNil ifTrue:[ |
|
394 |
rootHolder removeDependent:self |
|
395 |
]. |
|
855 | 396 |
|
514 | 397 |
(rootHolder := aValueHolder) notNil ifTrue:[ |
398 |
rootHolder addDependent:self. |
|
399 |
self rootFromModel. |
|
494 | 400 |
]. |
514 | 401 |
! |
402 |
||
403 |
selectionHolder |
|
404 |
"get the holder which keeps a list of selected items or nil |
|
405 |
" |
|
406 |
^ selectionHolder |
|
407 |
||
408 |
! |
|
409 |
||
410 |
selectionHolder:aHolder |
|
411 |
"set the holder which keeps a list of selected items or nil |
|
412 |
" |
|
413 |
selectionHolder notNil ifTrue:[ |
|
414 |
selectionHolder removeDependent:self |
|
415 |
]. |
|
416 |
||
417 |
(selectionHolder := aHolder) notNil ifTrue:[ |
|
418 |
selectionHolder addDependent:self. |
|
419 |
self selectionFromModel |
|
420 |
]. |
|
421 |
||
490 | 422 |
! ! |
423 |
||
424 |
!SelectionInTreeView methodsFor:'accessing-images'! |
|
425 |
||
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
426 |
imageClosed |
1278 | 427 |
"return the value of the instance variable 'imageClosed'. |
428 |
Thats the (default) bitmap image shown for closed folders |
|
429 |
(initialized to a file-directory bitmap)" |
|
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
430 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
431 |
^ imageClosed |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
432 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
433 |
"Created: 3.7.1997 / 12:34:31 / cg" |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
434 |
! |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
435 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
436 |
imageItem |
1278 | 437 |
"return the value of the instance variable 'imageItem'. |
438 |
Thats the (default) bitmap image shown for regular items |
|
439 |
(initialized to a plain-file bitmap)" |
|
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
440 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
441 |
^ imageItem |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
442 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
443 |
"Created: 3.7.1997 / 12:34:34 / cg" |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
444 |
! |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
445 |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
446 |
imageOnMyDevice:anImage |
846 | 447 |
"associate image to device and clear pixel mask (in case of realized); |
569 | 448 |
returns the new image. |
449 |
" |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
450 |
|deviceImage| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
451 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
452 |
anImage isNil ifTrue:[^ anImage]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
453 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
454 |
deviceImage := anImage onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
455 |
deviceImage isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
456 |
deviceImage clearMaskedPixels. |
569 | 457 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
458 |
^ deviceImage |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
459 |
"/ |img| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
460 |
"/ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
461 |
"/ img := anImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
462 |
"/ img notNil ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
463 |
"/ img device ~~ device ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
464 |
"/ img := img copy. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
465 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
466 |
"/ img := img onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
467 |
"/ img := img clearMaskedPixels. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
468 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
469 |
"/ ^ img |
846 | 470 |
|
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
471 |
"Modified: / 12.8.1998 / 12:46:38 / cg" |
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
472 |
! |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
473 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
474 |
imageOpened |
1278 | 475 |
"return the value of the instance variable 'imageOpened'. |
476 |
Thats the (default) bitmap image shown for opened folders |
|
477 |
(initialized to an open file-directory bitmap)" |
|
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
478 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
479 |
^ imageOpened |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
480 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
481 |
"Created: 3.7.1997 / 12:34:28 / cg" |
471 | 482 |
! ! |
483 |
||
1275 | 484 |
!SelectionInTreeView methodsFor:'accessing-look'! |
485 |
||
486 |
showDirectoryIndicator |
|
487 |
"returns true if directories has an open/closed indicator |
|
488 |
" |
|
489 |
^ showDirectoryIndicator |
|
490 |
! |
|
491 |
||
492 |
showDirectoryIndicator:aState |
|
493 |
"set or clear open/closed indicator for directories |
|
494 |
" |
|
495 |
"show or hide lines |
|
496 |
" |
|
497 |
aState ~~ showDirectoryIndicator ifTrue:[ |
|
498 |
showDirectoryIndicator := aState. |
|
499 |
self recomputeDirectoryIndicator. |
|
500 |
self invalidate |
|
501 |
]. |
|
502 |
! |
|
503 |
||
504 |
showDirectoryIndicatorForRoot |
|
505 |
"returns true if root directory has an open/closed indicator if |
|
506 |
the common showDirectoryIndicator is enabled |
|
507 |
" |
|
508 |
^ showDirectoryIndicatorForRoot |
|
509 |
! |
|
510 |
||
511 |
showDirectoryIndicatorForRoot:aState |
|
512 |
"true if root directory has an open/closed indicator if |
|
513 |
the common showDirectoryIndicator is enabled |
|
514 |
" |
|
515 |
aState ~~ showDirectoryIndicatorForRoot ifTrue:[ |
|
516 |
showDirectoryIndicatorForRoot := aState. |
|
517 |
self recomputeDirectoryIndicator. |
|
518 |
self invalidate |
|
519 |
]. |
|
520 |
! |
|
521 |
||
522 |
showLines |
|
523 |
"returns true if lines are shown |
|
524 |
" |
|
525 |
^ showLines |
|
526 |
! |
|
527 |
||
528 |
showLines:aState |
|
529 |
"show or hide lines |
|
530 |
" |
|
531 |
aState ~~ showLines ifTrue:[ |
|
532 |
showLines := aState. |
|
533 |
self invalidate |
|
534 |
]. |
|
535 |
! |
|
536 |
||
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
537 |
showLinesForRoot |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
538 |
"returns true if root-lines are shown |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
539 |
" |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
540 |
^ showLinesForRoot |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
541 |
! |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
542 |
|
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
543 |
showLinesForRoot:aState |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
544 |
"show or hide lines for root(s) |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
545 |
" |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
546 |
aState ~~ showLinesForRoot ifTrue:[ |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
547 |
showLinesForRoot := aState. |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
548 |
self invalidate |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
549 |
]. |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
550 |
! |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
551 |
|
1275 | 552 |
showRoot |
553 |
"list with or without root |
|
554 |
" |
|
555 |
^ showRoot |
|
556 |
! |
|
557 |
||
558 |
showRoot:aState |
|
559 |
"list with or without root |
|
560 |
" |
|
561 |
showRoot ~~ aState ifTrue:[ |
|
562 |
model showRoot:(showRoot := aState). |
|
563 |
]. |
|
564 |
! ! |
|
565 |
||
514 | 566 |
!SelectionInTreeView methodsFor:'change & update'! |
567 |
||
855 | 568 |
modelChanged:what with:aPara |
2483
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
569 |
"hierarchical list changed" |
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
570 |
|
855 | 571 |
|start size visLn h y0 y1 cY parent pvLv ndLv| |
572 |
||
573 |
aPara isNil ifTrue:[ |
|
574 |
what == #list ifTrue:[ self getListFromModel ] |
|
575 |
ifFalse:[ super update:what with:aPara from:model ]. |
|
576 |
^ self |
|
577 |
]. |
|
578 |
||
579 |
(what == #insertCollection: or:[what == #removeFrom:]) ifFalse:[ |
|
580 |
what == #at: ifTrue:[ ^ self redrawLine:aPara ]. |
|
581 |
what == #replace ifTrue:[ ^ self invalidateRepairNow:true ]. |
|
582 |
||
583 |
^ super update:what with:aPara from:model. |
|
584 |
]. |
|
585 |
list := self listFromModel. |
|
586 |
||
587 |
shown ifFalse:[ |
|
588 |
^ self contentsChanged |
|
589 |
]. |
|
2483
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
590 |
(self sensor hasExposeEventFor:self) ifTrue:[ |
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
591 |
"/ outstanding expose events |
855 | 592 |
self invalidateRepairNow:true. |
593 |
^ self contentsChanged |
|
594 |
]. |
|
595 |
||
596 |
start := aPara at:1. |
|
597 |
size := aPara at:2. |
|
598 |
parent := aPara at:3. |
|
599 |
||
860 | 600 |
what == #removeFrom: ifTrue:[ |
601 |
size := size - start + 1 |
|
602 |
]. |
|
603 |
||
855 | 604 |
start > 1 ifTrue:[ |
605 |
pvLv := (list at:start - 1) level. |
|
606 |
ndLv := parent level + 1. |
|
607 |
||
608 |
ndLv < pvLv ifTrue:[ |
|
609 |
what == #insertCollection: ifTrue:[ |
|
610 |
visLn := start + size. |
|
611 |
] ifFalse:[ |
|
612 |
visLn := start. |
|
613 |
]. |
|
614 |
||
615 |
(visLn > list size or:[(list at:visLn) level ~~ ndLv]) ifTrue:[ |
|
616 |
[(start := start - 1) ~~ 1] whileTrue:[ |
|
617 |
(list at:start) level <= ndLv ifTrue:[ |
|
618 |
self redrawFromLine:start. |
|
619 |
^ self contentsChanged. |
|
620 |
] |
|
621 |
]. |
|
622 |
self invalidateRepairNow:true. |
|
623 |
^ self contentsChanged |
|
624 |
] |
|
625 |
]. |
|
626 |
self redrawIconAndIndicatorAt:(start - 1) |
|
627 |
]. |
|
628 |
(visLn := self listLineToVisibleLine:start) isNil ifTrue:[ |
|
629 |
^ self contentsChanged |
|
630 |
]. |
|
631 |
||
632 |
h := size * fontHeight. |
|
633 |
y0 := self yOfVisibleLine:visLn. |
|
634 |
y1 := y0 + h. |
|
635 |
cY := height - y1 - 1. |
|
636 |
||
637 |
cY < 40 ifTrue:[ |
|
638 |
self redrawFromLine:start. |
|
639 |
] ifFalse:[ |
|
640 |
self catchExpose. |
|
641 |
||
642 |
what == #insertCollection: ifTrue:[ |
|
643 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:cY async:true. |
|
644 |
] ifFalse:[ |
|
645 |
self copyFrom:self x:0 y:y1 toX:0 y:y0 width:width height:cY async:true. |
|
646 |
y0 := y0 + cY. |
|
647 |
h := height - y0. |
|
648 |
]. |
|
649 |
self redrawX:0 y:y0 width:width height:h. |
|
650 |
self waitForExpose. |
|
651 |
]. |
|
652 |
device flush. |
|
653 |
self contentsChanged. |
|
654 |
! |
|
655 |
||
514 | 656 |
update:something with:aParameter from:aModel |
657 |
"one of my models changed its value |
|
785 | 658 |
" |
659 |
|idx| |
|
660 |
||
514 | 661 |
aModel == rootHolder ifTrue:[ |
662 |
^ self rootFromModel |
|
663 |
]. |
|
855 | 664 |
|
514 | 665 |
aModel == selectionHolder ifTrue:[ |
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
666 |
^ self selectionFromModel |
514 | 667 |
]. |
668 |
||
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
669 |
aModel == model ifTrue:[ |
855 | 670 |
^ self modelChanged:something with:aParameter |
671 |
]. |
|
672 |
||
673 |
(aModel isKindOf:TreeItem) ifTrue:[ |
|
674 |
(something == #size or:[something == #children]) ifTrue:[ |
|
675 |
model recomputeList. |
|
676 |
^ self |
|
677 |
]. |
|
678 |
||
679 |
(idx := self indexOfNode:aModel) ~~ 0 ifTrue:[ |
|
680 |
something == #value ifTrue:[ |
|
681 |
^ self redrawLine:idx. |
|
785 | 682 |
]. |
811 | 683 |
|
855 | 684 |
something == #indication ifTrue:[ |
685 |
^ self redrawIndicatorLine:idx. |
|
811 | 686 |
]. |
1308 | 687 |
"/ assume that the nodes string has changed |
688 |
^ self redrawLine:idx. |
|
855 | 689 |
]. |
690 |
^ self |
|
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
691 |
]. |
855 | 692 |
super update:something with:aParameter from:aModel. |
811 | 693 |
|
514 | 694 |
! ! |
695 |
||
444 | 696 |
!SelectionInTreeView methodsFor:'drawing'! |
697 |
||
481 | 698 |
drawLine:line atX:atX inVisible:visLineNr with:fg and:bg |
699 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
|
444 | 700 |
|
701 |
! |
|
702 |
||
703 |
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg |
|
481 | 704 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
444 | 705 |
|
706 |
! |
|
707 |
||
708 |
drawLine:line inVisible:visLineNr with:fg and:bg |
|
481 | 709 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
444 | 710 |
|
711 |
! |
|
712 |
||
713 |
drawVisibleLine:visLineNr col:col with:fg and:bg |
|
481 | 714 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
444 | 715 |
|
716 |
! |
|
717 |
||
718 |
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg |
|
481 | 719 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
720 |
||
444 | 721 |
! |
722 |
||
723 |
drawVisibleLine:visLineNr from:startCol with:fg and:bg |
|
481 | 724 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fg and:bg |
444 | 725 |
|
846 | 726 |
! |
727 |
||
728 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
|
729 |
self redrawX:0 |
|
730 |
y:(self yOfVisibleLine:startVisLineNr) |
|
731 |
width:width |
|
732 |
height:(endVisLineNr - startVisLineNr + 1 * fontHeight) |
|
733 |
||
734 |
||
848 | 735 |
! |
444 | 736 |
|
848 | 737 |
redrawIconAndIndicatorAt:aLnNr |
738 |
|visLineNr x0 x1 lv| |
|
481 | 739 |
|
769 | 740 |
shown ifTrue:[ |
848 | 741 |
visLineNr := self listLineToVisibleLine:aLnNr. |
742 |
visLineNr notNil ifTrue:[ |
|
743 |
lv := (listOfNodes at:aLnNr) level. |
|
744 |
x1 := (imageWidth + (self xOfFigureLevel:lv)) min:width. |
|
745 |
x0 := (self xOfFigureLevel:(lv - 1)) max:0. |
|
769 | 746 |
|
848 | 747 |
(x0 > width or:[x1 < 0]) ifFalse:[ |
748 |
self redrawX:x0 |
|
749 |
y:(self yOfVisibleLine:visLineNr) |
|
750 |
width:(x1 - x0) |
|
751 |
height:fontHeight |
|
752 |
] |
|
769 | 753 |
] |
848 | 754 |
]. |
769 | 755 |
! |
756 |
||
811 | 757 |
redrawIndicatorLine:aLineNr |
758 |
"redraw the directory indicator for a line |
|
759 |
" |
|
760 |
|node ext img visLn |
|
761 |
x "{ Class:SmallInteger }" |
|
762 |
y "{ Class:SmallInteger }" |
|
763 |
dX "{ Class:SmallInteger }" |
|
764 |
| |
|
765 |
||
766 |
( shown |
|
767 |
and:[showDirectoryIndicator |
|
768 |
and:[(visLn := self listLineToVisibleLine:aLineNr) notNil]] |
|
769 |
) ifFalse:[ |
|
770 |
^ self |
|
771 |
]. |
|
772 |
||
773 |
node := listOfNodes at:aLineNr. |
|
774 |
||
846 | 775 |
(node parent notNil or:[showDirectoryIndicatorForRoot]) ifFalse:[ |
811 | 776 |
^ self |
777 |
]. |
|
778 |
||
846 | 779 |
x := imageWidth // 2. |
780 |
x := x + (self xOfFigureLevel:(node level - 1)). |
|
811 | 781 |
|
782 |
"/ draw directory indicator |
|
783 |
||
784 |
img := node isCollapsable ifTrue:[openIndicator] ifFalse:[closeIndicator]. |
|
1620
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
785 |
img notNil ifTrue:[ |
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
786 |
ext := img extent // 2. |
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
787 |
dX := ext x. |
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
788 |
|
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
789 |
(x + dX > 0 and:[(x := x - dX) < (width - margin)]) ifTrue:[ |
3176 | 790 |
self paintOnIsSelected:(self isInSelection:aLineNr). |
1620
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
791 |
|
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
792 |
y := (self yOfVisibleLine:visLn) + (fontHeight // 2) - 1. |
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
793 |
self displayForm:img x:x y:(y - ext y) |
99124a1a1342
care for nil-image when drawing indicator line
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
794 |
]. |
811 | 795 |
]. |
900 | 796 |
! |
797 |
||
798 |
redrawVisibleLine:visLineNr |
|
799 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fgColor and:bgColor |
|
800 |
! |
|
801 |
||
802 |
redrawVisibleLine:visLineNr from:startCol to:endCol |
|
803 |
self drawFromVisibleLine:visLineNr to:visLineNr with:fgColor and:bgColor |
|
848 | 804 |
! ! |
805 |
||
806 |
!SelectionInTreeView methodsFor:'drawing basics'! |
|
807 |
||
900 | 808 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
809 |
"redraw a visible line range with clearing the background |
|
848 | 810 |
" |
900 | 811 |
|y h| |
848 | 812 |
|
900 | 813 |
y := self yOfVisibleLine:startVisLineNr. |
814 |
h := endVisLineNr - startVisLineNr + 1 * fontHeight. |
|
815 |
||
816 |
y + h > height ifTrue:[ |
|
817 |
h := height - y |
|
818 |
]. |
|
819 |
self redrawX:0 y:y width:width height:h. |
|
848 | 820 |
! |
821 |
||
822 |
drawVHLinesX:x0 y:y0 toX:x1 start:start stop:stop |
|
823 |
"redraw from line to line without clearing the background |
|
824 |
" |
|
825 |
|node prevNode parent p1 p2 showVLines showHLine lv nxtPrnt |
|
1305
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
826 |
showRootNot isFirst |
848 | 827 |
|
828 |
x "{ Class:SmallInteger }" |
|
829 |
y "{ Class:SmallInteger }" |
|
830 |
||
831 |
yTop "{ Class:SmallInteger }" |
|
832 |
yBot "{ Class:SmallInteger }" |
|
833 |
yCtr "{ Class:SmallInteger }" |
|
834 |
||
835 |
begHLnY "{ Class:SmallInteger }" |
|
836 |
begHLnX "{ Class:SmallInteger }" |
|
837 |
endHLnX "{ Class:SmallInteger }" |
|
838 |
||
839 |
widthLvl "{ Class:SmallInteger }" |
|
840 |
offsHLnX "{ Class:SmallInteger }" |
|
841 |
||
842 |
level "{ Class:SmallInteger }" |
|
855 | 843 |
startLvI "{ Class:SmallInteger }" |
844 |
startLvX "{ Class:SmallInteger }" |
|
845 |
limitLvI "{ Class:SmallInteger }" |
|
846 |
limitLvX "{ Class:SmallInteger }" |
|
3692
af710a4ee08a
do not draw dotted line under the icon (for transparent icons)
Claus Gittinger <cg@exept.de>
parents:
3690
diff
changeset
|
847 |
xIcon |
848 | 848 |
| |
1305
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
849 |
|
848 | 850 |
yBot := y0. |
851 |
yCtr := yBot - (fontHeight // 2). |
|
852 |
widthLvl := imageInset + imageWidth. |
|
3692
af710a4ee08a
do not draw dotted line under the icon (for transparent icons)
Claus Gittinger <cg@exept.de>
parents:
3690
diff
changeset
|
853 |
offsHLnX := (imageWidth // 2) + (self xOfFigureLevel:-1). |
af710a4ee08a
do not draw dotted line under the icon (for transparent icons)
Claus Gittinger <cg@exept.de>
parents:
3690
diff
changeset
|
854 |
xIcon := imageWidth // 2. |
848 | 855 |
|
856 |
parent := 4711. "/ to force a recompute |
|
857 |
prevNode := 4711. "/ to force a recomputation of the level |
|
858 |
||
3456
fa55a397f4c9
changed #drawVHLinesX:y:toX:start:stop:
Stefan Vogel <sv@exept.de>
parents:
3423
diff
changeset
|
859 |
self maskOrigin:(self viewOrigin + (0 @ 1) \\ (lineMask extent)). |
848 | 860 |
self paint:lineColor on:bgColor. |
861 |
self mask:lineMask. |
|
862 |
begHLnY := y0. |
|
855 | 863 |
startLvI := self smallestLevelOfNodesBetween:start and:stop. |
864 |
startLvX := self xOfFigureLevel:startLvI. |
|
865 |
limitLvI := drawVLinesFromLevel + 1. |
|
866 |
limitLvX := limitLvI * widthLvl + offsHLnX. |
|
848 | 867 |
|
868 |
buildInArray atAllPut:0. |
|
869 |
||
870 |
start == 1 ifTrue:[ |
|
871 |
begHLnY := yCtr + fontHeight. |
|
872 |
]. |
|
1305
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
873 |
showRootNot := showRoot not. |
848 | 874 |
|
875 |
start to:stop do:[:anIndex| |
|
876 |
node := listOfNodes at:anIndex. |
|
877 |
yTop := yBot - 1. |
|
878 |
yBot := yBot + fontHeight. |
|
879 |
yCtr := yCtr + fontHeight. |
|
880 |
||
881 |
(nxtPrnt := node parent) ~~ parent ifTrue:[ |
|
882 |
parent := nxtPrnt. |
|
883 |
||
884 |
prevNode == parent ifTrue:[ |
|
885 |
level := level + 1. |
|
886 |
begHLnX := endHLnX. |
|
887 |
] ifFalse:[ |
|
888 |
level := node level. |
|
1309 | 889 |
begHLnX := level * widthLvl + offsHLnX. |
848 | 890 |
]. |
891 |
||
1305
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
892 |
isFirst := parent isNil or:[(showRootNot and:[level == 2])]. |
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
893 |
endHLnX := begHLnX + widthLvl. |
855 | 894 |
showVLines := begHLnX >= x0 and:[level > drawVLinesFromLevel]. |
1305
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
895 |
showHLine := x0 < endHLnX and:[x1 > begHLnX]. |
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
896 |
|
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
897 |
(showHLine and:[isFirst]) ifTrue:[ |
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
898 |
showHLine := showDirectoryIndicatorForRoot and:[showDirectoryIndicator] |
c8f2fe1fac85
fix drawing horizontal lines for the root element(s)
Claus Gittinger <cg@exept.de>
parents:
1278
diff
changeset
|
899 |
] |
848 | 900 |
]. |
901 |
||
902 |
showHLine ifTrue:[ |
|
3692
af710a4ee08a
do not draw dotted line under the icon (for transparent icons)
Claus Gittinger <cg@exept.de>
parents:
3690
diff
changeset
|
903 |
self displayLineFromX:begHLnX y:yCtr toX:endHLnX-xIcon y:yCtr |
848 | 904 |
]. |
905 |
||
906 |
showVLines ifTrue:[ |
|
907 |
y := (parent basicLastChild == node) ifTrue:[yCtr] ifFalse:[yBot]. |
|
908 |
x := begHLnX. |
|
909 |
p2 := parent. |
|
910 |
lv := level - 1. |
|
911 |
self displayLineFromX:x y:begHLnY toX:x y:y. |
|
912 |
||
855 | 913 |
[((p1 := p2 parent) notNil and:[(x := x - widthLvl) >= limitLvX])] whileTrue:[ |
848 | 914 |
(p1 basicLastChild ~~ p2 and:[x <= x1]) ifTrue:[ |
855 | 915 |
x >= startLvX ifTrue:[ |
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
916 |
(isFirst not or:[showLinesForRoot]) ifTrue:[ |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
917 |
self displayLineFromX:x y:yTop toX:x y:yBot |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
918 |
] |
848 | 919 |
] ifFalse:[ |
920 |
buildInArray at:lv put:yBot |
|
921 |
]. |
|
922 |
]. |
|
923 |
lv := lv - 1. |
|
924 |
p2 := p1 |
|
925 |
] |
|
926 |
]. |
|
927 |
prevNode := node. |
|
928 |
begHLnY := yCtr. |
|
929 |
]. |
|
930 |
||
855 | 931 |
"/ |
932 |
"/ draw outstanding verical lines to left |
|
933 |
"/ |
|
934 |
x := limitLvX. |
|
935 |
y := (start ~~ 1) ifTrue:[y0] ifFalse:[y0 + (fontHeight // 2)]. |
|
848 | 936 |
|
855 | 937 |
limitLvI to:startLvI do:[:i| |
938 |
(yBot := buildInArray at:i) ~~ 0 ifTrue:[ |
|
939 |
self displayLineFromX:x y:y toX:x y:yBot |
|
940 |
]. |
|
941 |
x := x + widthLvl. |
|
848 | 942 |
]. |
943 |
self mask:nil. |
|
811 | 944 |
! |
945 |
||
900 | 946 |
drawVisibleLineSelected:visLineNr with:fg and:bg |
947 |
"redraw a single line as selected." |
|
948 |
||
949 |
(self visibleLineToListLine:visLineNr) isNil ifTrue:[ |
|
950 |
^ super drawVisibleLine:visLineNr with:fg and:bg |
|
951 |
]. |
|
952 |
self redrawX:0 |
|
953 |
y:(self yOfVisibleLine:visLineNr) |
|
954 |
width:width |
|
955 |
height:fontHeight |
|
956 |
! |
|
957 |
||
3176 | 958 |
paintOnIsSelected:isSelected |
959 |
isSelected ifTrue:[ |
|
960 |
self hasFocus ifTrue:[ |
|
961 |
self paint:hilightFgColor on:hilightBgColor |
|
962 |
] ifFalse:[ |
|
963 |
self paint:hilightFgColorNoFocus on:hilightBgColorNoFocus |
|
964 |
] |
|
965 |
] ifFalse:[ |
|
966 |
self paint:fgColor on:bgColor. |
|
967 |
]. |
|
968 |
! |
|
969 |
||
902 | 970 |
redrawElement:anIndex |
971 |
||
972 |
|vln x0 xT y| |
|
973 |
||
974 |
shown ifTrue:[ |
|
975 |
( highlightMode ~~ #label |
|
908 | 976 |
or:[(vln := self listLineToVisibleLine:anIndex) isNil |
977 |
or:[anIndex > listOfNodes size]] |
|
902 | 978 |
) ifTrue:[ |
979 |
super redrawElement:anIndex |
|
980 |
] ifFalse:[ |
|
981 |
y := self yOfVisibleLine:vln. |
|
982 |
xT := self xOfStringLevel:((listOfNodes at:anIndex) level). |
|
983 |
x0 := xT - textInset. |
|
984 |
self paint:bgColor. |
|
985 |
self fillRectangleX:x0 y:y width:(width - x0) height:fontHeight. |
|
986 |
self redrawLabelAt:xT y:y index:anIndex |
|
987 |
] |
|
988 |
] |
|
989 |
||
990 |
! |
|
991 |
||
900 | 992 |
redrawLabelAt:x y:yTop index:anIndex |
1171 | 993 |
|isSel y0 x0 w label node value xV wV| |
994 |
||
995 |
node := listOfNodes at:anIndex. |
|
996 |
label := node name. |
|
997 |
isSel := self isInSelection:anIndex. |
|
998 |
xV := 0. |
|
999 |
wV := 0. |
|
1000 |
y0 := yTop + (fontHeight // 2) + labelOffsetY. |
|
1001 |
||
1002 |
(value := node printableEditValue) notNil ifTrue:[ |
|
1003 |
xV := (self xOfValueNode:node) - SelectionInset |
|
1004 |
]. |
|
900 | 1005 |
|
1006 |
highlightMode == #label ifTrue:[ |
|
1007 |
x0 := x + 4. |
|
1008 |
||
1171 | 1009 |
isSel ifTrue:[ |
900 | 1010 |
w := (label notNil ifTrue:[label widthOn:self] ifFalse:[60]) + 8. |
3176 | 1011 |
|
1012 |
self hasFocus ifTrue:[ |
|
1013 |
self paint:hilightBgColor. |
|
1014 |
] ifFalse:[ |
|
1015 |
self paint:hilightBgColorNoFocus. |
|
1016 |
]. |
|
900 | 1017 |
self fillRectangleX:x y:yTop width:w height:fontHeight. |
1171 | 1018 |
|
1019 |
(value notNil and:[(editorWidget isNil or:[editorIndex ~~ anIndex])]) ifTrue:[ |
|
1020 |
wV := SelectionInset + SelectionInset + (value widthOn:self). |
|
1021 |
self fillRectangleX:xV y:yTop width:wV height:fontHeight. |
|
1022 |
] |
|
900 | 1023 |
] |
1024 |
] ifFalse:[ |
|
1025 |
x0 := x |
|
1026 |
]. |
|
1027 |
||
1028 |
label notNil ifTrue:[ |
|
3176 | 1029 |
self paintOnIsSelected:isSel. |
1171 | 1030 |
self displayOpaqueString:label x:x0 y:y0. |
1031 |
||
1032 |
value notNil ifTrue:[ |
|
1175 | 1033 |
isSel ifFalse:[ |
1034 |
self paint:editValueFgColor on:bgColor |
|
1035 |
]. |
|
1171 | 1036 |
self displayOpaqueString:value x:(xV + SelectionInset) y:y0 |
1037 |
]. |
|
1038 |
||
900 | 1039 |
]. |
1040 |
||
1171 | 1041 |
(isSel and:[highlightMode == #label]) ifTrue:[ |
1042 |
self redrawSelFrameAtX:x y:yTop toX:(x + w). |
|
1043 |
||
1044 |
wV ~~ 0 ifTrue:[ |
|
1045 |
self redrawSelFrameAtX:xV y:yTop toX:(xV + wV) |
|
3176 | 1046 |
]. |
900 | 1047 |
]. |
1048 |
! |
|
1049 |
||
769 | 1050 |
redrawLinesX:x0 y:y0 toX:x1 start:start stop:stop |
1051 |
"redraw from line to line without clearing the background |
|
1052 |
" |
|
848 | 1053 |
|node prevNode parent icon showIndc showIcon showText nxtPrnt |
846 | 1054 |
|
1055 |
end "{ Class:SmallInteger }" |
|
1056 |
||
1057 |
yBot "{ Class:SmallInteger }" |
|
1058 |
yCtr "{ Class:SmallInteger }" |
|
1059 |
||
848 | 1060 |
xIndc "{ Class:SmallInteger }" |
846 | 1061 |
xIcon "{ Class:SmallInteger }" |
1062 |
xText "{ Class:SmallInteger }" |
|
1063 |
||
1064 |
widthLvl "{ Class:SmallInteger }" |
|
1065 |
insetTxt "{ Class:SmallInteger }" |
|
848 | 1066 |
|
1067 |
offIndcX "{ Class:SmallInteger }" |
|
1068 |
offIndcY "{ Class:SmallInteger }" |
|
1069 |
offIconX "{ Class:SmallInteger }" |
|
769 | 1070 |
| |
848 | 1071 |
(end := stop min:(listOfNodes size)) < start ifTrue:[ |
1072 |
^ self |
|
1073 |
]. |
|
846 | 1074 |
yBot := y0. |
1075 |
yCtr := yBot - (fontHeight // 2). |
|
1076 |
widthLvl := imageInset + imageWidth. |
|
1077 |
insetTxt := imageWidth + textInset. |
|
848 | 1078 |
offIconX := self xOfFigureLevel:0. |
1079 |
showIndc := false. |
|
846 | 1080 |
|
1081 |
showDirectoryIndicator ifTrue:[ |
|
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1082 |
offIndcX := imageWidth // 2 - widthLvl. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1083 |
offIndcY := 0. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1084 |
openIndicator notNil ifTrue:[ |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1085 |
icon := openIndicator extent // 2. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1086 |
offIndcX := offIndcX - icon x. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1087 |
offIndcY := icon y. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1088 |
] |
846 | 1089 |
]. |
785 | 1090 |
|
1091 |
showLines ifTrue:[ |
|
848 | 1092 |
self drawVHLinesX:x0 y:y0 toX:x1 start:start stop:end |
785 | 1093 |
]. |
485 | 1094 |
|
846 | 1095 |
parent := 4711. "/ to force a recompute |
1096 |
prevNode := 4711. "/ to force a recomputation of the level |
|
1097 |
||
1098 |
start to:end do:[:anIndex| |
|
1099 |
node := listOfNodes at:anIndex. |
|
1100 |
yBot := yBot + fontHeight. |
|
494 | 1101 |
yCtr := yCtr + fontHeight. |
485 | 1102 |
|
848 | 1103 |
(nxtPrnt := node parent) ~~ parent ifTrue:[ |
1104 |
parent := nxtPrnt. |
|
1105 |
xIcon := prevNode == parent ifTrue:[xIcon + widthLvl] |
|
1106 |
ifFalse:[node level * widthLvl + offIconX]. |
|
481 | 1107 |
|
848 | 1108 |
xText := xIcon + insetTxt. |
1109 |
showIcon := xIcon < x1 and:[xText > x0]. |
|
1110 |
showText := xText < x1. |
|
769 | 1111 |
|
848 | 1112 |
showDirectoryIndicator ifTrue:[ |
1113 |
xIndc := xIcon + offIndcX. |
|
481 | 1114 |
|
848 | 1115 |
showIndc := ( (parent notNil or:[showDirectoryIndicatorForRoot]) |
1116 |
and:[(xIcon > x0 and:[xIndc < x1])] |
|
1117 |
) |
|
1118 |
] |
|
785 | 1119 |
]. |
481 | 1120 |
|
846 | 1121 |
(showIcon and:[(icon := self figureFor:node) notNil]) ifTrue:[ |
1122 |
self displayForm:icon x:xIcon y:(yCtr - (icon height // 2)) |
|
770 | 1123 |
]. |
848 | 1124 |
|
846 | 1125 |
showText ifTrue:[ |
900 | 1126 |
self redrawLabelAt:xText y:(yBot - fontHeight) index:anIndex |
485 | 1127 |
]. |
848 | 1128 |
(showIndc and:[node showIndicator]) ifTrue:[ |
846 | 1129 |
icon := node isCollapsable ifTrue:[openIndicator] ifFalse:[closeIndicator]. |
1091
2e86163cfb17
care for non-existing icon image
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1130 |
icon notNil ifTrue:[ |
2e86163cfb17
care for non-existing icon image
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1131 |
self displayForm:icon x:xIndc y:(yCtr - offIndcY) |
2e86163cfb17
care for non-existing icon image
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1132 |
] |
846 | 1133 |
]. |
1134 |
prevNode := node. |
|
769 | 1135 |
] |
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1136 |
|
1091
2e86163cfb17
care for non-existing icon image
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1137 |
"Modified: / 22.8.1998 / 12:56:50 / cg" |
792 | 1138 |
! |
1139 |
||
900 | 1140 |
redrawSelFrameAtX:x0 y:y0 toX:x1 |
1141 |
"redraw selection frame for a line |
|
792 | 1142 |
" |
900 | 1143 |
| |
792 | 1144 |
w "{ Class: SmallInteger }" |
1145 |
y "{ Class: SmallInteger }" |
|
1146 |
x "{ Class: SmallInteger }" |
|
1147 |
| |
|
1148 |
||
1149 |
hilightFrameColor notNil ifTrue:[ |
|
1150 |
hilightLevel == 0 ifTrue:[ |
|
1151 |
self paint:hilightFrameColor. |
|
3176 | 1152 |
|
1105
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1153 |
highlightMode == #line ifTrue:[ |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1154 |
self displayLineFromX:x0 y:y0 toX:x1 y:y0. |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1155 |
y := y0 + fontHeight - 1. |
3176 | 1156 |
self displayLineFromX:x0 y:y toX:x1 y:y. |
1105
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1157 |
] ifFalse:[ |
3176 | 1158 |
self displayRectangleX:x0 y:y0 width:x1 - x0 height:fontHeight. |
1159 |
]. |
|
1160 |
^ self |
|
1161 |
]. |
|
792 | 1162 |
] ifFalse:[ |
1163 |
hilightStyle == #motif ifTrue:[ |
|
1164 |
self paint:bgColor. |
|
900 | 1165 |
y := y0 + 1. |
1105
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1166 |
highlightMode == #line ifTrue:[ |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1167 |
self displayLineFromX:x0 y:y toX:x1 y:y. |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1168 |
y := y0 + fontHeight - 2. |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1169 |
self displayLineFromX:x0 y:y toX:x1 y:y. |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1170 |
] ifFalse:[ |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1171 |
self displayRectangleX:x0 + 1 y:y width:x1 - x0 - 2 height:fontHeight - 2 |
c79bb5824b74
draw closed frames around selections if highlightMode ~~ #line
tz
parents:
1091
diff
changeset
|
1172 |
] |
792 | 1173 |
] |
1174 |
]. |
|
1175 |
||
1176 |
hilightLevel ~~ 0 ifTrue:[ |
|
1177 |
"/ draw edge |
|
1178 |
||
900 | 1179 |
highlightMode == #line ifTrue:[ |
2015
5a83ee792cc3
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2014
diff
changeset
|
1180 |
w := ((width - (2 * margin)) max:(self widthOfContents)) + viewOrigin x. |
5a83ee792cc3
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2014
diff
changeset
|
1181 |
x := margin - viewOrigin x. |
900 | 1182 |
] ifFalse:[ |
1183 |
w := x1 - x0. |
|
1184 |
x := x0. |
|
1185 |
]. |
|
1186 |
self drawEdgesForX:x y:y0 width:w height:fontHeight level:hilightLevel. |
|
792 | 1187 |
] |
900 | 1188 |
! |
1189 |
||
1190 |
redrawX:x y:y width:w height:h |
|
1191 |
"a region must be redrawn" |
|
1192 |
||
1193 |
|savClip startLn sel |
|
1194 |
y0 "{ Class:SmallInteger }" |
|
1195 |
y1 "{ Class:SmallInteger }" |
|
1196 |
visStart "{ Class:SmallInteger }" |
|
1197 |
visEnd "{ Class:SmallInteger }" |
|
1198 |
stopLn "{ Class:SmallInteger }" |
|
1199 |
maxY "{ Class:SmallInteger }" |
|
1200 |
maxX "{ Class:SmallInteger }" |
|
1201 |
dltLine "{ Class:SmallInteger }" |
|
1202 |
startY "{ Class:SmallInteger }"| |
|
1203 |
||
1204 |
shown ifFalse:[^ self]. |
|
1205 |
||
1206 |
visStart := self visibleLineOfY:(y + 1). |
|
1207 |
startLn := self visibleLineToAbsoluteLine:visStart. |
|
1208 |
||
1209 |
self paint:bgColor. |
|
1210 |
self fillRectangleX:x y:y width:w height:h. |
|
1211 |
startLn isNil ifTrue:[ ^ self ]. |
|
1212 |
||
1213 |
sel := nil. |
|
1214 |
maxX := x + w. |
|
1215 |
maxY := y + h. |
|
1216 |
visEnd := self visibleLineOfY:maxY. |
|
1217 |
startY := self yOfVisibleLine:visStart. |
|
1218 |
dltLine := startLn - visStart. |
|
1219 |
stopLn := dltLine + visEnd. |
|
1220 |
savClip := clipRect. |
|
1221 |
||
1222 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
1223 |
||
1224 |
(highlightMode == #line and:[self hasSelection]) ifTrue:[ |
|
1225 |
"/ redraw the background for all selected lines in the invalid range |
|
1226 |
||
1227 |
self selectionDo:[:lnNr| |
|
1228 |
(lnNr between:startLn and:stopLn) ifTrue:[ |
|
1229 |
sel isNil ifTrue:[ |
|
1230 |
sel := OrderedCollection new. |
|
1231 |
self paint:hilightBgColor. |
|
1232 |
]. |
|
1233 |
sel add:(y0 := self yOfVisibleLine:(lnNr - dltLine)). |
|
1234 |
y1 := y0 + fontHeight min:maxY. |
|
1235 |
y0 := y0 max:y. |
|
1236 |
self fillRectangleX:x y:y0 width:w height:y1 - y0. |
|
1237 |
] |
|
1238 |
] |
|
1239 |
]. |
|
1240 |
self redrawLinesX:x y:startY toX:maxX start:startLn stop:stopLn. |
|
1241 |
||
1242 |
"/ draw selection frames |
|
1243 |
sel notNil ifTrue:[ |
|
1244 |
sel do:[:y0| self redrawSelFrameAtX:x y:y0 toX:maxX] |
|
1245 |
]. |
|
1246 |
||
1247 |
self clippingRectangle:savClip. |
|
444 | 1248 |
! ! |
1249 |
||
494 | 1250 |
!SelectionInTreeView methodsFor:'enumerating'! |
490 | 1251 |
|
494 | 1252 |
detectNode:aOneArgBlock |
1253 |
"evaluate the argument, aBlock for each node in the list until |
|
1254 |
the block returns true; in this case return the node which caused |
|
1255 |
the true evaluation. If none node is detected, nil is returned. |
|
1256 |
" |
|
1257 |
^ listOfNodes detect:aOneArgBlock ifNone:nil |
|
507 | 1258 |
! |
1259 |
||
1260 |
selectedNodesDo:aOneArgBlock |
|
1261 |
"evaluate the block on each node selected |
|
1262 |
" |
|
1263 |
self selectionDo:[:i| aOneArgBlock value:(listOfNodes at:i) ] |
|
490 | 1264 |
! ! |
1265 |
||
569 | 1266 |
!SelectionInTreeView methodsFor:'event handling'! |
1267 |
||
3744 | 1268 |
activateMenu |
1269 |
|node menu| |
|
1270 |
||
1271 |
node := self selectedNode. |
|
1272 |
node notNil ifTrue:[ |
|
1273 |
menu := node middleButtonMenu. |
|
1274 |
menu notNil ifTrue:[ |
|
1275 |
menu isCollection ifTrue:[ |
|
1276 |
|appl| |
|
1277 |
||
1278 |
menu := Menu decodeFromLiteralArray:menu. |
|
1279 |
||
1280 |
(appl := self application) notNil ifTrue:[ |
|
1281 |
menu findGuiResourcesIn:appl |
|
1282 |
]. |
|
1283 |
"/ menu receiver:appl. -- now done in findGuiResources ... |
|
1284 |
]. |
|
1285 |
self startUpMenu:menu. |
|
1286 |
^ self. |
|
1287 |
]. |
|
1288 |
]. |
|
1289 |
super activateMenu |
|
1290 |
! |
|
1291 |
||
639 | 1292 |
buttonMotion:buttonMask x:x y:y |
1293 |
"mouse-move while button was pressed - handle selection changes" |
|
1294 |
||
1295 |
discardMotionEvents ifFalse:[ |
|
1296 |
super buttonMotion:buttonMask x:x y:y |
|
1297 |
] |
|
1298 |
||
1299 |
||
1300 |
! |
|
1301 |
||
569 | 1302 |
buttonMultiPress:button x:x y:y |
1303 |
||
1304 |
(self indicatiorLineForButton:button atX:x y:y) == 0 ifTrue:[ |
|
1305 |
^ super buttonMultiPress:button x:x y:y |
|
1306 |
]. |
|
1307 |
"/ discard doubleClick on indicator |
|
1308 |
! |
|
1309 |
||
1310 |
buttonPress:button x:x y:y |
|
3744 | 1311 |
"handle button press event" |
1312 |
||
1313 |
|node| |
|
1314 |
||
1315 |
(button == 1) ifTrue:[ |
|
1171 | 1316 |
self handleSelectButtonAtX:x y:y. |
1317 |
||
3744 | 1318 |
(editorWidget isNil |
1171 | 1319 |
and:[(node := self selectedNode) notNil |
1320 |
and:[node canEdit |
|
1321 |
and:[x >= (self xOfValueNode:node)]]] |
|
1322 |
) ifTrue:[ |
|
1323 |
self openEditor |
|
3744 | 1324 |
]. |
1325 |
^ self. |
|
1326 |
]. |
|
1327 |
super buttonPress:button x:x y:y |
|
1171 | 1328 |
! |
1329 |
||
1330 |
buttonRelease:button x:x y:y |
|
1331 |
"stop any autoscroll" |
|
1332 |
||
1333 |
discardMotionEvents ifTrue:[ |
|
1334 |
clickPosition := nil. |
|
1335 |
discardMotionEvents := false. |
|
1336 |
]. |
|
1337 |
super buttonRelease:button x:x y:y |
|
1338 |
||
1339 |
! |
|
1340 |
||
1341 |
doubleClicked |
|
1342 |
"handle a double click; collapse or expand selected entry |
|
1343 |
in case of having children |
|
1344 |
" |
|
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1345 |
|node | |
1171 | 1346 |
|
1347 |
(node := self selectedNode) notNil ifTrue:[ |
|
1202
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1348 |
(validateDoubleClickBlock isNil |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1349 |
or:[(validateDoubleClickBlock value:node) ~~ false]) ifTrue:[ |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1350 |
(validateExpandabilityBlock isNil |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1351 |
or:[(validateExpandabilityBlock value:node) ~~ false]) ifTrue:[ |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1352 |
self selectedNodeExpand:(node isExpandable). |
b9a3beb20ca7
added an extra validateExpandability block,
Claus Gittinger <cg@exept.de>
parents:
1191
diff
changeset
|
1353 |
]. |
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1354 |
node hasChildren ifFalse:[ |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1355 |
super doubleClicked |
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1356 |
] |
1171 | 1357 |
] |
1358 |
] |
|
1359 |
||
1360 |
! |
|
1361 |
||
1362 |
handleSelectButtonAtX:x y:y |
|
1363 |
"handle a select button click |
|
569 | 1364 |
" |
1268 | 1365 |
|node lineNr sensor isExpd| |
569 | 1366 |
|
1171 | 1367 |
lineNr := self indicatiorLineForButton:#select atX:x y:y. |
569 | 1368 |
|
1369 |
lineNr == 0 ifTrue:[ |
|
3744 | 1370 |
^ super buttonPress:1 x:x y:y |
569 | 1371 |
]. |
1372 |
node := listOfNodes at:lineNr. |
|
1373 |
||
639 | 1374 |
discardMotionEvents := true. |
569 | 1375 |
dragIsActive := false. |
1376 |
clickPosition := nil. |
|
1377 |
||
639 | 1378 |
self hasSelection ifTrue:[ |
1379 |
(selectConditionBlock isNil or:[selectConditionBlock value:lineNr]) ifTrue:[ |
|
1380 |
self selection:lineNr |
|
1381 |
] ifFalse:[ |
|
1382 |
self selection:nil |
|
569 | 1383 |
] |
1384 |
]. |
|
855 | 1385 |
|
1386 |
isExpd := node isExpandable. |
|
835 | 1387 |
|
2483
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
1388 |
(supportsExpandAll |
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
1389 |
and:[(sensor := self sensor) ctrlDown or:[sensor shiftDown]] |
855 | 1390 |
) ifTrue:[ |
1391 |
isExpd ifTrue:[model doExpandAll:node] |
|
1392 |
ifFalse:[model doCollapseAll:node] |
|
835 | 1393 |
] ifFalse:[ |
855 | 1394 |
isExpd ifTrue:[model doExpand:node] |
1395 |
ifFalse:[model doCollapse:node]. |
|
835 | 1396 |
]. |
639 | 1397 |
! |
1398 |
||
569 | 1399 |
indicatiorLineForButton:aButton atX:x y:y |
1400 |
"returns linenumber assigned to indicator at x/y or 0 |
|
1401 |
" |
|
1268 | 1402 |
|nr x0 node| |
569 | 1403 |
|
1404 |
( enabled |
|
1405 |
and:[showDirectoryIndicator |
|
1406 |
and:[aButton == 1 or:[aButton == #select]]] |
|
1407 |
) ifTrue:[ |
|
2014 | 1408 |
nr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
569 | 1409 |
|
835 | 1410 |
nr notNil ifTrue:[ |
1411 |
node := listOfNodes at:nr. |
|
1412 |
node hasChildren ifTrue:[ |
|
1413 |
x0 := self xOfFigureLevel:(node level - 1). |
|
569 | 1414 |
|
835 | 1415 |
(x > x0 and:[(x0 + imageWidth) > x and:[node children notEmpty]]) ifTrue:[ |
1416 |
^ nr |
|
569 | 1417 |
] |
1418 |
] |
|
1419 |
] |
|
1420 |
]. |
|
1421 |
^ 0 |
|
756 | 1422 |
! |
1423 |
||
835 | 1424 |
isCtrlMetaAltOrShiftPressed |
2483
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
1425 |
"returns true if CTRL, META, ALT or SHIFT is pressed" |
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
1426 |
|
1589203d52f3
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2333
diff
changeset
|
1427 |
^ self sensor anyModifierKeyDown. |
835 | 1428 |
! |
1429 |
||
756 | 1430 |
key:key select:index x:x y:y |
1431 |
"select an entry by a keyboard action. This is treated like a doubleClick |
|
1432 |
on that entry. |
|
1433 |
Add on: In case that the entry is not selectable, scroll to the entry |
|
1434 |
" |
|
1435 |
(enabled and:[keyActionStyle notNil]) ifFalse:[ |
|
1436 |
^ self |
|
1437 |
]. |
|
1438 |
||
1439 |
(selectConditionBlock isNil or:[selectConditionBlock value:index]) ifTrue:[ |
|
1887
b47b3cb2515b
does not inherit #key:select:x:y:
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
1440 |
^ super keyPress:key x:x y:y |
b47b3cb2515b
does not inherit #key:select:x:y:
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
1441 |
"/ ^ super key:key select:index x:x y:y |
756 | 1442 |
]. |
1443 |
||
1444 |
keyActionStyle == #pass ifTrue:[ |
|
1445 |
^ self |
|
1446 |
]. |
|
1447 |
||
1448 |
self gotoLine:index |
|
785 | 1449 |
! |
1450 |
||
811 | 1451 |
keyPress:key x:x y:y |
1452 |
"handle keyboard input" |
|
1453 |
||
1454 |
<resource: #keyboard ( #CursorLeft #CursorRight ) > |
|
1455 |
||
4253 | 1456 |
|node| |
811 | 1457 |
|
1458 |
enabled ifFalse:[ |
|
1459 |
^ self |
|
1460 |
]. |
|
1461 |
||
2065
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1462 |
"/ cg: its nicer to expand/collaps on these keys |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1463 |
key == #CursorRight ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1464 |
(node := self selectedNode) notNil ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1465 |
model doExpand:node. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1466 |
^ self. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1467 |
]. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1468 |
]. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1469 |
key == #CursorLeft ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1470 |
(node := self selectedNode) notNil ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1471 |
model doCollapse:node. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1472 |
^ self. |
811 | 1473 |
]. |
1474 |
]. |
|
2065
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1475 |
|
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1476 |
"/ search fwd/bwd for a node with children |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1477 |
|
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1478 |
"/ (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1479 |
"/ (idx := self selectedIndex) == 0 ifTrue:[ ^ self ]. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1480 |
"/ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1481 |
"/ (key == #CursorLeft) ifTrue:[ inc := -1. end := 0 ] |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1482 |
"/ ifFalse:[ inc := 1. end := 1 + listOfNodes size ]. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1483 |
"/ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1484 |
"/ [(idx := idx + inc) ~~ end] whileTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1485 |
"/ node := listOfNodes at:idx. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1486 |
"/ node hasChildren ifTrue:[ |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1487 |
"/ ^ self key:key select:idx x:x y:y |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1488 |
"/ ] |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1489 |
"/ ]. |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1490 |
"/ ^ self |
845bd5d2523c
crsrLeft/right behavior changed
Claus Gittinger <cg@exept.de>
parents:
2056
diff
changeset
|
1491 |
"/ ]. |
811 | 1492 |
^ super keyPress:key x:x y:y |
569 | 1493 |
! ! |
1494 |
||
2501 | 1495 |
!SelectionInTreeView methodsFor:'initialization & release'! |
444 | 1496 |
|
685 | 1497 |
create |
1498 |
super create. |
|
695
3e5240577e37
dont use Image>>on: -> use Image>>onDevice:
Claus Gittinger <cg@exept.de>
parents:
685
diff
changeset
|
1499 |
lineMask := lineMask onDevice:device. |
685 | 1500 |
|
846 | 1501 |
lineColor := lineColor isNil ifTrue:[fgColor] |
1502 |
ifFalse:[lineColor onDevice:device]. |
|
1175 | 1503 |
|
1504 |
editValueFgColor := editValueFgColor onDevice:device. |
|
685 | 1505 |
! |
1506 |
||
785 | 1507 |
fetchDefaultImages |
1508 |
"returns a directory with default keys and images; could be |
|
1509 |
redefined by subclass. |
|
1510 |
" |
|
1171 | 1511 |
^ itemClass notNil ifTrue:[itemClass keysAndIcons] |
1512 |
ifFalse:[nil] |
|
785 | 1513 |
! |
1514 |
||
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1515 |
fetchDeviceResources |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1516 |
"initialize heavily used device resources - to avoid rendering |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1517 |
images again and again later" |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1518 |
|
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1519 |
super fetchDeviceResources. |
478 | 1520 |
self refetchDeviceResources |
448
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1521 |
! |
7f9f3531660c
cache device images for fast drawing
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
1522 |
|
478 | 1523 |
fetchImageResources |
1524 |
"initialize heavily used device resources - to avoid rendering |
|
1525 |
images again and again later; returns maximum extent of the images used. |
|
1526 |
Could be redefined by subclass |
|
471 | 1527 |
" |
785 | 1528 |
|img x y keysAndIcons| |
494 | 1529 |
|
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1530 |
x := y := 0. |
494 | 1531 |
imageOpened isNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1532 |
imageOpened := self imageOnMyDevice:(self class imageOpened) |
494 | 1533 |
]. |
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1534 |
imageOpened notNil ifTrue:[ |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1535 |
x := x max:(imageOpened width). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1536 |
y := y max:(imageOpened height). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1537 |
]. |
444 | 1538 |
|
494 | 1539 |
imageClosed isNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1540 |
imageClosed := self imageOnMyDevice:(self class imageClosed) |
533
d7867efb6f60
#fetchImageResources returned the max extent only on the first invocation
Stefan Vogel <sv@exept.de>
parents:
532
diff
changeset
|
1541 |
]. |
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1542 |
imageClosed notNil ifTrue:[ |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1543 |
x := x max:(imageClosed width). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1544 |
y := y max:(imageClosed height). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1545 |
]. |
494 | 1546 |
|
1547 |
imageItem isNil ifTrue:[ |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1548 |
imageItem := self imageOnMyDevice:(self class imageItem) |
533
d7867efb6f60
#fetchImageResources returned the max extent only on the first invocation
Stefan Vogel <sv@exept.de>
parents:
532
diff
changeset
|
1549 |
]. |
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1550 |
imageItem notNil ifTrue:[ |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1551 |
x := x max:(imageItem width). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1552 |
y := y max:(imageItem height). |
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1553 |
]. |
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
1554 |
|
785 | 1555 |
(keysAndIcons := self fetchDefaultImages) notNil ifTrue:[ |
1556 |
keysAndIcons keysAndValuesDo:[:aKey :anIcon| |
|
1557 |
(anIcon isImage and:[aKey notNil]) ifTrue:[ |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1558 |
registeredImages at:aKey put:(self imageOnMyDevice:anIcon) |
785 | 1559 |
] |
1560 |
] |
|
1561 |
]. |
|
1562 |
registeredImages keysAndValuesDo:[:k :img| |
|
1563 |
x := (img width) max:x. |
|
1564 |
y := (img height) max:y. |
|
1565 |
]. |
|
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
1566 |
|
785 | 1567 |
(listOfNodes size > 0 and:[(img := listOfNodes first icon) isImage]) ifTrue:[ |
1568 |
x := (img width) max:x. |
|
1569 |
y := (img height) max:y. |
|
1570 |
]. |
|
1571 |
^ x @ y |
|
1070
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1572 |
|
856d037fe133
care for non-existing images.
Claus Gittinger <cg@exept.de>
parents:
1061
diff
changeset
|
1573 |
"Modified: / 12.8.1998 / 12:45:53 / cg" |
444 | 1574 |
! |
1575 |
||
480 | 1576 |
getFontParameters |
546 | 1577 |
"save old computed height derived from images |
1578 |
" |
|
1579 |
|lineHeight| |
|
1580 |
||
1581 |
lineHeight := fontHeight ? 0. |
|
480 | 1582 |
super getFontParameters. |
569 | 1583 |
labelOffsetY := fontAscent - (fontHeight - lineSpacing // 2). |
480 | 1584 |
|
546 | 1585 |
lineHeight > fontHeight ifTrue:[ |
1586 |
fontHeight := lineHeight |
|
1587 |
]. |
|
685 | 1588 |
fontHeight odd ifTrue:[ |
1589 |
fontHeight := fontHeight + 1 |
|
1590 |
] |
|
480 | 1591 |
! |
1592 |
||
900 | 1593 |
initStyle |
1594 |
"setup viewStyle specifics" |
|
1595 |
||
1596 |
super initStyle. |
|
1171 | 1597 |
highlightMode := DefaultHilightMode ? #label. |
900 | 1598 |
|
1599 |
! |
|
1600 |
||
444 | 1601 |
initialize |
471 | 1602 |
"setup instance attributes |
1603 |
" |
|
444 | 1604 |
super initialize. |
1171 | 1605 |
|
1606 |
itemClass isNil ifTrue:[ |
|
1607 |
itemClass := TreeItem |
|
1608 |
]. |
|
1609 |
||
835 | 1610 |
supportsExpandAll := true. |
569 | 1611 |
self bitGravity:#NorthWest. |
773 | 1612 |
showRoot := showDirectoryIndicatorForRoot := showLines := computeResources := true. |
1815
a5f2bd36e179
double click on expandable item does not perform
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1613 |
showDirectoryIndicator := discardMotionEvents := showLinesForRoot := false. |
1275 | 1614 |
leftMargin := 2. |
1615 |
lineMask := Form width:2 height:2 fromArray:#[16rAA 16r55]. |
|
773 | 1616 |
registeredImages := IdentityDictionary new. |
855 | 1617 |
drawVLinesFromLevel := 1. |
659 | 1618 |
textInset := 4. |
494 | 1619 |
imageInset := 0. "/ set during indication enabled |
1620 |
imageWidth := 8. "/ default: will change during startup |
|
848 | 1621 |
|
1622 |
buildInArray := Array new:50. "/ used for temporary calculation |
|
1623 |
"/ suppress garbage collection |
|
1624 |
||
514 | 1625 |
self model:nil. "/ creates a default model. |
1171 | 1626 |
highlightMode := #label. |
1175 | 1627 |
editValueFgColor := Color blue. |
478 | 1628 |
! |
1629 |
||
569 | 1630 |
realize |
1631 |
super realize. |
|
1632 |
self refetchDeviceResources. |
|
1633 |
! |
|
1634 |
||
811 | 1635 |
recomputeDirectoryIndicator |
1636 |
"setup attributes used by directory indicator |
|
1637 |
" |
|
1638 |
|x w| |
|
1639 |
||
1640 |
imageInset := 0. |
|
1641 |
||
1642 |
(showDirectoryIndicator and:[computeResources not]) ifFalse:[ |
|
1643 |
^ self |
|
1644 |
]. |
|
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1645 |
|
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1646 |
x := 0. |
811 | 1647 |
openIndicator isNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1648 |
openIndicator := self imageOnMyDevice:(self class openIndicator) |
811 | 1649 |
]. |
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1650 |
openIndicator notNil ifTrue:[ |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1651 |
x := openIndicator width |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1652 |
]. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1653 |
|
811 | 1654 |
closeIndicator isNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
1655 |
closeIndicator := self imageOnMyDevice:(self class closeIndicator) |
811 | 1656 |
]. |
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1657 |
closeIndicator notNil ifTrue:[ |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1658 |
x := x max:(closeIndicator width) |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1659 |
]. |
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1660 |
|
811 | 1661 |
x := x // 2. |
1662 |
w := imageWidth // 2. |
|
1663 |
||
1664 |
(x := x + self class minImageInset) > w ifTrue:[ |
|
1665 |
imageInset := x - w. |
|
1666 |
]. |
|
1667 |
||
1072
1888703adc18
care for non-existing open/close indicators.
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
1668 |
"Modified: / 13.8.1998 / 12:02:04 / cg" |
811 | 1669 |
! |
1670 |
||
478 | 1671 |
refetchDeviceResources |
1672 |
"reinitialize heavily used device resources - to avoid rendering |
|
1673 |
images again and again later |
|
1674 |
" |
|
551 | 1675 |
|extent| |
478 | 1676 |
|
569 | 1677 |
(realized and:[computeResources and:[listOfNodes size ~~ 0]]) ifTrue:[ |
546 | 1678 |
computeResources := false. |
1679 |
extent := self fetchImageResources. |
|
494 | 1680 |
|
546 | 1681 |
extent y >= fontHeight ifTrue:[ |
1682 |
fontHeight := 1 + extent y. |
|
494 | 1683 |
]. |
685 | 1684 |
fontHeight odd ifTrue:[ |
1685 |
fontHeight := fontHeight + 1 |
|
1686 |
]. |
|
846 | 1687 |
"/ round and not odd: because of line drawing |
685 | 1688 |
|
846 | 1689 |
imageWidth := (extent x) // 2. |
1690 |
imageWidth odd ifTrue:[imageWidth := imageWidth + 1]. |
|
1691 |
imageWidth := imageWidth * 2. |
|
1692 |
||
546 | 1693 |
self recomputeDirectoryIndicator. |
569 | 1694 |
self computeNumberOfLinesShown. |
546 | 1695 |
] |
2156 | 1696 |
! |
1697 |
||
1698 |
release |
|
1699 |
"remove dependencies |
|
1700 |
" |
|
1701 |
rootHolder removeDependent:self. |
|
1702 |
selectionHolder removeDependent:self. |
|
1703 |
||
1704 |
model notNil ifTrue:[ |
|
1705 |
model stopRunningTasks |
|
1706 |
]. |
|
1707 |
super release. |
|
444 | 1708 |
! ! |
1709 |
||
483 | 1710 |
!SelectionInTreeView methodsFor:'model'! |
444 | 1711 |
|
1712 |
getListFromModel |
|
1713 |
"if I have a model, get my list from it using the listMessage. |
|
1714 |
If listMessage is nil, try aspectMessage for backward compatibilty. |
|
1715 |
" |
|
483 | 1716 |
super list:(self listFromModel) keepSelection:true |
1717 |
! |
|
444 | 1718 |
|
483 | 1719 |
listFromModel |
1720 |
"get list from model and return the new list. |
|
1721 |
If listMessage is nil, try aspectMessage for backward compatibilty. |
|
1722 |
" |
|
846 | 1723 |
|msg| |
838 | 1724 |
|
846 | 1725 |
widthOfWidestLine := nil. |
847 | 1726 |
list := listOfNodes := (msg := listMsg ? aspectMsg) notNil ifTrue:[model perform:msg] ifFalse:[#()]. |
1727 |
self refetchDeviceResources. |
|
846 | 1728 |
^ listOfNodes |
494 | 1729 |
! |
1730 |
||
1731 |
model:aModel |
|
514 | 1732 |
"check whether model is nil; than a default model is created |
1733 |
" |
|
855 | 1734 |
|model root| |
514 | 1735 |
|
811 | 1736 |
model notNil ifTrue:[ |
1737 |
model stopRunningTasks |
|
1738 |
]. |
|
1739 |
||
1171 | 1740 |
model := aModel ? (self class defaultModelClass new). |
1741 |
self itemClass:(model class defaultItemClass). |
|
855 | 1742 |
root := model root. |
1743 |
||
514 | 1744 |
model showRoot:showRoot. |
855 | 1745 |
|
1746 |
root notNil ifTrue:[ |
|
1747 |
root expand |
|
1748 |
]. |
|
514 | 1749 |
super model:model. |
855 | 1750 |
self getListFromModel |
811 | 1751 |
|
514 | 1752 |
! |
1753 |
||
1754 |
rootFromModel |
|
1755 |
"update hierarchical list from root model; 'rootHolder' |
|
1756 |
" |
|
1757 |
|root| |
|
1758 |
||
585 | 1759 |
root := rootHolder root. |
514 | 1760 |
|
1761 |
self root == root ifFalse:[ |
|
1762 |
self selection:nil. |
|
1763 |
self root:root. |
|
585 | 1764 |
]. |
514 | 1765 |
! |
1766 |
||
1767 |
selectionFromModel |
|
1768 |
"set the selection derived from the selectionHolder |
|
1769 |
" |
|
855 | 1770 |
|coll value size idx| |
514 | 1771 |
|
4246 | 1772 |
(value := selectionHolder value) notNil ifTrue:[ |
1214 | 1773 |
(multipleSelectOk and:[value isCollection]) ifFalse:[ |
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
1774 |
^ self selectNode:value withNotify:false. |
860 | 1775 |
]. |
1214 | 1776 |
|
1777 |
(size := value size) ~~ 0 ifTrue:[ |
|
1778 |
size == 1 ifTrue:[ |
|
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
1779 |
^ self selectNode:(value at:1) withNotify:false |
1214 | 1780 |
]. |
1781 |
||
1782 |
model doMakeVisible:value. |
|
1783 |
||
1784 |
coll := OrderedCollection new:size. |
|
1785 |
||
1786 |
value do:[:el| |
|
1787 |
idx := el isNumber ifTrue:[el] ifFalse:[self indexOfNode:el]. |
|
1788 |
||
1789 |
idx ~~ 0 ifTrue:[ |
|
1790 |
coll add:idx |
|
1791 |
]. |
|
1792 |
]. |
|
1793 |
||
4272 | 1794 |
coll := coll asNilIfEmpty. |
1214 | 1795 |
]. |
848 | 1796 |
]. |
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
1797 |
self setSelection:coll |
514 | 1798 |
! |
1799 |
||
1800 |
selectionToModel |
|
1801 |
"write selection to selection holder |
|
1802 |
" |
|
1803 |
|newSel oldSel| |
|
1804 |
||
1805 |
oldSel := selectionHolder value. |
|
1806 |
||
1807 |
multipleSelectOk ifFalse:[ |
|
1808 |
(newSel := self selectedNode) ~~ oldSel ifTrue:[ |
|
1809 |
selectionHolder value:newSel |
|
1810 |
] |
|
1811 |
] ifTrue:[ |
|
1812 |
selection size == 0 ifTrue:[ |
|
1813 |
oldSel notNil ifTrue:[ |
|
1814 |
selectionHolder value:nil |
|
1815 |
] |
|
1816 |
] ifFalse:[ |
|
1817 |
newSel := selection collect:[:i| listOfNodes at:i]. |
|
1818 |
||
1819 |
newSel size ~~ oldSel size ifTrue:[ |
|
1820 |
selectionHolder value:newSel. |
|
1821 |
] ifFalse:[ |
|
1822 |
newSel do:[:aNode| |
|
785 | 1823 |
(oldSel includesIdentical:aNode) ifFalse:[ |
514 | 1824 |
^ selectionHolder value:newSel |
1825 |
] |
|
1826 |
] |
|
1827 |
] |
|
1828 |
] |
|
1829 |
] |
|
444 | 1830 |
! ! |
1831 |
||
490 | 1832 |
!SelectionInTreeView methodsFor:'private'! |
1833 |
||
1171 | 1834 |
closeEditor |
1835 |
"close the editor |
|
1836 |
" |
|
1837 |
editorWidget notNil ifTrue:[ |
|
1838 |
editorWidget destroy. |
|
1839 |
editorIndex := 0. |
|
1840 |
editorWidget := nil. |
|
1841 |
]. |
|
1842 |
||
1843 |
! |
|
1844 |
||
490 | 1845 |
list:aList keepSelection:keepSelection |
585 | 1846 |
"setup new list; keep selection dependent on the boolean state |
1847 |
keepSelection |
|
1848 |
" |
|
1268 | 1849 |
|list| |
490 | 1850 |
|
846 | 1851 |
list := (aList size == 0) ifTrue:[#()] ifFalse:[aList]. |
1852 |
super list:list keepSelection:keepSelection. |
|
1853 |
self refetchDeviceResources. |
|
490 | 1854 |
|
1171 | 1855 |
! |
1856 |
||
1857 |
openEditor |
|
1858 |
"open an editor on selection |
|
1859 |
" |
|
1175 | 1860 |
|node x0 x1 y0| |
1171 | 1861 |
|
1862 |
editorWidget notNil ifTrue:[ |
|
1863 |
^ self |
|
1864 |
]. |
|
1865 |
editorIndex := self selectedIndex. |
|
1866 |
||
1867 |
( (node := listOfNodes at:editorIndex ifAbsent:nil) isNil |
|
1868 |
or:[(y0 := self listLineToVisibleLine:editorIndex) isNil |
|
1869 |
or:[(editorWidget := node editor) isNil]] |
|
1870 |
) ifTrue:[ |
|
1871 |
^ self |
|
1872 |
]. |
|
1175 | 1873 |
editorWidget withAllSubViewsDo:[:v| v font:font ]. |
1874 |
||
1171 | 1875 |
y0 := self yOfVisibleLine:y0. |
1876 |
x0 := self xOfValueNode:node. |
|
3423
5870494fda6b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
1877 |
x1 := (editorWidget preferredWidth) max:50. |
1171 | 1878 |
x1 := (x0 + x1) min:(self width - 5). |
1879 |
||
1880 |
editorWidget geometryLayout:(Rectangle left:x0 right:x1 top:y0 bottom:y0 + fontHeight). |
|
1881 |
||
1882 |
self addComponent:editorWidget. |
|
1883 |
editorWidget realize. |
|
1884 |
self paint:bgColor. |
|
1885 |
||
1886 |
self fillRectangleX:(x0 - SelectionInset) |
|
1887 |
y:y0 |
|
1888 |
width:SelectionInset + SelectionInset + (x1 - x0) |
|
1889 |
height:fontHeight. |
|
811 | 1890 |
! ! |
1891 |
||
2494 | 1892 |
!SelectionInTreeView methodsFor:'private-drag and drop'! |
569 | 1893 |
|
811 | 1894 |
collectionOfDragObjects |
1895 |
"returns collection of dragable objects assigned to selection |
|
1896 |
Here, by default, a collection of text-dragObjects is generated; |
|
1897 |
however, if a dragObjectConverter is defined, that one gets a chance |
|
1898 |
to convert as appropriate." |
|
1899 |
||
1900 |
|collection converted selection dLbl dObj node| |
|
1901 |
||
1902 |
selection := self selectionAsCollection. |
|
1903 |
||
1904 |
collection := selection collect:[:nr| |
|
1905 |
node := listOfNodes at:nr. |
|
1906 |
dObj := self dragObjectForNode:node. |
|
1907 |
dObj theObject:(node contents). |
|
846 | 1908 |
dLbl := LabelAndIcon icon:(self figureFor:node) string:(node name). |
811 | 1909 |
dObj displayObject:dLbl. |
1910 |
dObj |
|
1911 |
]. |
|
1912 |
||
1913 |
dragObjectConverter notNil ifTrue:[ |
|
1914 |
converted := OrderedCollection new. |
|
1915 |
collection keysAndValuesDo:[:nr :obj | |
|
1916 |
(dObj := dragObjectConverter value:obj) notNil ifTrue:[ |
|
846 | 1917 |
node := listOfNodes at:nr. |
1918 |
dLbl := LabelAndIcon icon:(self figureFor:node) string:(node name). |
|
811 | 1919 |
converted displayObject:dLbl. |
1920 |
converted add:dObj |
|
1921 |
] |
|
1922 |
]. |
|
1923 |
collection := converted |
|
1924 |
]. |
|
1925 |
^ collection. |
|
1926 |
||
1927 |
||
569 | 1928 |
|
1929 |
! |
|
1930 |
||
811 | 1931 |
dragObjectForNode:aNode |
1932 |
"returns the dragable object for a node; could be redefined in subclass |
|
546 | 1933 |
" |
811 | 1934 |
^ DropObject new:aNode. |
546 | 1935 |
|
811 | 1936 |
|
1937 |
! |
|
546 | 1938 |
|
811 | 1939 |
startDragX:x y:y |
1940 |
"start drag |
|
1941 |
" |
|
1942 |
dragIsActive := true. |
|
546 | 1943 |
|
811 | 1944 |
DragAndDropManager startDrag:(self collectionOfDragObjects) |
1945 |
from:self |
|
1946 |
atEnd:endDragAction |
|
546 | 1947 |
|
1948 |
||
490 | 1949 |
! ! |
1950 |
||
2494 | 1951 |
!SelectionInTreeView methodsFor:'private-queries'! |
468 | 1952 |
|
1953 |
lengthOfLongestLineBetween:firstLine and:lastLine |
|
1954 |
"return the length (in characters) of the longest line in a line-range |
|
1955 |
" |
|
846 | 1956 |
^ self widthOfContents // fontWidth + 1 |
468 | 1957 |
! |
1958 |
||
848 | 1959 |
smallestLevelOfNodesBetween:start and:stop |
1960 |
"returns the smallest level of the nodes in a line range |
|
1961 |
" |
|
1962 |
|prevNode currParent nextParent |
|
1963 |
||
1964 |
lvl "{ Class:SmallInteger }" |
|
1965 |
min "{ Class:SmallInteger }" |
|
1966 |
end "{ Class:SmallInteger }" |
|
1967 |
beg "{ Class:SmallInteger }" |
|
1968 |
| |
|
1969 |
||
1970 |
(end := stop min:(listOfNodes size)) < start ifTrue:[ |
|
1971 |
^ 0 |
|
1972 |
]. |
|
1973 |
||
1974 |
prevNode := listOfNodes at:start. |
|
1975 |
currParent := prevNode parent. |
|
1976 |
||
1977 |
currParent isNil ifTrue:[ |
|
1978 |
^ 1 |
|
1979 |
]. |
|
1980 |
||
1981 |
(min := prevNode level) == 2 ifTrue:[ |
|
1982 |
^ min |
|
1983 |
]. |
|
1984 |
beg := start + 1. |
|
1985 |
||
1986 |
listOfNodes from:beg to:end do:[:currNode| |
|
1987 |
(nextParent := currNode parent) == currParent ifFalse:[ |
|
1988 |
(currParent := nextParent) == prevNode ifFalse:[ |
|
1989 |
(lvl := currNode level) == 2 ifTrue:[ |
|
1990 |
^ 2 |
|
1991 |
]. |
|
1992 |
min := min min:lvl |
|
1993 |
] |
|
1994 |
]. |
|
1995 |
prevNode := currNode |
|
1996 |
]. |
|
1997 |
^ min |
|
1998 |
||
1999 |
||
2000 |
||
2001 |
||
2002 |
! |
|
2003 |
||
468 | 2004 |
widthOfContents |
2005 |
"return the width of the contents in pixels |
|
2006 |
- used for scrollbar interface" |
|
2007 |
||
846 | 2008 |
listOfNodes isNil ifTrue:[^ 0]. |
468 | 2009 |
|
2010 |
(widthOfWidestLine isNil or:[widthOfWidestLine == 0]) ifTrue:[ |
|
846 | 2011 |
widthOfWidestLine := self widthOfLongestLine |
468 | 2012 |
]. |
2013 |
^ widthOfWidestLine + (leftMargin * 2) |
|
2014 |
||
2015 |
! |
|
2016 |
||
846 | 2017 |
widthOfLongestLine |
2018 |
"return the width of the longest line in pixels |
|
468 | 2019 |
" |
848 | 2020 |
|parent pItem p |
846 | 2021 |
startX "{ Class: SmallInteger }" |
2022 |
deltaX "{ Class: SmallInteger }" |
|
838 | 2023 |
level "{ Class: SmallInteger }" |
2024 |
width "{ Class: SmallInteger }" |
|
2025 |
maxSz "{ Class: SmallInteger }"| |
|
468 | 2026 |
|
848 | 2027 |
buildInArray atAllPut:0. |
846 | 2028 |
parent := nil. |
2029 |
maxSz := 1. |
|
838 | 2030 |
level := 1. |
846 | 2031 |
|
2032 |
listOfNodes do:[:anItem| |
|
848 | 2033 |
(p := anItem parent) ~~ parent ifTrue:[ |
2034 |
buildInArray at:level put:maxSz. |
|
846 | 2035 |
|
848 | 2036 |
(parent := p) == pItem ifTrue:[level := level + 1] |
2037 |
ifFalse:[level := anItem level]. |
|
2038 |
||
2039 |
maxSz := buildInArray at:level. |
|
846 | 2040 |
]. |
2041 |
pItem := anItem. |
|
2042 |
maxSz := maxSz max:(anItem name size). |
|
2043 |
]. |
|
848 | 2044 |
buildInArray at:level put:maxSz. |
468 | 2045 |
|
846 | 2046 |
startX := self xOfStringLevel:1. |
2047 |
deltaX := imageInset + imageWidth. |
|
2048 |
width := '1' widthOn:self. |
|
2049 |
maxSz := 0. |
|
468 | 2050 |
|
848 | 2051 |
buildInArray do:[:el| |
2015
5a83ee792cc3
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2014
diff
changeset
|
2052 |
el == 0 ifTrue:[ ^ maxSz + viewOrigin x ]. |
846 | 2053 |
maxSz := maxSz max:(el * width + startX). |
2054 |
startX := startX + deltaX. |
|
468 | 2055 |
]. |
846 | 2056 |
! ! |
2057 |
||
2494 | 2058 |
!SelectionInTreeView methodsFor:'private-redefinitions'! |
846 | 2059 |
|
2060 |
expandTabs |
|
2061 |
"nothing to do |
|
2062 |
" |
|
838 | 2063 |
|
2064 |
||
468 | 2065 |
! |
2066 |
||
846 | 2067 |
list:aCollection expandTabs:expand scanForNonStrings:scan |
2068 |
||
2069 |
includesNonStrings := false. |
|
4380 | 2070 |
self list:aCollection expandTabs:false scanForNonStrings:false includesNonStrings:nil |
846 | 2071 |
! |
2072 |
||
468 | 2073 |
withoutRedrawAt:anIndex put:aString |
1813 | 2074 |
"change a line without redisplay and WITHOUT any sizeChange notifications. |
2075 |
Somewhat dangerous, since scrollBars will not be informed about contents-changes. |
|
2076 |
Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other |
|
2077 |
means at the end." |
|
468 | 2078 |
|
2079 |
|width| |
|
2080 |
||
2081 |
width := widthOfWidestLine. |
|
2082 |
widthOfWidestLine := nil. |
|
2083 |
super withoutRedrawAt:anIndex put:aString. |
|
846 | 2084 |
widthOfWidestLine := width. |
468 | 2085 |
|
846 | 2086 |
(widthOfWidestLine notNil and:[aString size ~~ 0]) ifTrue:[ |
2087 |
width := self xOfStringNode:(listOfNodes at:anIndex) |
|
2088 |
+ (aString widthOn:self) |
|
2015
5a83ee792cc3
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2014
diff
changeset
|
2089 |
+ viewOrigin x. |
846 | 2090 |
|
838 | 2091 |
widthOfWidestLine := widthOfWidestLine max:width. |
468 | 2092 |
]. |
2093 |
! ! |
|
2094 |
||
483 | 2095 |
!SelectionInTreeView methodsFor:'queries'! |
2096 |
||
2097 |
figureFor:aNode |
|
1278 | 2098 |
"return a (bitmap) figure for a node" |
2099 |
||
785 | 2100 |
|icon img| |
2101 |
||
1278 | 2102 |
"/ the item may provide an icon |
2103 |
"/ (it knows for itself if its open or closed) |
|
2104 |
||
785 | 2105 |
(icon := aNode icon) notNil ifTrue:[ |
2106 |
img := registeredImages at:icon ifAbsent:nil. |
|
2107 |
img notNil ifTrue:[ |
|
2108 |
^ img |
|
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
2109 |
]. |
785 | 2110 |
icon isImage ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2111 |
img := self imageOnMyDevice:icon. |
785 | 2112 |
registeredImages at:icon put:img. |
1278 | 2113 |
^ img |
785 | 2114 |
] |
763
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
2115 |
]. |
dd29c58e8ea6
supports dynamic read behavior for contents, label, children, and icon of tree items
tz
parents:
760
diff
changeset
|
2116 |
|
1278 | 2117 |
"/ ok, node did not return an icon - use default. |
2118 |
||
846 | 2119 |
aNode hasChildren ifFalse:[ |
1278 | 2120 |
"/ regular |
2121 |
^ imageItem |
|
846 | 2122 |
]. |
1278 | 2123 |
"/ folder |
846 | 2124 |
^ aNode hidden ifTrue:[imageClosed] ifFalse:[imageOpened] |
483 | 2125 |
! |
2126 |
||
2127 |
indexOfNode:aNode |
|
2128 |
"returns index of a node |
|
2129 |
" |
|
785 | 2130 |
^ listOfNodes identityIndexOf:aNode |
483 | 2131 |
! |
2132 |
||
494 | 2133 |
xOfFigureLevel:aLevel |
2134 |
"origin x where to draw the icon |
|
2135 |
" |
|
785 | 2136 |
|l "{ Class:SmallInteger }"| |
494 | 2137 |
|
785 | 2138 |
l := showRoot ifTrue:[aLevel] ifFalse:[aLevel - 1]. |
494 | 2139 |
|
659 | 2140 |
showDirectoryIndicator ifFalse:[ |
2141 |
l := l - 1 |
|
2142 |
] ifTrue:[ |
|
2143 |
showDirectoryIndicatorForRoot ifFalse:[ |
|
2144 |
l := l - 1 |
|
2145 |
] |
|
2146 |
]. |
|
2015
5a83ee792cc3
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2014
diff
changeset
|
2147 |
^ (l * (imageInset + imageWidth)) + imageInset - viewOrigin x + leftMargin |
494 | 2148 |
! |
2149 |
||
483 | 2150 |
xOfFigureNode:aNode |
2151 |
"origin x where to draw the icon |
|
2152 |
" |
|
494 | 2153 |
^ self xOfFigureLevel:(aNode level) |
2154 |
! |
|
490 | 2155 |
|
494 | 2156 |
xOfStringLevel:aLevel |
2157 |
"origin x where to draw the text( label ) |
|
2158 |
" |
|
2159 |
^ (self xOfFigureLevel:aLevel) + imageWidth + textInset |
|
483 | 2160 |
|
2161 |
! |
|
2162 |
||
2163 |
xOfStringNode:aNode |
|
2164 |
"origin x where to draw the text( label ) |
|
2165 |
" |
|
494 | 2166 |
^ self xOfStringLevel:(aNode level) |
483 | 2167 |
|
1171 | 2168 |
! |
2169 |
||
2170 |
xOfValueNode:aNode |
|
2171 |
"returns the left x position of the start of the value |
|
2172 |
" |
|
2173 |
|p x| |
|
2174 |
||
2175 |
p := aNode parent. |
|
2176 |
||
2177 |
x := p notNil ifTrue:[30 + (p childrenWidthOn:self)] |
|
2178 |
ifFalse:[0]. |
|
2179 |
||
2180 |
^ x + (self xOfStringNode:aNode) |
|
2181 |
||
483 | 2182 |
! ! |
2183 |
||
1061
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2184 |
!SelectionInTreeView methodsFor:'scrolling'! |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2185 |
|
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2186 |
needScrollToMakeLine:aListLineNr |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2187 |
"redefined to scroll whenever line is not in top half" |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2188 |
|
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2189 |
(aListLineNr >= firstLineShown) ifTrue:[ |
1162 | 2190 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
1061
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2191 |
^ false |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2192 |
] |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2193 |
]. |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2194 |
^ true |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2195 |
|
1171 | 2196 |
! |
2197 |
||
2198 |
originChanged:delta |
|
2199 |
"sent after scrolling - have to update origin of editor |
|
2200 |
" |
|
2201 |
super originChanged:delta. |
|
2202 |
||
2203 |
editorWidget notNil ifTrue:[ |
|
2204 |
editorWidget origin:(editorWidget origin - delta) |
|
2205 |
] |
|
2206 |
||
1061
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2207 |
! ! |
8eba9d898259
scroll to bring selection into upper half of view
Claus Gittinger <cg@exept.de>
parents:
908
diff
changeset
|
2208 |
|
444 | 2209 |
!SelectionInTreeView methodsFor:'selection'! |
2210 |
||
468 | 2211 |
selectNode:aNode |
2212 |
"change selection to a node |
|
2213 |
" |
|
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2214 |
^ self selectNode:aNode withNotify:true. |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2215 |
! |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2216 |
|
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2217 |
selectNode:aNode withNotify:withNotify |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2218 |
"change selection to a node |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2219 |
" |
855 | 2220 |
|index| |
848 | 2221 |
|
860 | 2222 |
(index := aNode) notNil ifTrue:[ |
2223 |
index isNumber ifFalse:[ |
|
2224 |
(index := self indexOfNode:aNode) == 0 ifTrue:[ |
|
2225 |
model doMakeVisible:aNode. |
|
2226 |
index := self indexOfNode:aNode. |
|
2227 |
] |
|
855 | 2228 |
]. |
848 | 2229 |
index == 0 ifTrue:[ |
855 | 2230 |
index := nil |
848 | 2231 |
] |
2232 |
]. |
|
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2233 |
withNotify ifFalse:[ |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2234 |
self setSelection:index |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2235 |
] ifTrue:[ |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2236 |
self selection:index |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2237 |
]. |
468 | 2238 |
! |
2239 |
||
1972 | 2240 |
selectNodes:aCollectionOfNodes |
2689
c382886ddb08
bugfix: catch recursion if selection changed through to the model
ca
parents:
2688
diff
changeset
|
2241 |
^ self selectNodes:aCollectionOfNodes withNotify:true. |
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2242 |
! |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2243 |
|
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2244 |
selectNodes:aCollectionOfNodes withNotify:withNotify |
1972 | 2245 |
|selIndexCollection| |
2246 |
||
2247 |
selIndexCollection := aCollectionOfNodes collect:[:eachNode | listOfNodes identityIndexOf:eachNode]. |
|
2248 |
selIndexCollection := selIndexCollection reject:[:eachIndex | eachIndex == 0]. |
|
2688
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2249 |
|
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2250 |
withNotify ifTrue:[ |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2251 |
self selection:selIndexCollection. |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2252 |
] ifFalse:[ |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2253 |
self setSelection:selIndexCollection. |
2d853020325f
bugfix: catch recursion if selection changed through to the model
ca
parents:
2659
diff
changeset
|
2254 |
]. |
1972 | 2255 |
|
2256 |
"/ first := true. |
|
2257 |
"/ aCollectionOfNodes do:[:eachNode | |
|
2258 |
"/ first ifTrue:[ |
|
2259 |
"/ self selectNode:eachNode. |
|
2260 |
"/ first := false. |
|
2261 |
"/ ] ifFalse:[ |
|
2262 |
"/ self selectedNodeAdd:eachNode |
|
2263 |
"/ ] |
|
2264 |
"/ ]. |
|
2265 |
"/ |
|
2266 |
! |
|
2267 |
||
456 | 2268 |
selectedIndex |
2269 |
"get single selected index or 0 |
|
2270 |
" |
|
483 | 2271 |
selection size == 1 ifTrue:[^ selection first]. |
2272 |
selection isNumber ifTrue:[^ selection]. |
|
456 | 2273 |
^ 0 |
444 | 2274 |
! |
2275 |
||
2276 |
selectedNode |
|
2277 |
"get the single selected node or nil |
|
2278 |
" |
|
456 | 2279 |
|idx| |
2280 |
||
2281 |
(idx := self selectedIndex) ~~ 0 ifTrue:[ |
|
3985 | 2282 |
^ listOfNodes at:idx ifAbsent:nil |
444 | 2283 |
]. |
3985 | 2284 |
^ nil |
2285 |
||
2286 |
"Modified: / 19-01-2011 / 18:41:02 / cg" |
|
514 | 2287 |
! |
2288 |
||
1972 | 2289 |
selectedNodes |
2290 |
"get a collection of selected nodes |
|
2291 |
" |
|
2292 |
|selIndexCollection| |
|
2293 |
||
2294 |
(selIndexCollection := self selection) size == 0 ifTrue:[^ #() ]. |
|
2295 |
^ selIndexCollection collect:[:eachIndex | listOfNodes at:eachIndex]. |
|
2296 |
! |
|
2297 |
||
514 | 2298 |
selectionChangedFrom:oldSelection |
2299 |
"update selectionHolder if not nil |
|
2300 |
" |
|
1171 | 2301 |
self closeEditor. |
514 | 2302 |
|
623
4de870640523
first change selectionHolders value,
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
2303 |
"/ first change my selectionHolders value ... |
514 | 2304 |
selectionHolder notNil ifTrue:[ |
2305 |
self selectionToModel. |
|
2306 |
]. |
|
2307 |
||
623
4de870640523
first change selectionHolders value,
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
2308 |
"/ ... then make notifications. |
4de870640523
first change selectionHolders value,
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
2309 |
super selectionChangedFrom:oldSelection. |
4de870640523
first change selectionHolders value,
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
2310 |
|
4de870640523
first change selectionHolders value,
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
2311 |
|
1171 | 2312 |
! |
2313 |
||
2314 |
setSelection:aSelection |
|
2315 |
"if no selection exists, close the editor |
|
2316 |
" |
|
2317 |
(aSelection isNil or:[aSelection == 0]) ifTrue:[ |
|
2318 |
self closeEditor |
|
2319 |
]. |
|
2320 |
super setSelection:aSelection |
|
2321 |
||
2322 |
||
444 | 2323 |
! ! |
2324 |
||
855 | 2325 |
!SelectionInTreeView methodsFor:'selection actions'! |
507 | 2326 |
|
2327 |
selectedNodeAdd:something |
|
2328 |
"add a node or collection of nodes after selected node |
|
2329 |
" |
|
2330 |
|node| |
|
2331 |
||
2332 |
something notNil ifTrue:[ |
|
2333 |
(node := self selectedNode) notNil ifTrue:[ |
|
2334 |
node parent notNil ifTrue:[ |
|
2335 |
node isCollapsable ifTrue:[ |
|
2336 |
model add:something beforeIndex:1 below:node |
|
2337 |
] ifFalse:[ |
|
2338 |
model add:something after:node |
|
2339 |
] |
|
2340 |
] ifFalse:[ |
|
2341 |
model add:something beforeIndex:1 below:(self root) |
|
2342 |
] |
|
2343 |
] |
|
2344 |
] |
|
2345 |
||
2346 |
! |
|
2347 |
||
2348 |
selectedNodeBecomeChildOfNext |
|
1972 | 2349 |
"make the selected node a child of the next node |
507 | 2350 |
" |
2351 |
|idx node cprt nprt| |
|
2352 |
||
2353 |
((node := self selectedNode) isNil or:[(cprt := node parent) isNil]) ifFalse:[ |
|
2354 |
idx := cprt indexOfChild:node. |
|
2355 |
||
2356 |
idx == cprt children size ifFalse:[ |
|
2357 |
nprt := cprt childAt:(idx + 1). |
|
2358 |
||
2359 |
nprt notNil ifTrue:[ |
|
855 | 2360 |
self setSelection:nil. |
2361 |
model remove:node. |
|
507 | 2362 |
model add:node beforeIndex:1 below:nprt. |
2363 |
self selectNode:node. |
|
2364 |
] |
|
2365 |
] |
|
2366 |
] |
|
2367 |
! |
|
2368 |
||
1972 | 2369 |
selectedNodeBecomeChildOfPrevious |
4253 | 2370 |
"make the selected node a child of the previous node" |
2371 |
||
1972 | 2372 |
|idx node cprt nprt| |
2373 |
||
2374 |
((node := self selectedNode) isNil or:[(cprt := node parent) isNil]) ifFalse:[ |
|
2375 |
idx := cprt indexOfChild:node. |
|
2376 |
||
2377 |
idx == cprt children size ifFalse:[ |
|
2378 |
nprt := cprt childAt:(idx - 1). |
|
2379 |
||
2380 |
nprt notNil ifTrue:[ |
|
2381 |
self setSelection:nil. |
|
2382 |
model remove:node. |
|
2383 |
model add:node below:nprt. |
|
2384 |
self selectNode:node. |
|
2385 |
] |
|
2386 |
] |
|
2387 |
] |
|
2388 |
! |
|
2389 |
||
507 | 2390 |
selectedNodeBecomeSisterOfParent |
2391 |
"become node a sister of its current parent |
|
2392 |
" |
|
2393 |
|node cprt nprt| |
|
2394 |
||
2395 |
( (node := self selectedNode) isNil |
|
2396 |
or:[(cprt := node parent) isNil |
|
2397 |
or:[(nprt := cprt parent) isNil]] |
|
2398 |
) ifFalse:[ |
|
855 | 2399 |
self setSelection:nil. |
2400 |
model remove:node. |
|
507 | 2401 |
model add:node afterIndex:(nprt indexOfChild:cprt) below:nprt. |
855 | 2402 |
self selectNode:node. |
507 | 2403 |
] |
2404 |
||
2405 |
! |
|
2406 |
||
2407 |
selectedNodeChangeSequenceOrder:anOffset |
|
3690 | 2408 |
"move child 'anOffset' forward or backward in list of children" |
2409 |
||
507 | 2410 |
|idx node size parent| |
2411 |
||
2412 |
( (node := self selectedNode) notNil |
|
2413 |
and:[(parent := node parent) notNil |
|
2414 |
and:[(size := parent children size) > 1]] |
|
2415 |
) ifTrue:[ |
|
2416 |
idx := parent indexOfChild:node. |
|
855 | 2417 |
self setSelection:nil. |
2418 |
model remove:node. |
|
507 | 2419 |
|
2420 |
(idx := idx + anOffset) < 1 ifTrue:[ |
|
2421 |
idx := size |
|
2422 |
] ifFalse:[ |
|
2423 |
idx > size ifTrue:[idx := 1] |
|
2424 |
]. |
|
2425 |
model add:node beforeIndex:idx below:parent. |
|
2426 |
self selectNode:node. |
|
2427 |
] |
|
2428 |
! |
|
2429 |
||
2430 |
selectedNodeExpand:doExpand |
|
2431 |
"collapse or expand selected node |
|
2432 |
" |
|
855 | 2433 |
|node| |
507 | 2434 |
|
855 | 2435 |
(node := self selectedNode) notNil ifTrue:[ |
2436 |
doExpand ifTrue:[model doExpand:node] |
|
2437 |
ifFalse:[model doCollapse:node] |
|
2438 |
] |
|
507 | 2439 |
! |
2440 |
||
1972 | 2441 |
selectedNodesBecomeChildrenOfNext |
4253 | 2442 |
"make the selected nodes children of the next node" |
2443 |
||
2444 |
|indices maxIndex nodes newParent| |
|
1972 | 2445 |
|
2446 |
nodes := self selectedNodes. |
|
2447 |
nodes size == 0 ifTrue:[^ self]. |
|
2448 |
||
2449 |
indices := nodes collect:[:eachNode | listOfNodes identityIndexOf:eachNode]. |
|
2450 |
maxIndex := indices max. |
|
2451 |
||
2452 |
newParent := listOfNodes at:(maxIndex + 1) ifAbsent:nil. |
|
2453 |
newParent isNil ifTrue:[^ self]. |
|
2454 |
||
2455 |
indices sortWith:nodes. |
|
2456 |
||
2457 |
nodes reverseDo:[:eachNodeToMove | |
|
2458 |
model remove:eachNodeToMove. |
|
2459 |
model add:eachNodeToMove beforeIndex:1 below:newParent. |
|
2460 |
]. |
|
2461 |
self selectNodes:nodes. |
|
2462 |
! |
|
2463 |
||
2464 |
selectedNodesBecomeSistersOfParent |
|
2465 |
"move selected nodes up (out of their parent to their grandparent). |
|
2466 |
I.e. nodes become sisters of their current parent |
|
2467 |
" |
|
2468 |
|nodes parent grandParent indices| |
|
2469 |
||
2470 |
nodes := self selectedNodes. |
|
2471 |
nodes size == 0 ifTrue:[^ self]. |
|
2472 |
||
2473 |
"/ common parent ? |
|
2474 |
parent := nodes first parent. |
|
2475 |
(nodes conform:[:eachNode | eachNode parent == parent]) ifFalse:[^ self]. |
|
2476 |
||
2477 |
"/ is there a grandparent ? |
|
2478 |
grandParent := parent parent. |
|
2479 |
grandParent isNil ifTrue:[^ self]. |
|
2480 |
||
2481 |
self setSelection:nil. |
|
2482 |
indices := nodes collect:[:eachNode | listOfNodes identityIndexOf:eachNode]. |
|
2483 |
indices sortWith:nodes. |
|
2484 |
||
2485 |
nodes reverseDo:[:eachNodeToMove | |
|
2486 |
model remove:eachNodeToMove. |
|
2487 |
model add:eachNodeToMove afterIndex:(grandParent indexOfChild:parent) below:grandParent. |
|
2488 |
]. |
|
2489 |
self selectNodes:nodes. |
|
2490 |
! |
|
2491 |
||
507 | 2492 |
selectedNodesRemove |
2493 |
"remove selected nodes |
|
2494 |
" |
|
855 | 2495 |
|selection| |
2496 |
||
2497 |
selection := self selection. |
|
507 | 2498 |
self selection:nil. |
855 | 2499 |
model remove:selection. |
507 | 2500 |
! ! |
2501 |
||
444 | 2502 |
!SelectionInTreeView class methodsFor:'documentation'! |
2503 |
||
2504 |
version |
|
4380 | 2505 |
^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.119 2013-09-06 12:24:53 cg Exp $' |
3985 | 2506 |
! |
2507 |
||
2508 |
version_CVS |
|
4380 | 2509 |
^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.119 2013-09-06 12:24:53 cg Exp $' |
444 | 2510 |
! ! |
4246 | 2511 |