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