author | tz |
Sun, 15 Feb 1998 17:47:59 +0100 | |
changeset 638 | a82372d61cf8 |
parent 620 | 03e969ddd336 |
child 644 | 3a1a1cae7428 |
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 |
||
73 |
windowSpec |
|
74 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
75 |
||
76 |
"do not manually edit this - the painter/builder may not be able to |
|
77 |
handle the specification if its corrupted." |
|
78 |
||
79 |
" |
|
80 |
UIPainter new openOnClass:DirectoryView andSelector:#windowSpec |
|
81 |
DirectoryView new openInterface:#windowSpec |
|
82 |
" |
|
83 |
"DirectoryView open" |
|
84 |
||
85 |
<resource: #canvas> |
|
86 |
||
87 |
^ |
|
88 |
||
89 |
#(#FullSpec |
|
90 |
#'window:' |
|
91 |
#(#WindowSpec |
|
92 |
#'name:' 'Directory View' |
|
607 | 93 |
#'layout:' #(#LayoutFrame 64 0 703 0 463 0 1002 0) |
424 | 94 |
#'label:' 'Directory View' |
95 |
#'min:' #(#Point 10 10) |
|
96 |
#'max:' #(#Point 1152 900) |
|
607 | 97 |
#'bounds:' #(#Rectangle 64 703 464 1003) |
424 | 98 |
#'usePreferredExtent:' false |
99 |
) |
|
100 |
#'component:' |
|
101 |
#(#SpecCollection |
|
102 |
#'collection:' |
|
103 |
#( |
|
104 |
#(#DataSetSpec |
|
105 |
#'name:' 'filesDataSetView' |
|
607 | 106 |
#'layout:' #(#LayoutFrame 0 0.0 24 0.0 -2 1.0 0 1.0) |
424 | 107 |
#'model:' #selectionOfFile |
108 |
#'hasHorizontalScrollBar:' true |
|
109 |
#'hasVerticalScrollBar:' true |
|
110 |
#'miniScrollerHorizontal:' true |
|
111 |
#'dataList:' #listOfFiles |
|
112 |
#'useIndex:' false |
|
113 |
#'doubleClickSelector:' #fileDoubleClicked |
|
114 |
#'columnHolder:' #fileAttributeColumns |
|
115 |
#'valueChangeSelector:' #fileSelected |
|
116 |
#'verticalSpacing:' 1 |
|
117 |
) |
|
118 |
#(#ComboBoxSpec |
|
119 |
#'name:' 'formatComboBox' |
|
120 |
#'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 22 0) |
|
121 |
#'model:' #selectionOfFileFilter |
|
122 |
#'immediateAccept:' false |
|
123 |
#'acceptOnTab:' false |
|
124 |
#'comboList:' #listOfFileFilters |
|
125 |
) |
|
126 |
) |
|
127 |
) |
|
128 |
) |
|
607 | 129 |
|
130 |
"Modified: / 6.2.1998 / 03:42:15 / cg" |
|
424 | 131 |
! |
132 |
||
133 |
windowSpecOfFileAttributeColumns |
|
134 |
||
135 |
^ |
|
136 |
#( |
|
137 |
#(#DataSetColumnSpec |
|
138 |
#'label:' '' |
|
139 |
#'width:' 30 |
|
140 |
#'height:' 22 |
|
141 |
#'printSelector:' #'iconOn:' |
|
142 |
#'canSelect:' false |
|
143 |
) |
|
144 |
#(#DataSetColumnSpec |
|
145 |
#'label:' 'File name' |
|
590 | 146 |
#'labelAlignment:' #left |
607 | 147 |
#'minWidth:' 150 |
424 | 148 |
#'model:' #baseName |
149 |
#'canSelect:' false |
|
150 |
) |
|
151 |
#(#DataSetColumnSpec |
|
152 |
#'label:' 'Size' |
|
590 | 153 |
#'labelAlignment:' #left |
607 | 154 |
#'width:' 70 |
424 | 155 |
#'model:' #size |
156 |
#'canSelect:' false |
|
157 |
) |
|
158 |
#(#DataSetColumnSpec |
|
593 | 159 |
#'label:' 'Modified' |
590 | 160 |
#'labelAlignment:' #left |
424 | 161 |
#'model:' #modified |
162 |
#'canSelect:' false |
|
163 |
) |
|
164 |
#(#DataSetColumnSpec |
|
165 |
#'label:' 'Permissions' |
|
590 | 166 |
#'labelAlignment:' #left |
424 | 167 |
#'width:' 85 |
168 |
#'model:' #permissions |
|
169 |
#'canSelect:' false |
|
170 |
) |
|
171 |
#(#DataSetColumnSpec |
|
172 |
#'label:' 'Owner' |
|
590 | 173 |
#'labelAlignment:' #left |
424 | 174 |
#'width:' 50 |
175 |
#'model:' #owner |
|
176 |
#'canSelect:' false |
|
177 |
) |
|
178 |
#(#DataSetColumnSpec |
|
179 |
#'label:' 'Group' |
|
590 | 180 |
#'labelAlignment:' #left |
424 | 181 |
#'width:' 50 |
182 |
#'model:' #group |
|
183 |
#'canSelect:' false |
|
184 |
) |
|
185 |
) |
|
186 |
||
607 | 187 |
"Modified: / 6.2.1998 / 03:40:16 / cg" |
424 | 188 |
! ! |
189 |
||
190 |
!DirectoryView methodsFor:'accessing'! |
|
191 |
||
192 |
directory: aDirectory |
|
193 |
||
194 |
directory := aDirectory asFilename asAbsoluteFilename name |
|
195 |
! |
|
196 |
||
197 |
fileAttributes: anArray |
|
198 |
||
199 |
fileAttributes := anArray |
|
200 |
! |
|
201 |
||
202 |
fileDoubleClickAction: anActionBlock |
|
203 |
||
204 |
fileDoubleClickAction := anActionBlock |
|
205 |
! |
|
206 |
||
207 |
fileFilterSelectAction: anActionBlock |
|
208 |
||
209 |
fileFilterSelectAction := anActionBlock |
|
210 |
! |
|
211 |
||
212 |
fileSelectAction: anActionBlock |
|
213 |
||
214 |
fileSelectAction := anActionBlock |
|
215 |
! |
|
216 |
||
217 |
listOfFileFilters: aCollection |
|
218 |
||
219 |
self listOfFileFilters contents: aCollection. |
|
220 |
self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
|
221 |
! |
|
222 |
||
223 |
monitoring: aBoolean |
|
224 |
||
225 |
aBoolean |
|
226 |
ifTrue: |
|
227 |
[ |
|
228 |
monitoringTimeBlock := [self readDirectory]. |
|
229 |
self readDirectory. |
|
230 |
] |
|
231 |
ifFalse: |
|
232 |
[ |
|
233 |
monitoring ifTrue: |
|
234 |
[ |
|
235 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
236 |
monitoringTimeBlock := nil |
|
237 |
] |
|
238 |
]. |
|
239 |
||
240 |
monitoring := aBoolean. |
|
241 |
||
242 |
! ! |
|
243 |
||
244 |
!DirectoryView methodsFor:'aspects'! |
|
245 |
||
246 |
fileAttributeColumns |
|
247 |
||
248 |
|holder| |
|
249 |
(holder := builder bindingAt:#fileAttributeColumns) isNil ifTrue:[ |
|
250 |
|fileAttributeColumns| |
|
251 |
builder aspectAt:#fileAttributeColumns put:(holder := List new). |
|
252 |
fileAttributeColumns := self class windowSpecOfFileAttributeColumns collect: [:i| i decodeAsLiteralArray]. |
|
253 |
holder add: fileAttributeColumns first. |
|
254 |
fileAttributeColumns do: |
|
255 |
[:col| |
|
256 |
(fileAttributes includes: col label) ifTrue: [holder add: col] |
|
257 |
]. |
|
591 | 258 |
holder do: [:col| col label: ' ', col label] |
424 | 259 |
]. |
260 |
^ holder |
|
261 |
! |
|
262 |
||
263 |
listOfFileFilters |
|
264 |
||
265 |
|holder| |
|
266 |
(holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[ |
|
267 |
builder aspectAt:#listOfFileFilters put:(holder := List with: '*'). |
|
268 |
]. |
|
269 |
^ holder |
|
270 |
! |
|
271 |
||
272 |
listOfFiles |
|
273 |
||
274 |
|holder| |
|
275 |
(holder := builder bindingAt:#listOfFiles) isNil ifTrue:[ |
|
276 |
builder aspectAt:#listOfFiles put:(holder := List new). |
|
277 |
]. |
|
278 |
^ holder |
|
279 |
! |
|
280 |
||
281 |
selectionOfFile |
|
282 |
||
283 |
|holder| |
|
284 |
(holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[ |
|
285 |
builder aspectAt:#selectionOfFile put:(holder := ValueHolder new). |
|
286 |
]. |
|
287 |
^ holder |
|
288 |
||
289 |
! |
|
290 |
||
291 |
selectionOfFileFilter |
|
292 |
||
293 |
|holder| |
|
294 |
(holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[ |
|
295 |
builder aspectAt:#selectionOfFileFilter put: |
|
296 |
(holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter). |
|
297 |
selectedFileFilter := '*'. |
|
298 |
]. |
|
299 |
^ holder |
|
300 |
! ! |
|
301 |
||
302 |
!DirectoryView methodsFor:'callbacks'! |
|
303 |
||
304 |
fileDoubleClicked |
|
305 |
||
473 | 306 |
(fileDoubleClickAction notNil and: [self selectionOfFile value notNil]) |
424 | 307 |
ifTrue: |
308 |
[ |
|
309 |
fileDoubleClickAction numArgs = 0 |
|
310 |
ifTrue: |
|
311 |
[ |
|
312 |
fileDoubleClickAction value |
|
313 |
]. |
|
314 |
fileDoubleClickAction numArgs = 1 |
|
315 |
ifTrue: |
|
451 | 316 |
[ |
317 |
fileDoubleClickAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
|
424 | 318 |
] |
319 |
] |
|
320 |
! |
|
321 |
||
322 |
fileSelected |
|
323 |
||
473 | 324 |
(fileSelectAction notNil and: [self selectionOfFile value notNil]) |
424 | 325 |
ifTrue: |
326 |
[ |
|
327 |
fileSelectAction numArgs = 0 |
|
328 |
ifTrue: |
|
329 |
[ |
|
330 |
fileSelectAction value |
|
331 |
]. |
|
332 |
fileSelectAction numArgs = 1 |
|
333 |
ifTrue: |
|
334 |
[ |
|
451 | 335 |
fileSelectAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
424 | 336 |
] |
337 |
] |
|
338 |
! ! |
|
339 |
||
340 |
!DirectoryView methodsFor:'initialization'! |
|
341 |
||
342 |
initialize |
|
343 |
||
344 |
super initialize. |
|
345 |
||
346 |
directory := directory ? '.' asFilename asAbsoluteFilename directoryName. |
|
347 |
monitoring := false. |
|
593 | 348 |
fileAttributes := #('File name' 'Size' 'Modified'). |
424 | 349 |
self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
350 |
||
351 |
! ! |
|
352 |
||
353 |
!DirectoryView methodsFor:'private'! |
|
354 |
||
355 |
readDirectory |
|
356 |
||
614 | 357 |
|foundFiles list| |
590 | 358 |
foundFiles := OrderedCollection new. |
614 | 359 |
list := self listOfFileFilters value. |
360 |
||
590 | 361 |
Cursor wait showWhile: |
362 |
[ |
|
614 | 363 |
(DirectoryContents directoryNamed: directory) filesAndBasenamesDo: |
364 |
[:file :name| |
|
365 |
list do: |
|
590 | 366 |
[:filter| |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
367 |
((filter match: name) and: [(foundFiles includes: file) not]) |
590 | 368 |
ifTrue: |
369 |
[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
370 |
foundFiles add: file |
590 | 371 |
]. |
372 |
]. |
|
373 |
]. |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
374 |
self listOfFiles contents: (foundFiles collect: [:file| FileRow new fileName: file]) |
590 | 375 |
] |
614 | 376 |
|
590 | 377 |
! |
378 |
||
379 |
readMonitoringDirectory |
|
380 |
||
424 | 381 |
|readBlock| |
382 |
readTask notNil ifTrue: [readTask terminate]. |
|
383 |
readBlock := |
|
384 |
[ |
|
385 |
|dir currentFilenames oldListOfFiles| |
|
386 |
dir := directory asFilename. |
|
387 |
currentFilenames := OrderedCollection new. |
|
388 |
(dir isReadable and:[dir isExecutable]) ifTrue: |
|
389 |
[ |
|
390 |
self listOfFileFilters value do: |
|
391 |
[:filter| |
|
392 |
(dir filesMatchingWithoutDotDirs: filter) do: |
|
393 |
[:aFileName| |
|
394 |
|file| |
|
395 |
(file := dir construct: aFileName) isDirectory |
|
396 |
ifFalse: |
|
397 |
[ |
|
398 |
currentFilenames add: file |
|
399 |
] |
|
400 |
]. |
|
401 |
]. |
|
402 |
]. |
|
403 |
oldListOfFiles := self listOfFiles copy. |
|
404 |
(currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet do: |
|
405 |
[:fileName| |
|
406 |
(oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil |
|
407 |
ifTrue: |
|
408 |
[ |
|
409 |
|nearestFileRow r| |
|
410 |
nearestFileRow := self listOfFiles indexOf: (self listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil). |
|
411 |
nearestFileRow = 0 |
|
412 |
ifTrue: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename)] |
|
413 |
ifFalse: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename) beforeIndex: nearestFileRow]. |
|
414 |
monitoring ifTrue: [self selectionOfFile value: r]. |
|
415 |
] |
|
416 |
]. |
|
417 |
self listOfFiles reverseDo: |
|
418 |
[:fileRow| |
|
419 |
(currentFilenames includes: fileRow fileName) |
|
420 |
ifFalse: [self listOfFiles remove: fileRow] |
|
421 |
] |
|
422 |
]. |
|
423 |
||
424 |
monitoring |
|
425 |
ifTrue: |
|
426 |
[ |
|
427 |
readTask := readBlock forkAt: Processor userBackgroundPriority. |
|
428 |
Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1 |
|
429 |
] |
|
430 |
ifFalse: |
|
431 |
[ |
|
432 |
Cursor wait showWhile: [readBlock value] |
|
433 |
] |
|
434 |
! ! |
|
435 |
||
436 |
!DirectoryView methodsFor:'selection'! |
|
437 |
||
438 |
selectedFileFilter |
|
439 |
||
440 |
^selectedFileFilter |
|
441 |
||
442 |
! |
|
443 |
||
444 |
selectedFileFilter: aString |
|
445 |
||
446 |
aString size = 0 ifTrue: [self listOfFileFilters remove: selectedFileFilter ifAbsent: nil]. |
|
447 |
selectedFileFilter := aString. |
|
448 |
(self listOfFileFilters includes: selectedFileFilter) not & |
|
449 |
selectedFileFilter notEmpty |
|
450 |
ifTrue: |
|
451 |
[ |
|
452 |
self listOfFileFilters addFirst: selectedFileFilter |
|
453 |
]. |
|
454 |
(self listOfFileFilters includes: selectedFileFilter) & |
|
455 |
fileFilterSelectAction notNil |
|
456 |
ifTrue: |
|
457 |
[ |
|
458 |
fileFilterSelectAction numArgs = 0 |
|
459 |
ifTrue: |
|
460 |
[ |
|
461 |
fileFilterSelectAction value |
|
462 |
]. |
|
463 |
fileFilterSelectAction numArgs = 1 |
|
464 |
ifTrue: |
|
465 |
[ |
|
466 |
fileFilterSelectAction value: selectedFileFilter |
|
467 |
] |
|
468 |
]. |
|
469 |
self readDirectory. |
|
470 |
! ! |
|
471 |
||
472 |
!DirectoryView methodsFor:'startup / release'! |
|
473 |
||
474 |
closeRequest |
|
475 |
||
476 |
self release. |
|
477 |
||
478 |
super closeRequest |
|
479 |
||
480 |
! |
|
481 |
||
482 |
release |
|
483 |
||
484 |
monitoring ifTrue: |
|
485 |
[ |
|
486 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
487 |
monitoringTimeBlock := nil |
|
488 |
]. |
|
489 |
||
490 |
super release |
|
491 |
||
492 |
! ! |
|
493 |
||
494 |
!DirectoryView::FileRow class methodsFor:'resources'! |
|
495 |
||
496 |
HFileIcon |
|
497 |
||
498 |
^self hFileIcon |
|
499 |
! |
|
500 |
||
501 |
MakefileIcon |
|
590 | 502 |
"Generated by the Image Editor" |
503 |
" |
|
504 |
ImageEditor openOnClass:self andSelector:#MakefileIcon |
|
505 |
" |
|
424 | 506 |
|
507 |
<resource: #image> |
|
590 | 508 |
|
509 |
^Icon |
|
510 |
constantNamed:#'DirectoryView::FileRow MakefileIcon' |
|
511 |
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 | 512 |
|
513 |
binaryFileIcon |
|
590 | 514 |
"Generated by the Image Editor" |
515 |
" |
|
516 |
ImageEditor openOnClass:self andSelector:#binaryFileIcon |
|
517 |
" |
|
424 | 518 |
|
519 |
<resource: #image> |
|
590 | 520 |
|
521 |
^Icon |
|
522 |
constantNamed:#'DirectoryView::FileRow binaryFileIcon' |
|
523 |
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 | 524 |
|
525 |
cFileIcon |
|
590 | 526 |
"Generated by the Image Editor" |
527 |
" |
|
528 |
ImageEditor openOnClass:self andSelector:#cFileIcon |
|
529 |
" |
|
424 | 530 |
|
531 |
<resource: #image> |
|
590 | 532 |
|
533 |
^Icon |
|
534 |
constantNamed:#'DirectoryView::FileRow cFileIcon' |
|
535 |
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 | 536 |
|
537 |
exeFileIcon |
|
590 | 538 |
"Generated by the Image Editor" |
539 |
" |
|
540 |
ImageEditor openOnClass:self andSelector:#exeFileIcon |
|
541 |
" |
|
424 | 542 |
|
543 |
<resource: #image> |
|
590 | 544 |
|
545 |
^Icon |
|
546 |
constantNamed:#'DirectoryView::FileRow exeFileIcon' |
|
547 |
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 | 548 |
|
549 |
fileIcon |
|
590 | 550 |
"Generated by the Image Editor" |
551 |
" |
|
552 |
ImageEditor openOnClass:self andSelector:#fileIcon |
|
553 |
" |
|
424 | 554 |
|
555 |
<resource: #image> |
|
590 | 556 |
|
557 |
^Icon |
|
558 |
constantNamed:#'DirectoryView::FileRow fileIcon' |
|
559 |
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 | 560 |
|
561 |
hFileIcon |
|
590 | 562 |
"Generated by the Image Editor" |
563 |
" |
|
564 |
ImageEditor openOnClass:self andSelector:#hFileIcon |
|
565 |
" |
|
424 | 566 |
|
567 |
<resource: #image> |
|
590 | 568 |
|
569 |
^Icon |
|
570 |
constantNamed:#'DirectoryView::FileRow hFileIcon' |
|
571 |
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 | 572 |
|
573 |
imageFileIcon |
|
574 |
"ImageEditor openOnClass:self andSelector:#imageFileIcon" |
|
575 |
||
576 |
<resource: #image> |
|
577 |
^(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 1 17 17 17 17 17 16 0 0 0 1 17 17 17 17 17 16 16 0 0 1 17 17 17 17 17 16 17 0 0 1 17 17 17 17 17 16 17 16 0 1 17 17 17 17 17 16 0 0 0 1 68 71 119 74 71 215 0 0 0 1 68 71 119 164 173 125 17 17 0 1 68 71 119 74 71 215 17 17 0 1 51 54 102 57 54 198 17 17 0 1 51 54 102 147 156 108 17 17 0 1 51 54 102 57 54 198 17 17 0 1 34 37 85 40 37 181 17 17 0 1 34 37 85 130 139 91 17 17 0 1 34 37 85 40 37 181 17 17 0 1 17 17 17 17 17 17 17 17 0 1 17 17 17 17 17 17 17 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; 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.9992 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9992 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9992); add:(Color red:0.0 green:49.9992 blue:49.9992); add:(Color red:49.9992 green:49.9992 blue:0.0); add:(Color red:49.9992 green:0.0 blue:49.9992); add:(Color grey:49.9992); add:(Color grey:66.9993); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
578 |
||
579 |
imgFileIcon |
|
590 | 580 |
"Generated by the Image Editor" |
581 |
" |
|
582 |
ImageEditor openOnClass:self andSelector:#imgFileIcon |
|
583 |
" |
|
424 | 584 |
|
585 |
<resource: #image> |
|
590 | 586 |
|
587 |
^Icon |
|
588 |
constantNamed:#'DirectoryView::FileRow imgFileIcon' |
|
589 |
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]! |
|
424 | 590 |
|
591 |
linkedFileIcon |
|
592 |
"ImageEditor openOnClass:self andSelector:#linkedFileIcon" |
|
593 |
||
594 |
<resource: #image> |
|
595 |
^(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 64 0 0 21 85 64 0 0 17 85 64 0 0 16 85 64 0 0 16 21 64 0 0 21 85 64 0 0 5 85 64 0 0 0 5 64 0 0 8 5 64 0 0 10 5 64 0 10 170 133 64 0 42 170 133 64 0 160 10 5 66 170 128 8 5 66 170 0 0 5 64 0 0 0 5 64 0 0 0 5 85 85 85 85 85 85 85 85 85 85]) ; 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:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
596 |
||
597 |
lockedFileIcon |
|
598 |
"ImageEditor openOnClass:self andSelector:#lockedFileIcon" |
|
599 |
||
600 |
<resource: #image> |
|
601 |
^(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 104 0 0 21 85 74 0 0 17 85 66 128 0 16 85 64 160 0 16 21 64 40 0 149 85 64 10 2 133 85 64 2 138 0 5 64 0 168 0 5 64 0 168 0 5 64 2 138 0 5 64 10 2 128 5 64 40 0 160 5 64 160 0 40 5 66 128 0 10 5 74 0 0 2 133 104 0 0 0 165 85 85 85 85 85 85 85 85 85 85]) ; 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:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
602 |
||
603 |
protoFileIcon |
|
604 |
||
605 |
^self MakefileIcon |
|
606 |
! |
|
607 |
||
608 |
rcFileIcon |
|
609 |
"ImageEditor openOnClass:self andSelector:#rcFileIcon" |
|
610 |
||
611 |
<resource: #image> |
|
612 |
^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 130 152 48 131 36 48 130 32 48 130 32 48 154 36 59 154 24 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
613 |
||
614 |
sFileIcon |
|
615 |
"ImageEditor openOnClass:self andSelector:#sFileIcon" |
|
616 |
||
617 |
<resource: #image> |
|
618 |
^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 129 128 48 130 0 48 131 0 48 129 128 48 152 128 59 155 0 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
619 |
||
620 |
stFileIcon |
|
590 | 621 |
"Generated by the Image Editor" |
622 |
" |
|
623 |
ImageEditor openOnClass:self andSelector:#stFileIcon |
|
624 |
" |
|
424 | 625 |
|
626 |
<resource: #image> |
|
590 | 627 |
|
628 |
^Icon |
|
629 |
constantNamed:#'DirectoryView::FileRow stFileIcon' |
|
630 |
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 | 631 |
|
632 |
stcFileIcon |
|
633 |
"ImageEditor openOnClass:self andSelector:#stcFileIcon" |
|
634 |
||
635 |
<resource: #image> |
|
636 |
^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 32 48 128 32 48 129 243 48 130 36 176 131 36 48 129 164 48 152 164 187 155 51 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! ! |
|
637 |
||
638 |
!DirectoryView::FileRow methodsFor:'accessing'! |
|
639 |
||
640 |
baseName |
|
641 |
||
642 |
^baseName ? (baseName := fileName baseName) |
|
643 |
||
644 |
||
645 |
||
646 |
||
647 |
||
648 |
||
649 |
||
650 |
! |
|
651 |
||
652 |
fileName |
|
653 |
||
654 |
^fileName |
|
655 |
! |
|
656 |
||
657 |
fileName: aFileName |
|
658 |
||
614 | 659 |
fileName := aFileName |
424 | 660 |
! |
661 |
||
662 |
group |
|
663 |
||
664 |
^group |
|
665 |
! |
|
666 |
||
667 |
iconOn:aGC |
|
668 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
669 |
|icon| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
670 |
iconKey isNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
671 |
ifTrue: |
424 | 672 |
[ |
614 | 673 |
self validateAttributes. |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
674 |
(imageFromFile isNil and: [iconKey == #imageFileIcon]) |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
675 |
ifTrue: [icon := self retrieveImageFromFileAndRegisterOn: aGC] |
424 | 676 |
]. |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
677 |
imageFromFile |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
678 |
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
|
679 |
ifTrue: [icon := aGC registeredImageAt: iconKey]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
680 |
^icon |
424 | 681 |
! |
682 |
||
683 |
modified |
|
684 |
||
685 |
^modified |
|
686 |
! |
|
687 |
||
688 |
owner |
|
689 |
||
690 |
^owner |
|
691 |
! |
|
692 |
||
693 |
permissions |
|
694 |
||
695 |
^permissions |
|
696 |
! |
|
697 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
698 |
retrieveImageFromFileAndRegisterOn: aGC |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
699 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
700 |
|image| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
701 |
imageFromFile := false. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
702 |
(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
|
703 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
704 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
705 |
size < 5000 |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
706 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
707 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
708 |
Object errorSignal handle: [:ex|] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
709 |
do: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
710 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
711 |
(image := Image fromFile: fileName name) notNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
712 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
713 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
714 |
image extent y > 22 |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
715 |
ifTrue: |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
716 |
[ |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
717 |
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
|
718 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
719 |
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
|
720 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
721 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
722 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
723 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
724 |
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
|
725 |
^image |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
726 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
727 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
728 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
729 |
! |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
730 |
|
424 | 731 |
size |
607 | 732 |
size isNumber ifFalse:[^ size]. |
733 |
size < 1000 ifTrue: [^ size printString]. |
|
734 |
size < (100*1024) ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb']. |
|
735 |
size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb']. |
|
736 |
^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb' |
|
424 | 737 |
|
607 | 738 |
"Modified: / 6.2.1998 / 03:38:45 / cg" |
424 | 739 |
! ! |
740 |
||
741 |
!DirectoryView::FileRow methodsFor:'private'! |
|
742 |
||
743 |
validateAttributes |
|
744 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
745 |
|info mode| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
746 |
|
424 | 747 |
permissions := String new:9 withAll:$-. |
748 |
||
749 |
(info := fileName info) isNil |
|
750 |
ifTrue: |
|
751 |
[ |
|
752 |
iconKey := #lockedFileIcon. |
|
753 |
size := owner := group := '?'. |
|
754 |
^ self |
|
755 |
]. |
|
756 |
size := info size. |
|
757 |
modified := info modified printString. |
|
758 |
owner := OperatingSystem getUserNameFromID: info uid. |
|
759 |
group := OperatingSystem getGroupNameFromID: info gid. |
|
760 |
mode := info mode. |
|
761 |
||
762 |
1 to:9 by:3 do:[:i| |
|
763 |
#((0 $x) (1 $w) (2 $r)) do: |
|
764 |
[:m| |
|
765 |
(mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
766 |
] |
|
767 |
]. |
|
768 |
||
769 |
fileName isReadable |
|
770 |
ifTrue: |
|
771 |
[ |
|
772 |
info type == #symbolicLink |
|
773 |
ifTrue: |
|
774 |
[ |
|
775 |
^iconKey := #linkedFileIcon |
|
776 |
] |
|
777 |
ifFalse: |
|
778 |
[ |
|
779 |
((DirectoryView::FileRow class implements: (iconKey := (fileName suffix, 'FileIcon') asSymbol)) |
|
780 |
or: |
|
781 |
[DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)]) |
|
782 |
ifFalse: |
|
783 |
[ |
|
784 |
iconKey := #fileIcon. |
|
785 |
(Image isImageFileSuffix:fileName suffix) |
|
786 |
ifTrue: |
|
787 |
[ |
|
788 |
^iconKey := #imageFileIcon |
|
789 |
]. |
|
790 |
(fileName suffix = 'o') | (fileName suffix = 'so') |
|
791 |
ifTrue: |
|
792 |
[ |
|
793 |
^iconKey := #binaryFileIcon |
|
794 |
]. |
|
795 |
||
796 |
fileName isExecutableProgram |
|
797 |
ifTrue: |
|
798 |
[ |
|
799 |
^iconKey := #exeFileIcon |
|
800 |
] |
|
801 |
] |
|
802 |
] |
|
803 |
] |
|
804 |
ifFalse: |
|
805 |
[ |
|
806 |
^iconKey := #lockedFileIcon |
|
807 |
]. |
|
808 |
||
809 |
||
810 |
! ! |
|
811 |
||
812 |
!DirectoryView class methodsFor:'documentation'! |
|
813 |
||
814 |
version |
|
815 |
^ '$Header$' |
|
816 |
! ! |