author | tz |
Wed, 13 May 1998 14:38:36 +0200 | |
changeset 821 | 950e6fbbc1f0 |
parent 820 | e967a1359d77 |
child 823 | 47e7d348e01a |
permissions | -rw-r--r-- |
424 | 1 |
" |
502 | 2 |
COPYRIGHT (c) 1997 by eXept Software AG |
424 | 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 |
" |
|
12 |
||
13 |
||
14 |
ApplicationModel subclass:#DirectoryView |
|
15 |
instanceVariableNames:'directory selectedFileFilter readTask monitoring |
|
16 |
monitoringTimeBlock fileDoubleClickAction fileSelectAction |
|
17 |
fileFilterSelectAction fileAttributes' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
620 | 20 |
category:'Interface-Support' |
424 | 21 |
! |
22 |
||
23 |
Object subclass:#FileRow |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
24 |
instanceVariableNames:'fileName size modified iconKey imageFromFile group owner |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
25 |
permissions baseName' |
424 | 26 |
classVariableNames:'' |
27 |
poolDictionaries:'' |
|
28 |
privateIn:DirectoryView |
|
29 |
! |
|
30 |
||
31 |
!DirectoryView class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
502 | 35 |
COPYRIGHT (c) 1997 by eXept Software AG |
424 | 36 |
All Rights Reserved |
37 |
||
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
45 |
||
46 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
50 |
documentation to be added. |
|
502 | 51 |
|
52 |
[author:] |
|
53 |
Thomas Zwick |
|
424 | 54 |
" |
55 |
! ! |
|
56 |
||
57 |
!DirectoryView class methodsFor:'instance creation'! |
|
58 |
||
516
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
59 |
openOnDirectory: aDirectoryString |
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
60 |
"open a DirectoryView for a aDirectoryString" |
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
61 |
|
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
62 |
^ (self new directory: aDirectoryString) open |
424 | 63 |
|
516
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
64 |
" |
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
65 |
self openOnDirectory: '/etc' |
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
66 |
" |
424 | 67 |
|
516
d336effde882
Fix #openOnDirectory: and copyright.
Stefan Vogel <sv@exept.de>
parents:
502
diff
changeset
|
68 |
"Modified: / 28.1.1998 / 15:44:53 / stefan" |
424 | 69 |
! ! |
70 |
||
71 |
!DirectoryView class methodsFor:'interface specs'! |
|
72 |
||
820 | 73 |
tableColumnsForFileAttributes |
74 |
"This resource specification was automatically generated |
|
75 |
by the DataSetBuilder of ST/X." |
|
76 |
||
77 |
"Do not manually edit this!! If it is corrupted, |
|
78 |
the DataSetBuilder may not be able to read the specification." |
|
79 |
||
80 |
" |
|
81 |
DataSetBuilder new openOnClass:DirectoryView andSelector:#tableColumnsForFileAttributes |
|
82 |
" |
|
83 |
||
84 |
<resource: #tableColumns> |
|
85 |
||
424 | 86 |
|
820 | 87 |
^ #( |
88 |
#(#DataSetColumnSpec |
|
89 |
#label: '' |
|
90 |
#width: 30 |
|
91 |
#height: 22 |
|
92 |
#printSelector: #iconOn: |
|
93 |
#canSelect: false |
|
94 |
) |
|
95 |
#(#DataSetColumnSpec |
|
96 |
#label: 'File name' |
|
97 |
#labelAlignment: #left |
|
98 |
#minWidth: 150 |
|
99 |
#model: #baseName |
|
100 |
#canSelect: false |
|
101 |
) |
|
102 |
#(#DataSetColumnSpec |
|
103 |
#label: 'Size' |
|
104 |
#labelAlignment: #left |
|
105 |
#width: 70 |
|
106 |
#model: #size |
|
107 |
#canSelect: false |
|
108 |
) |
|
109 |
#(#DataSetColumnSpec |
|
110 |
#label: 'Modified' |
|
111 |
#labelAlignment: #left |
|
112 |
#model: #modified |
|
113 |
#canSelect: false |
|
114 |
) |
|
115 |
#(#DataSetColumnSpec |
|
116 |
#label: 'Permissions' |
|
117 |
#labelAlignment: #left |
|
118 |
#width: 85 |
|
119 |
#model: #permissions |
|
120 |
#canSelect: false |
|
121 |
) |
|
122 |
#(#DataSetColumnSpec |
|
123 |
#label: 'Owner' |
|
124 |
#labelAlignment: #left |
|
125 |
#width: 50 |
|
126 |
#model: #owner |
|
127 |
#canSelect: false |
|
128 |
) |
|
129 |
#(#DataSetColumnSpec |
|
130 |
#label: 'Group' |
|
131 |
#labelAlignment: #left |
|
132 |
#width: 50 |
|
133 |
#model: #group |
|
134 |
#canSelect: false |
|
135 |
) |
|
136 |
) |
|
137 |
! |
|
138 |
||
139 |
windowSpec |
|
140 |
"This resource specification was automatically generated |
|
141 |
by the UIPainter of ST/X." |
|
142 |
||
143 |
"Do not manually edit this!! If it is corrupted, |
|
144 |
the UIPainter may not be able to read the specification." |
|
424 | 145 |
|
146 |
" |
|
147 |
UIPainter new openOnClass:DirectoryView andSelector:#windowSpec |
|
148 |
DirectoryView new openInterface:#windowSpec |
|
820 | 149 |
DirectoryView open |
424 | 150 |
" |
151 |
||
152 |
<resource: #canvas> |
|
153 |
||
154 |
^ |
|
820 | 155 |
|
424 | 156 |
#(#FullSpec |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
157 |
#window: |
424 | 158 |
#(#WindowSpec |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
159 |
#name: 'Directory View' |
820 | 160 |
#layout: #(#LayoutFrame 412 0 367 0 811 0 666 0) |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
161 |
#label: 'Directory View' |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
162 |
#min: #(#Point 10 10) |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
163 |
#max: #(#Point 1152 900) |
820 | 164 |
#bounds: #(#Rectangle 412 367 812 667) |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
165 |
#usePreferredExtent: false |
424 | 166 |
) |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
167 |
#component: |
424 | 168 |
#(#SpecCollection |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
169 |
#collection: |
424 | 170 |
#( |
171 |
#(#DataSetSpec |
|
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
172 |
#name: 'filesDataSetView' |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
173 |
#layout: #(#LayoutFrame 0 0.0 24 0.0 -2 1.0 0 1.0) |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
174 |
#model: #selectionOfFile |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
175 |
#hasHorizontalScrollBar: true |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
176 |
#hasVerticalScrollBar: true |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
177 |
#miniScrollerHorizontal: true |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
178 |
#dataList: #listOfFiles |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
179 |
#useIndex: false |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
180 |
#doubleClickSelector: #fileDoubleClicked |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
181 |
#columnHolder: #fileAttributeColumns |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
182 |
#valueChangeSelector: #fileSelected |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
183 |
#verticalSpacing: 1 |
424 | 184 |
) |
185 |
#(#ComboBoxSpec |
|
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
186 |
#name: 'formatComboBox' |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
187 |
#layout: #(#LayoutFrame 63 0.0 0 0 0 1.0 22 0) |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
188 |
#model: #selectionOfFileFilter |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
189 |
#immediateAccept: false |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
190 |
#acceptOnTab: false |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
191 |
#comboList: #listOfFileFilters |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
192 |
) |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
193 |
#(#LabelSpec |
820 | 194 |
#name: 'filterLabel' |
652
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
195 |
#layout: #(#LayoutFrame 0 0 0 0 62 0 22 0) |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
196 |
#label: 'Filter: ' |
75644c11d619
label 'Filter:' added to avoid using as file name input field
tz
parents:
645
diff
changeset
|
197 |
#adjust: #right |
424 | 198 |
) |
199 |
) |
|
200 |
) |
|
201 |
) |
|
202 |
! ! |
|
203 |
||
204 |
!DirectoryView methodsFor:'accessing'! |
|
205 |
||
206 |
directory: aDirectory |
|
207 |
||
208 |
directory := aDirectory asFilename asAbsoluteFilename name |
|
209 |
! |
|
210 |
||
211 |
fileAttributes: anArray |
|
212 |
||
213 |
fileAttributes := anArray |
|
214 |
! |
|
215 |
||
216 |
fileDoubleClickAction: anActionBlock |
|
217 |
||
218 |
fileDoubleClickAction := anActionBlock |
|
219 |
! |
|
220 |
||
221 |
fileFilterSelectAction: anActionBlock |
|
222 |
||
223 |
fileFilterSelectAction := anActionBlock |
|
224 |
! |
|
225 |
||
226 |
fileSelectAction: anActionBlock |
|
227 |
||
228 |
fileSelectAction := anActionBlock |
|
229 |
! |
|
230 |
||
231 |
listOfFileFilters: aCollection |
|
232 |
||
233 |
self listOfFileFilters contents: aCollection. |
|
234 |
self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
|
235 |
! |
|
236 |
||
237 |
monitoring: aBoolean |
|
238 |
||
239 |
aBoolean |
|
240 |
ifTrue: |
|
241 |
[ |
|
242 |
monitoringTimeBlock := [self readDirectory]. |
|
243 |
self readDirectory. |
|
244 |
] |
|
245 |
ifFalse: |
|
246 |
[ |
|
247 |
monitoring ifTrue: |
|
248 |
[ |
|
249 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
250 |
monitoringTimeBlock := nil |
|
251 |
] |
|
252 |
]. |
|
253 |
||
254 |
monitoring := aBoolean. |
|
255 |
||
256 |
! ! |
|
257 |
||
258 |
!DirectoryView methodsFor:'aspects'! |
|
259 |
||
260 |
fileAttributeColumns |
|
261 |
||
262 |
|holder| |
|
263 |
(holder := builder bindingAt:#fileAttributeColumns) isNil ifTrue:[ |
|
264 |
|fileAttributeColumns| |
|
265 |
builder aspectAt:#fileAttributeColumns put:(holder := List new). |
|
820 | 266 |
fileAttributeColumns := self class tableColumnsForFileAttributes collect: [:i| i decodeAsLiteralArray]. |
424 | 267 |
holder add: fileAttributeColumns first. |
268 |
fileAttributeColumns do: |
|
269 |
[:col| |
|
270 |
(fileAttributes includes: col label) ifTrue: [holder add: col] |
|
271 |
]. |
|
591 | 272 |
holder do: [:col| col label: ' ', col label] |
424 | 273 |
]. |
274 |
^ holder |
|
275 |
! |
|
276 |
||
277 |
listOfFileFilters |
|
278 |
||
279 |
|holder| |
|
280 |
(holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[ |
|
281 |
builder aspectAt:#listOfFileFilters put:(holder := List with: '*'). |
|
282 |
]. |
|
283 |
^ holder |
|
284 |
! |
|
285 |
||
286 |
listOfFiles |
|
287 |
||
288 |
|holder| |
|
289 |
(holder := builder bindingAt:#listOfFiles) isNil ifTrue:[ |
|
290 |
builder aspectAt:#listOfFiles put:(holder := List new). |
|
291 |
]. |
|
292 |
^ holder |
|
293 |
! |
|
294 |
||
295 |
selectionOfFile |
|
296 |
||
297 |
|holder| |
|
298 |
(holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[ |
|
299 |
builder aspectAt:#selectionOfFile put:(holder := ValueHolder new). |
|
300 |
]. |
|
301 |
^ holder |
|
302 |
||
303 |
! |
|
304 |
||
305 |
selectionOfFileFilter |
|
306 |
||
307 |
|holder| |
|
308 |
(holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[ |
|
309 |
builder aspectAt:#selectionOfFileFilter put: |
|
310 |
(holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter). |
|
311 |
selectedFileFilter := '*'. |
|
312 |
]. |
|
313 |
^ holder |
|
314 |
! ! |
|
315 |
||
316 |
!DirectoryView methodsFor:'callbacks'! |
|
317 |
||
318 |
fileDoubleClicked |
|
319 |
||
473 | 320 |
(fileDoubleClickAction notNil and: [self selectionOfFile value notNil]) |
424 | 321 |
ifTrue: |
322 |
[ |
|
323 |
fileDoubleClickAction numArgs = 0 |
|
324 |
ifTrue: |
|
325 |
[ |
|
326 |
fileDoubleClickAction value |
|
327 |
]. |
|
328 |
fileDoubleClickAction numArgs = 1 |
|
329 |
ifTrue: |
|
451 | 330 |
[ |
331 |
fileDoubleClickAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
|
424 | 332 |
] |
333 |
] |
|
334 |
! |
|
335 |
||
336 |
fileSelected |
|
337 |
||
473 | 338 |
(fileSelectAction notNil and: [self selectionOfFile value notNil]) |
424 | 339 |
ifTrue: |
340 |
[ |
|
341 |
fileSelectAction numArgs = 0 |
|
342 |
ifTrue: |
|
343 |
[ |
|
344 |
fileSelectAction value |
|
345 |
]. |
|
346 |
fileSelectAction numArgs = 1 |
|
347 |
ifTrue: |
|
348 |
[ |
|
451 | 349 |
fileSelectAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
424 | 350 |
] |
351 |
] |
|
352 |
! ! |
|
353 |
||
354 |
!DirectoryView methodsFor:'initialization'! |
|
355 |
||
356 |
initialize |
|
357 |
||
358 |
super initialize. |
|
359 |
||
360 |
directory := directory ? '.' asFilename asAbsoluteFilename directoryName. |
|
361 |
monitoring := false. |
|
593 | 362 |
fileAttributes := #('File name' 'Size' 'Modified'). |
424 | 363 |
self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
364 |
||
365 |
! ! |
|
366 |
||
367 |
!DirectoryView methodsFor:'private'! |
|
368 |
||
369 |
readDirectory |
|
370 |
||
614 | 371 |
|foundFiles list| |
590 | 372 |
foundFiles := OrderedCollection new. |
614 | 373 |
list := self listOfFileFilters value. |
374 |
||
590 | 375 |
Cursor wait showWhile: |
376 |
[ |
|
614 | 377 |
(DirectoryContents directoryNamed: directory) filesAndBasenamesDo: |
378 |
[:file :name| |
|
379 |
list do: |
|
590 | 380 |
[:filter| |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
381 |
((filter match: name) and: [(foundFiles includes: file) not]) |
590 | 382 |
ifTrue: |
383 |
[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
384 |
foundFiles add: file |
590 | 385 |
]. |
386 |
]. |
|
387 |
]. |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
388 |
self listOfFiles contents: (foundFiles collect: [:file| FileRow new fileName: file]) |
590 | 389 |
] |
614 | 390 |
|
590 | 391 |
! |
392 |
||
393 |
readMonitoringDirectory |
|
394 |
||
424 | 395 |
|readBlock| |
396 |
readTask notNil ifTrue: [readTask terminate]. |
|
397 |
readBlock := |
|
398 |
[ |
|
399 |
|dir currentFilenames oldListOfFiles| |
|
400 |
dir := directory asFilename. |
|
401 |
currentFilenames := OrderedCollection new. |
|
402 |
(dir isReadable and:[dir isExecutable]) ifTrue: |
|
403 |
[ |
|
404 |
self listOfFileFilters value do: |
|
405 |
[:filter| |
|
406 |
(dir filesMatchingWithoutDotDirs: filter) do: |
|
407 |
[:aFileName| |
|
408 |
|file| |
|
409 |
(file := dir construct: aFileName) isDirectory |
|
410 |
ifFalse: |
|
411 |
[ |
|
412 |
currentFilenames add: file |
|
413 |
] |
|
414 |
]. |
|
415 |
]. |
|
416 |
]. |
|
417 |
oldListOfFiles := self listOfFiles copy. |
|
418 |
(currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet do: |
|
419 |
[:fileName| |
|
420 |
(oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil |
|
421 |
ifTrue: |
|
422 |
[ |
|
423 |
|nearestFileRow r| |
|
424 |
nearestFileRow := self listOfFiles indexOf: (self listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil). |
|
425 |
nearestFileRow = 0 |
|
426 |
ifTrue: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename)] |
|
427 |
ifFalse: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename) beforeIndex: nearestFileRow]. |
|
428 |
monitoring ifTrue: [self selectionOfFile value: r]. |
|
429 |
] |
|
430 |
]. |
|
431 |
self listOfFiles reverseDo: |
|
432 |
[:fileRow| |
|
433 |
(currentFilenames includes: fileRow fileName) |
|
434 |
ifFalse: [self listOfFiles remove: fileRow] |
|
435 |
] |
|
436 |
]. |
|
437 |
||
438 |
monitoring |
|
439 |
ifTrue: |
|
440 |
[ |
|
441 |
readTask := readBlock forkAt: Processor userBackgroundPriority. |
|
442 |
Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1 |
|
443 |
] |
|
444 |
ifFalse: |
|
445 |
[ |
|
446 |
Cursor wait showWhile: [readBlock value] |
|
447 |
] |
|
448 |
! ! |
|
449 |
||
450 |
!DirectoryView methodsFor:'selection'! |
|
451 |
||
452 |
selectedFileFilter |
|
453 |
||
454 |
^selectedFileFilter |
|
455 |
||
456 |
! |
|
457 |
||
458 |
selectedFileFilter: aString |
|
459 |
||
460 |
aString size = 0 ifTrue: [self listOfFileFilters remove: selectedFileFilter ifAbsent: nil]. |
|
461 |
selectedFileFilter := aString. |
|
462 |
(self listOfFileFilters includes: selectedFileFilter) not & |
|
463 |
selectedFileFilter notEmpty |
|
464 |
ifTrue: |
|
465 |
[ |
|
466 |
self listOfFileFilters addFirst: selectedFileFilter |
|
467 |
]. |
|
468 |
(self listOfFileFilters includes: selectedFileFilter) & |
|
469 |
fileFilterSelectAction notNil |
|
470 |
ifTrue: |
|
471 |
[ |
|
472 |
fileFilterSelectAction numArgs = 0 |
|
473 |
ifTrue: |
|
474 |
[ |
|
475 |
fileFilterSelectAction value |
|
476 |
]. |
|
477 |
fileFilterSelectAction numArgs = 1 |
|
478 |
ifTrue: |
|
479 |
[ |
|
480 |
fileFilterSelectAction value: selectedFileFilter |
|
481 |
] |
|
482 |
]. |
|
483 |
self readDirectory. |
|
484 |
! ! |
|
485 |
||
486 |
!DirectoryView methodsFor:'startup / release'! |
|
487 |
||
488 |
closeRequest |
|
489 |
||
490 |
self release. |
|
491 |
||
492 |
super closeRequest |
|
493 |
||
494 |
! |
|
495 |
||
496 |
release |
|
497 |
||
498 |
monitoring ifTrue: |
|
499 |
[ |
|
500 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
501 |
monitoringTimeBlock := nil |
|
502 |
]. |
|
503 |
||
504 |
super release |
|
505 |
||
506 |
! ! |
|
507 |
||
508 |
!DirectoryView::FileRow class methodsFor:'resources'! |
|
509 |
||
510 |
HFileIcon |
|
511 |
||
512 |
^self hFileIcon |
|
513 |
! |
|
514 |
||
515 |
MakefileIcon |
|
590 | 516 |
"Generated by the Image Editor" |
517 |
" |
|
518 |
ImageEditor openOnClass:self andSelector:#MakefileIcon |
|
519 |
" |
|
424 | 520 |
|
521 |
<resource: #image> |
|
590 | 522 |
|
523 |
^Icon |
|
524 |
constantNamed:#'DirectoryView::FileRow MakefileIcon' |
|
525 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 @@0)IV0/U$0)]&0)UT;)UV4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 526 |
|
527 |
binaryFileIcon |
|
590 | 528 |
"Generated by the Image Editor" |
529 |
" |
|
530 |
ImageEditor openOnClass:self andSelector:#binaryFileIcon |
|
531 |
" |
|
424 | 532 |
|
533 |
<resource: #image> |
|
590 | 534 |
|
535 |
^Icon |
|
536 |
constantNamed:#'DirectoryView::FileRow binaryFileIcon' |
|
537 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???3 @_7 @W4#&S0&6Q0&6_3&6O5&6@0#&@9 @@0&\@2&6@0&6@0&6@1&6@8&\@0 @@0???0???1'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 538 |
|
539 |
cFileIcon |
|
590 | 540 |
"Generated by the Image Editor" |
541 |
" |
|
542 |
ImageEditor openOnClass:self andSelector:#cFileIcon |
|
543 |
" |
|
424 | 544 |
|
545 |
<resource: #image> |
|
590 | 546 |
|
547 |
^Icon |
|
548 |
constantNamed:#'DirectoryView::FileRow cFileIcon' |
|
549 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 \@0 "@0 @0 @0&"@;&\@4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 550 |
|
551 |
exeFileIcon |
|
590 | 552 |
"Generated by the Image Editor" |
553 |
" |
|
554 |
ImageEditor openOnClass:self andSelector:#exeFileIcon |
|
555 |
" |
|
424 | 556 |
|
557 |
<resource: #image> |
|
590 | 558 |
|
559 |
^Icon |
|
560 |
constantNamed:#'DirectoryView::FileRow exeFileIcon' |
|
561 |
ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU@@@@UUT@@@AEUP@@@DEU@@@@PETEUUUUUPZ**)UUAUUUUATG???4EP_???PUA???=ATG???4EP_???PUA???=ATEUUUTEP@@@@@U@@@@@AUUUUUUUUUUUUUTb'); colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color red:0.0 green:49.9977 blue:49.9977)); at:4 put:((Color grey:66.9978)); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 562 |
|
563 |
fileIcon |
|
590 | 564 |
"Generated by the Image Editor" |
565 |
" |
|
566 |
ImageEditor openOnClass:self andSelector:#fileIcon |
|
567 |
" |
|
424 | 568 |
|
569 |
<resource: #image> |
|
590 | 570 |
|
571 |
^Icon |
|
572 |
constantNamed:#'DirectoryView::FileRow fileIcon' |
|
644 | 573 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 @@0 @@0 @@0 @@0 @@; @@4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
424 | 574 |
|
575 |
hFileIcon |
|
590 | 576 |
"Generated by the Image Editor" |
577 |
" |
|
578 |
ImageEditor openOnClass:self andSelector:#hFileIcon |
|
579 |
" |
|
424 | 580 |
|
581 |
<resource: #image> |
|
590 | 582 |
|
583 |
^Icon |
|
584 |
constantNamed:#'DirectoryView::FileRow hFileIcon' |
|
585 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @0 @0 ,@0 2@0 "@0 "@0&"@;&"@4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 586 |
|
644 | 587 |
htmlFileIcon |
588 |
"Generated by the Image Editor" |
|
589 |
" |
|
590 |
ImageEditor openOnClass:self andSelector:#htmlFileIcon |
|
591 |
" |
|
424 | 592 |
|
593 |
<resource: #image> |
|
644 | 594 |
|
595 |
^Icon |
|
596 |
constantNamed:#'DirectoryView::FileRow htmlFileIcon' |
|
597 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQ????????DQDQD_???????1@QDQG???L3L3<P@QDQ??L3ADL3D@@QD_?3L0P3L1DQDQG?L3MCP3L1DQDQ?3QCQCMCP??1D_<4P4QDL4O?<QG?L4QDL3MD??DQ?3L3QCL3PO?1D_<3L4QDL4O?<QG?<3QDQCMO??DQ??L4QDP4S??1D_??=D@@S???<QG???????????DQ???????????1DQDQDQDQDQDQDQDQDQDQDQDQDQDP@a') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9977 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9977 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9977); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:49.9977 green:49.9977 blue:0.0); add:(Color red:49.9977 green:0.0 blue:49.9977); add:(Color grey:49.9977); add:(Color grey:66.9978); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
598 |
||
599 |
imageFileIcon |
|
600 |
"Generated by the Image Editor" |
|
601 |
" |
|
602 |
ImageEditor openOnClass:self andSelector:#imageFileIcon |
|
603 |
" |
|
604 |
||
605 |
<resource: #image> |
|
606 |
||
607 |
^Icon |
|
608 |
constantNamed:#'DirectoryView::FileRow imageFileIcon' |
|
609 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@DQDQDQDQ@@@@@ADQDQDQDPD@@@@QDQDQDQDAD@@@DQDQDQDQ@QD@@ADQDQDQDP@@@@@TQG]4)G50@@@@EDQ7^$+W4QDP@AQD]7R$_WDQD@@SL6Y#$61!!DQ@@D3M&ZS''F0QDP@AL3Y&NS[FDQD@@RH%UR %-QDQ@@D"IUVB"5,QDP@AH"UUJBV5DQD@@QDQDQDQDQDQ@@DQDQDQDQDQDP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9977 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9977 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9977); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:49.9977 green:49.9977 blue:0.0); add:(Color red:49.9977 green:0.0 blue:49.9977); add:(Color grey:49.9977); add:(Color grey:66.9978); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
424 | 610 |
|
611 |
imgFileIcon |
|
590 | 612 |
"Generated by the Image Editor" |
613 |
" |
|
614 |
ImageEditor openOnClass:self andSelector:#imgFileIcon |
|
615 |
" |
|
424 | 616 |
|
617 |
<resource: #image> |
|
590 | 618 |
|
619 |
^Icon |
|
620 |
constantNamed:#'DirectoryView::FileRow imgFileIcon' |
|
644 | 621 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @0 @@0!!-F0 **0 **0 **0&**;&*&4 @B0 @N0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself] |
622 |
! |
|
424 | 623 |
|
624 |
linkedFileIcon |
|
644 | 625 |
"Generated by the Image Editor" |
626 |
" |
|
627 |
ImageEditor openOnClass:self andSelector:#linkedFileIcon |
|
628 |
" |
|
424 | 629 |
|
630 |
<resource: #image> |
|
644 | 631 |
|
632 |
^Icon |
|
633 |
constantNamed:#'DirectoryView::FileRow linkedFileIcon' |
|
634 |
ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU@@@@UUT@@@AEUP@@@DEU@@@@PET@@@AUUP@@@AUU@@@@@AT@@@@ EP@@@B U@@@**!!T@@J**EP@B B UB*(@HATJ*@@@EP@@@@@U@@@@@AUUUUUUUUUUUUUTb') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
424 | 635 |
|
636 |
lockedFileIcon |
|
644 | 637 |
"Generated by the Image Editor" |
638 |
" |
|
639 |
ImageEditor openOnClass:self andSelector:#lockedFileIcon |
|
640 |
" |
|
424 | 641 |
|
642 |
<resource: #image> |
|
644 | 643 |
|
644 |
^Icon |
|
645 |
constantNamed:#'DirectoryView::FileRow lockedFileIcon' |
|
646 |
ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU(@@@UUT(@@AEUP(@@DEU@(@@PET@(@IUUP@(B!!UU@@((@AT@@*@@EP@B(@@U@@((@AT@J@(@EPB @(@U@(@@(ATJ@@@(ER @@@(U(@@@@)UUUUUUUUUUUUUTb') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
424 | 647 |
|
648 |
protoFileIcon |
|
649 |
||
650 |
^self MakefileIcon |
|
651 |
! |
|
652 |
||
653 |
rcFileIcon |
|
644 | 654 |
"Generated by the Image Editor" |
655 |
" |
|
656 |
ImageEditor openOnClass:self andSelector:#rcFileIcon |
|
657 |
" |
|
424 | 658 |
|
659 |
<resource: #image> |
|
644 | 660 |
|
661 |
^Icon |
|
662 |
constantNamed:#'DirectoryView::FileRow rcFileIcon' |
|
663 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 ) 0 2P0 "@0 "@0&"P;&!! 4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
424 | 664 |
|
665 |
sFileIcon |
|
644 | 666 |
"Generated by the Image Editor" |
667 |
" |
|
668 |
ImageEditor openOnClass:self andSelector:#sFileIcon |
|
669 |
" |
|
424 | 670 |
|
671 |
<resource: #image> |
|
644 | 672 |
|
673 |
^Icon |
|
674 |
constantNamed:#'DirectoryView::FileRow sFileIcon' |
|
675 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 X@0 @0 0@0 X@0&H@;&0@4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! |
|
424 | 676 |
|
677 |
stFileIcon |
|
590 | 678 |
"Generated by the Image Editor" |
679 |
" |
|
680 |
ImageEditor openOnClass:self andSelector:#stFileIcon |
|
681 |
" |
|
424 | 682 |
|
683 |
<resource: #image> |
|
590 | 684 |
|
685 |
^Icon |
|
686 |
constantNamed:#'DirectoryView::FileRow stFileIcon' |
|
687 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 A@0 A@0 [00 !!@0 1@0 Y@0&I@;&004 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]! |
|
424 | 688 |
|
689 |
stcFileIcon |
|
644 | 690 |
"Generated by the Image Editor" |
691 |
" |
|
692 |
ImageEditor openOnClass:self andSelector:#stcFileIcon |
|
693 |
" |
|
424 | 694 |
|
695 |
<resource: #image> |
|
644 | 696 |
|
697 |
^Icon |
|
698 |
constantNamed:#'DirectoryView::FileRow stcFileIcon' |
|
699 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 B@0 B@0 _L0 "R0 2P0 ZP0&JR;&3L4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]! ! |
|
424 | 700 |
|
701 |
!DirectoryView::FileRow methodsFor:'accessing'! |
|
702 |
||
703 |
baseName |
|
704 |
||
705 |
^baseName ? (baseName := fileName baseName) |
|
706 |
||
707 |
||
708 |
||
709 |
||
710 |
||
711 |
||
712 |
||
713 |
! |
|
714 |
||
715 |
fileName |
|
716 |
||
717 |
^fileName |
|
718 |
! |
|
719 |
||
720 |
fileName: aFileName |
|
721 |
||
614 | 722 |
fileName := aFileName |
424 | 723 |
! |
724 |
||
725 |
group |
|
726 |
||
727 |
^group |
|
728 |
! |
|
729 |
||
730 |
iconOn:aGC |
|
731 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
732 |
|icon| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
733 |
iconKey isNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
734 |
ifTrue: |
424 | 735 |
[ |
614 | 736 |
self validateAttributes. |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
737 |
(imageFromFile isNil and: [iconKey == #imageFileIcon]) |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
738 |
ifTrue: [icon := self retrieveImageFromFileAndRegisterOn: aGC] |
424 | 739 |
]. |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
740 |
imageFromFile == true |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
741 |
ifFalse: [icon := aGC registerImage: (self class perform: iconKey) key: iconKey] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
742 |
ifTrue: [icon := aGC registeredImageAt: iconKey]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
743 |
^icon |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
744 |
|
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
745 |
"Modified: / 18.2.1998 / 18:01:52 / cg" |
424 | 746 |
! |
747 |
||
748 |
modified |
|
749 |
||
750 |
^modified |
|
751 |
! |
|
752 |
||
753 |
owner |
|
754 |
||
755 |
^owner |
|
756 |
! |
|
757 |
||
758 |
permissions |
|
759 |
||
760 |
^permissions |
|
761 |
! |
|
762 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
763 |
retrieveImageFromFileAndRegisterOn: aGC |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
764 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
765 |
|image| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
766 |
imageFromFile := false. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
767 |
(image := aGC registeredImageAt: fileName name asSymbol) isNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
768 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
769 |
[ |
820 | 770 |
size < 500000 |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
771 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
772 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
773 |
Object errorSignal handle: [:ex|] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
774 |
do: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
775 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
776 |
(image := Image fromFile: fileName name) notNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
777 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
778 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
779 |
image extent y > 22 |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
780 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
781 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
782 |
image := image magnifiedBy: 22/image extent y |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
783 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
784 |
image := aGC registerImage: image key: fileName name asSymbol. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
785 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
786 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
787 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
788 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
789 |
image notNil ifTrue: [imageFromFile := true. iconKey := fileName name asSymbol]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
790 |
^image |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
791 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
792 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
793 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
794 |
! |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
795 |
|
424 | 796 |
size |
607 | 797 |
size isNumber ifFalse:[^ size]. |
798 |
size < 1000 ifTrue: [^ size printString]. |
|
799 |
size < (100*1024) ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb']. |
|
800 |
size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb']. |
|
801 |
^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb' |
|
424 | 802 |
|
607 | 803 |
"Modified: / 6.2.1998 / 03:38:45 / cg" |
424 | 804 |
! ! |
805 |
||
806 |
!DirectoryView::FileRow methodsFor:'private'! |
|
807 |
||
808 |
validateAttributes |
|
809 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
810 |
|info mode| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
811 |
|
424 | 812 |
permissions := String new:9 withAll:$-. |
813 |
||
814 |
(info := fileName info) isNil |
|
815 |
ifTrue: |
|
816 |
[ |
|
817 |
iconKey := #lockedFileIcon. |
|
818 |
size := owner := group := '?'. |
|
819 |
^ self |
|
820 |
]. |
|
821 |
size := info size. |
|
822 |
modified := info modified printString. |
|
823 |
owner := OperatingSystem getUserNameFromID: info uid. |
|
824 |
group := OperatingSystem getGroupNameFromID: info gid. |
|
825 |
mode := info mode. |
|
826 |
||
827 |
1 to:9 by:3 do:[:i| |
|
828 |
#((0 $x) (1 $w) (2 $r)) do: |
|
829 |
[:m| |
|
830 |
(mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
831 |
] |
|
832 |
]. |
|
833 |
||
834 |
fileName isReadable |
|
835 |
ifTrue: |
|
836 |
[ |
|
837 |
info type == #symbolicLink |
|
838 |
ifTrue: |
|
839 |
[ |
|
840 |
^iconKey := #linkedFileIcon |
|
841 |
] |
|
842 |
ifFalse: |
|
843 |
[ |
|
844 |
((DirectoryView::FileRow class implements: (iconKey := (fileName suffix, 'FileIcon') asSymbol)) |
|
845 |
or: |
|
846 |
[DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)]) |
|
847 |
ifFalse: |
|
848 |
[ |
|
849 |
iconKey := #fileIcon. |
|
850 |
(Image isImageFileSuffix:fileName suffix) |
|
851 |
ifTrue: |
|
852 |
[ |
|
853 |
^iconKey := #imageFileIcon |
|
854 |
]. |
|
855 |
(fileName suffix = 'o') | (fileName suffix = 'so') |
|
856 |
ifTrue: |
|
857 |
[ |
|
858 |
^iconKey := #binaryFileIcon |
|
859 |
]. |
|
860 |
||
861 |
fileName isExecutableProgram |
|
862 |
ifTrue: |
|
863 |
[ |
|
864 |
^iconKey := #exeFileIcon |
|
865 |
] |
|
866 |
] |
|
867 |
] |
|
868 |
] |
|
869 |
ifFalse: |
|
870 |
[ |
|
871 |
^iconKey := #lockedFileIcon |
|
872 |
]. |
|
873 |
||
874 |
||
875 |
! ! |
|
876 |
||
877 |
!DirectoryView class methodsFor:'documentation'! |
|
878 |
||
879 |
version |
|
880 |
^ '$Header$' |
|
881 |
! ! |