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