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