author | Claus Gittinger <cg@exept.de> |
Tue, 28 May 2019 08:28:02 +0200 | |
changeset 3669 | 650468354956 |
parent 3634 | b97f51aaa9ac |
child 3757 | cc41088a39df |
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 |
#bounds: #(#Rectangle 13 23 413 323) |
|
102 |
) |
|
103 |
#component: |
|
104 |
#(#SpecCollection |
|
105 |
#collection: #( |
|
106 |
#(#DataSetSpec |
|
107 |
#name: 'filesDataSetView' |
|
108 |
#layout: #(#LayoutFrame 0 0.0 24 0.0 -2 1.0 0 1.0) |
|
109 |
#model: #selectionOfFile |
|
110 |
#menu: #fileListMenu |
|
111 |
#hasHorizontalScrollBar: true |
|
112 |
#hasVerticalScrollBar: true |
|
113 |
#miniScrollerHorizontal: true |
|
114 |
#dataList: #listOfFiles |
|
115 |
#useIndex: false |
|
116 |
#has3Dsepartors: false |
|
117 |
#doubleClickSelector: #fileDoubleClicked |
|
118 |
#columnHolder: #fileAttributeColumns |
|
119 |
#valueChangeSelector: #fileSelected |
|
120 |
#verticalSpacing: 1 |
|
121 |
) |
|
122 |
#(#ComboBoxSpec |
|
123 |
#name: 'formatComboBox' |
|
124 |
#layout: #(#LayoutFrame 63 0.0 0 0 0 1.0 22 0) |
|
125 |
#model: #selectionOfFileFilter |
|
126 |
#immediateAccept: false |
|
127 |
#acceptOnTab: false |
|
128 |
#acceptOnPointerLeave: false |
|
129 |
#comboList: #listOfFileFilters |
|
130 |
) |
|
131 |
#(#LabelSpec |
|
132 |
#label: 'Filter: ' |
|
133 |
#name: 'filterLabel' |
|
134 |
#layout: #(#LayoutFrame 0 0 0 0 62 0 22 0) |
|
135 |
#adjust: #right |
|
136 |
) |
|
137 |
) |
|
138 |
||
139 |
) |
|
823 | 140 |
) |
1346 | 141 |
|
142 |
"Modified: / 11.2.2000 / 00:11:43 / cg" |
|
823 | 143 |
! ! |
144 |
||
145 |
!DirectoryView class methodsFor:'list specs'! |
|
146 |
||
820 | 147 |
tableColumnsForFileAttributes |
148 |
"This resource specification was automatically generated |
|
149 |
by the DataSetBuilder of ST/X." |
|
150 |
||
151 |
"Do not manually edit this!! If it is corrupted, |
|
152 |
the DataSetBuilder may not be able to read the specification." |
|
153 |
||
154 |
" |
|
155 |
DataSetBuilder new openOnClass:DirectoryView andSelector:#tableColumnsForFileAttributes |
|
156 |
" |
|
157 |
||
158 |
<resource: #tableColumns> |
|
159 |
||
424 | 160 |
|
820 | 161 |
^ #( |
162 |
#(#DataSetColumnSpec |
|
163 |
#label: '' |
|
164 |
#width: 30 |
|
165 |
#height: 22 |
|
166 |
#printSelector: #iconOn: |
|
167 |
#canSelect: false |
|
168 |
) |
|
169 |
#(#DataSetColumnSpec |
|
170 |
#label: 'File name' |
|
171 |
#labelAlignment: #left |
|
172 |
#minWidth: 150 |
|
173 |
#model: #baseName |
|
174 |
#canSelect: false |
|
175 |
) |
|
176 |
#(#DataSetColumnSpec |
|
177 |
#label: 'Size' |
|
178 |
#labelAlignment: #left |
|
179 |
#width: 70 |
|
180 |
#model: #size |
|
181 |
#canSelect: false |
|
182 |
) |
|
183 |
#(#DataSetColumnSpec |
|
184 |
#label: 'Modified' |
|
185 |
#labelAlignment: #left |
|
186 |
#model: #modified |
|
187 |
#canSelect: false |
|
188 |
) |
|
189 |
#(#DataSetColumnSpec |
|
190 |
#label: 'Permissions' |
|
191 |
#labelAlignment: #left |
|
192 |
#width: 85 |
|
193 |
#model: #permissions |
|
194 |
#canSelect: false |
|
195 |
) |
|
196 |
#(#DataSetColumnSpec |
|
197 |
#label: 'Owner' |
|
198 |
#labelAlignment: #left |
|
199 |
#width: 50 |
|
200 |
#model: #owner |
|
201 |
#canSelect: false |
|
202 |
) |
|
203 |
#(#DataSetColumnSpec |
|
204 |
#label: 'Group' |
|
205 |
#labelAlignment: #left |
|
206 |
#width: 50 |
|
207 |
#model: #group |
|
208 |
#canSelect: false |
|
209 |
) |
|
210 |
) |
|
424 | 211 |
! ! |
212 |
||
1346 | 213 |
!DirectoryView class methodsFor:'menu specs'! |
214 |
||
215 |
fileListMenu |
|
216 |
"This resource specification was automatically generated |
|
217 |
by the MenuEditor of ST/X." |
|
218 |
||
219 |
"Do not manually edit this!! If it is corrupted, |
|
220 |
the MenuEditor may not be able to read the specification." |
|
221 |
||
222 |
" |
|
223 |
MenuEditor new openOnClass:DirectoryView andSelector:#fileListMenu |
|
224 |
(Menu new fromLiteralArrayEncoding:(DirectoryView fileListMenu)) startUp |
|
225 |
" |
|
226 |
||
227 |
<resource: #menu> |
|
228 |
||
229 |
^ |
|
230 |
#(#Menu |
|
231 |
#( |
|
232 |
#(#MenuItem |
|
233 |
#label: 'Update' |
|
234 |
#translateLabel: true |
|
235 |
#value: #updateFileList |
|
236 |
) |
|
237 |
) |
|
238 |
nil |
|
239 |
nil |
|
240 |
) |
|
241 |
||
242 |
"Created: / 11.2.2000 / 00:11:39 / cg" |
|
243 |
! ! |
|
244 |
||
424 | 245 |
!DirectoryView methodsFor:'accessing'! |
246 |
||
247 |
directory: aDirectory |
|
248 |
||
249 |
directory := aDirectory asFilename asAbsoluteFilename name |
|
250 |
! |
|
251 |
||
252 |
fileAttributes: anArray |
|
253 |
||
254 |
fileAttributes := anArray |
|
255 |
! |
|
256 |
||
257 |
fileDoubleClickAction: anActionBlock |
|
258 |
||
259 |
fileDoubleClickAction := anActionBlock |
|
260 |
! |
|
261 |
||
262 |
fileFilterSelectAction: anActionBlock |
|
263 |
||
264 |
fileFilterSelectAction := anActionBlock |
|
265 |
! |
|
266 |
||
267 |
fileSelectAction: anActionBlock |
|
268 |
||
269 |
fileSelectAction := anActionBlock |
|
270 |
! |
|
271 |
||
272 |
listOfFileFilters: aCollection |
|
273 |
||
274 |
self listOfFileFilters contents: aCollection. |
|
275 |
self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
|
276 |
! |
|
277 |
||
278 |
monitoring: aBoolean |
|
279 |
||
280 |
aBoolean |
|
281 |
ifTrue: |
|
282 |
[ |
|
283 |
monitoringTimeBlock := [self readDirectory]. |
|
284 |
self readDirectory. |
|
285 |
] |
|
286 |
ifFalse: |
|
287 |
[ |
|
288 |
monitoring ifTrue: |
|
289 |
[ |
|
290 |
Processor removeTimedBlock:monitoringTimeBlock. |
|
291 |
monitoringTimeBlock := nil |
|
292 |
] |
|
293 |
]. |
|
294 |
||
295 |
monitoring := aBoolean. |
|
296 |
||
297 |
! ! |
|
298 |
||
299 |
!DirectoryView methodsFor:'aspects'! |
|
300 |
||
301 |
fileAttributeColumns |
|
302 |
||
303 |
|holder| |
|
304 |
(holder := builder bindingAt:#fileAttributeColumns) isNil ifTrue:[ |
|
305 |
|fileAttributeColumns| |
|
306 |
builder aspectAt:#fileAttributeColumns put:(holder := List new). |
|
820 | 307 |
fileAttributeColumns := self class tableColumnsForFileAttributes collect: [:i| i decodeAsLiteralArray]. |
424 | 308 |
holder add: fileAttributeColumns first. |
309 |
fileAttributeColumns do: |
|
310 |
[:col| |
|
311 |
(fileAttributes includes: col label) ifTrue: [holder add: col] |
|
312 |
]. |
|
591 | 313 |
holder do: [:col| col label: ' ', col label] |
424 | 314 |
]. |
315 |
^ holder |
|
316 |
! |
|
317 |
||
318 |
listOfFileFilters |
|
319 |
||
320 |
|holder| |
|
321 |
(holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[ |
|
322 |
builder aspectAt:#listOfFileFilters put:(holder := List with: '*'). |
|
323 |
]. |
|
324 |
^ holder |
|
325 |
! |
|
326 |
||
327 |
listOfFiles |
|
328 |
||
329 |
|holder| |
|
330 |
(holder := builder bindingAt:#listOfFiles) isNil ifTrue:[ |
|
331 |
builder aspectAt:#listOfFiles put:(holder := List new). |
|
332 |
]. |
|
333 |
^ holder |
|
334 |
! |
|
335 |
||
336 |
selectionOfFile |
|
337 |
||
338 |
|holder| |
|
339 |
(holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[ |
|
340 |
builder aspectAt:#selectionOfFile put:(holder := ValueHolder new). |
|
341 |
]. |
|
342 |
^ holder |
|
343 |
||
344 |
! |
|
345 |
||
346 |
selectionOfFileFilter |
|
347 |
||
348 |
|holder| |
|
349 |
(holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[ |
|
350 |
builder aspectAt:#selectionOfFileFilter put: |
|
351 |
(holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter). |
|
352 |
selectedFileFilter := '*'. |
|
353 |
]. |
|
354 |
^ holder |
|
355 |
! ! |
|
356 |
||
357 |
!DirectoryView methodsFor:'callbacks'! |
|
358 |
||
359 |
fileDoubleClicked |
|
360 |
||
473 | 361 |
(fileDoubleClickAction notNil and: [self selectionOfFile value notNil]) |
424 | 362 |
ifTrue: |
363 |
[ |
|
364 |
fileDoubleClickAction numArgs = 0 |
|
365 |
ifTrue: |
|
366 |
[ |
|
367 |
fileDoubleClickAction value |
|
368 |
]. |
|
369 |
fileDoubleClickAction numArgs = 1 |
|
370 |
ifTrue: |
|
451 | 371 |
[ |
372 |
fileDoubleClickAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
|
424 | 373 |
] |
374 |
] |
|
375 |
! |
|
376 |
||
377 |
fileSelected |
|
378 |
||
473 | 379 |
(fileSelectAction notNil and: [self selectionOfFile value notNil]) |
424 | 380 |
ifTrue: |
381 |
[ |
|
382 |
fileSelectAction numArgs = 0 |
|
383 |
ifTrue: |
|
384 |
[ |
|
385 |
fileSelectAction value |
|
386 |
]. |
|
387 |
fileSelectAction numArgs = 1 |
|
388 |
ifTrue: |
|
389 |
[ |
|
451 | 390 |
fileSelectAction value: (directory asFilename construct: self selectionOfFile value baseName) name |
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]. |
|
3018 | 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 |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
593 |
and:[selectedFileFilter notEmpty]) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
594 |
ifTrue: [ |
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) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
598 |
and:[fileFilterSelectAction notNil]) |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
599 |
ifTrue: [ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
600 |
(nArgs := fileFilterSelectAction numArgs) == 0 |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
601 |
ifTrue: [ |
424 | 602 |
fileFilterSelectAction value |
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
603 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
604 |
nArgs == 1 ifTrue:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
605 |
fileFilterSelectAction value: selectedFileFilter |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
606 |
] ifFalse:[ |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
607 |
self error:'bad numArgs of fileFilter action block' |
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
608 |
] |
424 | 609 |
] |
610 |
]. |
|
611 |
self readDirectory. |
|
999
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
612 |
|
3dc1bc073981
fixed filter for caseless fileSystems (win32)
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
613 |
"Modified: / 23.9.1998 / 16:53:05 / cg" |
424 | 614 |
! ! |
615 |
||
3035 | 616 |
!DirectoryView methodsFor:'startup & release'! |
424 | 617 |
|
618 |
closeRequest |
|
3563 | 619 |
"/ is this needed? - I think release is sent anyway by super... |
424 | 620 |
self release. |
621 |
||
622 |
super closeRequest |
|
623 |
||
3563 | 624 |
"Modified (comment): / 28-05-2018 / 09:50:20 / Claus Gittinger" |
424 | 625 |
! ! |
626 |
||
627 |
!DirectoryView::FileRow class methodsFor:'resources'! |
|
628 |
||
629 |
HFileIcon |
|
630 |
||
631 |
^self hFileIcon |
|
632 |
! |
|
633 |
||
634 |
MakefileIcon |
|
3298 | 635 |
"This resource specification was automatically generated |
636 |
by the ImageEditor of ST/X." |
|
637 |
||
638 |
"Do not manually edit this!! If it is corrupted, |
|
639 |
the ImageEditor may not be able to read the specification." |
|
640 |
||
590 | 641 |
" |
3298 | 642 |
self MakefileIcon inspect |
643 |
ImageEditor openOnClass:self andSelector:#MakefileIcon |
|
644 |
Icon flushCachedIcons |
|
590 | 645 |
" |
424 | 646 |
|
647 |
<resource: #image> |
|
590 | 648 |
|
649 |
^Icon |
|
3298 | 650 |
constantNamed:'DirectoryView::FileRow MakefileIcon' |
651 |
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') |
|
652 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
653 |
mask:((ImageMask width:20 height:19) bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself] |
|
1627 | 654 |
! |
424 | 655 |
|
656 |
binaryFileIcon |
|
3298 | 657 |
"This resource specification was automatically generated |
658 |
by the ImageEditor of ST/X." |
|
659 |
||
660 |
"Do not manually edit this!! If it is corrupted, |
|
661 |
the ImageEditor may not be able to read the specification." |
|
662 |
||
590 | 663 |
" |
3298 | 664 |
self binaryFileIcon inspect |
665 |
ImageEditor openOnClass:self andSelector:#binaryFileIcon |
|
666 |
Icon flushCachedIcons |
|
590 | 667 |
" |
424 | 668 |
|
669 |
<resource: #image> |
|
590 | 670 |
|
671 |
^Icon |
|
3298 | 672 |
constantNamed:'DirectoryView::FileRow binaryFileIcon' |
673 |
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') |
|
674 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
675 |
mask:((ImageMask width:20 height:19) bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself] |
|
1627 | 676 |
! |
424 | 677 |
|
678 |
cFileIcon |
|
3298 | 679 |
"This resource specification was automatically generated |
680 |
by the ImageEditor of ST/X." |
|
681 |
||
682 |
"Do not manually edit this!! If it is corrupted, |
|
683 |
the ImageEditor may not be able to read the specification." |
|
684 |
||
590 | 685 |
" |
3298 | 686 |
self cFileIcon inspect |
687 |
ImageEditor openOnClass:self andSelector:#cFileIcon |
|
688 |
Icon flushCachedIcons |
|
590 | 689 |
" |
424 | 690 |
|
691 |
<resource: #image> |
|
590 | 692 |
|
693 |
^Icon |
|
3298 | 694 |
constantNamed:'DirectoryView::FileRow cFileIcon' |
695 |
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') |
|
696 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
697 |
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 | 698 |
! |
424 | 699 |
|
700 |
exeFileIcon |
|
3298 | 701 |
"This resource specification was automatically generated |
702 |
by the ImageEditor of ST/X." |
|
703 |
||
704 |
"Do not manually edit this!! If it is corrupted, |
|
705 |
the ImageEditor may not be able to read the specification." |
|
706 |
||
590 | 707 |
" |
3298 | 708 |
self exeFileIcon inspect |
709 |
ImageEditor openOnClass:self andSelector:#exeFileIcon |
|
710 |
Icon flushCachedIcons |
|
590 | 711 |
" |
424 | 712 |
|
713 |
<resource: #image> |
|
590 | 714 |
|
715 |
^Icon |
|
3298 | 716 |
constantNamed:'DirectoryView::FileRow exeFileIcon' |
717 |
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 |
|
718 |
UUUUUUTb') |
|
719 |
colorMapFromArray:#[255 255 255 0 0 0 0 127 127 170 170 170] |
|
720 |
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 | 721 |
! |
424 | 722 |
|
723 |
fileIcon |
|
590 | 724 |
"Generated by the Image Editor" |
725 |
" |
|
726 |
ImageEditor openOnClass:self andSelector:#fileIcon |
|
727 |
" |
|
424 | 728 |
|
729 |
<resource: #image> |
|
590 | 730 |
|
731 |
^Icon |
|
732 |
constantNamed:#'DirectoryView::FileRow fileIcon' |
|
1627 | 733 |
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] |
734 |
! |
|
424 | 735 |
|
736 |
hFileIcon |
|
590 | 737 |
"Generated by the Image Editor" |
738 |
" |
|
739 |
ImageEditor openOnClass:self andSelector:#hFileIcon |
|
740 |
" |
|
424 | 741 |
|
742 |
<resource: #image> |
|
590 | 743 |
|
744 |
^Icon |
|
745 |
constantNamed:#'DirectoryView::FileRow hFileIcon' |
|
1627 | 746 |
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] |
747 |
! |
|
424 | 748 |
|
644 | 749 |
htmlFileIcon |
3298 | 750 |
"This resource specification was automatically generated |
751 |
by the ImageEditor of ST/X." |
|
752 |
||
753 |
"Do not manually edit this!! If it is corrupted, |
|
754 |
the ImageEditor may not be able to read the specification." |
|
755 |
||
644 | 756 |
" |
3298 | 757 |
self htmlFileIcon inspect |
758 |
ImageEditor openOnClass:self andSelector:#htmlFileIcon |
|
759 |
Icon flushCachedIcons |
|
644 | 760 |
" |
424 | 761 |
|
762 |
<resource: #image> |
|
644 | 763 |
|
764 |
^Icon |
|
3298 | 765 |
constantNamed:'DirectoryView::FileRow htmlFileIcon' |
766 |
ifAbsentPut:[(Depth4Image width:20 height:19) bits:(ByteArray fromPackedString:' |
|
767 |
DQDQDQDQDQDQDQ????????DQDQD_???????1@QDQG???L3L3<P@QDQ??L3=DL3D@@QD_?3L?P3L1DQDQG?L3MCP3L1DQDQ?3QCQCMCP??1D_<4P4QDL4O?<Q |
|
768 |
G?L4QDL3MD??DQ?3L3QCL3S??1D_<3L4QDL4O?<QG?<3QDQCMO??DQ??L4QDP4S??1D_??=D??S???<QG???????????DQ???????????1DQDQDQDQDQDQDQ |
|
769 |
DQDQDQDQDQDQDP@a') |
|
770 |
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] |
|
771 |
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 | 772 |
! |
644 | 773 |
|
774 |
imageFileIcon |
|
3298 | 775 |
"This resource specification was automatically generated |
776 |
by the ImageEditor of ST/X." |
|
777 |
||
778 |
"Do not manually edit this!! If it is corrupted, |
|
779 |
the ImageEditor may not be able to read the specification." |
|
780 |
||
644 | 781 |
" |
3298 | 782 |
self imageFileIcon inspect |
783 |
ImageEditor openOnClass:self andSelector:#imageFileIcon |
|
784 |
Icon flushCachedIcons |
|
644 | 785 |
" |
786 |
||
787 |
<resource: #image> |
|
788 |
||
789 |
^Icon |
|
3298 | 790 |
constantNamed:'DirectoryView::FileRow imageFileIcon' |
791 |
ifAbsentPut:[(Depth4Image width:20 height:19) bits:(ByteArray fromPackedString:' |
|
792 |
@@@@@@@@@@@@@@DQDQDQDQ@@@@@ADQDQDQDPD@@@@QDQDQDQDAD@@@DQDQDQDQ@QD@@ADQDQDQDP@@@@@TQG]4)G50@@@@EDQ7^$+W4QDP@AQD]7R$_WDQD@ |
|
793 |
@SL6Y#$61!!DQ@@D3M&ZS''F0QDP@AL3Y&NS[FDQD@@RH%UR %-QDQ@@D"IUVB"5,QDP@AH"UUJBV5DQD@@QDQDQDQDQDQ@@DQDQDQDQDQDP@@@@@@@@@@@@@@ |
|
794 |
@@@@@@@@@@@@@@@a') |
|
795 |
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] |
|
796 |
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 | 797 |
! |
424 | 798 |
|
799 |
imgFileIcon |
|
590 | 800 |
"Generated by the Image Editor" |
801 |
" |
|
802 |
ImageEditor openOnClass:self andSelector:#imgFileIcon |
|
803 |
" |
|
424 | 804 |
|
805 |
<resource: #image> |
|
590 | 806 |
|
807 |
^Icon |
|
808 |
constantNamed:#'DirectoryView::FileRow imgFileIcon' |
|
644 | 809 |
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] |
810 |
! |
|
424 | 811 |
|
812 |
linkedFileIcon |
|
644 | 813 |
"Generated by the Image Editor" |
814 |
" |
|
815 |
ImageEditor openOnClass:self andSelector:#linkedFileIcon |
|
816 |
" |
|
424 | 817 |
|
818 |
<resource: #image> |
|
644 | 819 |
|
820 |
^Icon |
|
821 |
constantNamed:#'DirectoryView::FileRow linkedFileIcon' |
|
1627 | 822 |
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] |
823 |
! |
|
424 | 824 |
|
825 |
lockedFileIcon |
|
644 | 826 |
"Generated by the Image Editor" |
827 |
" |
|
828 |
ImageEditor openOnClass:self andSelector:#lockedFileIcon |
|
829 |
" |
|
424 | 830 |
|
831 |
<resource: #image> |
|
644 | 832 |
|
833 |
^Icon |
|
834 |
constantNamed:#'DirectoryView::FileRow lockedFileIcon' |
|
1627 | 835 |
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] |
836 |
! |
|
424 | 837 |
|
838 |
protoFileIcon |
|
839 |
||
840 |
^self MakefileIcon |
|
841 |
! |
|
842 |
||
843 |
rcFileIcon |
|
644 | 844 |
"Generated by the Image Editor" |
845 |
" |
|
846 |
ImageEditor openOnClass:self andSelector:#rcFileIcon |
|
847 |
" |
|
424 | 848 |
|
849 |
<resource: #image> |
|
644 | 850 |
|
851 |
^Icon |
|
852 |
constantNamed:#'DirectoryView::FileRow rcFileIcon' |
|
1627 | 853 |
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] |
854 |
! |
|
424 | 855 |
|
856 |
sFileIcon |
|
3298 | 857 |
"This resource specification was automatically generated |
858 |
by the ImageEditor of ST/X." |
|
859 |
||
860 |
"Do not manually edit this!! If it is corrupted, |
|
861 |
the ImageEditor may not be able to read the specification." |
|
862 |
||
644 | 863 |
" |
3298 | 864 |
self sFileIcon inspect |
865 |
ImageEditor openOnClass:self andSelector:#sFileIcon |
|
866 |
Icon flushCachedIcons |
|
644 | 867 |
" |
424 | 868 |
|
869 |
<resource: #image> |
|
644 | 870 |
|
871 |
^Icon |
|
3298 | 872 |
constantNamed:'DirectoryView::FileRow sFileIcon' |
873 |
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') |
|
874 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
875 |
mask:((ImageMask width:20 height:19) bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself] |
|
1627 | 876 |
! |
424 | 877 |
|
878 |
stFileIcon |
|
3298 | 879 |
"This resource specification was automatically generated |
880 |
by the ImageEditor of ST/X." |
|
881 |
||
882 |
"Do not manually edit this!! If it is corrupted, |
|
883 |
the ImageEditor may not be able to read the specification." |
|
884 |
||
590 | 885 |
" |
3298 | 886 |
self stFileIcon inspect |
887 |
ImageEditor openOnClass:self andSelector:#stFileIcon |
|
888 |
Icon flushCachedIcons |
|
590 | 889 |
" |
424 | 890 |
|
891 |
<resource: #image> |
|
590 | 892 |
|
893 |
^Icon |
|
3298 | 894 |
constantNamed:'DirectoryView::FileRow stFileIcon' |
895 |
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') |
|
896 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
897 |
mask:((ImageMask width:20 height:19) bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself] |
|
1627 | 898 |
! |
424 | 899 |
|
900 |
stcFileIcon |
|
3298 | 901 |
"This resource specification was automatically generated |
902 |
by the ImageEditor of ST/X." |
|
903 |
||
904 |
"Do not manually edit this!! If it is corrupted, |
|
905 |
the ImageEditor may not be able to read the specification." |
|
906 |
||
644 | 907 |
" |
3298 | 908 |
self stcFileIcon inspect |
909 |
ImageEditor openOnClass:self andSelector:#stcFileIcon |
|
910 |
Icon flushCachedIcons |
|
644 | 911 |
" |
424 | 912 |
|
913 |
<resource: #image> |
|
644 | 914 |
|
915 |
^Icon |
|
3298 | 916 |
constantNamed:'DirectoryView::FileRow stcFileIcon' |
917 |
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') |
|
918 |
colorMapFromArray:#[255 255 255 0 0 0] |
|
919 |
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 | 920 |
! ! |
424 | 921 |
|
922 |
!DirectoryView::FileRow methodsFor:'accessing'! |
|
923 |
||
924 |
baseName |
|
925 |
||
926 |
^baseName ? (baseName := fileName baseName) |
|
927 |
||
928 |
||
929 |
||
930 |
||
931 |
||
932 |
||
933 |
||
934 |
! |
|
935 |
||
936 |
fileName |
|
937 |
||
938 |
^fileName |
|
939 |
! |
|
940 |
||
941 |
fileName: aFileName |
|
942 |
||
614 | 943 |
fileName := aFileName |
424 | 944 |
! |
945 |
||
946 |
group |
|
947 |
||
948 |
^group |
|
949 |
! |
|
950 |
||
951 |
iconOn:aGC |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
952 |
|icon| |
3491 | 953 |
|
954 |
iconKey isNil ifTrue: [ |
|
614 | 955 |
self validateAttributes. |
3491 | 956 |
(imageFromFile isNil and: [iconKey == #imageFileIcon]) ifTrue: [ |
957 |
icon := self retrieveImageFromFileAndRegisterOn: aGC |
|
958 |
] |
|
424 | 959 |
]. |
3491 | 960 |
imageFromFile == true ifFalse: [ |
961 |
icon := aGC registerImage: (self class perform: iconKey) key: iconKey |
|
962 |
] ifTrue: [ |
|
963 |
icon := aGC registeredImageAt: iconKey |
|
964 |
]. |
|
965 |
^ icon |
|
645
9f422fbbd801
care for imageFromFile being uninitialized
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
966 |
|
3491 | 967 |
"Modified: / 18-02-1998 / 18:01:52 / cg" |
968 |
"Modified (format): / 13-09-2017 / 09:57:53 / cg" |
|
424 | 969 |
! |
970 |
||
971 |
modified |
|
972 |
||
973 |
^modified |
|
974 |
! |
|
975 |
||
976 |
owner |
|
977 |
||
978 |
^owner |
|
979 |
! |
|
980 |
||
981 |
permissions |
|
982 |
||
983 |
^permissions |
|
984 |
! |
|
985 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
986 |
retrieveImageFromFileAndRegisterOn: aGC |
1385 | 987 |
"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
|
988 |
|
1385 | 989 |
|image maxImageFileSize| |
990 |
||
991 |
maxImageFileSize := MaxImageFileSize ? 20000. |
|
992 |
||
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
993 |
imageFromFile := false. |
3491 | 994 |
(image := aGC registeredImageAt: fileName name asSymbol) isNil ifTrue:[ |
1385 | 995 |
size < maxImageFileSize ifTrue:[ |
2999 | 996 |
Error handle: [:ex|] |
1385 | 997 |
do:[ |
998 |
(image := Image fromFile: fileName name) notNil ifTrue:[ |
|
999 |
image extent y > 22 ifTrue:[ |
|
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1000 |
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
|
1001 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1002 |
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
|
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 |
]. |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1007 |
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
|
1008 |
^image |
3491 | 1009 |
|
1010 |
"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
|
1011 |
! |
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1012 |
|
424 | 1013 |
size |
3491 | 1014 |
size isNil ifTrue:[ |
1015 |
self validateAttributes. |
|
1016 |
]. |
|
1017 |
||
607 | 1018 |
size isNumber ifFalse:[^ size]. |
3491 | 1019 |
|
1020 |
"/ ^ UnitConverter fileSizeStringFor:size. |
|
1021 |
||
607 | 1022 |
size < 1000 ifTrue: [^ size printString]. |
1023 |
size < (100*1024) ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb']. |
|
1024 |
size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb']. |
|
1025 |
^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb' |
|
424 | 1026 |
|
3491 | 1027 |
"Modified: / 13-09-2017 / 09:58:42 / cg" |
424 | 1028 |
! ! |
1029 |
||
1030 |
!DirectoryView::FileRow methodsFor:'private'! |
|
1031 |
||
1032 |
validateAttributes |
|
2938 | 1033 |
|info mode suffix| |
638
a82372d61cf8
avoid rereading of file images + multiple listings of same filter matching files
tz
parents:
620
diff
changeset
|
1034 |
|
3366 | 1035 |
permissions := '---------' copy. |
424 | 1036 |
|
2938 | 1037 |
(info := fileName info) isNil ifTrue:[ |
424 | 1038 |
iconKey := #lockedFileIcon. |
1039 |
size := owner := group := '?'. |
|
2938 | 1040 |
^ self |
424 | 1041 |
]. |
3491 | 1042 |
size := info fileSize. |
1627 | 1043 |
modified := info modificationTime printString. |
424 | 1044 |
owner := OperatingSystem getUserNameFromID: info uid. |
1045 |
group := OperatingSystem getGroupNameFromID: info gid. |
|
1046 |
mode := info mode. |
|
1047 |
||
1048 |
1 to:9 by:3 do:[:i| |
|
1049 |
#((0 $x) (1 $w) (2 $r)) do: |
|
1050 |
[:m| |
|
1051 |
(mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
1052 |
] |
|
1053 |
]. |
|
1054 |
||
2938 | 1055 |
fileName isReadable ifFalse:[ |
3366 | 1056 |
^ iconKey := #lockedFileIcon |
424 | 1057 |
]. |
2938 | 1058 |
info type == #symbolicLink ifTrue:[ |
1059 |
^ iconKey := #linkedFileIcon |
|
1060 |
]. |
|
1061 |
suffix := fileName suffix. |
|
1062 |
||
3634 | 1063 |
((suffix asSingleByteStringIfPossible isSingleByteCollection |
1064 |
and:[ (self class respondsTo:(iconKey := (suffix, 'FileIcon') asSymbol))]) |
|
1065 |
or: [fileName baseName asSingleByteStringIfPossible isSingleByteCollection |
|
1066 |
and:[self class respondsTo: (iconKey := (fileName baseName, 'Icon') asSymbol)]] |
|
2938 | 1067 |
) ifFalse:[ |
1068 |
iconKey := #fileIcon. |
|
1069 |
((suffix = 'o') or:[suffix = 'so']) ifTrue: [ |
|
3366 | 1070 |
^ iconKey := #binaryFileIcon |
2938 | 1071 |
]. |
1072 |
(Image isImageFileSuffix:suffix) ifTrue: [ |
|
3366 | 1073 |
^ iconKey := #imageFileIcon |
2938 | 1074 |
]. |
1075 |
||
1076 |
fileName isExecutableProgram ifTrue:[ |
|
3366 | 1077 |
^ iconKey := #exeFileIcon |
2938 | 1078 |
] |
1079 |
] |
|
3491 | 1080 |
|
1081 |
"Modified: / 13-09-2017 / 10:00:42 / cg" |
|
3634 | 1082 |
"Modified: / 01-01-2019 / 15:23:11 / Claus Gittinger" |
424 | 1083 |
! ! |
1084 |
||
1085 |
!DirectoryView class methodsFor:'documentation'! |
|
1086 |
||
1087 |
version |
|
1088 |
^ '$Header$' |
|
3299 | 1089 |
! |
1090 |
||
1091 |
version_CVS |
|
1092 |
^ '$Header$' |
|
424 | 1093 |
! ! |
2999 | 1094 |