author | Claus Gittinger <cg@exept.de> |
Wed, 05 Sep 2012 11:22:38 +0200 | |
changeset 2917 | 086fcfdbd182 |
parent 2878 | 241be37ce37b |
child 2938 | 8e9207531826 |
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 |
||
2878 | 409 |
!DirectoryView methodsFor:'initialize-release'! |
410 |
||
411 |
release |
|
412 |
||
413 |
monitoring ifTrue: |
|
414 |
[ |
|
415 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
416 |
monitoringTimeBlock := nil |
|
417 |
]. |
|
418 |
||
419 |
super release |
|
420 |
||
421 |
! ! |
|
422 |
||
1346 | 423 |
!DirectoryView methodsFor:'menu actions'! |
424 |
||
425 |
updateFileList |
|
426 |
DirectoryContents flushCache. |
|
427 |
self readDirectory |
|
428 |
||
429 |
"Created: / 11.2.2000 / 00:12:46 / cg" |
|
430 |
"Modified: / 11.2.2000 / 00:14:32 / cg" |
|
431 |
! ! |
|
432 |
||
424 | 433 |
!DirectoryView methodsFor:'private'! |
434 |
||
435 |
readDirectory |
|
2439
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
436 |
|allDirectories allFiles foundFiles filterList dir newContents| |
828
12090f74be53
care for non-existing directory
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
437 |
|
2439
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
438 |
allFiles := OrderedCollection new. |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
439 |
allDirectories := OrderedCollection new. |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
440 |
foundFiles := OrderedCollection new. |
991
9454c462dad4
fixed file filter (must use selected filter; not all filters)
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
441 |
"/ filterList := self listOfFileFilters value. |
9454c462dad4
fixed file filter (must use selected filter; not all filters)
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
442 |
filterList := self selectedFileFilter asCollectionOfSubstringsSeparatedBy:$;. |
9454c462dad4
fixed file filter (must use selected filter; not all filters)
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
443 |
filterList := filterList collect:[:pattern | pattern withoutSeparators]. |
614 | 444 |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
445 |
self withCursor:Cursor read do:[ |
828
12090f74be53
care for non-existing directory
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
446 |
(dir := DirectoryContents directoryNamed: directory) notNil ifTrue:[ |
979 | 447 |
"/ dir filesAndBasenamesDo:[:file :name| |
448 |
"/ filterList do:[:filter| |
|
449 |
"/ ((filter match:name) and:[(foundFiles includes: name) not]) |
|
450 |
"/ ifTrue:[ |
|
451 |
"/ foundFiles add: name |
|
452 |
"/ ]. |
|
453 |
"/ ]. |
|
454 |
"/ ]. |
|
455 |
dir filesAndBasenamesDo:[:file :name| |
|
456 |
allFiles add: name |
|
590 | 457 |
]. |
2439
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
458 |
dir directoriesAndBasenamesDo:[:file :name| |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
459 |
allDirectories add: name |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
460 |
]. |
991
9454c462dad4
fixed file filter (must use selected filter; not all filters)
Claus Gittinger <cg@exept.de>
parents:
979
diff
changeset
|
461 |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
462 |
Filename isCaseSensitive ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
463 |
filterList do:[:filter| |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
464 |
|lcFilter| |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
465 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
466 |
lcFilter := filter asLowercase. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
467 |
foundFiles |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
468 |
addAll:(allFiles |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
469 |
select:[:name | lcFilter match:name asLowercase] |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
470 |
). |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
471 |
] |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
472 |
] ifTrue:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
473 |
filterList do:[:filter| |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
474 |
foundFiles |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
475 |
addAll:(allFiles |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
476 |
select:[:name | filter match:name] |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
477 |
). |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
478 |
] |
979 | 479 |
]. |
480 |
||
2439
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
481 |
foundFiles sort. |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
482 |
allDirectories sort. |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
483 |
|
979 | 484 |
dir := directory asFilename. |
2439
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
485 |
|
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
486 |
newContents := OrderedCollection new. |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
487 |
newContents addAll:(allDirectories collect:[:name| FileRow new fileName:(dir construct:name)]). |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
488 |
newContents addAll:(foundFiles collect:[:name| FileRow new fileName:(dir construct:name)]). |
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
489 |
|
9f6c2575f2b1
fixed entry callback and net-drive handling
Claus Gittinger <cg@exept.de>
parents:
2351
diff
changeset
|
490 |
self listOfFiles contents:newContents |
828
12090f74be53
care for non-existing directory
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
491 |
] |
590 | 492 |
] |
614 | 493 |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
494 |
"Modified: / 23.9.1998 / 17:00:42 / cg" |
590 | 495 |
! |
496 |
||
497 |
readMonitoringDirectory |
|
498 |
||
424 | 499 |
|readBlock| |
500 |
readTask notNil ifTrue: [readTask terminate]. |
|
501 |
readBlock := |
|
502 |
[ |
|
503 |
|dir currentFilenames oldListOfFiles| |
|
504 |
dir := directory asFilename. |
|
505 |
currentFilenames := OrderedCollection new. |
|
506 |
(dir isReadable and:[dir isExecutable]) ifTrue: |
|
507 |
[ |
|
508 |
self listOfFileFilters value do: |
|
509 |
[:filter| |
|
510 |
(dir filesMatchingWithoutDotDirs: filter) do: |
|
511 |
[:aFileName| |
|
512 |
|file| |
|
513 |
(file := dir construct: aFileName) isDirectory |
|
514 |
ifFalse: |
|
515 |
[ |
|
516 |
currentFilenames add: file |
|
517 |
] |
|
518 |
]. |
|
519 |
]. |
|
520 |
]. |
|
521 |
oldListOfFiles := self listOfFiles copy. |
|
522 |
(currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet do: |
|
523 |
[:fileName| |
|
524 |
(oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil |
|
525 |
ifTrue: |
|
526 |
[ |
|
527 |
|nearestFileRow r| |
|
528 |
nearestFileRow := self listOfFiles indexOf: (self listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil). |
|
529 |
nearestFileRow = 0 |
|
530 |
ifTrue: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename)] |
|
531 |
ifFalse: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename) beforeIndex: nearestFileRow]. |
|
532 |
monitoring ifTrue: [self selectionOfFile value: r]. |
|
533 |
] |
|
534 |
]. |
|
535 |
self listOfFiles reverseDo: |
|
536 |
[:fileRow| |
|
537 |
(currentFilenames includes: fileRow fileName) |
|
538 |
ifFalse: [self listOfFiles remove: fileRow] |
|
539 |
] |
|
540 |
]. |
|
541 |
||
542 |
monitoring |
|
543 |
ifTrue: |
|
544 |
[ |
|
545 |
readTask := readBlock forkAt: Processor userBackgroundPriority. |
|
546 |
Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1 |
|
547 |
] |
|
548 |
ifFalse: |
|
549 |
[ |
|
550 |
Cursor wait showWhile: [readBlock value] |
|
551 |
] |
|
552 |
! ! |
|
553 |
||
554 |
!DirectoryView methodsFor:'selection'! |
|
555 |
||
556 |
selectedFileFilter |
|
557 |
||
558 |
^selectedFileFilter |
|
559 |
||
560 |
! |
|
561 |
||
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
562 |
selectedFileFilter:aString |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
563 |
"change the file filter" |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
564 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
565 |
|listOfFileFilters nArgs| |
424 | 566 |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
567 |
aString = selectedFileFilter ifTrue:[^ self]. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
568 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
569 |
listOfFileFilters := self listOfFileFilters. |
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 |
"/ what is this for ? |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
572 |
aString size == 0 ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
573 |
listOfFileFilters remove: selectedFileFilter ifAbsent: nil |
424 | 574 |
]. |
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
575 |
selectedFileFilter := aString. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
576 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
577 |
((listOfFileFilters includes: selectedFileFilter) not |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
578 |
and:[selectedFileFilter notEmpty]) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
579 |
ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
580 |
listOfFileFilters addFirst: selectedFileFilter |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
581 |
]. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
582 |
((listOfFileFilters includes: selectedFileFilter) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
583 |
and:[fileFilterSelectAction notNil]) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
584 |
ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
585 |
(nArgs := fileFilterSelectAction numArgs) == 0 |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
586 |
ifTrue: [ |
424 | 587 |
fileFilterSelectAction value |
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
588 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
589 |
nArgs == 1 ifTrue:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
590 |
fileFilterSelectAction value: selectedFileFilter |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
591 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
592 |
self error:'bad numArgs of fileFilter action block' |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
593 |
] |
424 | 594 |
] |
595 |
]. |
|
596 |
self readDirectory. |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
597 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
598 |
"Modified: / 23.9.1998 / 16:53:05 / cg" |
424 | 599 |
! ! |
600 |
||
601 |
!DirectoryView methodsFor:'startup / release'! |
|
602 |
||
603 |
closeRequest |
|
604 |
||
605 |
self release. |
|
606 |
||
607 |
super closeRequest |
|
608 |
||
609 |
! ! |
|
610 |
||
611 |
!DirectoryView::FileRow class methodsFor:'resources'! |
|
612 |
||
613 |
HFileIcon |
|
614 |
||
615 |
^self hFileIcon |
|
616 |
! |
|
617 |
||
618 |
MakefileIcon |
|
590 | 619 |
"Generated by the Image Editor" |
620 |
" |
|
621 |
ImageEditor openOnClass:self andSelector:#MakefileIcon |
|
622 |
" |
|
424 | 623 |
|
624 |
<resource: #image> |
|
590 | 625 |
|
626 |
^Icon |
|
627 |
constantNamed:#'DirectoryView::FileRow MakefileIcon' |
|
1627 | 628 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 @@0)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] |
629 |
! |
|
424 | 630 |
|
631 |
binaryFileIcon |
|
590 | 632 |
"Generated by the Image Editor" |
633 |
" |
|
634 |
ImageEditor openOnClass:self andSelector:#binaryFileIcon |
|
635 |
" |
|
424 | 636 |
|
637 |
<resource: #image> |
|
590 | 638 |
|
639 |
^Icon |
|
640 |
constantNamed:#'DirectoryView::FileRow binaryFileIcon' |
|
1627 | 641 |
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] |
642 |
! |
|
424 | 643 |
|
644 |
cFileIcon |
|
590 | 645 |
"Generated by the Image Editor" |
646 |
" |
|
647 |
ImageEditor openOnClass:self andSelector:#cFileIcon |
|
648 |
" |
|
424 | 649 |
|
650 |
<resource: #image> |
|
590 | 651 |
|
652 |
^Icon |
|
653 |
constantNamed:#'DirectoryView::FileRow cFileIcon' |
|
1627 | 654 |
ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 \@0 "@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] |
655 |
! |
|
424 | 656 |
|
657 |
exeFileIcon |
|
590 | 658 |
"Generated by the Image Editor" |
659 |
" |
|
660 |
ImageEditor openOnClass:self andSelector:#exeFileIcon |
|
661 |
" |
|
424 | 662 |
|
663 |
<resource: #image> |
|
590 | 664 |
|
665 |
^Icon |
|
666 |
constantNamed:#'DirectoryView::FileRow exeFileIcon' |
|
1627 | 667 |
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] |
668 |
! |
|
424 | 669 |
|
670 |
fileIcon |
|
590 | 671 |
"Generated by the Image Editor" |
672 |
" |
|
673 |
ImageEditor openOnClass:self andSelector:#fileIcon |
|
674 |
" |
|
424 | 675 |
|
676 |
<resource: #image> |
|
590 | 677 |
|
678 |
^Icon |
|
679 |
constantNamed:#'DirectoryView::FileRow fileIcon' |
|
1627 | 680 |
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] |
681 |
! |
|
424 | 682 |
|
683 |
hFileIcon |
|
590 | 684 |
"Generated by the Image Editor" |
685 |
" |
|
686 |
ImageEditor openOnClass:self andSelector:#hFileIcon |
|
687 |
" |
|
424 | 688 |
|
689 |
<resource: #image> |
|
590 | 690 |
|
691 |
^Icon |
|
692 |
constantNamed:#'DirectoryView::FileRow hFileIcon' |
|
1627 | 693 |
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] |
694 |
! |
|
424 | 695 |
|
644 | 696 |
htmlFileIcon |
697 |
"Generated by the Image Editor" |
|
698 |
" |
|
699 |
ImageEditor openOnClass:self andSelector:#htmlFileIcon |
|
700 |
" |
|
424 | 701 |
|
702 |
<resource: #image> |
|
644 | 703 |
|
704 |
^Icon |
|
705 |
constantNamed:#'DirectoryView::FileRow htmlFileIcon' |
|
1627 | 706 |
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] |
707 |
! |
|
644 | 708 |
|
709 |
imageFileIcon |
|
710 |
"Generated by the Image Editor" |
|
711 |
" |
|
712 |
ImageEditor openOnClass:self andSelector:#imageFileIcon |
|
713 |
" |
|
714 |
||
715 |
<resource: #image> |
|
716 |
||
717 |
^Icon |
|
718 |
constantNamed:#'DirectoryView::FileRow imageFileIcon' |
|
1627 | 719 |
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] |
720 |
! |
|
424 | 721 |
|
722 |
imgFileIcon |
|
590 | 723 |
"Generated by the Image Editor" |
724 |
" |
|
725 |
ImageEditor openOnClass:self andSelector:#imgFileIcon |
|
726 |
" |
|
424 | 727 |
|
728 |
<resource: #image> |
|
590 | 729 |
|
730 |
^Icon |
|
731 |
constantNamed:#'DirectoryView::FileRow imgFileIcon' |
|
644 | 732 |
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] |
733 |
! |
|
424 | 734 |
|
735 |
linkedFileIcon |
|
644 | 736 |
"Generated by the Image Editor" |
737 |
" |
|
738 |
ImageEditor openOnClass:self andSelector:#linkedFileIcon |
|
739 |
" |
|
424 | 740 |
|
741 |
<resource: #image> |
|
644 | 742 |
|
743 |
^Icon |
|
744 |
constantNamed:#'DirectoryView::FileRow linkedFileIcon' |
|
1627 | 745 |
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] |
746 |
! |
|
424 | 747 |
|
748 |
lockedFileIcon |
|
644 | 749 |
"Generated by the Image Editor" |
750 |
" |
|
751 |
ImageEditor openOnClass:self andSelector:#lockedFileIcon |
|
752 |
" |
|
424 | 753 |
|
754 |
<resource: #image> |
|
644 | 755 |
|
756 |
^Icon |
|
757 |
constantNamed:#'DirectoryView::FileRow lockedFileIcon' |
|
1627 | 758 |
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] |
759 |
! |
|
424 | 760 |
|
761 |
protoFileIcon |
|
762 |
||
763 |
^self MakefileIcon |
|
764 |
! |
|
765 |
||
766 |
rcFileIcon |
|
644 | 767 |
"Generated by the Image Editor" |
768 |
" |
|
769 |
ImageEditor openOnClass:self andSelector:#rcFileIcon |
|
770 |
" |
|
424 | 771 |
|
772 |
<resource: #image> |
|
644 | 773 |
|
774 |
^Icon |
|
775 |
constantNamed:#'DirectoryView::FileRow rcFileIcon' |
|
1627 | 776 |
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] |
777 |
! |
|
424 | 778 |
|
779 |
sFileIcon |
|
644 | 780 |
"Generated by the Image Editor" |
781 |
" |
|
782 |
ImageEditor openOnClass:self andSelector:#sFileIcon |
|
783 |
" |
|
424 | 784 |
|
785 |
<resource: #image> |
|
644 | 786 |
|
787 |
^Icon |
|
788 |
constantNamed:#'DirectoryView::FileRow sFileIcon' |
|
1627 | 789 |
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] |
790 |
! |
|
424 | 791 |
|
792 |
stFileIcon |
|
590 | 793 |
"Generated by the Image Editor" |
794 |
" |
|
795 |
ImageEditor openOnClass:self andSelector:#stFileIcon |
|
796 |
" |
|
424 | 797 |
|
798 |
<resource: #image> |
|
590 | 799 |
|
800 |
^Icon |
|
801 |
constantNamed:#'DirectoryView::FileRow stFileIcon' |
|
1627 | 802 |
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] |
803 |
! |
|
424 | 804 |
|
805 |
stcFileIcon |
|
644 | 806 |
"Generated by the Image Editor" |
807 |
" |
|
808 |
ImageEditor openOnClass:self andSelector:#stcFileIcon |
|
809 |
" |
|
424 | 810 |
|
811 |
<resource: #image> |
|
644 | 812 |
|
813 |
^Icon |
|
814 |
constantNamed:#'DirectoryView::FileRow stcFileIcon' |
|
1627 | 815 |
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] |
816 |
! ! |
|
424 | 817 |
|
818 |
!DirectoryView::FileRow methodsFor:'accessing'! |
|
819 |
||
820 |
baseName |
|
821 |
||
822 |
^baseName ? (baseName := fileName baseName) |
|
823 |
||
824 |
||
825 |
||
826 |
||
827 |
||
828 |
||
829 |
||
830 |
! |
|
831 |
||
832 |
fileName |
|
833 |
||
834 |
^fileName |
|
835 |
! |
|
836 |
||
837 |
fileName: aFileName |
|
838 |
||
614 | 839 |
fileName := aFileName |
424 | 840 |
! |
841 |
||
842 |
group |
|
843 |
||
844 |
^group |
|
845 |
! |
|
846 |
||
847 |
iconOn:aGC |
|
848 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
849 |
|icon| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
850 |
iconKey isNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
851 |
ifTrue: |
424 | 852 |
[ |
614 | 853 |
self validateAttributes. |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
854 |
(imageFromFile isNil and: [iconKey == #imageFileIcon]) |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
855 |
ifTrue: [icon := self retrieveImageFromFileAndRegisterOn: aGC] |
424 | 856 |
]. |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
857 |
imageFromFile == true |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
858 |
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
|
859 |
ifTrue: [icon := aGC registeredImageAt: iconKey]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
860 |
^icon |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
861 |
|
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
862 |
"Modified: / 18.2.1998 / 18:01:52 / cg" |
424 | 863 |
! |
864 |
||
865 |
modified |
|
866 |
||
867 |
^modified |
|
868 |
! |
|
869 |
||
870 |
owner |
|
871 |
||
872 |
^owner |
|
873 |
! |
|
874 |
||
875 |
permissions |
|
876 |
||
877 |
^permissions |
|
878 |
! |
|
879 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
880 |
retrieveImageFromFileAndRegisterOn: aGC |
1385 | 881 |
"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
|
882 |
|
1385 | 883 |
|image maxImageFileSize| |
884 |
||
885 |
maxImageFileSize := MaxImageFileSize ? 20000. |
|
886 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
887 |
imageFromFile := false. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
888 |
(image := aGC registeredImageAt: fileName name asSymbol) isNil |
1385 | 889 |
ifTrue:[ |
890 |
size < maxImageFileSize ifTrue:[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
891 |
Object errorSignal handle: [:ex|] |
1385 | 892 |
do:[ |
893 |
(image := Image fromFile: fileName name) notNil ifTrue:[ |
|
894 |
image extent y > 22 ifTrue:[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
895 |
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
|
896 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
897 |
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
|
898 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
899 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
900 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
901 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
902 |
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
|
903 |
^image |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
904 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
905 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
906 |
|
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
907 |
! |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
908 |
|
424 | 909 |
size |
607 | 910 |
size isNumber ifFalse:[^ size]. |
911 |
size < 1000 ifTrue: [^ size printString]. |
|
912 |
size < (100*1024) ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb']. |
|
913 |
size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb']. |
|
914 |
^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb' |
|
424 | 915 |
|
607 | 916 |
"Modified: / 6.2.1998 / 03:38:45 / cg" |
424 | 917 |
! ! |
918 |
||
919 |
!DirectoryView::FileRow methodsFor:'private'! |
|
920 |
||
921 |
validateAttributes |
|
922 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
923 |
|info mode| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
924 |
|
424 | 925 |
permissions := String new:9 withAll:$-. |
926 |
||
927 |
(info := fileName info) isNil |
|
928 |
ifTrue: |
|
929 |
[ |
|
930 |
iconKey := #lockedFileIcon. |
|
931 |
size := owner := group := '?'. |
|
932 |
^ self |
|
933 |
]. |
|
934 |
size := info size. |
|
1627 | 935 |
modified := info modificationTime printString. |
424 | 936 |
owner := OperatingSystem getUserNameFromID: info uid. |
937 |
group := OperatingSystem getGroupNameFromID: info gid. |
|
938 |
mode := info mode. |
|
939 |
||
940 |
1 to:9 by:3 do:[:i| |
|
941 |
#((0 $x) (1 $w) (2 $r)) do: |
|
942 |
[:m| |
|
943 |
(mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
944 |
] |
|
945 |
]. |
|
946 |
||
947 |
fileName isReadable |
|
948 |
ifTrue: |
|
949 |
[ |
|
950 |
info type == #symbolicLink |
|
951 |
ifTrue: |
|
952 |
[ |
|
953 |
^iconKey := #linkedFileIcon |
|
954 |
] |
|
955 |
ifFalse: |
|
956 |
[ |
|
957 |
((DirectoryView::FileRow class implements: (iconKey := (fileName suffix, 'FileIcon') asSymbol)) |
|
958 |
or: |
|
959 |
[DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)]) |
|
960 |
ifFalse: |
|
961 |
[ |
|
962 |
iconKey := #fileIcon. |
|
963 |
(Image isImageFileSuffix:fileName suffix) |
|
964 |
ifTrue: |
|
965 |
[ |
|
966 |
^iconKey := #imageFileIcon |
|
967 |
]. |
|
968 |
(fileName suffix = 'o') | (fileName suffix = 'so') |
|
969 |
ifTrue: |
|
970 |
[ |
|
971 |
^iconKey := #binaryFileIcon |
|
972 |
]. |
|
973 |
||
974 |
fileName isExecutableProgram |
|
975 |
ifTrue: |
|
976 |
[ |
|
977 |
^iconKey := #exeFileIcon |
|
978 |
] |
|
979 |
] |
|
980 |
] |
|
981 |
] |
|
982 |
ifFalse: |
|
983 |
[ |
|
984 |
^iconKey := #lockedFileIcon |
|
985 |
]. |
|
986 |
! ! |
|
987 |
||
988 |
!DirectoryView class methodsFor:'documentation'! |
|
989 |
||
990 |
version |
|
991 |
^ '$Header$' |
|
992 |
! ! |