author | mawalch |
Wed, 03 Aug 2016 14:32:31 +0200 | |
changeset 3316 | db4749aa5c60 |
parent 3303 | d3836d28d2c0 |
child 3354 | 05ab9a73a9a6 |
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... |
|
3316 | 55 |
...but the disadvantage 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 |
|
3303 | 500 |
"this is a very ugly piece of code - |
501 |
left in as a bad example of how to make ST look slow... |
|
502 |
DO NOT USE IT, but read to learn" |
|
503 |
||
3018 | 504 |
|readBlock| |
590 | 505 |
|
424 | 506 |
readTask notNil ifTrue: [readTask terminate]. |
507 |
readBlock := |
|
508 |
[ |
|
3299 | 509 |
|dir currentFilenames oldListOfFiles listOfFiles| |
3018 | 510 |
|
511 |
dir := directory asFilename. |
|
512 |
currentFilenames := OrderedCollection new. |
|
513 |
(dir isReadable and:[dir isExecutable]) ifTrue: [ |
|
514 |
self listOfFileFilters value do: |
|
515 |
[:filter| |
|
516 |
(dir filesMatchingWithoutDotDirs: filter) do: [:aFileName| |
|
517 |
|file| |
|
518 |
(file := dir construct: aFileName) isDirectory ifFalse: [ |
|
519 |
currentFilenames add: file |
|
520 |
] |
|
521 |
]. |
|
424 | 522 |
]. |
523 |
]. |
|
3299 | 524 |
listOfFiles := self listOfFiles. |
525 |
||
526 |
oldListOfFiles := listOfFiles copy. |
|
3018 | 527 |
(currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet |
528 |
do: [:fileName| |
|
529 |
(oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil |
|
530 |
ifTrue: [ |
|
3299 | 531 |
|nearestFileRow newRow r| |
532 |
||
533 |
newRow := FileRow new fileName: fileName asFilename. |
|
534 |
"/ cg: how stupid is that? |
|
3303 | 535 |
nearestFileRow := listOfFiles indexOf: (listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil). |
536 |
"/ nearestFileRow := listOfFiles findFirst:[:fileRow | fileRow baseName > fileName baseName]. |
|
3018 | 537 |
nearestFileRow = 0 |
3299 | 538 |
ifTrue: [listOfFiles add: newRow] |
539 |
ifFalse: [listOfFiles add: newRow beforeIndex: nearestFileRow]. |
|
3018 | 540 |
monitoring ifTrue: [self selectionOfFile value: r]. |
541 |
] |
|
542 |
]. |
|
3299 | 543 |
|
544 |
listOfFiles |
|
3018 | 545 |
reverseDo: [:fileRow| |
546 |
(currentFilenames includes: fileRow fileName) |
|
3299 | 547 |
ifFalse: [listOfFiles remove: fileRow] |
3018 | 548 |
] |
424 | 549 |
]. |
550 |
||
3018 | 551 |
monitoring ifTrue: [ |
424 | 552 |
readTask := readBlock forkAt: Processor userBackgroundPriority. |
553 |
Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1 |
|
3018 | 554 |
] ifFalse: [ |
424 | 555 |
Cursor wait showWhile: [readBlock value] |
556 |
] |
|
557 |
! ! |
|
558 |
||
559 |
!DirectoryView methodsFor:'selection'! |
|
560 |
||
561 |
selectedFileFilter |
|
562 |
||
563 |
^selectedFileFilter |
|
564 |
||
565 |
! |
|
566 |
||
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
567 |
selectedFileFilter:aString |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
568 |
"change the file filter" |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
569 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
570 |
|listOfFileFilters nArgs| |
424 | 571 |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
572 |
aString = selectedFileFilter ifTrue:[^ self]. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
573 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
574 |
listOfFileFilters := self listOfFileFilters. |
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 |
"/ what is this for ? |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
577 |
aString size == 0 ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
578 |
listOfFileFilters remove: selectedFileFilter ifAbsent: nil |
424 | 579 |
]. |
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
580 |
selectedFileFilter := aString. |
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) not |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
583 |
and:[selectedFileFilter notEmpty]) |
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 |
listOfFileFilters addFirst: selectedFileFilter |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
586 |
]. |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
587 |
((listOfFileFilters includes: selectedFileFilter) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
588 |
and:[fileFilterSelectAction notNil]) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
589 |
ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
590 |
(nArgs := fileFilterSelectAction numArgs) == 0 |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
591 |
ifTrue: [ |
424 | 592 |
fileFilterSelectAction value |
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
593 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
594 |
nArgs == 1 ifTrue:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
595 |
fileFilterSelectAction value: selectedFileFilter |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
596 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
597 |
self error:'bad numArgs of fileFilter action block' |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
598 |
] |
424 | 599 |
] |
600 |
]. |
|
601 |
self readDirectory. |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
602 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
603 |
"Modified: / 23.9.1998 / 16:53:05 / cg" |
424 | 604 |
! ! |
605 |
||
3035 | 606 |
!DirectoryView methodsFor:'startup & release'! |
424 | 607 |
|
608 |
closeRequest |
|
609 |
||
610 |
self release. |
|
611 |
||
612 |
super closeRequest |
|
613 |
||
614 |
! ! |
|
615 |
||
616 |
!DirectoryView::FileRow class methodsFor:'resources'! |
|
617 |
||
618 |
HFileIcon |
|
619 |
||
620 |
^self hFileIcon |
|
621 |
! |
|
622 |
||
623 |
MakefileIcon |
|
3298 | 624 |
"This resource specification was automatically generated |
625 |
by the ImageEditor of ST/X." |
|
626 |
||
627 |
"Do not manually edit this!! If it is corrupted, |
|
628 |
the ImageEditor may not be able to read the specification." |
|
629 |
||
590 | 630 |
" |
3298 | 631 |
self MakefileIcon inspect |
632 |
ImageEditor openOnClass:self andSelector:#MakefileIcon |
|
633 |
Icon flushCachedIcons |
|
590 | 634 |
" |
424 | 635 |
|
636 |
<resource: #image> |
|
590 | 637 |
|
638 |
^Icon |
|
3298 | 639 |
constantNamed:'DirectoryView::FileRow MakefileIcon' |
640 |
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') |
|
641 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
642 |
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 | 643 |
! |
424 | 644 |
|
645 |
binaryFileIcon |
|
3298 | 646 |
"This resource specification was automatically generated |
647 |
by the ImageEditor of ST/X." |
|
648 |
||
649 |
"Do not manually edit this!! If it is corrupted, |
|
650 |
the ImageEditor may not be able to read the specification." |
|
651 |
||
590 | 652 |
" |
3298 | 653 |
self binaryFileIcon inspect |
654 |
ImageEditor openOnClass:self andSelector:#binaryFileIcon |
|
655 |
Icon flushCachedIcons |
|
590 | 656 |
" |
424 | 657 |
|
658 |
<resource: #image> |
|
590 | 659 |
|
660 |
^Icon |
|
3298 | 661 |
constantNamed:'DirectoryView::FileRow binaryFileIcon' |
662 |
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') |
|
663 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
664 |
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 | 665 |
! |
424 | 666 |
|
667 |
cFileIcon |
|
3298 | 668 |
"This resource specification was automatically generated |
669 |
by the ImageEditor of ST/X." |
|
670 |
||
671 |
"Do not manually edit this!! If it is corrupted, |
|
672 |
the ImageEditor may not be able to read the specification." |
|
673 |
||
590 | 674 |
" |
3298 | 675 |
self cFileIcon inspect |
676 |
ImageEditor openOnClass:self andSelector:#cFileIcon |
|
677 |
Icon flushCachedIcons |
|
590 | 678 |
" |
424 | 679 |
|
680 |
<resource: #image> |
|
590 | 681 |
|
682 |
^Icon |
|
3298 | 683 |
constantNamed:'DirectoryView::FileRow cFileIcon' |
684 |
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') |
|
685 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
686 |
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 | 687 |
! |
424 | 688 |
|
689 |
exeFileIcon |
|
3298 | 690 |
"This resource specification was automatically generated |
691 |
by the ImageEditor of ST/X." |
|
692 |
||
693 |
"Do not manually edit this!! If it is corrupted, |
|
694 |
the ImageEditor may not be able to read the specification." |
|
695 |
||
590 | 696 |
" |
3298 | 697 |
self exeFileIcon inspect |
698 |
ImageEditor openOnClass:self andSelector:#exeFileIcon |
|
699 |
Icon flushCachedIcons |
|
590 | 700 |
" |
424 | 701 |
|
702 |
<resource: #image> |
|
590 | 703 |
|
704 |
^Icon |
|
3298 | 705 |
constantNamed:'DirectoryView::FileRow exeFileIcon' |
706 |
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 |
|
707 |
UUUUUUTb') |
|
708 |
colorMapFromArray:#[255 255 255 0 0 0 0 127 127 170 170 170] |
|
709 |
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 | 710 |
! |
424 | 711 |
|
712 |
fileIcon |
|
590 | 713 |
"Generated by the Image Editor" |
714 |
" |
|
715 |
ImageEditor openOnClass:self andSelector:#fileIcon |
|
716 |
" |
|
424 | 717 |
|
718 |
<resource: #image> |
|
590 | 719 |
|
720 |
^Icon |
|
721 |
constantNamed:#'DirectoryView::FileRow fileIcon' |
|
1627 | 722 |
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] |
723 |
! |
|
424 | 724 |
|
725 |
hFileIcon |
|
590 | 726 |
"Generated by the Image Editor" |
727 |
" |
|
728 |
ImageEditor openOnClass:self andSelector:#hFileIcon |
|
729 |
" |
|
424 | 730 |
|
731 |
<resource: #image> |
|
590 | 732 |
|
733 |
^Icon |
|
734 |
constantNamed:#'DirectoryView::FileRow hFileIcon' |
|
1627 | 735 |
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] |
736 |
! |
|
424 | 737 |
|
644 | 738 |
htmlFileIcon |
3298 | 739 |
"This resource specification was automatically generated |
740 |
by the ImageEditor of ST/X." |
|
741 |
||
742 |
"Do not manually edit this!! If it is corrupted, |
|
743 |
the ImageEditor may not be able to read the specification." |
|
744 |
||
644 | 745 |
" |
3298 | 746 |
self htmlFileIcon inspect |
747 |
ImageEditor openOnClass:self andSelector:#htmlFileIcon |
|
748 |
Icon flushCachedIcons |
|
644 | 749 |
" |
424 | 750 |
|
751 |
<resource: #image> |
|
644 | 752 |
|
753 |
^Icon |
|
3298 | 754 |
constantNamed:'DirectoryView::FileRow htmlFileIcon' |
755 |
ifAbsentPut:[(Depth4Image width:20 height:19) bits:(ByteArray fromPackedString:' |
|
756 |
DQDQDQDQDQDQDQ????????DQDQD_???????1@QDQG???L3L3<P@QDQ??L3=DL3D@@QD_?3L?P3L1DQDQG?L3MCP3L1DQDQ?3QCQCMCP??1D_<4P4QDL4O?<Q |
|
757 |
G?L4QDL3MD??DQ?3L3QCL3S??1D_<3L4QDL4O?<QG?<3QDQCMO??DQ??L4QDP4S??1D_??=D??S???<QG???????????DQ???????????1DQDQDQDQDQDQDQ |
|
758 |
DQDQDQDQDQDQDP@a') |
|
759 |
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] |
|
760 |
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 | 761 |
! |
644 | 762 |
|
763 |
imageFileIcon |
|
3298 | 764 |
"This resource specification was automatically generated |
765 |
by the ImageEditor of ST/X." |
|
766 |
||
767 |
"Do not manually edit this!! If it is corrupted, |
|
768 |
the ImageEditor may not be able to read the specification." |
|
769 |
||
644 | 770 |
" |
3298 | 771 |
self imageFileIcon inspect |
772 |
ImageEditor openOnClass:self andSelector:#imageFileIcon |
|
773 |
Icon flushCachedIcons |
|
644 | 774 |
" |
775 |
||
776 |
<resource: #image> |
|
777 |
||
778 |
^Icon |
|
3298 | 779 |
constantNamed:'DirectoryView::FileRow imageFileIcon' |
780 |
ifAbsentPut:[(Depth4Image width:20 height:19) bits:(ByteArray fromPackedString:' |
|
781 |
@@@@@@@@@@@@@@DQDQDQDQ@@@@@ADQDQDQDPD@@@@QDQDQDQDAD@@@DQDQDQDQ@QD@@ADQDQDQDP@@@@@TQG]4)G50@@@@EDQ7^$+W4QDP@AQD]7R$_WDQD@ |
|
782 |
@SL6Y#$61!!DQ@@D3M&ZS''F0QDP@AL3Y&NS[FDQD@@RH%UR %-QDQ@@D"IUVB"5,QDP@AH"UUJBV5DQD@@QDQDQDQDQDQ@@DQDQDQDQDQDP@@@@@@@@@@@@@@ |
|
783 |
@@@@@@@@@@@@@@@a') |
|
784 |
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] |
|
785 |
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 | 786 |
! |
424 | 787 |
|
788 |
imgFileIcon |
|
590 | 789 |
"Generated by the Image Editor" |
790 |
" |
|
791 |
ImageEditor openOnClass:self andSelector:#imgFileIcon |
|
792 |
" |
|
424 | 793 |
|
794 |
<resource: #image> |
|
590 | 795 |
|
796 |
^Icon |
|
797 |
constantNamed:#'DirectoryView::FileRow imgFileIcon' |
|
644 | 798 |
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] |
799 |
! |
|
424 | 800 |
|
801 |
linkedFileIcon |
|
644 | 802 |
"Generated by the Image Editor" |
803 |
" |
|
804 |
ImageEditor openOnClass:self andSelector:#linkedFileIcon |
|
805 |
" |
|
424 | 806 |
|
807 |
<resource: #image> |
|
644 | 808 |
|
809 |
^Icon |
|
810 |
constantNamed:#'DirectoryView::FileRow linkedFileIcon' |
|
1627 | 811 |
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] |
812 |
! |
|
424 | 813 |
|
814 |
lockedFileIcon |
|
644 | 815 |
"Generated by the Image Editor" |
816 |
" |
|
817 |
ImageEditor openOnClass:self andSelector:#lockedFileIcon |
|
818 |
" |
|
424 | 819 |
|
820 |
<resource: #image> |
|
644 | 821 |
|
822 |
^Icon |
|
823 |
constantNamed:#'DirectoryView::FileRow lockedFileIcon' |
|
1627 | 824 |
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] |
825 |
! |
|
424 | 826 |
|
827 |
protoFileIcon |
|
828 |
||
829 |
^self MakefileIcon |
|
830 |
! |
|
831 |
||
832 |
rcFileIcon |
|
644 | 833 |
"Generated by the Image Editor" |
834 |
" |
|
835 |
ImageEditor openOnClass:self andSelector:#rcFileIcon |
|
836 |
" |
|
424 | 837 |
|
838 |
<resource: #image> |
|
644 | 839 |
|
840 |
^Icon |
|
841 |
constantNamed:#'DirectoryView::FileRow rcFileIcon' |
|
1627 | 842 |
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] |
843 |
! |
|
424 | 844 |
|
845 |
sFileIcon |
|
3298 | 846 |
"This resource specification was automatically generated |
847 |
by the ImageEditor of ST/X." |
|
848 |
||
849 |
"Do not manually edit this!! If it is corrupted, |
|
850 |
the ImageEditor may not be able to read the specification." |
|
851 |
||
644 | 852 |
" |
3298 | 853 |
self sFileIcon inspect |
854 |
ImageEditor openOnClass:self andSelector:#sFileIcon |
|
855 |
Icon flushCachedIcons |
|
644 | 856 |
" |
424 | 857 |
|
858 |
<resource: #image> |
|
644 | 859 |
|
860 |
^Icon |
|
3298 | 861 |
constantNamed:'DirectoryView::FileRow sFileIcon' |
862 |
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') |
|
863 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
864 |
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 | 865 |
! |
424 | 866 |
|
867 |
stFileIcon |
|
3298 | 868 |
"This resource specification was automatically generated |
869 |
by the ImageEditor of ST/X." |
|
870 |
||
871 |
"Do not manually edit this!! If it is corrupted, |
|
872 |
the ImageEditor may not be able to read the specification." |
|
873 |
||
590 | 874 |
" |
3298 | 875 |
self stFileIcon inspect |
876 |
ImageEditor openOnClass:self andSelector:#stFileIcon |
|
877 |
Icon flushCachedIcons |
|
590 | 878 |
" |
424 | 879 |
|
880 |
<resource: #image> |
|
590 | 881 |
|
882 |
^Icon |
|
3298 | 883 |
constantNamed:'DirectoryView::FileRow stFileIcon' |
884 |
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') |
|
885 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
886 |
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 | 887 |
! |
424 | 888 |
|
889 |
stcFileIcon |
|
3298 | 890 |
"This resource specification was automatically generated |
891 |
by the ImageEditor of ST/X." |
|
892 |
||
893 |
"Do not manually edit this!! If it is corrupted, |
|
894 |
the ImageEditor may not be able to read the specification." |
|
895 |
||
644 | 896 |
" |
3298 | 897 |
self stcFileIcon inspect |
898 |
ImageEditor openOnClass:self andSelector:#stcFileIcon |
|
899 |
Icon flushCachedIcons |
|
644 | 900 |
" |
424 | 901 |
|
902 |
<resource: #image> |
|
644 | 903 |
|
904 |
^Icon |
|
3298 | 905 |
constantNamed:'DirectoryView::FileRow stcFileIcon' |
906 |
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') |
|
907 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
908 |
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 | 909 |
! ! |
424 | 910 |
|
911 |
!DirectoryView::FileRow methodsFor:'accessing'! |
|
912 |
||
913 |
baseName |
|
914 |
||
915 |
^baseName ? (baseName := fileName baseName) |
|
916 |
||
917 |
||
918 |
||
919 |
||
920 |
||
921 |
||
922 |
||
923 |
! |
|
924 |
||
925 |
fileName |
|
926 |
||
927 |
^fileName |
|
928 |
! |
|
929 |
||
930 |
fileName: aFileName |
|
931 |
||
614 | 932 |
fileName := aFileName |
424 | 933 |
! |
934 |
||
935 |
group |
|
936 |
||
937 |
^group |
|
938 |
! |
|
939 |
||
940 |
iconOn:aGC |
|
941 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
942 |
|icon| |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
943 |
iconKey isNil |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
944 |
ifTrue: |
424 | 945 |
[ |
614 | 946 |
self validateAttributes. |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
947 |
(imageFromFile isNil and: [iconKey == #imageFileIcon]) |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
948 |
ifTrue: [icon := self retrieveImageFromFileAndRegisterOn: aGC] |
424 | 949 |
]. |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
950 |
imageFromFile == true |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
951 |
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
|
952 |
ifTrue: [icon := aGC registeredImageAt: iconKey]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
953 |
^icon |
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
954 |
|
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
955 |
"Modified: / 18.2.1998 / 18:01:52 / cg" |
424 | 956 |
! |
957 |
||
958 |
modified |
|
959 |
||
960 |
^modified |
|
961 |
! |
|
962 |
||
963 |
owner |
|
964 |
||
965 |
^owner |
|
966 |
! |
|
967 |
||
968 |
permissions |
|
969 |
||
970 |
^permissions |
|
971 |
! |
|
972 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
973 |
retrieveImageFromFileAndRegisterOn: aGC |
1385 | 974 |
"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
|
975 |
|
1385 | 976 |
|image maxImageFileSize| |
977 |
||
978 |
maxImageFileSize := MaxImageFileSize ? 20000. |
|
979 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
980 |
imageFromFile := false. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
981 |
(image := aGC registeredImageAt: fileName name asSymbol) isNil |
1385 | 982 |
ifTrue:[ |
983 |
size < maxImageFileSize ifTrue:[ |
|
2999 | 984 |
Error handle: [:ex|] |
1385 | 985 |
do:[ |
986 |
(image := Image fromFile: fileName name) notNil ifTrue:[ |
|
987 |
image extent y > 22 ifTrue:[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
988 |
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
|
989 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
990 |
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
|
991 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
992 |
] |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
993 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
994 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
995 |
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
|
996 |
^image |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
997 |
! |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
998 |
|
424 | 999 |
size |
607 | 1000 |
size isNumber ifFalse:[^ size]. |
1001 |
size < 1000 ifTrue: [^ size printString]. |
|
1002 |
size < (100*1024) ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb']. |
|
1003 |
size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb']. |
|
1004 |
^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb' |
|
424 | 1005 |
|
607 | 1006 |
"Modified: / 6.2.1998 / 03:38:45 / cg" |
424 | 1007 |
! ! |
1008 |
||
1009 |
!DirectoryView::FileRow methodsFor:'private'! |
|
1010 |
||
1011 |
validateAttributes |
|
1012 |
||
2938 | 1013 |
|info mode suffix| |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1014 |
|
424 | 1015 |
permissions := String new:9 withAll:$-. |
1016 |
||
2938 | 1017 |
(info := fileName info) isNil ifTrue:[ |
424 | 1018 |
iconKey := #lockedFileIcon. |
1019 |
size := owner := group := '?'. |
|
2938 | 1020 |
^ self |
424 | 1021 |
]. |
1022 |
size := info size. |
|
1627 | 1023 |
modified := info modificationTime printString. |
424 | 1024 |
owner := OperatingSystem getUserNameFromID: info uid. |
1025 |
group := OperatingSystem getGroupNameFromID: info gid. |
|
1026 |
mode := info mode. |
|
1027 |
||
1028 |
1 to:9 by:3 do:[:i| |
|
1029 |
#((0 $x) (1 $w) (2 $r)) do: |
|
1030 |
[:m| |
|
1031 |
(mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
1032 |
] |
|
1033 |
]. |
|
1034 |
||
2938 | 1035 |
fileName isReadable ifFalse:[ |
424 | 1036 |
^iconKey := #lockedFileIcon |
1037 |
]. |
|
2938 | 1038 |
info type == #symbolicLink ifTrue:[ |
1039 |
^ iconKey := #linkedFileIcon |
|
1040 |
]. |
|
1041 |
suffix := fileName suffix. |
|
1042 |
||
1043 |
((DirectoryView::FileRow class implements: (iconKey := (suffix, 'FileIcon') asSymbol)) |
|
1044 |
or: [DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)] |
|
1045 |
) ifFalse:[ |
|
1046 |
iconKey := #fileIcon. |
|
1047 |
((suffix = 'o') or:[suffix = 'so']) ifTrue: [ |
|
1048 |
^iconKey := #binaryFileIcon |
|
1049 |
]. |
|
1050 |
(Image isImageFileSuffix:suffix) ifTrue: [ |
|
1051 |
^iconKey := #imageFileIcon |
|
1052 |
]. |
|
1053 |
||
1054 |
fileName isExecutableProgram ifTrue:[ |
|
1055 |
^iconKey := #exeFileIcon |
|
1056 |
] |
|
1057 |
] |
|
424 | 1058 |
! ! |
1059 |
||
1060 |
!DirectoryView class methodsFor:'documentation'! |
|
1061 |
||
1062 |
version |
|
1063 |
^ '$Header$' |
|
3299 | 1064 |
! |
1065 |
||
1066 |
version_CVS |
|
1067 |
^ '$Header$' |
|
424 | 1068 |
! ! |
2999 | 1069 |