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