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