author | Claus Gittinger <cg@exept.de> |
Fri, 18 Nov 2016 12:10:24 +0100 | |
changeset 17085 | 668edba4082f |
parent 16802 | f2f4117db68a |
child 16803 | e4ac430c7cd9 |
child 17316 | 5413216c3f0a |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
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 |
" |
|
8250 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
15366 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
3892 | 16 |
SimpleDialog subclass:#FileDialog |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
17 |
instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
18 |
multipleSelect doubleClickAction cancelLabelHolder okLabelHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
19 |
startFilename result filterField filenameField viewFiles |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
20 |
filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
21 |
appendButtonVisibleHolder appendWasPressed |
6065 | 22 |
buttonPanelVisibleHolder appendLabelHolder browseVisibleHolder |
9678 | 23 |
selectedDeviceDrive listOfDeviceDrives rootDirectoryHolder |
15766 | 24 |
initialRoot verticalPanelView okLabelEnabled' |
5931 | 25 |
classVariableNames:'LastExtent' |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
26 |
poolDictionaries:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
27 |
category:'Interface-Tools-File' |
3892 | 28 |
! |
29 |
||
30 |
!FileDialog class methodsFor:'documentation'! |
|
31 |
||
5140 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
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 |
||
3892 | 46 |
documentation |
47 |
" |
|
9767 | 48 |
A slightly better file dialog |
3892 | 49 |
|
50 |
[author:] |
|
51 |
Martin Walser (martin@vercingetorix) |
|
52 |
||
53 |
[instance variables:] |
|
54 |
||
55 |
[class variables:] |
|
56 |
||
57 |
[see also:] |
|
58 |
||
59 |
" |
|
60 |
! |
|
61 |
||
62 |
examples |
|
63 |
" |
|
15451 | 64 |
usually direct access to FileDialog is not recommended; |
65 |
please use the Dialog interface, which is able to dispatch to |
|
66 |
alternative file choosers if the settings say so |
|
67 |
(native dialogs, for example): |
|
3892 | 68 |
[exBegin] |
15451 | 69 |
|fileOrNil| |
70 |
||
71 |
fileOrNil := Dialog requestFileName:'Choose a File'. |
|
72 |
Transcript showCR:fileOrNil |
|
3892 | 73 |
[exEnd] |
74 |
||
15451 | 75 |
simple examples: |
3892 | 76 |
[exBegin] |
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
77 |
FileDialog |
4804 | 78 |
requestFileName:'enter a fileName:' |
79 |
default:'' |
|
80 |
version:nil |
|
81 |
ifFail:['none'] |
|
82 |
pattern:'*.conf' |
|
83 |
fromDirectory:'/etc' |
|
84 |
whenBoxCreatedEvaluate:nil. |
|
85 |
[exEnd] |
|
15451 | 86 |
|
4804 | 87 |
[exBegin] |
88 |
|fd| |
|
89 |
||
90 |
fd := FileDialog new. |
|
91 |
fd multipleSelect:true. |
|
92 |
fd open |
|
3892 | 93 |
[exEnd] |
12816 | 94 |
|
15451 | 95 |
[exBegin] |
96 |
|fd| |
|
97 |
||
98 |
fd := FileDialog new. |
|
99 |
fd multipleSelect:true. |
|
100 |
fd browseMenuItemVisible:false. |
|
101 |
fd open |
|
102 |
[exEnd] |
|
103 |
||
12816 | 104 |
Adding custom components: |
105 |
[exBegin] |
|
15451 | 106 |
Dialog modifyingBoxWith:[:dialog | |
12816 | 107 |
| fmtBox | |
108 |
||
109 |
fmtBox := ComboListView new. |
|
110 |
fmtBox list: #('Comma Separated Values (.csv)' |
|
111 |
'Microsoft Excel (.xls)' |
|
112 |
'Microsoft Excel XML (.xlsx)') . |
|
113 |
fmtBox model:'Select...' asValue. |
|
15451 | 114 |
dialog application addComponent: fmtBox. |
12816 | 115 |
] do:[ |
116 |
Dialog requestFileName: 'Save file as...' |
|
117 |
] |
|
118 |
[exEnd] |
|
119 |
||
3892 | 120 |
" |
5062 | 121 |
! |
122 |
||
123 |
todo |
|
124 |
" |
|
9769 | 125 |
- make the filedialog windows like |
5062 | 126 |
filename entry field shows only the filename not the whole directory |
127 |
the tree allways starts in currrent directory |
|
128 |
the parent tree is shown in a compobox where the perents are selectable |
|
9769 | 129 |
|
5062 | 130 |
- do not expand the ~ or relative pathnames to absolute pathnames |
131 |
" |
|
3892 | 132 |
! ! |
133 |
||
134 |
!FileDialog class methodsFor:'instance creation'! |
|
135 |
||
136 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
137 |
"same as requestFileName, but only show directories" |
|
138 |
||
4795 | 139 |
^ self |
140 |
requestDirectoryName:title |
|
141 |
default:aFileName |
|
142 |
ok:nil |
|
143 |
abort:nil |
|
144 |
version:nil |
|
145 |
pattern:nil |
|
146 |
fromDirectory:nil |
|
147 |
ifFail:failBlock |
|
148 |
whenBoxCreatedEvaluate:nil |
|
149 |
asLoadDialog:nil. |
|
3892 | 150 |
|
151 |
" |
|
3904 | 152 |
FileDialog |
3892 | 153 |
requestDirectoryName:'which directory ?' |
4627 | 154 |
default:Filename currentDirectory pathName |
3892 | 155 |
ifFail:'none' |
156 |
" |
|
157 |
! |
|
158 |
||
5336 | 159 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
160 |
"same as requestFileName, but only show directories" |
|
161 |
||
162 |
^ self |
|
163 |
requestDirectoryName:title |
|
164 |
default:aFileName |
|
165 |
ok:okText |
|
166 |
abort:abortText |
|
167 |
version:nil |
|
168 |
pattern:nil |
|
169 |
fromDirectory:nil |
|
170 |
ifFail:failBlock |
|
171 |
whenBoxCreatedEvaluate:nil |
|
172 |
asLoadDialog:nil. |
|
173 |
||
174 |
" |
|
175 |
FileDialog |
|
176 |
requestDirectoryName:'which directory ?' |
|
177 |
default:Filename currentDirectory pathName |
|
178 |
ok:'Yes' |
|
179 |
abort:'No' |
|
180 |
ifFail:'none' |
|
181 |
" |
|
182 |
! |
|
183 |
||
5823 | 184 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
185 |
"same as requestFileName, but only show directories" |
|
186 |
||
187 |
^ self |
|
188 |
requestDirectoryName:title |
|
189 |
default:aFileName |
|
190 |
ok:okText |
|
191 |
abort:abortText |
|
192 |
version:nil |
|
193 |
pattern:nil |
|
194 |
fromDirectory:nil |
|
195 |
ifFail:failBlock |
|
196 |
whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
|
197 |
asLoadDialog:nil. |
|
198 |
||
199 |
" |
|
200 |
FileDialog |
|
201 |
requestDirectoryName:'which directory ?' |
|
202 |
default:Filename currentDirectory pathName |
|
203 |
ok:'Yes' |
|
204 |
abort:'No' |
|
205 |
ifFail:'none' |
|
206 |
" |
|
207 |
! |
|
208 |
||
3956 | 209 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 210 |
"same as requestFileName, but only show directories" |
211 |
||
3956 | 212 |
|enteredFileName instance enteredFileNameString| |
3892 | 213 |
|
4795 | 214 |
instance := self |
215 |
startApplicationFor:titleString |
|
216 |
default:aFileName |
|
217 |
ok:okText |
|
218 |
abort:abortText |
|
219 |
ifFail:failBlock |
|
220 |
pattern:pattern |
|
221 |
fromDirectory:aDirectoryPath |
|
222 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
223 |
asLoadDialog:aBoolean |
|
5329 | 224 |
viewFiles:false |
4795 | 225 |
multipleSelect:false. |
3892 | 226 |
|
227 |
enteredFileNameString := instance result. |
|
228 |
enteredFileNameString isNil ifTrue:[ |
|
229 |
^ failBlock value |
|
230 |
]. |
|
231 |
enteredFileName := enteredFileNameString asFilename. |
|
12896 | 232 |
enteredFileName isRelative ifTrue:[ |
233 |
enteredFileName := instance directory construct:enteredFileNameString |
|
234 |
]. |
|
235 |
||
3892 | 236 |
enteredFileNameString := enteredFileName asString. |
237 |
(enteredFileName notNil |
|
238 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
239 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
240 |
versionSymbol == #mustBeNew ifTrue:[ |
|
241 |
"/ file may not exist |
|
242 |
enteredFileName exists ifTrue:[^ '']. |
|
243 |
]. |
|
244 |
versionSymbol == #new ifTrue:[ |
|
245 |
"/ file may not exist |
|
246 |
enteredFileName exists ifTrue:[ |
|
6356 | 247 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 248 |
ifFalse:[^ '']. |
249 |
]. |
|
250 |
]. |
|
251 |
versionSymbol == #mustBeOld ifTrue:[ |
|
252 |
enteredFileName exists ifFalse:[^ '']. |
|
253 |
]. |
|
254 |
versionSymbol == #old ifTrue:[ |
|
255 |
"/ file may not exist |
|
256 |
enteredFileName exists ifFalse:[ |
|
6356 | 257 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 258 |
ifFalse:[^ '']. |
259 |
]. |
|
260 |
]. |
|
261 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
262 |
]. |
|
263 |
^ enteredFileNameString |
|
264 |
||
265 |
" |
|
266 |
FileDialog |
|
267 |
requestDirectoryName:'which directory ?' |
|
4627 | 268 |
default:Filename currentDirectory pathName |
3892 | 269 |
ifFail:nil |
270 |
" |
|
3956 | 271 |
" |
272 |
FileDialog |
|
273 |
requestDirectoryName:'which directory ?' |
|
4627 | 274 |
default:Filename currentDirectory pathName |
3956 | 275 |
ok:nil |
276 |
abort:nil |
|
277 |
version:nil |
|
278 |
pattern:nil |
|
279 |
fromDirectory:nil |
|
280 |
ifFail:nil |
|
281 |
whenBoxCreatedEvaluate:nil |
|
282 |
asLoadDialog:true |
|
283 |
" |
|
3892 | 284 |
! |
285 |
||
5336 | 286 |
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
287 |
"same as requestFileName, but only show directories" |
|
288 |
||
289 |
^ self |
|
290 |
requestDirectoryName:title |
|
291 |
default:aFileName |
|
292 |
ok:okText |
|
293 |
abort:nil |
|
294 |
version:nil |
|
295 |
pattern:nil |
|
296 |
fromDirectory:nil |
|
297 |
ifFail:failBlock |
|
298 |
whenBoxCreatedEvaluate:nil |
|
299 |
asLoadDialog:nil. |
|
300 |
||
301 |
" |
|
302 |
FileDialog |
|
303 |
requestDirectoryName:'which directory ?' |
|
304 |
default:Filename currentDirectory pathName |
|
305 |
ok:'Yes' |
|
306 |
ifFail:'none' |
|
307 |
" |
|
308 |
! |
|
309 |
||
9765 | 310 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil |
311 |
"launch a Dialog, which allows user to enter a filename. |
|
312 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
313 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
314 |
The box will show okText in its okButton, abortText in the abortButton. |
|
315 |
The matchPattern is set to pattern initially. |
|
316 |
Return the string, or nil if cancel was pressed." |
|
317 |
||
318 |
^ self |
|
319 |
requestFileName:titleString |
|
320 |
default:defaultName |
|
321 |
ok:okText |
|
322 |
abort:abortText |
|
323 |
pattern:pattern |
|
324 |
fromDirectory:aDirectoryPathOrNil |
|
325 |
whenBoxCreatedEvaluate:nil |
|
326 |
||
327 |
"Created: / 14-02-2011 / 17:59:21 / cg" |
|
328 |
! |
|
329 |
||
3892 | 330 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
331 |
||
4795 | 332 |
^ self |
333 |
requestFileName:titleString |
|
334 |
default:defaultName |
|
335 |
ok:okText |
|
336 |
abort:abortText |
|
337 |
version:nil |
|
338 |
ifFail:nil |
|
339 |
pattern:pattern |
|
340 |
fromDirectory:aDirectoryPathOrNil |
|
341 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 342 |
! |
343 |
||
344 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
345 |
"launch a Dialog, which allows user to enter a filename. |
|
346 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
347 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
348 |
The box will show okText in its okButton, abortText in the abortButton. |
|
349 |
The matchPattern is set to pattern initially. |
|
350 |
Return the string, or nil if cancel was pressed |
|
351 |
The version argument allows validation of the files existance; |
|
352 |
it may be any of: |
|
353 |
#mustBeNew - fail (return empty string) if the file exists |
|
354 |
#new - confirm if the file exists |
|
355 |
#mustBeOld - fail if the file does not exist |
|
356 |
#old - confirm if the file does not exist |
|
357 |
#any (other) - no validation |
|
358 |
" |
|
359 |
||
4795 | 360 |
^ self |
361 |
requestFileName:titleString |
|
362 |
default:defaultName |
|
363 |
ok:okText |
|
364 |
abort:abortText |
|
365 |
version:versionSymbol |
|
366 |
ifFail:failBlock |
|
367 |
pattern:pattern |
|
368 |
fromDirectory:aDirectoryPath |
|
369 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
370 |
asLoadDialog:nil |
|
3956 | 371 |
! |
372 |
||
373 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
374 |
"launch a Dialog, which allows user to enter a filename. |
|
375 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
376 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
377 |
The box will show okText in its okButton, abortText in the abortButton. |
|
378 |
The matchPattern is set to pattern initially. |
|
379 |
Return the string, or nil if cancel was pressed |
|
380 |
The version argument allows validation of the files existance; |
|
381 |
it may be any of: |
|
382 |
#mustBeNew - fail (return empty string) if the file exists |
|
383 |
#new - confirm if the file exists |
|
384 |
#mustBeOld - fail if the file does not exist |
|
385 |
#old - confirm if the file does not exist |
|
386 |
#any (other) - no validation |
|
387 |
" |
|
388 |
||
3892 | 389 |
|
3904 | 390 |
| instance enteredFileName enteredFileNameString| |
3892 | 391 |
|
4795 | 392 |
instance := self |
393 |
startApplicationFor:titleString |
|
394 |
default:defaultName |
|
395 |
ok:okText |
|
396 |
abort:abortText |
|
397 |
ifFail:failBlock |
|
398 |
pattern:pattern |
|
399 |
fromDirectory:aDirectoryPath |
|
400 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
401 |
asLoadDialog:aBoolean |
|
5329 | 402 |
viewFiles:true |
4795 | 403 |
multipleSelect:false. |
3892 | 404 |
|
405 |
enteredFileNameString := instance result. |
|
16265 | 406 |
enteredFileNameString isEmptyOrNil ifTrue:[ |
3892 | 407 |
^ failBlock value |
408 |
]. |
|
16265 | 409 |
|
3892 | 410 |
enteredFileName := enteredFileNameString asFilename. |
12896 | 411 |
enteredFileName isRelative ifTrue:[ |
16265 | 412 |
(versionSymbol isNil and:[#(http https ftp) includes:(enteredFileNameString upToAll:'://')]) ifTrue:[ |
413 |
^ enteredFileNameString. |
|
414 |
] ifFalse:[ |
|
415 |
enteredFileName := instance directory construct:enteredFileNameString. |
|
416 |
enteredFileNameString := enteredFileName asString. |
|
3892 | 417 |
]. |
418 |
]. |
|
16265 | 419 |
|
420 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
|
421 |
||
422 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
423 |
versionSymbol == #mustBeNew ifTrue:[ |
|
424 |
"/ file must not exist |
|
425 |
enteredFileName exists ifTrue:[^ failBlock value]. |
|
426 |
]. |
|
427 |
versionSymbol == #new ifTrue:[ |
|
428 |
"/ file should not exist |
|
429 |
enteredFileName exists ifTrue:[ |
|
430 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
|
431 |
ifFalse:[^ failBlock value]. |
|
432 |
]. |
|
433 |
]. |
|
434 |
versionSymbol == #mustBeOld ifTrue:[ |
|
435 |
"/ file must exist |
|
436 |
enteredFileName exists ifFalse:[^ failBlock value]. |
|
437 |
]. |
|
438 |
versionSymbol == #old ifTrue:[ |
|
439 |
"/ file should exist |
|
440 |
enteredFileName exists ifFalse:[ |
|
441 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
|
442 |
ifFalse:[^ failBlock value]. |
|
443 |
]. |
|
444 |
]. |
|
445 |
||
3892 | 446 |
^ enteredFileNameString |
3956 | 447 |
" |
448 |
FileDialog |
|
449 |
requestFileName:'enter a fileName:' |
|
450 |
default:'' |
|
451 |
ok:nil |
|
452 |
abort:nil |
|
453 |
version:nil |
|
454 |
ifFail:['none'] |
|
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
455 |
pattern:'*' |
4627 | 456 |
fromDirectory:Filename currentDirectory pathName |
3956 | 457 |
whenBoxCreatedEvaluate:nil |
458 |
asLoadDialog:true |
|
459 |
" |
|
3892 | 460 |
! |
461 |
||
9765 | 462 |
requestFileName:titleString default:defaultName pattern:pattern fromDirectory:aDirectory |
463 |
"launch a Dialog, which allows user to enter a filename. |
|
464 |
The files presented initially are those from the current directory. |
|
465 |
The box will show ok/cancel in its buttons. |
|
466 |
The matchPattern is set to pattern initially. |
|
467 |
Return the string or nil if cancel was pressed." |
|
468 |
||
469 |
|resources| |
|
470 |
||
471 |
resources := self classResources. |
|
472 |
^ self |
|
473 |
requestFileName:titleString |
|
474 |
default:defaultName |
|
475 |
ok:(resources string:'OK') |
|
476 |
abort:(resources string:'Cancel') |
|
477 |
pattern:pattern |
|
478 |
fromDirectory:aDirectory |
|
479 |
||
480 |
"Created: / 14-02-2011 / 17:59:14 / cg" |
|
481 |
! |
|
482 |
||
3892 | 483 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
484 |
||
4795 | 485 |
^ self |
486 |
requestFileName:titleString |
|
487 |
default:defaultName |
|
488 |
ok:nil |
|
489 |
abort:nil |
|
490 |
version:versionSymbol |
|
491 |
ifFail:failBlock |
|
492 |
pattern:pattern |
|
493 |
fromDirectory:aDirectoryPathOrNil |
|
494 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 495 |
|
496 |
" |
|
497 |
FileDialog |
|
498 |
requestFileName:'enter a fileName:' |
|
499 |
default:'' |
|
500 |
version:nil |
|
501 |
ifFail:['none'] |
|
502 |
pattern:'*.conf' |
|
4627 | 503 |
fromDirectory:Filename currentDirectory pathName |
3892 | 504 |
whenBoxCreatedEvaluate:nil. |
505 |
Dialog |
|
506 |
requestFileName:'enter a fileName:' |
|
507 |
default:'' |
|
508 |
version:nil |
|
509 |
ifFail:['none'] |
|
510 |
pattern:'*.conf' |
|
4627 | 511 |
fromDirectory:Filename currentDirectory pathName |
3892 | 512 |
whenBoxCreatedEvaluate:nil |
513 |
" |
|
514 |
" |
|
515 |
FileDialog |
|
516 |
requestFileName:'enter a fileName:' |
|
517 |
default:'' |
|
518 |
version:#old |
|
519 |
ifFail:['none'] |
|
520 |
pattern:'*.conf' |
|
4627 | 521 |
fromDirectory:Filename currentDirectory pathName |
3892 | 522 |
whenBoxCreatedEvaluate:nil |
523 |
" |
|
524 |
" |
|
525 |
FileDialog |
|
526 |
requestFileName:'enter a fileName:' |
|
527 |
default:'' |
|
528 |
version:#mustBeNew |
|
529 |
ifFail:['none'] |
|
530 |
pattern:'*.conf' |
|
4627 | 531 |
fromDirectory:Filename currentDirectory pathName |
3892 | 532 |
whenBoxCreatedEvaluate:nil |
533 |
" |
|
3904 | 534 |
! |
535 |
||
536 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
537 |
"launch a Dialog, which allows user to enter a filename. |
|
538 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
539 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
540 |
The box will show okText in its okButton, abortText in the abortButton. |
|
541 |
The matchPattern is set to pattern initially. |
|
3905 | 542 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 543 |
" |
544 |
||
545 |
||
4795 | 546 |
^ self |
547 |
requestFileNames:titleString |
|
548 |
default:defaultName |
|
549 |
ok:okText |
|
550 |
abort:abortText |
|
551 |
ifFail:failBlock |
|
552 |
pattern:pattern |
|
553 |
fromDirectory:aDirectoryPath |
|
554 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
555 |
asLoadDialog:nil. |
|
3956 | 556 |
|
557 |
||
558 |
" |
|
559 |
FileDialog |
|
560 |
requestFileNames:'enter a fileName:' |
|
561 |
default:'' |
|
562 |
ok:nil |
|
563 |
abort:nil |
|
564 |
ifFail:['none'] |
|
565 |
pattern:'*.conf' |
|
4627 | 566 |
fromDirectory:Filename currentDirectory pathName |
3956 | 567 |
whenBoxCreatedEvaluate:nil. |
568 |
" |
|
569 |
! |
|
570 |
||
571 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
572 |
"launch a Dialog, which allows user to enter a filename. |
|
573 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
574 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
575 |
The box will show okText in its okButton, abortText in the abortButton. |
|
576 |
The matchPattern is set to pattern initially. |
|
577 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
578 |
" |
|
579 |
||
580 |
||
3904 | 581 |
| instance enteredFileNames lastDirectory| |
582 |
||
4795 | 583 |
instance := self |
584 |
startApplicationFor:titleString |
|
585 |
default:defaultName |
|
586 |
ok:okText |
|
587 |
abort:abortText |
|
588 |
ifFail:failBlock |
|
589 |
pattern:pattern |
|
590 |
fromDirectory:aDirectoryPath |
|
591 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
592 |
asLoadDialog:asLoadDialog |
|
5329 | 593 |
viewFiles:true |
4795 | 594 |
multipleSelect:true. |
3904 | 595 |
|
3996 | 596 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 597 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
598 |
^ failBlock value |
|
599 |
]. |
|
600 |
lastDirectory := enteredFileNames first. |
|
601 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
602 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
603 |
^ enteredFileNames |
|
604 |
||
605 |
" |
|
606 |
FileDialog |
|
607 |
requestFileNames:'enter a fileName:' |
|
608 |
default:'' |
|
609 |
ok:nil |
|
610 |
abort:nil |
|
611 |
ifFail:['none'] |
|
612 |
pattern:'*.conf' |
|
4627 | 613 |
fromDirectory:Filename currentDirectory pathName |
3956 | 614 |
whenBoxCreatedEvaluate:nil |
615 |
asLoadDialog:true. |
|
3904 | 616 |
" |
617 |
! |
|
618 |
||
5790 | 619 |
startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
3904 | 620 |
"launch a Dialog, which allows user to enter a filename. |
621 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
622 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
623 |
The box will show okText in its okButton, abortText in the abortButton. |
|
624 |
The matchPattern is set to pattern initially. |
|
625 |
Return the string, or nil if cancel was pressed |
|
626 |
The version argument allows validation of the files existance; |
|
627 |
it may be any of: |
|
628 |
#mustBeNew - fail (return empty string) if the file exists |
|
629 |
#new - confirm if the file exists |
|
630 |
#mustBeOld - fail if the file does not exist |
|
631 |
#old - confirm if the file does not exist |
|
632 |
#any (other) - no validation |
|
633 |
" |
|
634 |
||
635 |
||
5790 | 636 |
|defaultDir instance defaultFile okText abortText initialDefaultFileName| |
637 |
||
638 |
initialDefaultFileName := initialDefaultFileNameArg. |
|
639 |
initialDefaultFileName notNil ifTrue:[ |
|
13001 | 640 |
initialDefaultFileName := initialDefaultFileName asFilename. |
5790 | 641 |
]. |
5163 | 642 |
|
643 |
okText := okTextArg. |
|
644 |
okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
|
645 |
abortText := abortTextArg. |
|
646 |
abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
|
3904 | 647 |
|
648 |
defaultDir := aDirectoryPath. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
649 |
"/ defaultDir isNil ifTrue:[ |
5790 | 650 |
"/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
651 |
"/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
652 |
"/ ] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
653 |
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
654 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
655 |
"/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
656 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
657 |
"/ defaultDir asFilename exists ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
658 |
"/ defaultDir := nil |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
659 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
660 |
"/ ] |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
661 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
662 |
(initialDefaultFileName notNil |
5790 | 663 |
and:[initialDefaultFileName isAbsolute |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
664 |
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
5790 | 665 |
defaultDir := initialDefaultFileName asAbsoluteFilename. |
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
666 |
true "viewFiles" ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
667 |
defaultFile := defaultDir asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
668 |
defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
669 |
]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
670 |
] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
671 |
defaultDir isNil ifTrue:[ |
5193 | 672 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
673 |
defaultDir isNil ifTrue:[ |
|
674 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
675 |
]. |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
676 |
defaultDir asFilename exists ifFalse:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
677 |
defaultDir := nil |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
678 |
]. |
3956 | 679 |
] |
3904 | 680 |
]. |
4206 | 681 |
defaultDir := defaultDir asFilename asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
682 |
"/ [defaultDir exists] whileFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
683 |
"/ defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
684 |
"/ ]. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
685 |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
686 |
defaultFile isNil ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
687 |
viewFiles ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
688 |
defaultFile := defaultDir asAbsoluteFilename. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
689 |
] ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
690 |
(initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
691 |
defaultFile := defaultDir construct:initialDefaultFileName baseName. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
692 |
] ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
693 |
defaultFile := defaultDir. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
694 |
]. |
3956 | 695 |
]. |
3904 | 696 |
]. |
3956 | 697 |
|
3904 | 698 |
instance := self new. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
699 |
defaultDir notNil ifTrue:[instance directory:defaultDir]. |
15766 | 700 |
instance |
701 |
multipleSelect:multipleSelect ? false; |
|
702 |
startFilename:defaultFile; |
|
703 |
pattern:(pattern isEmptyOrNil ifTrue:['*'] ifFalse:[pattern]); |
|
704 |
initialText:titleString; |
|
705 |
beLoadDialog:asLoadDialog ? false; |
|
706 |
viewFiles:viewFiles ? true. |
|
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
707 |
|
15766 | 708 |
instance okLabelHolder value:okText. |
709 |
instance cancelLabelHolder value:abortText. |
|
710 |
||
3953 | 711 |
self setDoubleClickActionFor:instance. |
3904 | 712 |
instance allButOpenInterface:#windowSpec. |
713 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
714 |
|
8661
086147f751d0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8586
diff
changeset
|
715 |
"/ Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
7571 | 716 |
instance treeBrowser sortCaselessInTreeBrowser value: (Filename isCaseSensitive not). |
3904 | 717 |
instance openWindowModal. |
718 |
^ instance |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
719 |
|
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
720 |
"Modified: / 23-08-2006 / 12:24:54 / cg" |
7571 | 721 |
"Modified: / 13-12-2006 / 16:25:42 / User" |
3892 | 722 |
! ! |
723 |
||
724 |
!FileDialog class methodsFor:'accessing'! |
|
725 |
||
6650 | 726 |
classResources |
9110 | 727 |
^ (FileBrowserV2 ? AbstractFileBrowser) classResources |
6650 | 728 |
! |
729 |
||
5931 | 730 |
lastExtent |
731 |
^ LastExtent |
|
732 |
! |
|
733 |
||
734 |
lastExtent:anExtent |
|
735 |
LastExtent := anExtent |
|
736 |
! |
|
737 |
||
3953 | 738 |
setDoubleClickActionFor:instance |
739 |
||
740 |
instance doubleClickAction:[:anIndex| |
|
741 |
| item | |
|
742 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
743 |
item notNil ifTrue:[ |
|
5329 | 744 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 745 |
instance doAccept. |
746 |
] |
|
747 |
] |
|
748 |
]. |
|
3892 | 749 |
! ! |
750 |
||
8585 | 751 |
!FileDialog class methodsFor:'help specs'! |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
752 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
753 |
flyByHelpSpec |
8585 | 754 |
"This resource specification was automatically generated |
755 |
by the UIHelpTool of ST/X." |
|
756 |
||
757 |
"Do not manually edit this!! If it is corrupted, |
|
758 |
the UIHelpTool may not be able to read the specification." |
|
759 |
||
760 |
" |
|
761 |
UIHelpTool openOnClass:FileDialog |
|
762 |
" |
|
763 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
764 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
765 |
|
8585 | 766 |
^ FileBrowserV2 flyByHelpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
767 |
|
8585 | 768 |
#openFileBrowser |
13003 | 769 |
'Open a FileBrowser on the selected directory' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
770 |
|
8585 | 771 |
) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
772 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
773 |
|
3892 | 774 |
!FileDialog class methodsFor:'interface specs'! |
775 |
||
776 |
windowSpec |
|
777 |
"This resource specification was automatically generated |
|
778 |
by the UIPainter of ST/X." |
|
779 |
||
780 |
"Do not manually edit this!! If it is corrupted, |
|
781 |
the UIPainter may not be able to read the specification." |
|
782 |
||
783 |
" |
|
784 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
785 |
FileDialog new openInterface:#windowSpec |
|
786 |
FileDialog open |
|
787 |
" |
|
788 |
||
789 |
<resource: #canvas> |
|
790 |
||
791 |
^ |
|
13741 | 792 |
#(FullSpec |
793 |
name: windowSpec |
|
794 |
window: |
|
795 |
(WindowSpec |
|
796 |
label: 'FileDialog' |
|
797 |
name: 'FileDialog' |
|
798 |
min: (Point 10 10) |
|
16802 | 799 |
bounds: (Rectangle 0 0 460 482) |
13741 | 800 |
menu: mainMenu |
801 |
performer: treeBrowser |
|
802 |
) |
|
803 |
component: |
|
804 |
(SpecCollection |
|
805 |
collection: ( |
|
806 |
(VerticalPanelViewSpec |
|
807 |
name: 'FilePanel' |
|
16802 | 808 |
layout: (LayoutFrame 0 0 0 0 0 1 -40 1) |
13741 | 809 |
horizontalLayout: fit |
810 |
verticalLayout: bottomFit |
|
811 |
horizontalSpace: 0 |
|
812 |
verticalSpace: 3 |
|
813 |
elementsChangeSize: true |
|
814 |
component: |
|
815 |
(SpecCollection |
|
816 |
collection: ( |
|
817 |
(ViewSpec |
|
818 |
name: 'FilePart' |
|
819 |
component: |
|
820 |
(SpecCollection |
|
821 |
collection: ( |
|
822 |
(MenuPanelSpec |
|
823 |
name: 'ToolBar1' |
|
824 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0) |
|
825 |
tabable: true |
|
826 |
menu: toolBarMenu |
|
827 |
textDefault: true |
|
828 |
) |
|
829 |
(VariableHorizontalPanelSpec |
|
830 |
name: 'DeviceAndFilterPanel' |
|
831 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0) |
|
832 |
level: 1 |
|
833 |
showHandle: true |
|
834 |
component: |
|
835 |
(SpecCollection |
|
836 |
collection: ( |
|
837 |
(ViewSpec |
|
838 |
name: 'Box1' |
|
839 |
component: |
|
840 |
(SpecCollection |
|
841 |
collection: ( |
|
842 |
(ComboListSpec |
|
843 |
name: 'ComboList1' |
|
844 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1) |
|
845 |
visibilityChannel: driveSelectorVisible |
|
846 |
model: selectedDeviceDrive |
|
847 |
comboList: listOfDeviceDrives |
|
848 |
useIndex: false |
|
849 |
hidePullDownMenuButton: false |
|
12816 | 850 |
) |
13741 | 851 |
) |
852 |
||
853 |
) |
|
854 |
) |
|
855 |
(ViewSpec |
|
856 |
name: 'Box2' |
|
857 |
component: |
|
858 |
(SpecCollection |
|
859 |
collection: ( |
|
860 |
(LabelSpec |
|
861 |
label: 'Filter:' |
|
862 |
name: 'FilterLabel' |
|
863 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1) |
|
864 |
translateLabel: true |
|
865 |
adjust: right |
|
12816 | 866 |
) |
13741 | 867 |
(InputFieldSpec |
868 |
name: 'FilterEntryField' |
|
869 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1) |
|
870 |
model: filterHolder |
|
871 |
immediateAccept: true |
|
872 |
acceptOnReturn: true |
|
873 |
acceptOnTab: true |
|
874 |
acceptOnLostFocus: true |
|
875 |
acceptOnPointerLeave: false |
|
876 |
postBuildCallback: postBuildFilterField: |
|
877 |
) |
|
878 |
) |
|
879 |
||
880 |
) |
|
6065 | 881 |
) |
13741 | 882 |
) |
883 |
||
884 |
) |
|
16802 | 885 |
handles: (Any 0.29999999999999999 1.0) |
13741 | 886 |
) |
887 |
(SubCanvasSpec |
|
888 |
name: 'DirectoryTreeBrowser' |
|
16802 | 889 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -34 1) |
13741 | 890 |
tabable: true |
891 |
hasHorizontalScrollBar: false |
|
892 |
hasVerticalScrollBar: false |
|
893 |
majorKey: DirectoryTreeBrowser |
|
894 |
subAspectHolders: |
|
895 |
(Array |
|
6065 | 896 |
|
13741 | 897 |
(SubChannelInfoSpec |
898 |
subAspect: filterModel |
|
899 |
aspect: filterHolder |
|
900 |
) |
|
901 |
(SubChannelInfoSpec |
|
902 |
subAspect: rootHolder |
|
903 |
aspect: rootDirectoryHolder |
|
904 |
) |
|
905 |
||
906 |
(SubChannelInfoSpec |
|
907 |
subAspect: showHiddenFiles |
|
908 |
aspect: showHiddenFiles |
|
909 |
) |
|
910 |
) |
|
911 |
createNewApplication: true |
|
912 |
createNewBuilder: true |
|
913 |
postBuildCallback: postBuildTreeBrowser: |
|
4804 | 914 |
) |
13741 | 915 |
(LabelSpec |
916 |
label: 'Filename:' |
|
917 |
name: 'FilenameLabel' |
|
16802 | 918 |
layout: (LayoutFrame 3 0 -28 1 110 0 -1 1) |
13741 | 919 |
translateLabel: true |
920 |
labelChannel: filenameLabelHolder |
|
921 |
adjust: left |
|
922 |
) |
|
923 |
(FilenameInputFieldSpec |
|
924 |
name: 'FilenameEntryField' |
|
16802 | 925 |
layout: (LayoutFrame 110 0 -28 1 -2 1 -1 1) |
13741 | 926 |
tabable: true |
927 |
model: filenameHolder |
|
928 |
immediateAccept: false |
|
929 |
acceptOnPointerLeave: true |
|
930 |
hasKeyboardFocusInitially: true |
|
931 |
postBuildCallback: postBuildFileNameField: |
|
932 |
) |
|
933 |
) |
|
934 |
||
935 |
) |
|
16802 | 936 |
extent: (Point 460 442) |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
937 |
) |
13741 | 938 |
) |
939 |
||
940 |
) |
|
941 |
postBuildCallback: postBuildVerticalPanelView: |
|
942 |
) |
|
943 |
(HorizontalPanelViewSpec |
|
944 |
name: 'ButtonPanel' |
|
16802 | 945 |
layout: (LayoutFrame 0 0.0 -34 1 -16 1 0 1) |
13741 | 946 |
visibilityChannel: buttonPanelVisibleHolder |
947 |
horizontalLayout: fitSpace |
|
948 |
verticalLayout: center |
|
949 |
horizontalSpace: 3 |
|
950 |
verticalSpace: 3 |
|
951 |
reverseOrderIfOKAtLeft: true |
|
952 |
component: |
|
953 |
(SpecCollection |
|
954 |
collection: ( |
|
955 |
(ActionButtonSpec |
|
956 |
label: 'Cancel' |
|
957 |
name: 'cancelButton' |
|
958 |
translateLabel: true |
|
959 |
labelChannel: cancelLabelHolder |
|
960 |
tabable: true |
|
961 |
model: doCancel |
|
16802 | 962 |
extent: (Point 142 32) |
15366 | 963 |
usePreferredHeight: true |
3892 | 964 |
) |
13741 | 965 |
(ActionButtonSpec |
966 |
label: 'Append' |
|
967 |
name: 'appendButton' |
|
968 |
visibilityChannel: appendButtonVisibleHolder |
|
969 |
translateLabel: true |
|
970 |
labelChannel: appendLabelHolder |
|
971 |
tabable: true |
|
972 |
model: appendPressed |
|
16802 | 973 |
extent: (Point 143 32) |
15366 | 974 |
usePreferredHeight: true |
13741 | 975 |
) |
976 |
(ActionButtonSpec |
|
977 |
label: 'OK' |
|
978 |
name: 'okButton' |
|
979 |
translateLabel: true |
|
980 |
labelChannel: okLabelHolder |
|
981 |
tabable: true |
|
982 |
model: okPressed |
|
15766 | 983 |
enableChannel: okLabelEnabled |
13741 | 984 |
isDefault: true |
16802 | 985 |
extent: (Point 143 32) |
15366 | 986 |
usePreferredHeight: true |
13741 | 987 |
) |
988 |
) |
|
989 |
||
990 |
) |
|
991 |
keepSpaceForOSXResizeHandleH: true |
|
3892 | 992 |
) |
13741 | 993 |
) |
994 |
||
995 |
) |
|
996 |
) |
|
3892 | 997 |
! ! |
998 |
||
999 |
!FileDialog class methodsFor:'menu specs'! |
|
1000 |
||
9113 | 1001 |
mainMenu |
1002 |
"This resource specification was automatically generated |
|
1003 |
by the MenuEditor of ST/X." |
|
1004 |
||
1005 |
"Do not manually edit this!! If it is corrupted, |
|
1006 |
the MenuEditor may not be able to read the specification." |
|
1007 |
||
1008 |
" |
|
1009 |
MenuEditor new openOnClass:FileDialog andSelector:#mainMenu |
|
1010 |
(Menu new fromLiteralArrayEncoding:(FileDialog mainMenu)) startUp |
|
1011 |
" |
|
1012 |
||
1013 |
<resource: #menu> |
|
1014 |
||
1015 |
^ |
|
1016 |
#(Menu |
|
1017 |
( |
|
1018 |
(MenuItem |
|
1019 |
label: 'Directory' |
|
1020 |
translateLabel: true |
|
1021 |
submenu: |
|
1022 |
(Menu |
|
1023 |
( |
|
1024 |
(MenuItem |
|
1025 |
label: 'Up' |
|
1026 |
itemValue: doGoDirectoryUp |
|
1027 |
translateLabel: true |
|
1028 |
) |
|
1029 |
(MenuItem |
|
1030 |
label: '-' |
|
1031 |
) |
|
1032 |
(MenuItem |
|
1033 |
activeHelpKey: directoryBack |
|
1034 |
enabled: enableBack |
|
1035 |
label: 'Back' |
|
1036 |
itemValue: doBack |
|
1037 |
translateLabel: true |
|
1038 |
) |
|
1039 |
(MenuItem |
|
1040 |
activeHelpKey: directoryBack |
|
1041 |
enabled: enableForward |
|
1042 |
label: 'Forward' |
|
1043 |
itemValue: doForward |
|
1044 |
translateLabel: true |
|
1045 |
) |
|
1046 |
(MenuItem |
|
1047 |
label: '-' |
|
1048 |
) |
|
1049 |
(MenuItem |
|
1050 |
enabled: enableHome |
|
1051 |
label: 'Home Directory' |
|
1052 |
itemValue: doGotoHomeDirectory |
|
1053 |
translateLabel: true |
|
1054 |
) |
|
1055 |
(MenuItem |
|
1056 |
label: 'Bookmarks' |
|
1057 |
translateLabel: true |
|
1058 |
submenuChannel: bookmarksMenu |
|
1059 |
) |
|
1060 |
(MenuItem |
|
1061 |
label: 'Visited Directories' |
|
1062 |
translateLabel: true |
|
1063 |
submenuChannel: visitedDirectoriesMenu |
|
1064 |
) |
|
1065 |
) |
|
1066 |
nil |
|
1067 |
nil |
|
1068 |
) |
|
1069 |
) |
|
1070 |
(MenuItem |
|
1071 |
label: 'View' |
|
1072 |
translateLabel: true |
|
1073 |
submenu: |
|
1074 |
(Menu |
|
1075 |
( |
|
1076 |
(MenuItem |
|
1077 |
label: 'Sort' |
|
1078 |
translateLabel: true |
|
1079 |
submenuChannel: sortMenu |
|
1080 |
) |
|
1081 |
(MenuItem |
|
1082 |
label: 'Show' |
|
1083 |
translateLabel: true |
|
1084 |
submenuChannel: showMenuSpecForDialog |
|
1085 |
) |
|
1086 |
(MenuItem |
|
1087 |
label: '-' |
|
1088 |
) |
|
1089 |
(MenuItem |
|
1090 |
label: 'Update' |
|
1091 |
itemValue: updateCurrentDirectory |
|
1092 |
translateLabel: true |
|
1093 |
) |
|
1094 |
) |
|
1095 |
nil |
|
1096 |
nil |
|
1097 |
) |
|
1098 |
) |
|
1099 |
) |
|
1100 |
nil |
|
1101 |
nil |
|
1102 |
) |
|
1103 |
! |
|
1104 |
||
3892 | 1105 |
toolBarMenu |
1106 |
"This resource specification was automatically generated |
|
1107 |
by the MenuEditor of ST/X." |
|
1108 |
||
1109 |
"Do not manually edit this!! If it is corrupted, |
|
1110 |
the MenuEditor may not be able to read the specification." |
|
1111 |
||
1112 |
" |
|
1113 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
1114 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
1115 |
" |
|
1116 |
||
1117 |
<resource: #menu> |
|
1118 |
||
1119 |
^ |
|
5873 | 1120 |
#(Menu |
1121 |
( |
|
1122 |
(MenuItem |
|
1123 |
activeHelpKey: directoryBack |
|
1124 |
enabled: enableBack |
|
1125 |
label: 'Back' |
|
1126 |
itemValue: doBack |
|
1127 |
translateLabel: true |
|
1128 |
isButton: true |
|
1129 |
submenuChannel: menuDirHistoryBack |
|
6087 | 1130 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 1131 |
keepLinkedMenu: true |
3892 | 1132 |
) |
5873 | 1133 |
(MenuItem |
1134 |
label: '' |
|
3892 | 1135 |
) |
5873 | 1136 |
(MenuItem |
1137 |
activeHelpKey: directoryForward |
|
1138 |
enabled: enableForward |
|
1139 |
label: 'Forward' |
|
1140 |
itemValue: doForward |
|
1141 |
translateLabel: true |
|
1142 |
isButton: true |
|
1143 |
submenuChannel: menuDirHistoryForward |
|
6087 | 1144 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 1145 |
keepLinkedMenu: true |
3892 | 1146 |
) |
5873 | 1147 |
(MenuItem |
6462 | 1148 |
label: '-' |
1149 |
) |
|
1150 |
(MenuItem |
|
1151 |
activeHelpKey: directoryUp |
|
1152 |
enabled: enableDirectoryUp |
|
1153 |
label: 'DirectoryUp' |
|
1154 |
itemValue: doGoDirectoryUp |
|
1155 |
translateLabel: true |
|
1156 |
isButton: true |
|
1157 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 1158 |
) |
5873 | 1159 |
(MenuItem |
1160 |
activeHelpKey: fileHome |
|
1161 |
enabled: enableHome |
|
1162 |
label: 'Home' |
|
1163 |
itemValue: doGotoHomeDirectory |
|
1164 |
translateLabel: true |
|
1165 |
isButton: true |
|
6096 | 1166 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 1167 |
) |
5873 | 1168 |
(MenuItem |
8092 | 1169 |
activeHelpKey: fileDesktop |
8586 | 1170 |
enabled: enableGotoDesktop |
8092 | 1171 |
label: 'Desktop' |
1172 |
itemValue: doGotoDesktopDirectory |
|
1173 |
translateLabel: true |
|
1174 |
isButton: true |
|
1175 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
1176 |
) |
|
1177 |
(MenuItem |
|
6098 | 1178 |
activeHelpKey: fileGotoBookmark |
1179 |
label: 'Bookmarks' |
|
1180 |
translateLabel: true |
|
1181 |
isButton: true |
|
9113 | 1182 |
submenuChannel: gotoBookmarksMenu |
6098 | 1183 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
1184 |
) |
|
1185 |
(MenuItem |
|
5873 | 1186 |
label: '-' |
1187 |
isVisible: newDirectoryVisibilityHolder |
|
3923 | 1188 |
) |
5873 | 1189 |
(MenuItem |
6122 | 1190 |
label: 'New Directory...' |
5873 | 1191 |
itemValue: newDirectory |
1192 |
translateLabel: true |
|
1193 |
isButton: true |
|
1194 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 1195 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 1196 |
) |
8585 | 1197 |
(MenuItem |
1198 |
label: '-' |
|
1199 |
isVisible: browseVisibleHolder |
|
1200 |
) |
|
1201 |
(MenuItem |
|
1202 |
activeHelpKey: openFileBrowser |
|
1203 |
label: 'Browse' |
|
1204 |
itemValue: doBrowseDirectory |
|
1205 |
translateLabel: true |
|
1206 |
isButton: true |
|
15725 | 1207 |
isVisible: browseMenuItemVisibleHolder |
8585 | 1208 |
labelImage: (ResourceRetriever ToolbarIconLibrary startFileBrowserIcon) |
1209 |
) |
|
3892 | 1210 |
) |
1211 |
nil |
|
1212 |
nil |
|
1213 |
) |
|
9113 | 1214 |
! |
1215 |
||
1216 |
viewInContentsBrowserMenu |
|
1217 |
^ DirectoryContentsBrowser showMenuSpec |
|
3892 | 1218 |
! ! |
1219 |
||
8182 | 1220 |
!FileDialog class methodsFor:'plugIn spec'! |
1221 |
||
1222 |
aspectSelectors |
|
1223 |
"This resource specification was automatically generated |
|
1224 |
by the UIPainter of ST/X." |
|
1225 |
||
1226 |
"Do not manually edit this. If it is corrupted, |
|
1227 |
the UIPainter may not be able to read the specification." |
|
1228 |
||
1229 |
"Return a description of exported aspects; |
|
1230 |
these can be connected to aspects of an embedding application |
|
1231 |
(if this app is embedded in a subCanvas)." |
|
1232 |
||
1233 |
^ #( |
|
1234 |
#filenameHolder |
|
1235 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1236 |
#rootDirectoryHolder |
8182 | 1237 |
). |
1238 |
||
1239 |
! ! |
|
1240 |
||
3892 | 1241 |
!FileDialog methodsFor:'accessing'! |
1242 |
||
3996 | 1243 |
currentSelectedFiles |
1244 |
||
1245 |
| selectedFiles| |
|
1246 |
||
1247 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
12828 | 1248 |
^ selectedFiles reject:[:aFile| aFile isDirectory ]. |
3996 | 1249 |
! |
1250 |
||
3892 | 1251 |
directory |
1252 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1253 |
||
1254 |
^ directory |
|
1255 |
! |
|
1256 |
||
1257 |
directory:something |
|
1258 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1259 |
||
1260 |
directory := something. |
|
1261 |
! |
|
1262 |
||
1263 |
initialText |
|
13090 | 1264 |
^ resources string:(initialText ? 'File Dialog') |
3892 | 1265 |
! |
1266 |
||
1267 |
initialText:something |
|
1268 |
initialText := something. |
|
1269 |
! |
|
1270 |
||
1271 |
pattern |
|
1272 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1273 |
||
1274 |
^ pattern |
|
1275 |
! |
|
1276 |
||
1277 |
pattern:something |
|
1278 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1279 |
||
1280 |
pattern := something. |
|
1281 |
! |
|
1282 |
||
1283 |
result |
|
1284 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1285 |
||
1286 |
^ result |
|
1287 |
! |
|
1288 |
||
1289 |
result:something |
|
1290 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1291 |
||
1292 |
result := something. |
|
1293 |
! |
|
1294 |
||
3904 | 1295 |
selectedDirectories |
1296 |
||
1297 |
| selectedFiles| |
|
1298 |
||
1299 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1300 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1301 |
! |
|
1302 |
||
3892 | 1303 |
startFilename |
1304 |
startFilename isNil ifTrue:[ |
|
1305 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1306 |
]. |
|
1307 |
^ startFilename |
|
1308 |
! |
|
1309 |
||
1310 |
startFilename:something |
|
1311 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1312 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1313 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1314 |
!FileDialog methodsFor:'accessing-behavior'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1315 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1316 |
asLoadDialog |
4804 | 1317 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1318 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1319 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1320 |
asLoadDialog:aBoolean |
4804 | 1321 |
self beLoadDialog:aBoolean |
1322 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1323 |
|
4804 | 1324 |
beLoadDialog:aBoolean |
1325 |
||
1326 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1327 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1328 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1329 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1330 |
"return the value of the instance variable 'doubleClickAction' (automatically generated)" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1331 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1332 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1333 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1334 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1335 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1336 |
"set the value of the instance variable 'doubleClickAction' (automatically generated)" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1337 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1338 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1339 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1340 |
|
4804 | 1341 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1342 |
|
4804 | 1343 |
^ isLoadDialog ? true |
1344 |
! |
|
1345 |
||
1346 |
multipleSelect |
|
1347 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1348 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1349 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1350 |
multipleSelect:aBoolean |
4804 | 1351 |
multipleSelect := aBoolean. |
1352 |
treeBrowser notNil ifTrue:[ |
|
1353 |
treeBrowser multipleSelect:aBoolean. |
|
1354 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1355 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1356 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1357 |
!FileDialog methodsFor:'accessing-components'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1358 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1359 |
addButton:aButton |
6068 | 1360 |
|buttonPanel okButton| |
1361 |
||
1362 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1363 |
okButton := self okButton. |
|
1364 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1365 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1366 |
buttonPanel addSubView:aButton before:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1367 |
] ifFalse:[ |
6068 | 1368 |
buttonPanel addSubView:aButton after:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1369 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1370 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1371 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1372 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1373 |
^ (self componentAt:#okButton) |
3892 | 1374 |
! |
1375 |
||
3904 | 1376 |
treeBrowser |
1377 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1378 |
||
1379 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1380 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1381 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1382 |
!FileDialog methodsFor:'accessing-look'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1383 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1384 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1385 |
self buttonPanelVisibleHolder value:false |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1386 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1387 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1388 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1389 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1390 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1391 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1392 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1393 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1394 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1395 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1396 |
self buttonPanelVisibleHolder value:true |
3904 | 1397 |
! |
1398 |
||
3892 | 1399 |
viewFiles |
1400 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1401 |
||
1402 |
^ viewFiles |
|
1403 |
! |
|
1404 |
||
1405 |
viewFiles:something |
|
1406 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1407 |
||
1408 |
viewFiles := something. |
|
1409 |
! ! |
|
1410 |
||
1411 |
!FileDialog methodsFor:'aspects'! |
|
1412 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1413 |
appendButtonVisibleHolder |
15451 | 1414 |
"if set, an additional 'append' button is shown |
1415 |
(to let user append to a file, instead of overwriting the file)" |
|
1416 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1417 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1418 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1419 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1420 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1421 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1422 |
|
5193 | 1423 |
appendLabelHolder |
1424 |
appendLabelHolder isNil ifTrue:[ |
|
1425 |
appendLabelHolder := 'Append' asValue. |
|
1426 |
]. |
|
1427 |
^ appendLabelHolder |
|
1428 |
! |
|
1429 |
||
4804 | 1430 |
aspectOrNil:aKey forSubApplication:aSubApp |
1431 |
"this hook provides an aspect for a subApp" |
|
1432 |
||
1433 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1434 |
directory notNil ifTrue:[ |
|
1435 |
^ (OrderedCollection with:directory) asValue |
|
1436 |
] |
|
1437 |
]. |
|
1438 |
^ nil |
|
1439 |
! |
|
1440 |
||
15451 | 1441 |
browseMenuItemVisible:aBoolean |
1442 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1443 |
||
1444 |
self browseMenuItemVisibleHolder value:aBoolean |
|
1445 |
! |
|
1446 |
||
1447 |
browseMenuItemVisibleHolder |
|
1448 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1449 |
||
5969 | 1450 |
browseVisibleHolder isNil ifTrue:[ |
8585 | 1451 |
browseVisibleHolder := true "false" asValue. |
5969 | 1452 |
]. |
1453 |
^ browseVisibleHolder. |
|
1454 |
! |
|
1455 |
||
15451 | 1456 |
browseVisibleHolder |
1457 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1458 |
||
1459 |
<resource: #obsolete> |
|
1460 |
^ self browseMenuItemVisibleHolder. |
|
1461 |
! |
|
1462 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1463 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1464 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1465 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1466 |
buttonPanelVisibleHolder onChangeSend:#buttonPanelVisibilityChanged to:self. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1467 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1468 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1469 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1470 |
|
3892 | 1471 |
cancelLabelHolder |
1472 |
||
1473 |
cancelLabelHolder isNil ifTrue:[ |
|
1474 |
cancelLabelHolder := 'Cancel' asValue. |
|
1475 |
]. |
|
1476 |
^ cancelLabelHolder. |
|
1477 |
! |
|
1478 |
||
1479 |
enableBack |
|
4804 | 1480 |
^ treeBrowser enableBack. |
3892 | 1481 |
! |
1482 |
||
1483 |
enableDirectoryUp |
|
4804 | 1484 |
^ treeBrowser enableDirectoryUp. |
3892 | 1485 |
! |
1486 |
||
1487 |
enableForward |
|
4804 | 1488 |
^ treeBrowser enableForward. |
3892 | 1489 |
! |
1490 |
||
8169 | 1491 |
enableGotoDesktop |
1492 |
^ treeBrowser enableGotoDesktop. |
|
1493 |
! |
|
1494 |
||
3892 | 1495 |
enableHome |
4804 | 1496 |
^ treeBrowser enableHome. |
3892 | 1497 |
! |
1498 |
||
9269
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1499 |
fileEntryFieldHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1500 |
"for directoryTreeBrowser" |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1501 |
|
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1502 |
^ self filenameHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1503 |
! |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1504 |
|
3892 | 1505 |
filenameHolder |
1506 |
"Return a value holder with the filename. |
|
1507 |
Shown in the filename input-field. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1508 |
Being the selection in the tree." |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1509 |
|
3892 | 1510 |
|holder| |
7581 | 1511 |
|
3892 | 1512 |
holder := builder bindingAt:#filenameHolder. |
1513 |
||
7581 | 1514 |
holder isNil ifTrue:[ |
13001 | 1515 |
holder := startFilename asValue. |
3892 | 1516 |
holder addDependent:self. |
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1517 |
builder aspectAt:#filenameHolder put:holder. |
3892 | 1518 |
]. |
1519 |
||
1520 |
^ holder. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1521 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1522 |
"Modified: / 09-07-2010 / 19:25:15 / cg" |
3892 | 1523 |
! |
1524 |
||
8183 | 1525 |
filenameHolder:aHolder |
8182 | 1526 |
"needed when used as subcanvas" |
8183 | 1527 |
|
1528 |
|holder| |
|
8182 | 1529 |
|
8183 | 1530 |
holder := builder aspectAt:#filenameHolder. |
1531 |
holder notNil ifTrue:[ |
|
1532 |
holder removeDependent:self |
|
1533 |
]. |
|
8182 | 1534 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1535 |
aHolder addDependent:self |
8182 | 1536 |
! |
1537 |
||
3904 | 1538 |
filenameLabelHolder |
1539 |
"Return a value holder for the input string. |
|
1540 |
" |
|
1541 |
filenameLabelHolder isNil ifTrue:[ |
|
1542 |
filenameLabelHolder := 'Filename:' asValue. |
|
1543 |
]. |
|
1544 |
^ filenameLabelHolder |
|
1545 |
! |
|
1546 |
||
3892 | 1547 |
filterHolder |
8183 | 1548 |
"Return a value holder for filter" |
3892 | 1549 |
|
1550 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1551 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1552 |
]. |
1553 |
^ filterHolder |
|
1554 |
! |
|
1555 |
||
8183 | 1556 |
filterHolder:aHolder |
1557 |
"needed when used as subcanvas" |
|
1558 |
||
1559 |
filterHolder := aHolder. |
|
1560 |
! |
|
1561 |
||
9113 | 1562 |
gotoBookmarksMenu |
6098 | 1563 |
<resource: #programMenu> |
1564 |
||
9113 | 1565 |
^ treeBrowser gotoBookmarksMenu |
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1566 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1567 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1568 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1569 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1570 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1571 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1572 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1573 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1574 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1575 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1576 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1577 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1578 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1579 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1580 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1581 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1582 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1583 |
"/ ^ menu |
6098 | 1584 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1585 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1586 |
! |
1587 |
||
6065 | 1588 |
listOfDeviceDrives |
1589 |
||
1590 |
listOfDeviceDrives isNil ifTrue:[ |
|
1591 |
listOfDeviceDrives := Filename volumes. |
|
1592 |
]. |
|
1593 |
^ listOfDeviceDrives |
|
1594 |
! |
|
1595 |
||
15766 | 1596 |
okLabelEnabled |
1597 |
<resource: #uiAspect> |
|
1598 |
||
1599 |
okLabelEnabled isNil ifTrue:[ |
|
1600 |
isLoadDialog ifTrue:[ |
|
1601 |
okLabelEnabled := BlockValue |
|
1602 |
with:[:filename| filename notNil |
|
15768 | 1603 |
and:[ |
1604 |
|physicalFilename| |
|
1605 |
physicalFilename := filename asFilename physicalFilename. |
|
1606 |
physicalFilename notNil and:[ |
|
1607 |
viewFiles |
|
1608 |
ifTrue:[physicalFilename isRegularFile] |
|
1609 |
ifFalse:[physicalFilename isDirectory] |
|
1610 |
]. |
|
15766 | 1611 |
] |
1612 |
] |
|
1613 |
argument:self filenameHolder. |
|
1614 |
] ifFalse:[ |
|
1615 |
okLabelEnabled := true. |
|
1616 |
]. |
|
1617 |
]. |
|
1618 |
^ okLabelEnabled. |
|
1619 |
! |
|
1620 |
||
3892 | 1621 |
okLabelHolder |
16185 | 1622 |
<resource: #uiAspect> |
3892 | 1623 |
|
1624 |
okLabelHolder isNil ifTrue:[ |
|
1625 |
okLabelHolder := 'OK' asValue. |
|
1626 |
]. |
|
1627 |
^ okLabelHolder. |
|
6065 | 1628 |
! |
1629 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1630 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1631 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1632 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1633 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1634 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1635 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1636 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1637 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1638 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1639 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1640 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1641 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1642 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1643 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1644 |
|
6065 | 1645 |
selectedDeviceDrive |
1646 |
||
1647 |
selectedDeviceDrive isNil ifTrue:[ |
|
1648 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1649 |
selectedDeviceDrive addDependent:self. |
|
1650 |
]. |
|
1651 |
^ selectedDeviceDrive |
|
9110 | 1652 |
! |
1653 |
||
9113 | 1654 |
showDirectoryTree |
1655 |
^ false |
|
1656 |
! |
|
1657 |
||
1658 |
showDiskUsageHolder |
|
1659 |
^ treeBrowser showDiskUsageHolder |
|
1660 |
! |
|
1661 |
||
9110 | 1662 |
showHiddenFiles |
9113 | 1663 |
^ treeBrowser showHiddenFiles |
1664 |
! |
|
1665 |
||
1666 |
shownFiles |
|
1667 |
^ treeBrowser shownFiles |
|
1668 |
! |
|
1669 |
||
1670 |
sortCaselessInTreeBrowser |
|
1671 |
^ treeBrowser sortCaselessInTreeBrowser |
|
1672 |
! |
|
1673 |
||
1674 |
sortInTreeVisibilityHolder |
|
1675 |
^ true |
|
1676 |
! |
|
1677 |
||
1678 |
sortPropertyInTree |
|
1679 |
^ treeBrowser sortBlockProperty |
|
1680 |
! |
|
1681 |
||
1682 |
viewDirsInContentsBrowser |
|
1683 |
^ false |
|
1684 |
! |
|
1685 |
||
1686 |
viewFilesInDirectoryTree |
|
1687 |
^ false |
|
1688 |
! |
|
1689 |
||
1690 |
viewNoteBookApplicationHolder |
|
9110 | 1691 |
^ false |
3892 | 1692 |
! ! |
1693 |
||
1694 |
!FileDialog methodsFor:'change & update'! |
|
1695 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1696 |
buttonPanelVisibilityChanged |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1697 |
|panel filePart partAbove| |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1698 |
|
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1699 |
panel := builder componentAt:#FilePanel. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1700 |
panel isNil ifTrue:[ |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1701 |
filePart := builder componentAt:#FilePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1702 |
]. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1703 |
partAbove := panel ? filePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1704 |
partAbove notNil ifTrue:[ |
5598 | 1705 |
buttonPanelVisibleHolder value ifTrue:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1706 |
partAbove layout bottomOffset:-40 |
5598 | 1707 |
] ifFalse:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1708 |
partAbove layout bottomOffset:0 |
5598 | 1709 |
]. |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1710 |
partAbove containerChangedSize "/ force resize |
5598 | 1711 |
] |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1712 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1713 |
|
9765 | 1714 |
fileSelectionChanged |
1715 |
|files newFile entryFieldFilename filenameHolder| |
|
1716 |
||
1717 |
filenameHolder := self filenameHolder. |
|
1718 |
||
1719 |
files := treeBrowser currentFileNameHolder value. |
|
1720 |
||
1721 |
(files isEmpty) ifTrue:[ |
|
1722 |
newFile := nil. |
|
1723 |
] ifFalse:[ |
|
1724 |
files size == 1 ifTrue:[ |
|
1725 |
newFile := files first. |
|
1726 |
] ifFalse:[ |
|
1727 |
newFile := ''. |
|
1728 |
]. |
|
1729 |
]. |
|
1730 |
(filenameHolder value notNil |
|
1731 |
and:[newFile notNil |
|
1732 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
1733 |
entryFieldFilename := filenameHolder value asFilename. |
|
1734 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
1735 |
entryFieldFilename isDirectory ifFalse:[ |
|
1736 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
|
1737 |
]. |
|
1738 |
]. |
|
1739 |
]. |
|
1740 |
filenameHolder value:newFile withoutNotifying:self. |
|
1741 |
OperatingSystem supportsVolumes ifTrue:[ |
|
1742 |
| volume | |
|
1743 |
volume := (files size >= 1) |
|
1744 |
ifTrue:[files first volume] |
|
1745 |
ifFalse:nil. |
|
1746 |
self selectedDeviceDrive value:volume. |
|
1747 |
]. |
|
1748 |
||
1749 |
"Created: / 14-02-2011 / 17:54:08 / cg" |
|
1750 |
! |
|
1751 |
||
6065 | 1752 |
selectedDeviceDriveChanged |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1753 |
|newDrive curSel newFile| |
6065 | 1754 |
|
1755 |
newDrive := self selectedDeviceDrive value. |
|
1756 |
curSel := treeBrowser currentFileNameHolder value. |
|
1757 |
curSel notEmpty ifTrue:[ |
|
1758 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1759 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1760 |
|
6065 | 1761 |
newDrive notNil ifTrue:[ |
1762 |
newFile := newDrive asFilename. |
|
1763 |
newFile isReadable ifTrue:[ |
|
1764 |
treeBrowser gotoFile:newFile. |
|
1765 |
^self. |
|
1766 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1767 |
self warn:'Cannot open drive %1' with:newFile asFilename volume. |
6065 | 1768 |
]. |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1769 |
|
16477 | 1770 |
newDrive := curSel notEmpty |
1771 |
ifTrue:[ curSel first volume ] |
|
1772 |
ifFalse:[ |
|
1773 |
OperatingSystem isMSWINDOWSlike ifTrue:['C:'] ifFalse:['/'] |
|
1774 |
"/ Filename defaultVolumeName. |
|
1775 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1776 |
self selectedDeviceDrive value:newDrive. |
6065 | 1777 |
! |
1778 |
||
3892 | 1779 |
update:something with:aParameter from:changedObject |
9765 | 1780 |
|newLabel fn| |
3892 | 1781 |
|
1782 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
9765 | 1783 |
self fileSelectionChanged. |
1784 |
^ self. |
|
3892 | 1785 |
]. |
4804 | 1786 |
|
6065 | 1787 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1788 |
self selectedDeviceDriveChanged. |
|
1789 |
^ self. |
|
1790 |
]. |
|
3904 | 1791 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1792 |
changedObject value ifTrue:[ |
|
4804 | 1793 |
newLabel := 'Filename:'. |
3904 | 1794 |
] ifFalse:[ |
4804 | 1795 |
newLabel := 'Directory:'. |
1796 |
]. |
|
1797 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1798 |
]. |
9765 | 1799 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1800 |
fn := changedObject value asFilename. |
1801 |
(fn exists) ifFalse:[^ self]. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1802 |
treeBrowser currentFileNameHolder |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1803 |
value:(OrderedCollection with:fn) withoutNotifying:self. |
5949 | 1804 |
fn isDirectory ifTrue:[ |
1805 |
treeBrowser expandEnforceSelectedItems. |
|
1806 |
]. |
|
3892 | 1807 |
]. |
1808 |
^ super update:something with:aParameter from:changedObject |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1809 |
|
9765 | 1810 |
"Modified: / 14-02-2011 / 17:54:35 / cg" |
3892 | 1811 |
! ! |
1812 |
||
12816 | 1813 |
!FileDialog methodsFor:'construction-adding'! |
1814 |
||
1815 |
addComponent: aView |
|
12875 | 1816 |
verticalPanelView addComponent: aView |
12816 | 1817 |
|
1818 |
"Created: / 03-06-2013 / 17:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1819 |
! ! |
|
1820 |
||
3892 | 1821 |
!FileDialog methodsFor:'event handling'! |
1822 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1823 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1824 |
"valid after the dialog has been closed: true if append was pressed" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1825 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1826 |
^ appendWasPressed |
3892 | 1827 |
! ! |
1828 |
||
1829 |
!FileDialog methodsFor:'initialization & release'! |
|
1830 |
||
5932 | 1831 |
closeDownViews |
9765 | 1832 |
self rememberExtent. |
5932 | 1833 |
super closeDownViews. |
9765 | 1834 |
|
1835 |
"Modified: / 14-02-2011 / 17:55:14 / cg" |
|
5932 | 1836 |
! |
1837 |
||
1838 |
closeWindow |
|
9765 | 1839 |
self rememberExtent. |
5932 | 1840 |
super closeWindow. |
9765 | 1841 |
|
1842 |
"Modified: / 14-02-2011 / 17:55:55 / cg" |
|
5932 | 1843 |
! |
1844 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1845 |
commonPostOpen |
8182 | 1846 |
|selection| |
3892 | 1847 |
|
1848 |
"/ self windowGroup addPreEventHook:self. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1849 |
|
3892 | 1850 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1851 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1852 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1853 |
|
6409 | 1854 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1855 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1856 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1857 |
|
1858 |
self isLoadDialog ifTrue:[ |
|
4796 | 1859 |
treeBrowser newVisibilityHolder value:false. |
1860 |
treeBrowser allowFileOperations value:false. |
|
1861 |
self newDirectoryVisibilityHolder value:false. |
|
1862 |
]. |
|
5927 | 1863 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1864 |
|
1865 |
selection := treeBrowser treeSelectionHolder value. |
|
1866 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1867 |
selection := selection asCollection first. |
5929 | 1868 |
selection enforcedExpand. |
1869 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1870 |
]. |
|
4796 | 1871 |
! |
1872 |
||
6409 | 1873 |
initialRootDirectory |
1874 |
"returns the directory the browser is open on |
|
1875 |
" |
|
1876 |
|root| |
|
1877 |
||
9678 | 1878 |
initialRoot isNil ifTrue:[ |
6409 | 1879 |
|
9678 | 1880 |
(root := self directory) notNil ifTrue:[ |
1881 |
root := root asFilename. |
|
6409 | 1882 |
|
1883 |
root isDirectory ifFalse:[ |
|
9678 | 1884 |
root := root directory. |
1885 |
root isDirectory ifFalse:[ |
|
1886 |
root := nil. |
|
1887 |
] |
|
6409 | 1888 |
] |
9678 | 1889 |
]. |
1890 |
root isNil ifTrue:[ |
|
1891 |
root := Filename currentDirectory. |
|
1892 |
]. |
|
1893 |
initialRoot := root asAbsoluteFilename. |
|
6409 | 1894 |
]. |
9678 | 1895 |
^ initialRoot |
1896 |
||
1897 |
"Modified: / 27-12-2010 / 09:56:30 / cg" |
|
6409 | 1898 |
! |
1899 |
||
15767 | 1900 |
initialize |
15768 | 1901 |
super initialize. |
15767 | 1902 |
isLoadDialog := false. |
1903 |
! |
|
1904 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1905 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1906 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1907 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1908 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1909 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1910 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1911 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1912 |
filterField := aWidget. |
4796 | 1913 |
! |
1914 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1915 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1916 |
treeBrowser := aSubCanvasView client. |
6409 | 1917 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
9113 | 1918 |
treeBrowser sortPropertyInTree:(treeBrowser sortBlockProperty). |
9553 | 1919 |
treeBrowser showHiddenFiles value:true. |
1920 |
||
1921 |
"Modified: / 24-08-2010 / 16:07:16 / sr" |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1922 |
! |
4796 | 1923 |
|
12875 | 1924 |
postBuildVerticalPanelView:aView |
1925 |
verticalPanelView := aView. |
|
12816 | 1926 |
|
1927 |
"Created: / 03-06-2013 / 17:41:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1928 |
! |
|
1929 |
||
13004 | 1930 |
postBuildWith:aBuilder |
1931 |
|win hMin| |
|
1932 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1933 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1934 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1935 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1936 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1937 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1938 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1939 |
|
13004 | 1940 |
win := aBuilder window . |
13187 | 1941 |
win minExtent notNil ifTrue:[ |
1942 |
"minExtent is nil if window is not a TopView" |
|
1943 |
hMin := (win margin * 2) |
|
1944 |
+ (aBuilder menuBar isNil ifTrue:[0] ifFalse:[aBuilder menuBar preferredHeight]) |
|
1945 |
+ (aBuilder componentAt:#FilenameEntryField) height |
|
1946 |
+ (aBuilder componentAt:#ToolBar1) preferredHeight |
|
1947 |
+ (aBuilder componentAt:#ButtonPanel) preferredHeight. |
|
13004 | 1948 |
|
13187 | 1949 |
win minExtent:(win minExtent x @ hMin). |
1950 |
]. |
|
13090 | 1951 |
win topView label:self initialText. |
13004 | 1952 |
|
6632 | 1953 |
super postBuildWith:aBuilder |
5932 | 1954 |
! |
1955 |
||
8182 | 1956 |
postOpenAsSubcanvasWith:aBuilder |
1957 |
super postOpenAsSubcanvasWith:aBuilder. |
|
1958 |
||
1959 |
"No ok and cancel buttons, when dialog is part of a larger dialog" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1960 |
self hideButtonPanel. |
8183 | 1961 |
|
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
1962 |
"filenameHolder contains the initial file name, or nil" |
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1963 |
self startFilename:self filenameHolder value. |
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
1964 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
8182 | 1965 |
! |
1966 |
||
12816 | 1967 |
preOpenWith:aBuilder |
12883 | 1968 |
"called right before being opened" |
1969 |
||
13025 | 1970 |
|delta| |
8182 | 1971 |
|
12816 | 1972 |
"Increase height of the window so height of the file part |
12875 | 1973 |
remain the same. This cares for any components added by a hook" |
1974 |
||
1975 |
verticalPanelView notNil ifTrue:[ |
|
12883 | 1976 |
delta := verticalPanelView preferredHeight - verticalPanelView height. |
1977 |
delta > 0 ifTrue:[ |
|
1978 |
"/ components where added (possibly in the aboutToOpenBoxNotifiction |
|
1979 |
aBuilder window height: (aBuilder window height + delta). |
|
12875 | 1980 |
]. |
12883 | 1981 |
|
1982 |
"/ sumH := 0. |
|
1983 |
"/ verticalPanelView subViews from:2 do:[:view| |
|
1984 |
"/ sumH := sumH + view preferredHeight. |
|
1985 |
"/ ]. |
|
1986 |
"/ sumH ~~ 0 ifTrue:[ |
|
1987 |
"/ newVPanelHeight := verticalPanelView preferredHeight374 |
|
1988 |
"/ aBuilder window height: aBuilder window height + sumH. |
|
1989 |
"/ ]. |
|
8182 | 1990 |
]. |
12816 | 1991 |
|
14151 | 1992 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
1993 |
||
12816 | 1994 |
"Created: / 03-06-2013 / 18:19:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8182 | 1995 |
! |
1996 |
||
9765 | 1997 |
rememberExtent |
5932 | 1998 |
self class lastExtent:self window topView extent. |
9765 | 1999 |
|
2000 |
"Created: / 14-02-2011 / 17:55:11 / cg" |
|
4796 | 2001 |
! ! |
2002 |
||
9113 | 2003 |
!FileDialog methodsFor:'menus'! |
2004 |
||
2005 |
bookmarksMenu |
|
2006 |
^ treeBrowser bookmarksMenu |
|
2007 |
! |
|
2008 |
||
2009 |
directoryMenu |
|
2010 |
^ treeBrowser directoryMenu |
|
2011 |
! |
|
2012 |
||
2013 |
showMenuSpecForDialog |
|
2014 |
^ treeBrowser class showMenuSpecForDialog |
|
2015 |
! |
|
2016 |
||
2017 |
sortMenu |
|
2018 |
^ treeBrowser class sortInTreeMenu |
|
2019 |
! |
|
2020 |
||
2021 |
visitedDirectoriesMenu |
|
2022 |
^ treeBrowser visitedDirectoriesMenu |
|
2023 |
! ! |
|
2024 |
||
4796 | 2025 |
!FileDialog methodsFor:'private'! |
2026 |
||
2027 |
returnWasPressedInFilterField |
|
8663 | 2028 |
|wg ev| |
4796 | 2029 |
|
8663 | 2030 |
((wg := self windowGroup) notNil |
2031 |
and:[ (ev := wg lastEvent) notNil |
|
2032 |
and:[ ev isKeyEvent |
|
2033 |
and:[ ev key == #Return |
|
2034 |
and:[ (ev targetView isSameOrComponentOf:filterField) |
|
2035 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]]) ifTrue:[ |
|
4796 | 2036 |
^ true |
2037 |
]. |
|
2038 |
^ false |
|
2039 |
! |
|
2040 |
||
2041 |
returnWasPressedInFilterOrFilenameField |
|
2042 |
|ev| |
|
2043 |
||
2044 |
ev := self windowGroup lastEvent. |
|
2045 |
(ev notNil |
|
2046 |
and:[ev isKeyEvent |
|
2047 |
and:[ev key == #Return |
|
2048 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
2049 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
2050 |
^ true |
|
2051 |
]. |
|
2052 |
^ false |
|
2053 |
! ! |
|
2054 |
||
6065 | 2055 |
!FileDialog methodsFor:'queries'! |
2056 |
||
2057 |
driveSelectorVisible |
|
2058 |
^ OperatingSystem isMSDOSlike |
|
2059 |
! ! |
|
2060 |
||
4796 | 2061 |
!FileDialog methodsFor:'user actions'! |
2062 |
||
2063 |
appendPressed |
|
2064 |
appendWasPressed := true. |
|
2065 |
self commonAcceptAction. |
|
2066 |
! |
|
2067 |
||
2068 |
commonAcceptAction |
|
2069 |
filenameField accept. |
|
2070 |
self result:(self filenameHolder value asString). |
|
2071 |
||
2072 |
^ super doAccept |
|
2073 |
! |
|
2074 |
||
2075 |
doAccept |
|
2076 |
"force accept - ignore in filterField" |
|
2077 |
||
2078 |
self returnWasPressedInFilterField ifTrue:[ |
|
2079 |
^ self |
|
2080 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2081 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2082 |
"/ have to send the event to the TreeView |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2083 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2084 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2085 |
]. |
4796 | 2086 |
appendWasPressed := false. |
2087 |
self commonAcceptAction. |
|
2088 |
! |
|
2089 |
||
2090 |
doBack |
|
2091 |
||
2092 |
treeBrowser doBack. |
|
2093 |
! |
|
2094 |
||
5966 | 2095 |
doBrowseDirectory |
2096 |
UserPreferences fileBrowserClass openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
|
2097 |
||
2098 |
||
2099 |
! |
|
2100 |
||
4796 | 2101 |
doCancel |
2102 |
||
2103 |
self result:nil. |
|
2104 |
^ super doCancel. |
|
2105 |
! |
|
2106 |
||
2107 |
doForward |
|
2108 |
||
2109 |
treeBrowser doForward. |
|
2110 |
! |
|
2111 |
||
2112 |
doGoDirectoryUp |
|
2113 |
||
2114 |
treeBrowser doGoDirectoryUp. |
|
2115 |
! |
|
2116 |
||
8092 | 2117 |
doGotoDesktopDirectory |
2118 |
||
2119 |
treeBrowser doGotoDesktopDirectory. |
|
2120 |
! |
|
2121 |
||
4796 | 2122 |
doGotoHomeDirectory |
2123 |
||
2124 |
treeBrowser doGotoHomeDirectory. |
|
2125 |
! |
|
2126 |
||
2127 |
menuDirHistory:backOrForward |
|
2128 |
||
2129 |
^ treeBrowser menuDirHistory:backOrForward. |
|
2130 |
! |
|
2131 |
||
2132 |
menuDirHistoryBack |
|
2133 |
||
2134 |
^ treeBrowser menuDirHistory:#back. |
|
2135 |
! |
|
2136 |
||
2137 |
menuDirHistoryForward |
|
2138 |
||
2139 |
^ treeBrowser menuDirHistory:#forward. |
|
2140 |
! |
|
2141 |
||
2142 |
newDirectory |
|
2143 |
||
2144 |
^ treeBrowser newDirectory |
|
2145 |
! |
|
2146 |
||
2147 |
okPressed |
|
2148 |
self doAccept |
|
9113 | 2149 |
! |
2150 |
||
2151 |
updateCurrentDirectory |
|
2152 |
treeBrowser updateCurrentDirectory |
|
4796 | 2153 |
! ! |
2154 |
||
2155 |
!FileDialog class methodsFor:'documentation'! |
|
2156 |
||
2157 |
version |
|
15725 | 2158 |
^ '$Header$' |
12883 | 2159 |
! |
2160 |
||
2161 |
version_CVS |
|
15725 | 2162 |
^ '$Header$' |
9110 | 2163 |
! |
2164 |
||
12816 | 2165 |
version_HG |
2166 |
||
2167 |
^ '$Changeset: <not expanded> $' |
|
2168 |
! |
|
2169 |
||
2170 |
version_SVN |
|
15725 | 2171 |
^ '$Id$' |
4796 | 2172 |
! ! |
12816 | 2173 |