|
1 " |
|
2 COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick |
|
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 " |
|
12 |
|
13 |
|
14 ApplicationModel subclass:#DirectoryView |
|
15 instanceVariableNames:'directory selectedFileFilter readTask monitoring |
|
16 monitoringTimeBlock fileDoubleClickAction fileSelectAction |
|
17 fileFilterSelectAction fileAttributes' |
|
18 classVariableNames:'' |
|
19 poolDictionaries:'' |
|
20 category:'Interface-Advanced-Tools' |
|
21 ! |
|
22 |
|
23 Object subclass:#FileRow |
|
24 instanceVariableNames:'fileName size modified iconKey group owner permissions baseName' |
|
25 classVariableNames:'' |
|
26 poolDictionaries:'' |
|
27 privateIn:DirectoryView |
|
28 ! |
|
29 |
|
30 !DirectoryView class methodsFor:'documentation'! |
|
31 |
|
32 copyright |
|
33 " |
|
34 COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick |
|
35 All Rights Reserved |
|
36 |
|
37 This software is furnished under a license and may be used |
|
38 only in accordance with the terms of that license and with the |
|
39 inclusion of the above copyright notice. This software may not |
|
40 be provided or otherwise made available to, or used by, any |
|
41 other person. No title to or ownership of the software is |
|
42 hereby transferred. |
|
43 " |
|
44 |
|
45 ! |
|
46 |
|
47 documentation |
|
48 " |
|
49 documentation to be added. |
|
50 " |
|
51 ! |
|
52 |
|
53 history |
|
54 "Created: / 10.1.1998 / 10:59:49 / tz" |
|
55 ! ! |
|
56 |
|
57 !DirectoryView class methodsFor:'instance creation'! |
|
58 |
|
59 openOnDirectory: aDirectory |
|
60 |
|
61 "self openOnDirectory: '/home'" |
|
62 |
|
63 ^self open directory: aDirectory |
|
64 |
|
65 ! ! |
|
66 |
|
67 !DirectoryView class methodsFor:'interface specs'! |
|
68 |
|
69 windowSpec |
|
70 "this window spec was automatically generated by the ST/X UIPainter" |
|
71 |
|
72 "do not manually edit this - the painter/builder may not be able to |
|
73 handle the specification if its corrupted." |
|
74 |
|
75 " |
|
76 UIPainter new openOnClass:DirectoryView andSelector:#windowSpec |
|
77 DirectoryView new openInterface:#windowSpec |
|
78 " |
|
79 "DirectoryView open" |
|
80 |
|
81 <resource: #canvas> |
|
82 |
|
83 ^ |
|
84 |
|
85 #(#FullSpec |
|
86 #'window:' |
|
87 #(#WindowSpec |
|
88 #'name:' 'Directory View' |
|
89 #'layout:' #(#LayoutFrame 194 0 152 0 593 0 451 0) |
|
90 #'label:' 'Directory View' |
|
91 #'min:' #(#Point 10 10) |
|
92 #'max:' #(#Point 1152 900) |
|
93 #'bounds:' #(#Rectangle 194 152 594 452) |
|
94 #'usePreferredExtent:' false |
|
95 ) |
|
96 #'component:' |
|
97 #(#SpecCollection |
|
98 #'collection:' |
|
99 #( |
|
100 #(#DataSetSpec |
|
101 #'name:' 'filesDataSetView' |
|
102 #'layout:' #(#LayoutFrame 0 0.0 22 0.0 0 1.0 0 1.0) |
|
103 #'model:' #selectionOfFile |
|
104 #'hasHorizontalScrollBar:' true |
|
105 #'hasVerticalScrollBar:' true |
|
106 #'miniScrollerHorizontal:' true |
|
107 #'dataList:' #listOfFiles |
|
108 #'useIndex:' false |
|
109 #'doubleClickSelector:' #fileDoubleClicked |
|
110 #'columnHolder:' #fileAttributeColumns |
|
111 #'valueChangeSelector:' #fileSelected |
|
112 #'verticalSpacing:' 1 |
|
113 ) |
|
114 #(#ComboBoxSpec |
|
115 #'name:' 'formatComboBox' |
|
116 #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 22 0) |
|
117 #'model:' #selectionOfFileFilter |
|
118 #'immediateAccept:' false |
|
119 #'acceptOnTab:' false |
|
120 #'comboList:' #listOfFileFilters |
|
121 ) |
|
122 ) |
|
123 ) |
|
124 ) |
|
125 ! |
|
126 |
|
127 windowSpecOfFileAttributeColumns |
|
128 |
|
129 ^ |
|
130 #( |
|
131 #(#DataSetColumnSpec |
|
132 #'label:' '' |
|
133 #'width:' 30 |
|
134 #'height:' 22 |
|
135 #'printSelector:' #'iconOn:' |
|
136 #'canSelect:' false |
|
137 ) |
|
138 #(#DataSetColumnSpec |
|
139 #'label:' 'File name' |
|
140 #'minWidth:' 100 |
|
141 #'model:' #baseName |
|
142 #'canSelect:' false |
|
143 ) |
|
144 #(#DataSetColumnSpec |
|
145 #'label:' 'Size' |
|
146 #'width:' 50 |
|
147 #'model:' #size |
|
148 #'canSelect:' false |
|
149 ) |
|
150 #(#DataSetColumnSpec |
|
151 #'label:' 'Modified' |
|
152 #'model:' #modified |
|
153 #'canSelect:' false |
|
154 ) |
|
155 #(#DataSetColumnSpec |
|
156 #'label:' 'Permissions' |
|
157 #'width:' 85 |
|
158 #'model:' #permissions |
|
159 #'canSelect:' false |
|
160 ) |
|
161 #(#DataSetColumnSpec |
|
162 #'label:' 'Owner' |
|
163 #'width:' 50 |
|
164 #'model:' #owner |
|
165 #'canSelect:' false |
|
166 ) |
|
167 #(#DataSetColumnSpec |
|
168 #'label:' 'Group' |
|
169 #'width:' 50 |
|
170 #'model:' #group |
|
171 #'canSelect:' false |
|
172 ) |
|
173 ) |
|
174 |
|
175 ! ! |
|
176 |
|
177 !DirectoryView methodsFor:'accessing'! |
|
178 |
|
179 directory: aDirectory |
|
180 |
|
181 directory := aDirectory asFilename asAbsoluteFilename name |
|
182 ! |
|
183 |
|
184 fileAttributes: anArray |
|
185 |
|
186 fileAttributes := anArray |
|
187 ! |
|
188 |
|
189 fileDoubleClickAction: anActionBlock |
|
190 |
|
191 fileDoubleClickAction := anActionBlock |
|
192 ! |
|
193 |
|
194 fileFilterSelectAction: anActionBlock |
|
195 |
|
196 fileFilterSelectAction := anActionBlock |
|
197 ! |
|
198 |
|
199 fileSelectAction: anActionBlock |
|
200 |
|
201 fileSelectAction := anActionBlock |
|
202 ! |
|
203 |
|
204 listOfFileFilters: aCollection |
|
205 |
|
206 self listOfFileFilters contents: aCollection. |
|
207 self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
|
208 ! |
|
209 |
|
210 monitoring: aBoolean |
|
211 |
|
212 aBoolean |
|
213 ifTrue: |
|
214 [ |
|
215 monitoringTimeBlock := [self readDirectory]. |
|
216 self readDirectory. |
|
217 ] |
|
218 ifFalse: |
|
219 [ |
|
220 monitoring ifTrue: |
|
221 [ |
|
222 Processor removeTimedBlock:monitoringTimeBlock. |
|
223 monitoringTimeBlock := nil |
|
224 ] |
|
225 ]. |
|
226 |
|
227 monitoring := aBoolean. |
|
228 |
|
229 ! ! |
|
230 |
|
231 !DirectoryView methodsFor:'aspects'! |
|
232 |
|
233 fileAttributeColumns |
|
234 |
|
235 |holder| |
|
236 (holder := builder bindingAt:#fileAttributeColumns) isNil ifTrue:[ |
|
237 |fileAttributeColumns| |
|
238 builder aspectAt:#fileAttributeColumns put:(holder := List new). |
|
239 fileAttributeColumns := self class windowSpecOfFileAttributeColumns collect: [:i| i decodeAsLiteralArray]. |
|
240 holder add: fileAttributeColumns first. |
|
241 fileAttributeColumns do: |
|
242 [:col| |
|
243 (fileAttributes includes: col label) ifTrue: [holder add: col] |
|
244 ]. |
|
245 ]. |
|
246 ^ holder |
|
247 ! |
|
248 |
|
249 listOfFileFilters |
|
250 |
|
251 |holder| |
|
252 (holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[ |
|
253 builder aspectAt:#listOfFileFilters put:(holder := List with: '*'). |
|
254 ]. |
|
255 ^ holder |
|
256 ! |
|
257 |
|
258 listOfFiles |
|
259 |
|
260 |holder| |
|
261 (holder := builder bindingAt:#listOfFiles) isNil ifTrue:[ |
|
262 builder aspectAt:#listOfFiles put:(holder := List new). |
|
263 ]. |
|
264 ^ holder |
|
265 ! |
|
266 |
|
267 selectionOfFile |
|
268 |
|
269 |holder| |
|
270 (holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[ |
|
271 builder aspectAt:#selectionOfFile put:(holder := ValueHolder new). |
|
272 ]. |
|
273 ^ holder |
|
274 |
|
275 ! |
|
276 |
|
277 selectionOfFileFilter |
|
278 |
|
279 |holder| |
|
280 (holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[ |
|
281 builder aspectAt:#selectionOfFileFilter put: |
|
282 (holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter). |
|
283 selectedFileFilter := '*'. |
|
284 ]. |
|
285 ^ holder |
|
286 ! ! |
|
287 |
|
288 !DirectoryView methodsFor:'callbacks'! |
|
289 |
|
290 fileDoubleClicked |
|
291 |
|
292 fileDoubleClickAction notNil |
|
293 ifTrue: |
|
294 [ |
|
295 fileDoubleClickAction numArgs = 0 |
|
296 ifTrue: |
|
297 [ |
|
298 fileDoubleClickAction value |
|
299 ]. |
|
300 fileDoubleClickAction numArgs = 1 |
|
301 ifTrue: |
|
302 [ |
|
303 fileDoubleClickAction value: self selectionOfFile value baseName |
|
304 ] |
|
305 ] |
|
306 ! |
|
307 |
|
308 fileSelected |
|
309 |
|
310 fileSelectAction notNil |
|
311 ifTrue: |
|
312 [ |
|
313 fileSelectAction numArgs = 0 |
|
314 ifTrue: |
|
315 [ |
|
316 fileSelectAction value |
|
317 ]. |
|
318 fileSelectAction numArgs = 1 |
|
319 ifTrue: |
|
320 [ |
|
321 fileSelectAction value: self selectionOfFile value baseName |
|
322 ] |
|
323 ] |
|
324 ! ! |
|
325 |
|
326 !DirectoryView methodsFor:'initialization'! |
|
327 |
|
328 initialize |
|
329 |
|
330 super initialize. |
|
331 |
|
332 directory := directory ? '.' asFilename asAbsoluteFilename directoryName. |
|
333 monitoring := false. |
|
334 fileAttributes := #('File name' 'Size'). |
|
335 self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]). |
|
336 |
|
337 ! ! |
|
338 |
|
339 !DirectoryView methodsFor:'private'! |
|
340 |
|
341 readDirectory |
|
342 |
|
343 |readBlock| |
|
344 readTask notNil ifTrue: [readTask terminate]. |
|
345 readBlock := |
|
346 [ |
|
347 |dir currentFilenames oldListOfFiles| |
|
348 dir := directory asFilename. |
|
349 currentFilenames := OrderedCollection new. |
|
350 (dir isReadable and:[dir isExecutable]) ifTrue: |
|
351 [ |
|
352 self listOfFileFilters value do: |
|
353 [:filter| |
|
354 (dir filesMatchingWithoutDotDirs: filter) do: |
|
355 [:aFileName| |
|
356 |file| |
|
357 (file := dir construct: aFileName) isDirectory |
|
358 ifFalse: |
|
359 [ |
|
360 currentFilenames add: file |
|
361 ] |
|
362 ]. |
|
363 ]. |
|
364 ]. |
|
365 oldListOfFiles := self listOfFiles copy. |
|
366 (currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet do: |
|
367 [:fileName| |
|
368 (oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil |
|
369 ifTrue: |
|
370 [ |
|
371 |nearestFileRow r| |
|
372 nearestFileRow := self listOfFiles indexOf: (self listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil). |
|
373 nearestFileRow = 0 |
|
374 ifTrue: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename)] |
|
375 ifFalse: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename) beforeIndex: nearestFileRow]. |
|
376 monitoring ifTrue: [self selectionOfFile value: r]. |
|
377 ] |
|
378 ]. |
|
379 self listOfFiles reverseDo: |
|
380 [:fileRow| |
|
381 (currentFilenames includes: fileRow fileName) |
|
382 ifFalse: [self listOfFiles remove: fileRow] |
|
383 ] |
|
384 ]. |
|
385 |
|
386 monitoring |
|
387 ifTrue: |
|
388 [ |
|
389 readTask := readBlock forkAt: Processor userBackgroundPriority. |
|
390 Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1 |
|
391 ] |
|
392 ifFalse: |
|
393 [ |
|
394 Cursor wait showWhile: [readBlock value] |
|
395 ] |
|
396 ! ! |
|
397 |
|
398 !DirectoryView methodsFor:'selection'! |
|
399 |
|
400 selectedFileFilter |
|
401 |
|
402 ^selectedFileFilter |
|
403 |
|
404 ! |
|
405 |
|
406 selectedFileFilter: aString |
|
407 |
|
408 aString size = 0 ifTrue: [self listOfFileFilters remove: selectedFileFilter ifAbsent: nil]. |
|
409 selectedFileFilter := aString. |
|
410 (self listOfFileFilters includes: selectedFileFilter) not & |
|
411 selectedFileFilter notEmpty |
|
412 ifTrue: |
|
413 [ |
|
414 self listOfFileFilters addFirst: selectedFileFilter |
|
415 ]. |
|
416 (self listOfFileFilters includes: selectedFileFilter) & |
|
417 fileFilterSelectAction notNil |
|
418 ifTrue: |
|
419 [ |
|
420 fileFilterSelectAction numArgs = 0 |
|
421 ifTrue: |
|
422 [ |
|
423 fileFilterSelectAction value |
|
424 ]. |
|
425 fileFilterSelectAction numArgs = 1 |
|
426 ifTrue: |
|
427 [ |
|
428 fileFilterSelectAction value: selectedFileFilter |
|
429 ] |
|
430 ]. |
|
431 self readDirectory. |
|
432 ! ! |
|
433 |
|
434 !DirectoryView methodsFor:'startup / release'! |
|
435 |
|
436 closeRequest |
|
437 |
|
438 self release. |
|
439 |
|
440 super closeRequest |
|
441 |
|
442 ! |
|
443 |
|
444 release |
|
445 |
|
446 monitoring ifTrue: |
|
447 [ |
|
448 Processor removeTimedBlock:monitoringTimeBlock. |
|
449 monitoringTimeBlock := nil |
|
450 ]. |
|
451 |
|
452 super release |
|
453 |
|
454 ! ! |
|
455 |
|
456 !DirectoryView::FileRow class methodsFor:'resources'! |
|
457 |
|
458 HFileIcon |
|
459 |
|
460 ^self hFileIcon |
|
461 ! |
|
462 |
|
463 MakefileIcon |
|
464 "ImageEditor openOnClass:self andSelector:#MakefileIcon" |
|
465 |
|
466 <resource: #image> |
|
467 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 128 0 48 164 149 176 189 89 48 165 217 176 165 85 59 165 85 180 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
468 |
|
469 binaryFileIcon |
|
470 "ImageEditor openOnClass:self andSelector:#binaryFileIcon" |
|
471 |
|
472 <resource: #image> |
|
473 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 243 128 7 247 128 5 244 142 100 240 155 100 112 155 103 243 155 99 245 155 96 48 142 96 57 128 0 48 153 192 50 155 96 48 155 96 48 155 96 49 155 96 56 153 192 48 128 0 48 255 255 240 255 255 241]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
474 |
|
475 cFileIcon |
|
476 "ImageEditor openOnClass:self andSelector:#cFileIcon" |
|
477 |
|
478 <resource: #image> |
|
479 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 129 192 48 130 32 48 130 0 48 130 0 48 154 32 59 153 192 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
480 |
|
481 exeFileIcon |
|
482 "ImageEditor openOnClass:self andSelector:#exefileIcon" |
|
483 |
|
484 <resource: #image> |
|
485 ^(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 64 0 0 21 85 64 0 0 17 85 64 0 0 16 85 64 0 0 16 21 65 85 85 85 85 65 170 170 165 85 65 85 85 85 5 65 255 255 253 5 65 255 255 253 5 65 255 255 253 5 65 255 255 253 5 65 255 255 253 5 65 255 255 253 5 65 85 85 85 5 64 0 0 0 5 64 0 0 0 5 85 85 85 85 85 85 85 85 85 85]) ; colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color red:0.0 green:49.9992 blue:49.9992)); at:4 put:((Color grey:66.9993)); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself |
|
486 ! |
|
487 |
|
488 fileIcon |
|
489 "ImageEditor openOnClass:self andSelector:#fileIcon" |
|
490 |
|
491 <resource: #image> |
|
492 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 128 0 48 128 0 48 128 0 48 128 0 48 128 0 59 128 0 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
493 |
|
494 hFileIcon |
|
495 "ImageEditor openOnClass:self andSelector:#hFileIcon" |
|
496 |
|
497 <resource: #image> |
|
498 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 130 0 48 130 0 48 130 192 48 131 32 48 130 32 48 130 32 48 154 32 59 154 32 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
499 |
|
500 imageFileIcon |
|
501 "ImageEditor openOnClass:self andSelector:#imageFileIcon" |
|
502 |
|
503 <resource: #image> |
|
504 ^(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 1 17 17 17 17 17 16 0 0 0 1 17 17 17 17 17 16 16 0 0 1 17 17 17 17 17 16 17 0 0 1 17 17 17 17 17 16 17 16 0 1 17 17 17 17 17 16 0 0 0 1 68 71 119 74 71 215 0 0 0 1 68 71 119 164 173 125 17 17 0 1 68 71 119 74 71 215 17 17 0 1 51 54 102 57 54 198 17 17 0 1 51 54 102 147 156 108 17 17 0 1 51 54 102 57 54 198 17 17 0 1 34 37 85 40 37 181 17 17 0 1 34 37 85 130 139 91 17 17 0 1 34 37 85 40 37 181 17 17 0 1 17 17 17 17 17 17 17 17 0 1 17 17 17 17 17 17 17 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9992 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9992 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9992); add:(Color red:0.0 green:49.9992 blue:49.9992); add:(Color red:49.9992 green:49.9992 blue:0.0); add:(Color red:49.9992 green:0.0 blue:49.9992); add:(Color grey:49.9992); add:(Color grey:66.9993); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
505 |
|
506 imgFileIcon |
|
507 "ImageEditor openOnClass:self andSelector:#imgFileIcon" |
|
508 |
|
509 <resource: #image> |
|
510 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 130 0 48 128 0 48 134 209 176 130 170 176 130 170 176 130 170 176 154 170 187 154 169 180 128 0 176 128 3 176 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
511 |
|
512 linkedFileIcon |
|
513 "ImageEditor openOnClass:self andSelector:#linkedFileIcon" |
|
514 |
|
515 <resource: #image> |
|
516 ^(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 64 0 0 21 85 64 0 0 17 85 64 0 0 16 85 64 0 0 16 21 64 0 0 21 85 64 0 0 5 85 64 0 0 0 5 64 0 0 8 5 64 0 0 10 5 64 0 10 170 133 64 0 42 170 133 64 0 160 10 5 66 170 128 8 5 66 170 0 0 5 64 0 0 0 5 64 0 0 0 5 85 85 85 85 85 85 85 85 85 85]) ; 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:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
517 |
|
518 lockedFileIcon |
|
519 "ImageEditor openOnClass:self andSelector:#lockedFileIcon" |
|
520 |
|
521 <resource: #image> |
|
522 ^(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 104 0 0 21 85 74 0 0 17 85 66 128 0 16 85 64 160 0 16 21 64 40 0 149 85 64 10 2 133 85 64 2 138 0 5 64 0 168 0 5 64 0 168 0 5 64 2 138 0 5 64 10 2 128 5 64 40 0 160 5 64 160 0 40 5 66 128 0 10 5 74 0 0 2 133 104 0 0 0 165 85 85 85 85 85 85 85 85 85 85]) ; 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:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
523 |
|
524 protoFileIcon |
|
525 |
|
526 ^self MakefileIcon |
|
527 ! |
|
528 |
|
529 rcFileIcon |
|
530 "ImageEditor openOnClass:self andSelector:#rcFileIcon" |
|
531 |
|
532 <resource: #image> |
|
533 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 130 152 48 131 36 48 130 32 48 130 32 48 154 36 59 154 24 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
534 |
|
535 sFileIcon |
|
536 "ImageEditor openOnClass:self andSelector:#sFileIcon" |
|
537 |
|
538 <resource: #image> |
|
539 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 0 48 128 0 48 129 128 48 130 0 48 131 0 48 129 128 48 152 128 59 155 0 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
540 |
|
541 stFileIcon |
|
542 "ImageEditor openOnClass:self andSelector:#stFileIcon" |
|
543 |
|
544 <resource: #image> |
|
545 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 16 48 128 16 48 129 188 48 130 16 48 131 16 48 129 144 48 152 144 59 155 12 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! |
|
546 |
|
547 stcFileIcon |
|
548 "ImageEditor openOnClass:self andSelector:#stcFileIcon" |
|
549 |
|
550 <resource: #image> |
|
551 ^(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 249 128 7 240 128 5 242 128 4 240 128 4 112 128 7 240 128 3 248 128 32 48 128 32 48 129 243 48 130 36 176 131 36 48 129 164 48 152 164 187 155 51 52 128 0 48 128 0 48 255 255 240 255 255 240]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 252 0 255 254 0 255 255 0 255 255 128 255 255 192 255 255 224 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 255 255 240 127 255 240]) ; yourself); yourself! ! |
|
552 |
|
553 !DirectoryView::FileRow methodsFor:'accessing'! |
|
554 |
|
555 baseName |
|
556 |
|
557 ^baseName ? (baseName := fileName baseName) |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 ! |
|
566 |
|
567 fileName |
|
568 |
|
569 ^fileName |
|
570 ! |
|
571 |
|
572 fileName: aFileName |
|
573 |
|
574 fileName := aFileName. |
|
575 self validateAttributes |
|
576 ! |
|
577 |
|
578 group |
|
579 |
|
580 ^group |
|
581 ! |
|
582 |
|
583 iconOn:aGC |
|
584 |
|
585 (aGC registeredImageAt:iconKey) isNil |
|
586 ifTrue: |
|
587 [ |
|
588 ((iconKey == #imageFileIcon) and: [size < 50000]) |
|
589 ifTrue: |
|
590 [ |
|
591 Object errorSignal handle: [:ex|] |
|
592 do: |
|
593 [ |
|
594 |image| |
|
595 (image := Image fromFile: fileName name) notNil |
|
596 ifTrue: |
|
597 [ |
|
598 image extent y > 22 |
|
599 ifTrue: |
|
600 [ |
|
601 image := image magnifiedBy: 22/image extent y |
|
602 ]. |
|
603 (aGC registeredImageAt: (iconKey := fileName name asSymbol)) isNil |
|
604 ifTrue: |
|
605 [ |
|
606 aGC registerImage: image key: iconKey |
|
607 ] |
|
608 ] |
|
609 ] |
|
610 ] |
|
611 ifFalse: |
|
612 [ |
|
613 aGC registerImage: (self class perform: iconKey) key: iconKey |
|
614 ] |
|
615 ]. |
|
616 ^aGC registeredImageAt: iconKey |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 ! |
|
622 |
|
623 modified |
|
624 |
|
625 ^modified |
|
626 ! |
|
627 |
|
628 owner |
|
629 |
|
630 ^owner |
|
631 ! |
|
632 |
|
633 permissions |
|
634 |
|
635 ^permissions |
|
636 ! |
|
637 |
|
638 size |
|
639 |
|
640 ^size |
|
641 ! ! |
|
642 |
|
643 !DirectoryView::FileRow methodsFor:'private'! |
|
644 |
|
645 validateAttributes |
|
646 |
|
647 |info mode| |
|
648 permissions := String new:9 withAll:$-. |
|
649 |
|
650 (info := fileName info) isNil |
|
651 ifTrue: |
|
652 [ |
|
653 iconKey := #lockedFileIcon. |
|
654 size := owner := group := '?'. |
|
655 ^ self |
|
656 ]. |
|
657 size := info size. |
|
658 modified := info modified printString. |
|
659 owner := OperatingSystem getUserNameFromID: info uid. |
|
660 group := OperatingSystem getGroupNameFromID: info gid. |
|
661 mode := info mode. |
|
662 |
|
663 1 to:9 by:3 do:[:i| |
|
664 #((0 $x) (1 $w) (2 $r)) do: |
|
665 [:m| |
|
666 (mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last] |
|
667 ] |
|
668 ]. |
|
669 |
|
670 fileName isReadable |
|
671 ifTrue: |
|
672 [ |
|
673 info type == #symbolicLink |
|
674 ifTrue: |
|
675 [ |
|
676 ^iconKey := #linkedFileIcon |
|
677 ] |
|
678 ifFalse: |
|
679 [ |
|
680 ((DirectoryView::FileRow class implements: (iconKey := (fileName suffix, 'FileIcon') asSymbol)) |
|
681 or: |
|
682 [DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)]) |
|
683 ifFalse: |
|
684 [ |
|
685 iconKey := #fileIcon. |
|
686 (Image isImageFileSuffix:fileName suffix) |
|
687 ifTrue: |
|
688 [ |
|
689 ^iconKey := #imageFileIcon |
|
690 ]. |
|
691 (fileName suffix = 'o') | (fileName suffix = 'so') |
|
692 ifTrue: |
|
693 [ |
|
694 ^iconKey := #binaryFileIcon |
|
695 ]. |
|
696 |
|
697 fileName isExecutableProgram |
|
698 ifTrue: |
|
699 [ |
|
700 ^iconKey := #exeFileIcon |
|
701 ] |
|
702 ] |
|
703 ] |
|
704 ] |
|
705 ifFalse: |
|
706 [ |
|
707 ^iconKey := #lockedFileIcon |
|
708 ]. |
|
709 |
|
710 |
|
711 ! ! |
|
712 |
|
713 !DirectoryView class methodsFor:'documentation'! |
|
714 |
|
715 version |
|
716 ^ '$Header$' |
|
717 ! ! |