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