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