author | Claus Gittinger <cg@exept.de> |
Fri, 15 Nov 2002 12:24:35 +0100 | |
changeset 4252 | 9e1f4b2eeedd |
parent 4236 | 0a2732929a41 |
child 4254 | 3b184dbdb7de |
permissions | -rw-r--r-- |
3892 | 1 |
" |
2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
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 |
"{ Package: 'stx:libtool' }" |
|
14 |
||
15 |
AbstractFileBrowser subclass:#FileBrowserV2 |
|
4252 | 16 |
instanceVariableNames:'fileEntryFieldHolder pathEntryField previewProcess' |
4173 | 17 |
classVariableNames:'' |
3914 | 18 |
poolDictionaries:'' |
19 |
category:'Interface-Tools-File' |
|
3892 | 20 |
! |
21 |
||
4223
170e44ddba6e
after rename reread directory not change filename directly anymore
penk
parents:
4217
diff
changeset
|
22 |
ApplicationModel subclass:#SettingDialog |
4214 | 23 |
instanceVariableNames:'' |
24 |
classVariableNames:'' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:FileBrowserV2 |
|
27 |
! |
|
28 |
||
3892 | 29 |
!FileBrowserV2 class methodsFor:'documentation'! |
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
FileBrowserV2 is based on Filebrowser created by Claus Gittinger |
|
48 |
||
49 |
WARNING: files edited with FileBrowser will have leading spaces (multiple-8) |
|
50 |
being replaced by tabs. If tabs are to be preserved at other |
|
51 |
positions (for example, sendmail-config files) they will be |
|
52 |
corrupt after being written. |
|
53 |
||
54 |
[instance variables]: |
|
55 |
||
56 |
checkDelta <Integer> number of seconds of check interval |
|
57 |
(looks ever so often if shown directory |
|
58 |
has changed). You may make this number |
|
59 |
higher, if your network-times are |
|
60 |
incorrect and thus, the filebrowser |
|
61 |
checks too often. |
|
62 |
||
63 |
compressTabs <Boolean> if true, leading spaces will be |
|
64 |
replaced by tabs when saving text |
|
65 |
||
66 |
some of the defaults (long/short list etc.) can be set by the resource file; |
|
67 |
see FileBrowser>>initialize for more details.. |
|
68 |
||
69 |
[author:] |
|
70 |
Christian Penk |
|
71 |
||
72 |
[start with:] |
|
73 |
FileBrowserV2 open |
|
74 |
" |
|
75 |
! ! |
|
76 |
||
77 |
!FileBrowserV2 class methodsFor:'instance creation'! |
|
78 |
||
79 |
on:aDirectoryPath |
|
80 |
"return a new FileBrowserV2 in a pathname" |
|
81 |
||
4015 | 82 |
|instance files| |
83 |
instance := self new createBuilder. |
|
4172 | 84 |
aDirectoryPath isCollection ifTrue:[ |
85 |
files := aDirectoryPath |
|
86 |
] ifFalse:[ |
|
87 |
files := Array with:aDirectoryPath. |
|
88 |
]. |
|
3907 | 89 |
instance currentFileNameHolder value:files. |
3892 | 90 |
^ instance |
91 |
||
92 |
"/ | instance builder| |
|
93 |
"/ |
|
94 |
"/ builder := super open. |
|
95 |
"/ instance := builder application. |
|
96 |
"/ instance currentFileNameHolder value:aDirectoryPath. |
|
97 |
"/ ^ instance |
|
98 |
||
99 |
" |
|
100 |
(FileBrowserV2 on:'/usr/local/bin') open |
|
101 |
(FileBrowserV2 on:'/etc' ) open |
|
102 |
(FileBrowserV2 on:'..' ) open |
|
103 |
(FileBrowserV2 on:'.' ) open |
|
104 |
" |
|
105 |
! |
|
106 |
||
107 |
open |
|
108 |
"start a new FileBrowserV2" |
|
109 |
||
110 |
| instance | |
|
111 |
instance := self new. |
|
112 |
instance open. |
|
113 |
^ instance |
|
114 |
" |
|
115 |
FileBrowserV2 openOn:'/etc' withExtent:800@600 |
|
116 |
FileBrowserV2 openOn:'..' withExtent:200@300 |
|
117 |
FileBrowserV2 openOn:'.' withExtent:1024@768 |
|
118 |
" |
|
119 |
! |
|
120 |
||
121 |
openOn:aDirectoryPath |
|
122 |
"start a new FileBrowserV2 in a pathname" |
|
123 |
||
124 |
| instance| |
|
125 |
instance := self on:aDirectoryPath asFilename. |
|
126 |
^ instance open. |
|
127 |
" |
|
128 |
FileBrowserV2 openOn:'/etc' |
|
129 |
FileBrowserV2 openOn:'..' |
|
130 |
FileBrowserV2 openOn:'.' |
|
131 |
" |
|
132 |
! |
|
133 |
||
134 |
openOn:aDirectoryPath withExtent:extent |
|
135 |
"start a new FileBrowserV2 in a pathname" |
|
136 |
||
137 |
| instance builder| |
|
138 |
instance := self on:aDirectoryPath. |
|
139 |
builder := instance open. |
|
140 |
builder window extent:extent. |
|
141 |
^ instance |
|
142 |
" |
|
143 |
FileBrowserV2 openOn:'/etc' withExtent:800@600 |
|
144 |
FileBrowserV2 openOn:'..' withExtent:200@300 |
|
145 |
FileBrowserV2 openOn:'.' withExtent:1024@768 |
|
146 |
" |
|
147 |
! |
|
148 |
||
149 |
openWithAspects:someAspects withExtent:extent |
|
150 |
"start a new FileBrowserV2 in a pathname" |
|
151 |
||
152 |
|dir clone| |
|
153 |
||
154 |
dir := someAspects at:#currentFileNameHolder ifAbsent:nil. |
|
155 |
clone := self openOn:(dir value) withExtent:extent. |
|
156 |
||
157 |
" |
|
158 |
FileBrowserV2 openOn:'/etc' withExtent:800@600 |
|
159 |
FileBrowserV2 openOn:'..' withExtent:200@300 |
|
160 |
FileBrowserV2 openOn:'.' withExtent:1024@768 |
|
161 |
" |
|
162 |
! ! |
|
163 |
||
164 |
!FileBrowserV2 class methodsFor:'class initialization'! |
|
165 |
||
4027 | 166 |
applicationIcon |
167 |
^ NewLauncher startNewFileBrowserIcon |
|
168 |
! |
|
169 |
||
3892 | 170 |
clearHistoryIcon |
171 |
^ Icon deleteIcon |
|
172 |
! |
|
173 |
||
174 |
initialize |
|
175 |
||
176 |
self installInLauncher. |
|
177 |
! |
|
178 |
||
179 |
initializeDefaultCommands |
|
180 |
DefaultCommandPerMIME := Dictionary new. |
|
181 |
||
182 |
DefaultCommandPerMIME at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'. |
|
183 |
DefaultCommandPerMIME at:'application/pdf' put:'acroread %1'. |
|
184 |
||
185 |
" |
|
186 |
self initializeDefaultCommands |
|
187 |
" |
|
188 |
! |
|
189 |
||
190 |
installInLauncher |
|
191 |
"add myself to the launcher menu and toolBar" |
|
192 |
||
3914 | 193 |
|menuItem icon action currentLauncher| |
3892 | 194 |
|
195 |
FileBrowserV2 isNil ifTrue:[^ self]. |
|
196 |
||
197 |
action := [FileBrowserV2 open]. |
|
198 |
||
4027 | 199 |
icon := self applicationIcon. "/ self defaultIcon magnifiedTo:28@28. |
3892 | 200 |
|
201 |
menuItem := MenuItem new |
|
4037 | 202 |
translateLabel: true; |
3892 | 203 |
value: action; |
204 |
isButton: false; |
|
4037 | 205 |
label:'File Browser V2' icon:icon; |
3892 | 206 |
nameKey: #fileBrowserV2; |
207 |
activeHelpKey: #fileBrowserV2; |
|
208 |
submenuChannel: #menuFileHistory; |
|
209 |
showBusyCursorWhilePerforming:true. |
|
210 |
||
211 |
NewLauncher addMenuItem:menuItem in:'menu.file' position:#( #before #fileBrowser) space:true. |
|
212 |
||
213 |
menuItem := MenuItem new |
|
4037 | 214 |
translateLabel: true; |
3892 | 215 |
value: action; |
216 |
isButton: true; |
|
4037 | 217 |
"label:'File Browser V2'" icon:icon; |
3892 | 218 |
nameKey: #fileBrowserV2; |
219 |
activeHelpKey: #fileBrowserV2; |
|
220 |
submenuChannel: #menuFileHistory; |
|
221 |
showBusyCursorWhilePerforming:true. |
|
222 |
||
223 |
NewLauncher addMenuItem:menuItem in:'toolbar' position:#( #before #fileBrowser) space:false. |
|
224 |
||
3918 | 225 |
currentLauncher := NewLauncher current. |
3914 | 226 |
currentLauncher notNil ifTrue:[ |
227 |
currentLauncher fileBrowserItemVisible value:false |
|
228 |
]. |
|
3908 | 229 |
|
3892 | 230 |
" |
231 |
self installInLauncher |
|
232 |
self removeFromLauncher |
|
233 |
" |
|
234 |
! |
|
235 |
||
236 |
removeFromLauncher |
|
237 |
"/ |
|
238 |
"/ remove myself from the launcher menu |
|
239 |
"/ |
|
240 |
||
3914 | 241 |
|currentLauncher| |
242 |
||
3892 | 243 |
NewLauncher isNil ifTrue:[^ self]. |
3908 | 244 |
NewLauncher removeUserTool:#fileBrowserV2. |
3918 | 245 |
currentLauncher := NewLauncher current. |
3914 | 246 |
currentLauncher notNil ifTrue:[ |
247 |
currentLauncher fileBrowserItemVisible value:false |
|
248 |
]. |
|
3892 | 249 |
|
250 |
" |
|
251 |
self removeFromLauncher |
|
252 |
" |
|
253 |
! ! |
|
254 |
||
255 |
!FileBrowserV2 class methodsFor:'defaults'! |
|
256 |
||
257 |
entryFieldEndStringForMultipleSelection |
|
258 |
||
259 |
^ ('[*]') |
|
260 |
! ! |
|
261 |
||
262 |
!FileBrowserV2 class methodsFor:'help specs'! |
|
263 |
||
264 |
flyByHelpSpec |
|
265 |
<resource: #help> |
|
266 |
||
267 |
|spec| |
|
268 |
||
269 |
spec := super flyByHelpSpec addPairsFrom:#( |
|
270 |
||
271 |
#addTerminal |
|
272 |
'Shell Terminal' |
|
273 |
||
4236 | 274 |
#make |
275 |
'Make' |
|
276 |
||
3892 | 277 |
#searchFile |
278 |
'Search a File' |
|
279 |
||
280 |
#directoryUp |
|
4060 | 281 |
'Directory Up' |
3892 | 282 |
|
283 |
#directoryBack |
|
4060 | 284 |
'Directory Back' |
3892 | 285 |
|
286 |
#copyFile |
|
4060 | 287 |
'Copy File' |
3892 | 288 |
|
289 |
#cutFile |
|
4060 | 290 |
'Cut File' |
3892 | 291 |
|
292 |
#fileHome |
|
4060 | 293 |
'Home Directory' |
3892 | 294 |
|
295 |
#pasteFile |
|
296 |
'PasteFile' |
|
297 |
||
298 |
#deleteFile |
|
4060 | 299 |
'Delete File' |
3892 | 300 |
|
301 |
#fileIn |
|
4060 | 302 |
'File In' |
3892 | 303 |
|
304 |
#directoryForward |
|
4060 | 305 |
'Directory Forward' |
3892 | 306 |
|
307 |
#directoryHistory |
|
308 |
'Directory' |
|
309 |
||
310 |
#fileHistory |
|
4060 | 311 |
'File History' |
3892 | 312 |
|
313 |
#hideToolBar |
|
314 |
'Hide Toolbar' |
|
315 |
||
316 |
#hideFilenameEntryField |
|
317 |
'Hide Filename Field' |
|
318 |
||
3980 | 319 |
#showFileDetails |
320 |
'Show File Details' |
|
321 |
||
322 |
#hideFileDetails |
|
323 |
'Hide File Details' |
|
324 |
||
325 |
#toggleDetails |
|
326 |
'Show/Hide File Details' |
|
327 |
||
3892 | 328 |
). |
329 |
||
330 |
^ spec. |
|
3980 | 331 |
! |
332 |
||
333 |
helpSpec |
|
334 |
"This resource specification was automatically generated |
|
335 |
by the UIHelpTool of ST/X." |
|
336 |
||
337 |
"Do not manually edit this!! If it is corrupted, |
|
338 |
the UIHelpTool may not be able to read the specification." |
|
339 |
||
340 |
" |
|
341 |
UIHelpTool openOnClass:FileBrowserV2 |
|
342 |
" |
|
343 |
||
344 |
<resource: #help> |
|
345 |
||
346 |
^super helpSpec addPairsFrom:#( |
|
347 |
||
348 |
||
349 |
) |
|
3892 | 350 |
! ! |
351 |
||
352 |
!FileBrowserV2 class methodsFor:'icon'! |
|
353 |
||
354 |
defaultIcon |
|
355 |
"This resource specification was automatically generated |
|
356 |
by the ImageEditor of ST/X." |
|
357 |
||
358 |
"Do not manually edit this!! If it is corrupted, |
|
359 |
the ImageEditor may not be able to read the specification." |
|
360 |
||
361 |
" |
|
362 |
self defaultIcon inspect |
|
363 |
ImageEditor openOnClass:self andSelector:#defaultIcon |
|
364 |
" |
|
365 |
||
366 |
<resource: #image> |
|
367 |
||
368 |
^Icon |
|
369 |
constantNamed:#'FileBrowserV2 class defaultIcon' |
|
370 |
ifAbsentPut:[(Depth4Image new) width: 28; height: 28; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
371 |
@@@@@@@@@@@@@@@@@@@@CLA&Y&Y&Y&X@@ADP@@@L0F@@@@@@A @ADAD@@@3@XN;.;.8F@ADPDQ@@CLA ;.@@@@@@D@@@D@@L0FC.8O[6=/@QDADP@@3@X@; |
|
372 |
[6=/[0DPDP@@CLA DNC6<@@F<ADP@@@L0F@A@F= [0= @@@@@@3@X@@P=/[6=/@@@@@@CLA @@A/[6=/X@@@@@@L0FC0@O[6=/[0@@@@@@3@XF<@@@@@@@@@ |
|
373 |
@@@@CLA = @@@@@@@@@@@@@L0FA/[6=/A @@@@@@@@3@XO[6=/XF@@@@@@@@CLA @@@@@@X@@@@@@@@L0FY&Y&Y&Y @@@@@@@@C@Y&Y&Y&Y&@@@@@@@@@@@@ |
|
374 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@N@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
375 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@C @b') ; 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 127 127 127 170 170 170]; mask:((Depth1Image new) width: 28; height: 28; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
376 |
O??# C??9<@??>? O???<C????@????0O???8C???<@???>@O??<@C???@@???0@O??<@C??8@@??>@@O?? @C??8@@??>@@G?? @@??8@@@@@@@G.P=0AAD |
|
377 |
HP@PQBD@GDP8 AADHD@PQBA@DN^=0@@a') ; yourself); yourself] |
|
378 |
! |
|
379 |
||
380 |
hideFilenameEntryFieldIcon |
|
381 |
<resource: #programImage> |
|
382 |
||
383 |
^ ToolbarIconLibrary hideToolbarIconH14 |
|
384 |
! |
|
385 |
||
386 |
hideToolBarIcon |
|
387 |
<resource: #programImage> |
|
388 |
||
389 |
^ ToolbarIconLibrary hideToolbarIconH26 |
|
390 |
! ! |
|
391 |
||
3980 | 392 |
!FileBrowserV2 class methodsFor:'image specs'! |
393 |
||
394 |
viewDetailsIcon |
|
395 |
"This resource specification was automatically generated |
|
396 |
by the ImageEditor of ST/X." |
|
397 |
||
398 |
"Do not manually edit this!! If it is corrupted, |
|
399 |
the ImageEditor may not be able to read the specification." |
|
400 |
||
401 |
" |
|
402 |
self viewDetailsIcon inspect |
|
403 |
ImageEditor openOnClass:self andSelector:#viewDetailsIcon |
|
404 |
Icon flushCachedIcons |
|
405 |
" |
|
406 |
||
407 |
<resource: #image> |
|
408 |
||
409 |
^Icon |
|
410 |
constantNamed:#'FileBrowserV2 class viewDetailsIcon' |
|
411 |
ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@]+X@@@@@]+X@@@@@]+X@@@@@]+X@@@@@@@@b') ; yourself); yourself] |
|
412 |
! |
|
413 |
||
414 |
viewNoDetailsIcon |
|
415 |
"This resource specification was automatically generated |
|
416 |
by the ImageEditor of ST/X." |
|
417 |
||
418 |
"Do not manually edit this!! If it is corrupted, |
|
419 |
the ImageEditor may not be able to read the specification." |
|
420 |
||
421 |
" |
|
422 |
self viewNoDetailsIcon inspect |
|
423 |
ImageEditor openOnClass:self andSelector:#viewNoDetailsIcon |
|
424 |
Icon flushCachedIcons |
|
425 |
" |
|
426 |
||
427 |
<resource: #image> |
|
428 |
||
429 |
^Icon |
|
430 |
constantNamed:#'FileBrowserV2 class viewNoDetailsIcon' |
|
431 |
ifAbsentPut:[(Depth1Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@A<@@@@@@A<@@@@@@A<@@@@@@A<@@@@@@@@@b') ; yourself); yourself] |
|
432 |
! ! |
|
433 |
||
3892 | 434 |
!FileBrowserV2 class methodsFor:'interface specs'! |
435 |
||
436 |
windowSpec |
|
437 |
"This resource specification was automatically generated |
|
438 |
by the UIPainter of ST/X." |
|
439 |
||
440 |
"Do not manually edit this!! If it is corrupted, |
|
441 |
the UIPainter may not be able to read the specification." |
|
442 |
||
443 |
" |
|
444 |
UIPainter new openOnClass:FileBrowserV2 andSelector:#windowSpec |
|
445 |
FileBrowserV2 new openInterface:#windowSpec |
|
446 |
FileBrowserV2 open |
|
447 |
" |
|
448 |
||
449 |
<resource: #canvas> |
|
450 |
||
451 |
^ |
|
452 |
#(#FullSpec |
|
453 |
#name: #windowSpec |
|
454 |
#window: |
|
455 |
#(#WindowSpec |
|
456 |
#label: #FileBrowser |
|
457 |
#name: #FileBrowser |
|
458 |
#min: #(#Point 10 10) |
|
4252 | 459 |
#bounds: #(#Rectangle 16 46 816 646) |
3892 | 460 |
#menu: #mainMenu |
4027 | 461 |
#icon: #applicationIcon |
3892 | 462 |
) |
463 |
#component: |
|
464 |
#(#SpecCollection |
|
465 |
#collection: #( |
|
466 |
#(#ViewSpec |
|
467 |
#name: 'ToolbarBox' |
|
468 |
#layout: #(#LayoutFrame 0 0 0 0 0 1 30 0) |
|
469 |
#level: 0 |
|
470 |
#visibilityChannel: #toolBarVisibleHolder |
|
471 |
#component: |
|
472 |
#(#SpecCollection |
|
473 |
#collection: #( |
|
474 |
#(#ActionButtonSpec |
|
475 |
#label: 'hideToolBarIcon' |
|
476 |
#name: 'HideToolBarButton' |
|
477 |
#layout: #(#LayoutFrame 0 0 0 0 13 0 30 0) |
|
478 |
#activeHelpKey: #hideToolBar |
|
479 |
#hasCharacterOrientedLabel: false |
|
480 |
#translateLabel: true |
|
481 |
#model: #hideToolbar |
|
482 |
#postBuildCallback: #hideToolBarButtonCreated: |
|
483 |
) |
|
484 |
#(#MenuPanelSpec |
|
485 |
#name: 'ToolBar' |
|
486 |
#layout: #(#LayoutFrame 13 0 0 0 0 1 30 0) |
|
487 |
#menu: #toolBarMainMenu |
|
488 |
#textDefault: true |
|
489 |
) |
|
490 |
) |
|
491 |
||
492 |
) |
|
493 |
) |
|
494 |
#(#ViewSpec |
|
495 |
#name: 'FilenameEntryFieldBox' |
|
496 |
#layout: #(#LayoutFrame 0 0 30 0 0 1 55 0) |
|
497 |
#level: 0 |
|
498 |
#visibilityChannel: #filenameEntryFieldVisibleHolder |
|
499 |
#component: |
|
500 |
#(#SpecCollection |
|
501 |
#collection: #( |
|
502 |
#(#ActionButtonSpec |
|
503 |
#label: 'hideFilenameEntryFieldIcon' |
|
504 |
#name: 'HideFilenameEntryFieldButton' |
|
505 |
#layout: #(#LayoutFrame 0 0 0 0 13 0 0 1) |
|
506 |
#activeHelpKey: #hideFilenameEntryField |
|
507 |
#hasCharacterOrientedLabel: false |
|
508 |
#translateLabel: true |
|
509 |
#model: #hideFilenameEntryField |
|
510 |
#postBuildCallback: #hideFilenameEntryFieldButtonCreated: |
|
511 |
) |
|
512 |
#(#ViewSpec |
|
513 |
#name: 'Box1' |
|
514 |
#layout: #(#LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0) |
|
515 |
#level: 1 |
|
516 |
#component: |
|
517 |
#(#SpecCollection |
|
518 |
#collection: #( |
|
519 |
#(#VariableHorizontalPanelSpec |
|
520 |
#name: 'VariableHorizontalPanel1' |
|
521 |
#layout: #(#LayoutFrame 1 0.0 1 0.0 -1 1.0 -1 1.0) |
|
522 |
#level: 0 |
|
523 |
#showHandle: true |
|
524 |
#component: |
|
525 |
#(#SpecCollection |
|
526 |
#collection: #( |
|
527 |
#(#FilenameInputFieldSpec |
|
528 |
#name: 'FilenameEntryField' |
|
529 |
#level: 1 |
|
530 |
#model: #fileEntryFieldHolder |
|
531 |
#acceptOnPointerLeave: false |
|
532 |
#postBuildCallback: #postBuildPathField: |
|
533 |
) |
|
534 |
#(#ViewSpec |
|
535 |
#name: 'FilterBox' |
|
536 |
#component: |
|
537 |
#(#SpecCollection |
|
538 |
#collection: #( |
|
539 |
#(#LabelSpec |
|
540 |
#label: 'Filter:' |
|
541 |
#name: 'Filter' |
|
542 |
#layout: #(#LayoutFrame 0 0 0 0 40 0 0 1) |
|
543 |
#translateLabel: true |
|
544 |
#adjust: #left |
|
545 |
#postBuildCallback: #postBuildPathViewBox: |
|
546 |
) |
|
547 |
#(#ComboBoxSpec |
|
548 |
#name: 'FilterSelectionBox' |
|
549 |
#layout: #(#LayoutFrame 40 0 0 0 0 1 0 1) |
|
550 |
#model: #filterModel |
|
551 |
#immediateAccept: true |
|
552 |
#acceptOnPointerLeave: false |
|
553 |
#comboList: #filterListModel |
|
554 |
) |
|
555 |
) |
|
556 |
||
557 |
) |
|
558 |
#postBuildCallback: #postBuildPathViewBox: |
|
559 |
) |
|
560 |
) |
|
561 |
||
562 |
) |
|
563 |
#handles: #(#Any 0.8 1.0) |
|
564 |
#postBuildCallback: #postBuildPathViewBox: |
|
565 |
) |
|
566 |
) |
|
567 |
||
568 |
) |
|
569 |
#postBuildCallback: #postBuildPathViewBox: |
|
570 |
) |
|
571 |
) |
|
572 |
||
573 |
) |
|
574 |
) |
|
575 |
#(#ViewSpec |
|
576 |
#name: 'BrowserBox' |
|
577 |
#layout: #(#LayoutFrame 0 0.0 55 0 0 1.0 -20 1) |
|
578 |
#level: 0 |
|
579 |
#component: |
|
580 |
#(#SpecCollection |
|
581 |
#collection: #( |
|
582 |
#(#'FileBrowserV2UISpecifications::PanelSpec' |
|
583 |
#name: 'VerticalPanel' |
|
584 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
585 |
#level: 0 |
|
586 |
#whichView: #last |
|
587 |
#orientation: #vertical |
|
588 |
#visibility: #viewNoteBookApplicationHolder |
|
589 |
#component: |
|
590 |
#(#SpecCollection |
|
591 |
#collection: #( |
|
592 |
#(#'FileBrowserV2UISpecifications::PanelSpec' |
|
593 |
#name: 'HorizontalPanel' |
|
594 |
#level: 0 |
|
595 |
#whichView: #first |
|
596 |
#orientation: #horizontal |
|
4201 | 597 |
#visibility: #showDirectoryTree |
3892 | 598 |
#component: |
599 |
#(#SpecCollection |
|
600 |
#collection: #( |
|
601 |
#(#SubCanvasSpec |
|
602 |
#name: 'DirectoryTreeBrowser' |
|
603 |
#hasHorizontalScrollBar: false |
|
604 |
#hasVerticalScrollBar: false |
|
605 |
#majorKey: #DirectoryTreeBrowser |
|
606 |
#createNewApplication: true |
|
607 |
#createNewBuilder: true |
|
608 |
) |
|
609 |
#(#SubCanvasSpec |
|
610 |
#name: 'DirectoryContentsBrowser' |
|
611 |
#hasHorizontalScrollBar: false |
|
612 |
#hasVerticalScrollBar: false |
|
613 |
#majorKey: #DirectoryContentsBrowser |
|
614 |
#createNewApplication: true |
|
615 |
#createNewBuilder: true |
|
616 |
) |
|
617 |
) |
|
618 |
||
619 |
) |
|
620 |
#handles: #(#Any 0.229621 1.0) |
|
621 |
) |
|
622 |
#(#SubCanvasSpec |
|
623 |
#name: 'FileApplicationNoteBook' |
|
4018 | 624 |
#tabable: false |
3892 | 625 |
#hasHorizontalScrollBar: false |
626 |
#hasVerticalScrollBar: false |
|
627 |
#majorKey: #FileApplicationNoteBook |
|
628 |
#createNewApplication: true |
|
629 |
#createNewBuilder: true |
|
630 |
) |
|
631 |
) |
|
632 |
||
633 |
) |
|
634 |
#handles: #(#Any 0.5 1.0) |
|
635 |
) |
|
636 |
) |
|
637 |
||
638 |
) |
|
639 |
) |
|
640 |
#(#ViewSpec |
|
641 |
#name: 'Box2' |
|
642 |
#layout: #(#LayoutFrame 0 0 -20 1 0 1 0 1) |
|
643 |
#level: 0 |
|
644 |
#component: |
|
645 |
#(#SpecCollection |
|
646 |
#collection: #( |
|
647 |
#(#LabelSpec |
|
648 |
#label: 'NotifyLabel' |
|
649 |
#name: 'NotifyLabel' |
|
4018 | 650 |
#layout: #(#LayoutFrame 1 0.0 1 0.0 -50 1 1 1.0) |
3892 | 651 |
#level: -1 |
652 |
#translateLabel: true |
|
653 |
#labelChannel: #notifyChannel |
|
654 |
#adjust: #left |
|
655 |
) |
|
4018 | 656 |
#(#LabelSpec |
657 |
#label: 'Shown Files' |
|
658 |
#name: 'Label1' |
|
659 |
#layout: #(#LayoutFrame -50 1 1 0.0 1 1 1 1.0) |
|
660 |
#level: -1 |
|
661 |
#translateLabel: true |
|
662 |
#labelChannel: #shownFiles |
|
663 |
#adjust: #left |
|
664 |
#postBuildCallback: #postBuildFilterBox: |
|
665 |
) |
|
3892 | 666 |
) |
667 |
||
668 |
) |
|
669 |
) |
|
4252 | 670 |
#(#LabelSpec |
671 |
#label: 'Preview' |
|
672 |
#name: 'PreviewLabel' |
|
673 |
#layout: #(#LayoutFrame 0 0.5 39 0 100 0.5 61 0) |
|
674 |
#level: 0 |
|
675 |
#borderWidth: 1 |
|
676 |
#visibilityChannel: #previewVisibleHolder |
|
677 |
#backgroundColor: #(#Color 86.9993 86.9993 86.9993) |
|
678 |
#translateLabel: true |
|
679 |
) |
|
680 |
#(#ArbitraryComponentSpec |
|
681 |
#name: 'ImagePreview' |
|
682 |
#layout: #(#LayoutFrame 0 0.5 63 0 -20 1 -57 1) |
|
683 |
#level: 1 |
|
684 |
#visibilityChannel: #previewVisibleHolder |
|
685 |
#model: #previewImageHolder |
|
686 |
#hasBorder: false |
|
687 |
#component: #ImageView |
|
688 |
) |
|
3892 | 689 |
) |
690 |
||
691 |
) |
|
692 |
) |
|
693 |
! ! |
|
694 |
||
695 |
!FileBrowserV2 class methodsFor:'menu specs'! |
|
696 |
||
697 |
mainMenu |
|
698 |
"This resource specification was automatically generated |
|
699 |
by the MenuEditor of ST/X." |
|
700 |
||
701 |
"Do not manually edit this!! If it is corrupted, |
|
702 |
the MenuEditor may not be able to read the specification." |
|
703 |
||
704 |
" |
|
705 |
MenuEditor new openOnClass:FileBrowserV2 andSelector:#mainMenu |
|
706 |
(Menu new fromLiteralArrayEncoding:(FileBrowserV2 mainMenu)) startUp |
|
707 |
" |
|
708 |
||
709 |
<resource: #menu> |
|
710 |
||
711 |
^ |
|
712 |
#(#Menu |
|
713 |
#( |
|
714 |
#(#MenuItem |
|
715 |
#label: 'Browser' |
|
716 |
#translateLabel: true |
|
717 |
#submenuChannel: #browserMenu |
|
718 |
) |
|
719 |
#(#MenuItem |
|
720 |
#label: 'Directory' |
|
721 |
#translateLabel: true |
|
722 |
#submenuChannel: #directoryMenu |
|
723 |
) |
|
724 |
#(#MenuItem |
|
725 |
#label: 'File' |
|
726 |
#translateLabel: true |
|
727 |
#submenuChannel: #fileMenu |
|
728 |
) |
|
729 |
#(#MenuItem |
|
730 |
#label: 'Edit' |
|
731 |
#translateLabel: true |
|
732 |
#submenuChannel: #editMenu |
|
733 |
) |
|
734 |
#(#MenuItem |
|
735 |
#label: 'View' |
|
736 |
#translateLabel: true |
|
737 |
#submenu: |
|
738 |
#(#Menu |
|
739 |
#( |
|
740 |
#(#MenuItem |
|
3980 | 741 |
#label: 'Show' |
3892 | 742 |
#translateLabel: true |
4201 | 743 |
#submenuChannel: #showMenuSpec |
3892 | 744 |
) |
745 |
#(#MenuItem |
|
3980 | 746 |
#label: 'Sort' |
3892 | 747 |
#translateLabel: true |
748 |
#submenuChannel: #sortMenu |
|
749 |
) |
|
750 |
#(#MenuItem |
|
3980 | 751 |
#label: 'Details' |
3892 | 752 |
#translateLabel: true |
3980 | 753 |
#submenuChannel: #viewInContentsBrowserMenu |
3892 | 754 |
) |
755 |
#(#MenuItem |
|
756 |
#label: '-' |
|
757 |
) |
|
758 |
#(#MenuItem |
|
759 |
#label: 'Toolbar' |
|
760 |
#translateLabel: true |
|
761 |
#hideMenuOnActivated: false |
|
762 |
#indication: #toolBarVisibleHolder |
|
763 |
) |
|
764 |
#(#MenuItem |
|
4084 | 765 |
#label: 'Path Entry && Filter' |
3892 | 766 |
#translateLabel: true |
767 |
#hideMenuOnActivated: false |
|
768 |
#indication: #filenameEntryFieldVisibleHolder |
|
769 |
) |
|
770 |
#(#MenuItem |
|
4252 | 771 |
#label: 'Preview' |
772 |
#translateLabel: true |
|
773 |
#hideMenuOnActivated: false |
|
774 |
#indication: #previewVisibleHolder |
|
775 |
) |
|
776 |
#(#MenuItem |
|
3892 | 777 |
#label: '-' |
778 |
) |
|
779 |
#(#MenuItem |
|
780 |
#label: 'Update' |
|
781 |
#translateLabel: true |
|
782 |
) |
|
783 |
) |
|
784 |
nil |
|
785 |
nil |
|
786 |
) |
|
787 |
) |
|
788 |
#(#MenuItem |
|
789 |
#label: 'Tools' |
|
790 |
#translateLabel: true |
|
791 |
#submenuChannel: #toolsMenuSpec |
|
792 |
) |
|
793 |
#(#MenuItem |
|
794 |
#label: 'CVS' |
|
795 |
#translateLabel: true |
|
4105 | 796 |
#submenuChannel: #cvsMenu |
3892 | 797 |
) |
798 |
#(#MenuItem |
|
799 |
#label: 'Help' |
|
800 |
#translateLabel: true |
|
801 |
#startGroup: #right |
|
802 |
#submenu: |
|
803 |
#(#Menu |
|
804 |
#( |
|
805 |
#(#MenuItem |
|
806 |
#label: 'FileBrowser Documentation' |
|
807 |
#translateLabel: true |
|
808 |
) |
|
809 |
#(#MenuItem |
|
810 |
#label: '-' |
|
811 |
) |
|
812 |
#(#MenuItem |
|
813 |
#label: 'About FileBrowser...' |
|
814 |
#translateLabel: true |
|
815 |
) |
|
816 |
) |
|
817 |
nil |
|
818 |
nil |
|
819 |
) |
|
820 |
) |
|
821 |
) |
|
822 |
nil |
|
823 |
nil |
|
824 |
) |
|
825 |
! |
|
826 |
||
827 |
toolBarMainMenu |
|
828 |
"This resource specification was automatically generated |
|
829 |
by the MenuEditor of ST/X." |
|
830 |
||
831 |
"Do not manually edit this!! If it is corrupted, |
|
832 |
the MenuEditor may not be able to read the specification." |
|
833 |
||
834 |
" |
|
835 |
MenuEditor new openOnClass:FileBrowserV2 andSelector:#toolBarMainMenu |
|
836 |
(Menu new fromLiteralArrayEncoding:(FileBrowserV2 toolBarMainMenu)) startUp |
|
837 |
" |
|
838 |
||
839 |
<resource: #menu> |
|
840 |
||
841 |
^ |
|
842 |
#(#Menu |
|
843 |
#( |
|
844 |
#(#MenuItem |
|
4084 | 845 |
#activeHelpKey: #directoryUp |
846 |
#enabled: #enableDirectoryUp |
|
3892 | 847 |
#label: 'DirectoryUp' |
4084 | 848 |
#itemValue: #doGoDirectoryUp |
3892 | 849 |
#translateLabel: true |
850 |
#isButton: true |
|
4094 | 851 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrowIcon) |
3892 | 852 |
) |
853 |
#(#MenuItem |
|
854 |
#label: '' |
|
855 |
) |
|
856 |
#(#MenuItem |
|
4084 | 857 |
#activeHelpKey: #directoryBack |
858 |
#enabled: #enableBack |
|
3892 | 859 |
#label: 'Back' |
4084 | 860 |
#itemValue: #doBack |
3892 | 861 |
#translateLabel: true |
862 |
#isButton: true |
|
4084 | 863 |
#submenuChannel: #menuDirHistoryBack |
4094 | 864 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrowIcon) |
3892 | 865 |
) |
866 |
#(#MenuItem |
|
867 |
#label: '' |
|
868 |
) |
|
869 |
#(#MenuItem |
|
4084 | 870 |
#activeHelpKey: #directoryForward |
871 |
#enabled: #enableForward |
|
3892 | 872 |
#label: 'Forward' |
4084 | 873 |
#itemValue: #doForward |
3892 | 874 |
#translateLabel: true |
875 |
#isButton: true |
|
4084 | 876 |
#submenuChannel: #menuDirHistoryForward |
4094 | 877 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrowIcon) |
3892 | 878 |
) |
879 |
#(#MenuItem |
|
880 |
#label: '' |
|
881 |
) |
|
882 |
#(#MenuItem |
|
4084 | 883 |
#activeHelpKey: #fileHome |
884 |
#enabled: #enableHome |
|
3892 | 885 |
#label: 'Home' |
4084 | 886 |
#itemValue: #doGotoHomeDirectory |
3892 | 887 |
#translateLabel: true |
888 |
#isButton: true |
|
4084 | 889 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon) |
3892 | 890 |
) |
891 |
#(#MenuItem |
|
892 |
#label: '' |
|
893 |
) |
|
894 |
#(#MenuItem |
|
4084 | 895 |
#activeHelpKey: #fileHistory |
896 |
#enabled: #enableFileHistory |
|
3892 | 897 |
#label: 'File History' |
898 |
#translateLabel: true |
|
899 |
#isButton: true |
|
4084 | 900 |
#submenuChannel: #menuFileHistory |
4094 | 901 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #historyIcon) |
3892 | 902 |
) |
903 |
#(#MenuItem |
|
904 |
#label: '' |
|
905 |
) |
|
906 |
#(#MenuItem |
|
4084 | 907 |
#activeHelpKey: #copyFile |
908 |
#enabled: #hasSelection |
|
3892 | 909 |
#label: 'Copy' |
4084 | 910 |
#itemValue: #copyInDirContentsBrowser |
3892 | 911 |
#translateLabel: true |
912 |
#isButton: true |
|
4094 | 913 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #copyIcon) |
3892 | 914 |
) |
915 |
#(#MenuItem |
|
4084 | 916 |
#activeHelpKey: #cutFile |
917 |
#enabled: #hasSelection |
|
3892 | 918 |
#label: 'Cut' |
4084 | 919 |
#itemValue: #cutInDirContentsBrowser |
3892 | 920 |
#translateLabel: true |
921 |
#isButton: true |
|
4094 | 922 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #cutIcon) |
3892 | 923 |
) |
924 |
#(#MenuItem |
|
4084 | 925 |
#activeHelpKey: #pasteFile |
926 |
#enabled: #canPaste |
|
3892 | 927 |
#label: 'Paste' |
4084 | 928 |
#itemValue: #pasteFiles |
3892 | 929 |
#translateLabel: true |
930 |
#isButton: true |
|
4094 | 931 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #pasteIcon) |
3892 | 932 |
) |
933 |
#(#MenuItem |
|
4084 | 934 |
#activeHelpKey: #deleteFile |
935 |
#enabled: #hasSelection |
|
3892 | 936 |
#label: 'Delete' |
4084 | 937 |
#itemValue: #deleteInDirContentsBrowser |
3892 | 938 |
#translateLabel: true |
939 |
#isButton: true |
|
4094 | 940 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #deleteIcon) |
3892 | 941 |
) |
942 |
#(#MenuItem |
|
943 |
#label: '' |
|
944 |
) |
|
945 |
#(#MenuItem |
|
4084 | 946 |
#activeHelpKey: #fileIn |
947 |
#enabled: #hasSelection |
|
3892 | 948 |
#label: 'File In' |
4084 | 949 |
#itemValue: #fileFileIn |
3892 | 950 |
#translateLabel: true |
951 |
#isButton: true |
|
4094 | 952 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #fileInIcon) |
3892 | 953 |
) |
954 |
#(#MenuItem |
|
955 |
#label: '' |
|
956 |
) |
|
957 |
#(#MenuItem |
|
4084 | 958 |
#activeHelpKey: #searchFile |
3892 | 959 |
#label: 'Search File' |
4084 | 960 |
#itemValue: #doOpenSearchFile |
3892 | 961 |
#translateLabel: true |
962 |
#isButton: true |
|
4094 | 963 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #searchIcon) |
3892 | 964 |
) |
965 |
#(#MenuItem |
|
4084 | 966 |
#activeHelpKey: #addTerminal |
3892 | 967 |
#label: 'VT100' |
4084 | 968 |
#itemValue: #doAddTerminal |
3892 | 969 |
#translateLabel: true |
970 |
#isButton: true |
|
4094 | 971 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #shellWithoutTextIcon) |
3892 | 972 |
) |
3980 | 973 |
#(#MenuItem |
4236 | 974 |
#activeHelpKey: #make |
975 |
#enabled: #canMake |
|
976 |
#label: 'Make' |
|
977 |
#itemValue: #doMake |
|
978 |
#translateLabel: true |
|
979 |
#isButton: true |
|
980 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #makeIcon) |
|
981 |
) |
|
982 |
#(#MenuItem |
|
4084 | 983 |
#activeHelpKey: #toggleDetails |
3980 | 984 |
#label: 'viewDetails' |
4084 | 985 |
#translateLabel: true |
3980 | 986 |
#isButton: true |
987 |
#startGroup: #right |
|
4084 | 988 |
#indication: #viewDetails |
989 |
#submenuChannel: #viewDetailsMenuSpec |
|
3980 | 990 |
#labelImage: #(#ResourceRetriever nil #viewDetailsIcon) |
991 |
) |
|
3892 | 992 |
) |
993 |
nil |
|
994 |
nil |
|
995 |
) |
|
996 |
! ! |
|
997 |
||
998 |
!FileBrowserV2 methodsFor:'actions'! |
|
999 |
||
1000 |
changeFileBrowserTitleTo:aString |
|
1001 |
||
1002 |
|string| |
|
1003 |
||
1004 |
string := 'FileBrowser ', aString. |
|
1005 |
self window label:string. |
|
1006 |
! |
|
1007 |
||
1008 |
doSpawn |
|
1009 |
||
1010 |
self saveRuntimeAspectValues. |
|
1011 |
self class openWithAspects:aspects withExtent:self builder window extent. |
|
1012 |
! |
|
1013 |
||
1014 |
hideFilenameEntryField |
|
1015 |
self filenameEntryFieldVisibleHolder value:false. |
|
1016 |
! |
|
1017 |
||
1018 |
hideToolbar |
|
1019 |
self toolBarVisibleHolder value:false. |
|
3980 | 1020 |
! |
1021 |
||
1022 |
toggleFileDetailsFor:anItem |
|
1023 |
|viewDetails| |
|
1024 |
||
1025 |
viewDetails := self viewDetails value not. |
|
1026 |
self viewDetails value:viewDetails. |
|
1027 |
||
1028 |
viewDetails ifTrue:[ |
|
1029 |
anItem activeHelpKey:#hideFileDetails. |
|
1030 |
anItem label:(self class viewNoDetailsIcon). |
|
1031 |
] ifFalse:[ |
|
1032 |
anItem activeHelpKey:#showFileDetails. |
|
1033 |
anItem label:(self class viewDetailsIcon). |
|
1034 |
]. |
|
3892 | 1035 |
! ! |
1036 |
||
1037 |
!FileBrowserV2 methodsFor:'aspects'! |
|
1038 |
||
1039 |
fileEntryFieldHolder |
|
1040 |
||
1041 |
fileEntryFieldHolder isNil ifTrue:[ |
|
1042 |
fileEntryFieldHolder := ValueHolder new. |
|
1043 |
fileEntryFieldHolder addDependent:self. |
|
1044 |
]. |
|
1045 |
^ fileEntryFieldHolder. |
|
1046 |
! ! |
|
1047 |
||
4252 | 1048 |
!FileBrowserV2 methodsFor:'aspects-visibility'! |
1049 |
||
1050 |
filenameEntryFieldVisibleHolder |
|
1051 |
" aspect for show FileEntryField " |
|
1052 |
||
1053 |
^ self aspectFor:#filenameEntryFieldVisibleHolder ifAbsent:[true asValue] |
|
1054 |
! |
|
1055 |
||
1056 |
previewVisibleHolder |
|
1057 |
" aspect for show preview" |
|
1058 |
||
1059 |
^ self aspectFor:#previewVisibleHolder ifAbsent:[false asValue] |
|
1060 |
! |
|
1061 |
||
1062 |
toolBarVisibleHolder |
|
1063 |
" aspect for show toolbar" |
|
1064 |
||
1065 |
^ self aspectFor:#toolBarVisibleHolder ifAbsent:[true asValue] |
|
1066 |
! ! |
|
1067 |
||
3892 | 1068 |
!FileBrowserV2 methodsFor:'change & update'! |
1069 |
||
4011 | 1070 |
currentFileNameHolderChanged |
1071 |
||
4252 | 1072 |
|newEntryValue nSelected files| |
4011 | 1073 |
|
1074 |
files := self currentFileNameHolder value. |
|
4252 | 1075 |
nSelected := files size. |
4011 | 1076 |
|
4252 | 1077 |
nSelected == 0 ifTrue:[ |
1078 |
newEntryValue := nil. |
|
4011 | 1079 |
] ifFalse:[ |
4252 | 1080 |
nSelected == 1 ifTrue:[ |
1081 |
newEntryValue := files first. |
|
4011 | 1082 |
] ifFalse:[ |
4252 | 1083 |
newEntryValue := self getCommonForCurrentFiles. |
4011 | 1084 |
]. |
1085 |
]. |
|
4252 | 1086 |
self fileEntryFieldHolder value:newEntryValue withoutNotifying:self. |
1087 |
||
1088 |
self updatePreview. |
|
4011 | 1089 |
! |
1090 |
||
1091 |
fileEntryFieldHolderChanged |
|
1092 |
||
1093 |
(fileEntryFieldHolder value asFilename exists) ifFalse:[ pathEntryField flash. ^ self]. |
|
1094 |
self currentFileNameHolder value:(OrderedCollection with:(fileEntryFieldHolder value asFilename)). |
|
1095 |
! |
|
1096 |
||
4252 | 1097 |
selectedImage |
1098 |
|files selectedFile mime img| |
|
1099 |
||
1100 |
files := self currentFileNameHolder value. |
|
1101 |
||
1102 |
files size == 1 ifFalse:[ |
|
1103 |
^ nil |
|
1104 |
]. |
|
1105 |
selectedFile := files first. |
|
1106 |
||
1107 |
mime := MIMETypes mimeTypeForFilename:selectedFile. |
|
1108 |
(mime notNil and:[mime startsWith:'image/']) ifTrue:[ |
|
1109 |
img := Image fromFile:selectedFile. |
|
1110 |
^ img |
|
1111 |
]. |
|
1112 |
||
1113 |
^ nil. |
|
1114 |
! |
|
1115 |
||
1116 |
showPreview:image |
|
1117 |
|imgView| |
|
1118 |
||
1119 |
imgView := builder componentAt:#ImagePreview. |
|
1120 |
||
1121 |
imgView adjust:#fitBig. |
|
1122 |
imgView image:image. |
|
1123 |
! |
|
1124 |
||
3892 | 1125 |
update:something with:aParameter from:changedObject |
1126 |
||
1127 |
||
1128 |
changedObject == self fileEntryFieldHolder ifTrue:[ |
|
4011 | 1129 |
self fileEntryFieldHolderChanged. |
1130 |
^ self. |
|
3892 | 1131 |
]. |
1132 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4011 | 1133 |
super update:something with:aParameter from:changedObject. |
1134 |
self currentFileNameHolderChanged. |
|
1135 |
^ self. |
|
3892 | 1136 |
]. |
4252 | 1137 |
(changedObject == self previewVisibleHolder) ifTrue:[ |
1138 |
self updatePreview. |
|
1139 |
^ self. |
|
1140 |
]. |
|
3892 | 1141 |
(changedObject == self toolBarVisibleHolder |
1142 |
or:[changedObject == self filenameEntryFieldVisibleHolder]) ifTrue:[ |
|
1143 |
self updateToolVisibility. |
|
1144 |
^ self. |
|
1145 |
]. |
|
4085
9e58ddfa6969
sort will be triggered from the FileBrowserV2 instance not from AbstractFileBrowser anymore
penk
parents:
4084
diff
changeset
|
1146 |
(changedObject == self sortBlockProperty or:[changedObject == self sortDirectoriesBeforeFiles]) ifTrue:[ |
9e58ddfa6969
sort will be triggered from the FileBrowserV2 instance not from AbstractFileBrowser anymore
penk
parents:
4084
diff
changeset
|
1147 |
self sortFileListsBy:(self sortBlockProperty value) withReverse:false. |
9e58ddfa6969
sort will be triggered from the FileBrowserV2 instance not from AbstractFileBrowser anymore
penk
parents:
4084
diff
changeset
|
1148 |
^ self. |
9e58ddfa6969
sort will be triggered from the FileBrowserV2 instance not from AbstractFileBrowser anymore
penk
parents:
4084
diff
changeset
|
1149 |
]. |
3892 | 1150 |
|
1151 |
^ super update:something with:aParameter from:changedObject. |
|
1152 |
! |
|
1153 |
||
4252 | 1154 |
updatePreview |
1155 |
|previewLabel imgView shownImage| |
|
1156 |
||
1157 |
shownImage := nil. |
|
1158 |
imgView := builder componentAt:#ImagePreview. |
|
1159 |
previewLabel := builder componentAt:#PreviewLabel. |
|
1160 |
||
1161 |
self previewVisibleHolder value ifTrue:[ |
|
1162 |
previewProcess notNil ifTrue:[ |
|
1163 |
previewProcess terminate |
|
1164 |
]. |
|
1165 |
previewProcess := [ |
|
1166 |
|imgView oldBg shownImage lbl| |
|
1167 |
||
1168 |
oldBg := previewLabel backgroundColor. |
|
1169 |
previewLabel backgroundColor:(Color red lightened lightened). |
|
1170 |
[ |
|
1171 |
shownImage := self selectedImage. |
|
1172 |
lbl := shownImage ifNil:'Preview' ifNotNil:[ shownImage fileName asFilename baseName ]. |
|
1173 |
previewLabel label:lbl; preferredExtent:nil; forceResize. |
|
1174 |
self enqueueMessage:#'showPreview:' for:self arguments:(Array with:shownImage). |
|
1175 |
previewProcess := nil. |
|
1176 |
] ensure:[ |
|
1177 |
previewLabel backgroundColor:oldBg. |
|
1178 |
]. |
|
1179 |
] forkAt:7. |
|
1180 |
] ifFalse:[ |
|
1181 |
imgView image:nil. |
|
1182 |
]. |
|
1183 |
! |
|
1184 |
||
3892 | 1185 |
updateToolVisibility |
1186 |
|builder toolBar filenameEntryField vPanel topOffset visible d| |
|
1187 |
||
1188 |
builder := self builder. |
|
1189 |
||
1190 |
topOffset := 0. |
|
1191 |
visible := self toolBarVisibleHolder value. |
|
1192 |
visible ifTrue:[ |
|
1193 |
toolBar := builder componentAt:#ToolbarBox. |
|
1194 |
topOffset := topOffset + toolBar height. |
|
1195 |
]. |
|
1196 |
||
1197 |
visible := self filenameEntryFieldVisibleHolder value. |
|
1198 |
visible ifTrue:[ |
|
1199 |
filenameEntryField := builder componentAt:#FilenameEntryFieldBox. |
|
1200 |
d := filenameEntryField layout bottomOffset - filenameEntryField layout topOffset. |
|
1201 |
filenameEntryField layout topOffset:topOffset bottomOffset:topOffset + d. |
|
1202 |
topOffset := topOffset + filenameEntryField height. |
|
1203 |
filenameEntryField container notNil ifTrue:[ |
|
1204 |
filenameEntryField containerChangedSize. |
|
1205 |
]. |
|
1206 |
]. |
|
1207 |
||
1208 |
vPanel := builder componentAt:#BrowserBox. |
|
1209 |
vPanel layout topOffset:topOffset+1. |
|
1210 |
vPanel container notNil ifTrue:[ |
|
1211 |
vPanel containerChangedSize. |
|
1212 |
]. |
|
1213 |
! ! |
|
1214 |
||
3957 | 1215 |
!FileBrowserV2 methodsFor:'event handling'! |
1216 |
||
1217 |
processEvent:anEvent |
|
1218 |
"filter keyboard events. |
|
1219 |
Return true, if I have eaten the event" |
|
1220 |
||
1221 |
|focusView key rawKey fileName| |
|
1222 |
||
1223 |
anEvent isKeyPressEvent ifTrue:[ |
|
1224 |
focusView := anEvent targetView. |
|
1225 |
key := anEvent key. |
|
1226 |
rawKey := anEvent rawKey. |
|
1227 |
||
1228 |
(focusView isSameOrComponentOf:self window) ifTrue:[ |
|
1229 |
||
1230 |
((focusView == pathEntryField) not) ifTrue:[ ^ false]. |
|
1231 |
||
1232 |
(key == #Return) ifTrue:[ |
|
1233 |
fileName := pathEntryField list first asFilename. |
|
1234 |
(fileName exists and:[fileName isDirectory not]) ifTrue:[ |
|
4101 | 1235 |
self openApplForFile:fileName |
3957 | 1236 |
]. |
1237 |
]. |
|
1238 |
] |
|
1239 |
]. |
|
1240 |
^ false |
|
1241 |
! ! |
|
1242 |
||
3892 | 1243 |
!FileBrowserV2 methodsFor:'startup & release'! |
1244 |
||
3954 | 1245 |
closeRequest |
1246 |
||
4082 | 1247 |
(self application:#FileApplicationNoteBook do:#tryCloseApplications) not ifTrue:[ |
3954 | 1248 |
^ self |
1249 |
]. |
|
1250 |
^ super closeRequest. |
|
1251 |
! |
|
1252 |
||
3892 | 1253 |
hideFilenameEntryFieldButtonCreated:aButton |
1254 |
||
1255 |
aButton passiveLevel:(MenuPanel defaultLevel). |
|
1256 |
aButton activeLevel:-1. |
|
1257 |
aButton backgroundColor:(MenuPanel defaultBackgroundColor). |
|
1258 |
! |
|
1259 |
||
1260 |
hideToolBarButtonCreated:aButton |
|
1261 |
||
1262 |
aButton passiveLevel:(MenuPanel defaultLevel). |
|
1263 |
aButton activeLevel:-1. |
|
1264 |
aButton backgroundColor:(MenuPanel defaultBackgroundColor). |
|
1265 |
! |
|
1266 |
||
1267 |
initialize |
|
1268 |
||
1269 |
self masterApplication:nil. |
|
4022 | 1270 |
self dirHistory resetForwardBackward. |
3892 | 1271 |
! |
1272 |
||
1273 |
makeDependent |
|
4008 | 1274 |
|
4004 | 1275 |
super makeDependent. |
4085
9e58ddfa6969
sort will be triggered from the FileBrowserV2 instance not from AbstractFileBrowser anymore
penk
parents:
4084
diff
changeset
|
1276 |
self sortBlockProperty addDependent:self. |
3892 | 1277 |
self filenameEntryFieldVisibleHolder addDependent:self. |
1278 |
self toolBarVisibleHolder addDependent:self. |
|
1279 |
! |
|
1280 |
||
4018 | 1281 |
postBuildFilterBox:aWidget |
1282 |
||
1283 |
self filterValueBox value:aWidget. |
|
1284 |
self filterBackgroundColor value:aWidget backgroundColor. |
|
1285 |
! |
|
1286 |
||
3892 | 1287 |
postBuildPathField:aWidget |
1288 |
" |
|
1289 |
set the pramters that not can be changed in the window spec |
|
1290 |
" |
|
1291 |
||
3957 | 1292 |
pathEntryField := aWidget. |
3892 | 1293 |
aWidget level:-1. |
1294 |
||
1295 |
"/ sClr := aWidget shadowColor. |
|
1296 |
"/ lClr := aWidget lightColor. |
|
1297 |
"/ sClr := (self builder componentAt:#ToolBar) shadowColor. |
|
1298 |
"/ lClr := (self builder componentAt:#ToolBar) lightColor. |
|
1299 |
||
1300 |
"/ aWidget backgroundColor:(aWidget superView viewBackground). |
|
1301 |
"/ aWidget shadowColor:sClr. |
|
1302 |
! |
|
1303 |
||
1304 |
postBuildPathViewBox:aWidget |
|
1305 |
||
1306 |
aWidget backgroundColor:(MenuPanel defaultBackgroundColor). |
|
1307 |
! |
|
1308 |
||
1309 |
postBuildWith:aBuilder |
|
1310 |
||
1311 |
super postBuildWith:aBuilder. |
|
3980 | 1312 |
self updateToolVisibility. |
3892 | 1313 |
! |
1314 |
||
1315 |
postOpenWith:aBuilder |
|
1316 |
||
4071 | 1317 |
super postOpenWith:aBuilder. |
1318 |
self abstractCurrentFileNameHolderChanged. |
|
1319 |
self currentFileNameHolderChanged. |
|
4027 | 1320 |
|
3957 | 1321 |
self windowGroup addPreEventHook:self. |
3892 | 1322 |
! |
1323 |
||
1324 |
release |
|
1325 |
||
1326 |
self saveRuntimeAspectValues. |
|
1327 |
^ super release |
|
1328 |
! ! |
|
1329 |
||
4214 | 1330 |
!FileBrowserV2::SettingDialog class methodsFor:'interface specs'! |
1331 |
||
1332 |
windowSpec |
|
1333 |
"This resource specification was automatically generated |
|
1334 |
by the UIPainter of ST/X." |
|
1335 |
||
1336 |
"Do not manually edit this!! If it is corrupted, |
|
1337 |
the UIPainter may not be able to read the specification." |
|
1338 |
||
1339 |
" |
|
1340 |
UIPainter new openOnClass:FileBrowserV2::SettingDialog andSelector:#windowSpec |
|
1341 |
FileBrowserV2::SettingDialog new openInterface:#windowSpec |
|
1342 |
FileBrowserV2::SettingDialog open |
|
1343 |
" |
|
1344 |
||
1345 |
<resource: #canvas> |
|
1346 |
||
1347 |
^ |
|
1348 |
#(#FullSpec |
|
1349 |
#name: #windowSpec |
|
1350 |
#window: |
|
1351 |
#(#WindowSpec |
|
1352 |
#label: 'FileBrowser V2 Settings' |
|
1353 |
#name: 'FileBrowser V2 Settings' |
|
1354 |
#min: #(#Point 10 10) |
|
1355 |
#max: #(#Point 1024 768) |
|
1356 |
#bounds: #(#Rectangle 12 22 512 272) |
|
1357 |
) |
|
1358 |
#component: |
|
1359 |
#(#SpecCollection |
|
1360 |
#collection: #() |
|
1361 |
) |
|
1362 |
) |
|
1363 |
! ! |
|
1364 |
||
1365 |
!FileBrowserV2::SettingDialog methodsFor:'initialization & release'! |
|
1366 |
||
1367 |
closeDownViews |
|
1368 |
"This is a hook method generated by the Browser. |
|
1369 |
It will be invoked when your app/dialog-window is really closed. |
|
1370 |
See also #closeDownViews, which is invoked before and may suppress the close |
|
1371 |
or ask the user for confirmation." |
|
1372 |
||
1373 |
"/ change the code below as required ... |
|
1374 |
"/ This should cleanup any leftover resources |
|
1375 |
"/ (for example, temporary files) |
|
1376 |
"/ super closeRequest will initiate the closeDown |
|
1377 |
||
1378 |
"/ add your code here |
|
1379 |
||
1380 |
"/ do not remove the one below ... |
|
1381 |
^ super closeDownViews |
|
1382 |
! |
|
1383 |
||
1384 |
closeRequest |
|
1385 |
"This is a hook method generated by the Browser. |
|
1386 |
It will be invoked when your app/dialog-window is about to be |
|
1387 |
closed (this method has a chance to suppress the close). |
|
1388 |
See also #closeDownViews, which is invoked when the close is really done." |
|
1389 |
||
1390 |
"/ change the code below as required ... |
|
1391 |
"/ Closing can be suppressed, by simply returning. |
|
1392 |
"/ The 'super closeRequest' at the end will initiate the real closeDown |
|
1393 |
||
1394 |
^ super closeRequest |
|
1395 |
! |
|
1396 |
||
1397 |
postBuildWith:aBuilder |
|
1398 |
"This is a hook method generated by the Browser. |
|
1399 |
It will be invoked during the initialization of your app/dialog, |
|
1400 |
after all of the visual components have been built, |
|
1401 |
but BEFORE the top window is made visible. |
|
1402 |
Add any app-specific actions here (reading files, setting up values etc.) |
|
1403 |
See also #postOpenWith:, which is invoked after opening." |
|
1404 |
||
1405 |
"/ add any code here ... |
|
1406 |
||
1407 |
^ super postBuildWith:aBuilder |
|
1408 |
! |
|
1409 |
||
1410 |
postOpenWith:aBuilder |
|
1411 |
"This is a hook method generated by the Browser. |
|
1412 |
It will be invoked right after the applications window has been opened. |
|
1413 |
Add any app-specific actions here (starting background processes etc.). |
|
1414 |
See also #postBuildWith:, which is invoked before opening." |
|
1415 |
||
1416 |
"/ add any code here ... |
|
1417 |
||
1418 |
^ super postOpenWith:aBuilder |
|
1419 |
! ! |
|
1420 |
||
1421 |
!FileBrowserV2::SettingDialog methodsFor:'menu actions'! |
|
1422 |
||
4217 | 1423 |
help |
4214 | 1424 |
"This method was generated by the Browser. |
1425 |
It will be invoked when the menu-item 'help-documentation' is selected." |
|
1426 |
||
1427 |
"/ change below as required ... |
|
1428 |
||
1429 |
"/ to open an HTML viewer on some document (under 'doc/online/<language>/' ): |
|
4217 | 1430 |
"/ HTMLDocumentView openFullOnDocumentationFile:'TOP.html'. |
4214 | 1431 |
|
1432 |
"/ add application-specific help files under the 'doc/online/<language>/help/appName' |
|
1433 |
"/ directory, and open a viewer with: |
|
1434 |
"/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'. |
|
1435 |
! ! |
|
1436 |
||
3892 | 1437 |
!FileBrowserV2 class methodsFor:'documentation'! |
1438 |
||
1439 |
version |
|
4252 | 1440 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2.st,v 1.44 2002-11-15 11:24:35 cg Exp $' |
3892 | 1441 |
! ! |
1442 |
||
1443 |
FileBrowserV2 initialize! |