author | Claus Gittinger <cg@exept.de> |
Thu, 18 Jan 2018 17:18:35 +0100 | |
changeset 17943 | b2efb0175eab |
parent 17919 | d806bf4a9532 |
child 17990 | 0e4375f0483f |
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 |
" |
|
17527 | 125 |
- make the filedialog windows like |
126 |
filename entry field shows only the filename not the whole directory |
|
127 |
the tree always starts in current directory |
|
128 |
the parent tree is shown in a combobox where the perents are selectable |
|
9769 | 129 |
|
17527 | 130 |
- do not expand the ~ or relative pathnames to absolute pathnames |
5062 | 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; |
|
17410 | 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" |
17410 | 722 |
"Modified (format): / 14-02-2017 / 12:49:34 / cg" |
3892 | 723 |
! ! |
724 |
||
725 |
!FileDialog class methodsFor:'accessing'! |
|
726 |
||
6650 | 727 |
classResources |
9110 | 728 |
^ (FileBrowserV2 ? AbstractFileBrowser) classResources |
6650 | 729 |
! |
730 |
||
5931 | 731 |
lastExtent |
732 |
^ LastExtent |
|
733 |
! |
|
734 |
||
735 |
lastExtent:anExtent |
|
736 |
LastExtent := anExtent |
|
737 |
! |
|
738 |
||
3953 | 739 |
setDoubleClickActionFor:instance |
740 |
||
741 |
instance doubleClickAction:[:anIndex| |
|
742 |
| item | |
|
743 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
744 |
item notNil ifTrue:[ |
|
5329 | 745 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 746 |
instance doAccept. |
747 |
] |
|
748 |
] |
|
749 |
]. |
|
3892 | 750 |
! ! |
751 |
||
8585 | 752 |
!FileDialog class methodsFor:'help specs'! |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
753 |
|
17919 | 754 |
helpSpec |
8585 | 755 |
"This resource specification was automatically generated |
756 |
by the UIHelpTool of ST/X." |
|
757 |
||
758 |
"Do not manually edit this!! If it is corrupted, |
|
759 |
the UIHelpTool may not be able to read the specification." |
|
760 |
||
761 |
" |
|
762 |
UIHelpTool openOnClass:FileDialog |
|
763 |
" |
|
764 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
765 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
766 |
|
17919 | 767 |
^ FileBrowserV2 helpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
768 |
|
8585 | 769 |
#openFileBrowser |
13003 | 770 |
'Open a FileBrowser on the selected directory' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
771 |
|
8585 | 772 |
) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
773 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
774 |
|
3892 | 775 |
!FileDialog class methodsFor:'interface specs'! |
776 |
||
777 |
windowSpec |
|
778 |
"This resource specification was automatically generated |
|
779 |
by the UIPainter of ST/X." |
|
780 |
||
781 |
"Do not manually edit this!! If it is corrupted, |
|
782 |
the UIPainter may not be able to read the specification." |
|
783 |
||
784 |
" |
|
785 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
786 |
FileDialog new openInterface:#windowSpec |
|
787 |
FileDialog open |
|
788 |
" |
|
789 |
||
790 |
<resource: #canvas> |
|
791 |
||
792 |
^ |
|
13741 | 793 |
#(FullSpec |
794 |
name: windowSpec |
|
795 |
window: |
|
796 |
(WindowSpec |
|
797 |
label: 'FileDialog' |
|
798 |
name: 'FileDialog' |
|
799 |
min: (Point 10 10) |
|
16802 | 800 |
bounds: (Rectangle 0 0 460 482) |
13741 | 801 |
menu: mainMenu |
802 |
performer: treeBrowser |
|
803 |
) |
|
804 |
component: |
|
805 |
(SpecCollection |
|
806 |
collection: ( |
|
807 |
(VerticalPanelViewSpec |
|
808 |
name: 'FilePanel' |
|
16802 | 809 |
layout: (LayoutFrame 0 0 0 0 0 1 -40 1) |
13741 | 810 |
horizontalLayout: fit |
811 |
verticalLayout: bottomFit |
|
812 |
horizontalSpace: 0 |
|
813 |
verticalSpace: 3 |
|
814 |
elementsChangeSize: true |
|
815 |
component: |
|
816 |
(SpecCollection |
|
817 |
collection: ( |
|
818 |
(ViewSpec |
|
819 |
name: 'FilePart' |
|
820 |
component: |
|
821 |
(SpecCollection |
|
822 |
collection: ( |
|
823 |
(MenuPanelSpec |
|
824 |
name: 'ToolBar1' |
|
825 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0) |
|
826 |
tabable: true |
|
827 |
menu: toolBarMenu |
|
828 |
textDefault: true |
|
829 |
) |
|
830 |
(VariableHorizontalPanelSpec |
|
831 |
name: 'DeviceAndFilterPanel' |
|
832 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0) |
|
833 |
level: 1 |
|
834 |
showHandle: true |
|
835 |
component: |
|
836 |
(SpecCollection |
|
837 |
collection: ( |
|
838 |
(ViewSpec |
|
839 |
name: 'Box1' |
|
840 |
component: |
|
841 |
(SpecCollection |
|
842 |
collection: ( |
|
843 |
(ComboListSpec |
|
844 |
name: 'ComboList1' |
|
845 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1) |
|
846 |
visibilityChannel: driveSelectorVisible |
|
847 |
model: selectedDeviceDrive |
|
848 |
comboList: listOfDeviceDrives |
|
849 |
useIndex: false |
|
850 |
hidePullDownMenuButton: false |
|
12816 | 851 |
) |
13741 | 852 |
) |
853 |
||
854 |
) |
|
855 |
) |
|
856 |
(ViewSpec |
|
857 |
name: 'Box2' |
|
858 |
component: |
|
859 |
(SpecCollection |
|
860 |
collection: ( |
|
861 |
(LabelSpec |
|
862 |
label: 'Filter:' |
|
863 |
name: 'FilterLabel' |
|
864 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1) |
|
865 |
translateLabel: true |
|
866 |
adjust: right |
|
12816 | 867 |
) |
13741 | 868 |
(InputFieldSpec |
869 |
name: 'FilterEntryField' |
|
870 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1) |
|
871 |
model: filterHolder |
|
872 |
immediateAccept: true |
|
873 |
acceptOnReturn: true |
|
874 |
acceptOnTab: true |
|
875 |
acceptOnLostFocus: true |
|
876 |
acceptOnPointerLeave: false |
|
877 |
postBuildCallback: postBuildFilterField: |
|
878 |
) |
|
879 |
) |
|
880 |
||
881 |
) |
|
6065 | 882 |
) |
13741 | 883 |
) |
884 |
||
885 |
) |
|
16802 | 886 |
handles: (Any 0.29999999999999999 1.0) |
13741 | 887 |
) |
888 |
(SubCanvasSpec |
|
889 |
name: 'DirectoryTreeBrowser' |
|
16802 | 890 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -34 1) |
13741 | 891 |
tabable: true |
892 |
hasHorizontalScrollBar: false |
|
893 |
hasVerticalScrollBar: false |
|
894 |
majorKey: DirectoryTreeBrowser |
|
895 |
subAspectHolders: |
|
896 |
(Array |
|
6065 | 897 |
|
13741 | 898 |
(SubChannelInfoSpec |
899 |
subAspect: filterModel |
|
900 |
aspect: filterHolder |
|
901 |
) |
|
902 |
(SubChannelInfoSpec |
|
903 |
subAspect: rootHolder |
|
904 |
aspect: rootDirectoryHolder |
|
905 |
) |
|
906 |
||
907 |
(SubChannelInfoSpec |
|
908 |
subAspect: showHiddenFiles |
|
909 |
aspect: showHiddenFiles |
|
910 |
) |
|
911 |
) |
|
912 |
createNewApplication: true |
|
913 |
createNewBuilder: true |
|
914 |
postBuildCallback: postBuildTreeBrowser: |
|
4804 | 915 |
) |
13741 | 916 |
(LabelSpec |
917 |
label: 'Filename:' |
|
918 |
name: 'FilenameLabel' |
|
16802 | 919 |
layout: (LayoutFrame 3 0 -28 1 110 0 -1 1) |
13741 | 920 |
translateLabel: true |
921 |
labelChannel: filenameLabelHolder |
|
922 |
adjust: left |
|
923 |
) |
|
924 |
(FilenameInputFieldSpec |
|
925 |
name: 'FilenameEntryField' |
|
16802 | 926 |
layout: (LayoutFrame 110 0 -28 1 -2 1 -1 1) |
13741 | 927 |
tabable: true |
928 |
model: filenameHolder |
|
929 |
immediateAccept: false |
|
930 |
acceptOnPointerLeave: true |
|
931 |
hasKeyboardFocusInitially: true |
|
932 |
postBuildCallback: postBuildFileNameField: |
|
933 |
) |
|
934 |
) |
|
935 |
||
936 |
) |
|
16802 | 937 |
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
|
938 |
) |
13741 | 939 |
) |
940 |
||
941 |
) |
|
942 |
postBuildCallback: postBuildVerticalPanelView: |
|
943 |
) |
|
944 |
(HorizontalPanelViewSpec |
|
945 |
name: 'ButtonPanel' |
|
16802 | 946 |
layout: (LayoutFrame 0 0.0 -34 1 -16 1 0 1) |
13741 | 947 |
visibilityChannel: buttonPanelVisibleHolder |
948 |
horizontalLayout: fitSpace |
|
949 |
verticalLayout: center |
|
950 |
horizontalSpace: 3 |
|
951 |
verticalSpace: 3 |
|
952 |
reverseOrderIfOKAtLeft: true |
|
953 |
component: |
|
954 |
(SpecCollection |
|
955 |
collection: ( |
|
956 |
(ActionButtonSpec |
|
957 |
label: 'Cancel' |
|
958 |
name: 'cancelButton' |
|
959 |
translateLabel: true |
|
960 |
labelChannel: cancelLabelHolder |
|
961 |
tabable: true |
|
962 |
model: doCancel |
|
16802 | 963 |
extent: (Point 142 32) |
15366 | 964 |
usePreferredHeight: true |
3892 | 965 |
) |
13741 | 966 |
(ActionButtonSpec |
967 |
label: 'Append' |
|
968 |
name: 'appendButton' |
|
969 |
visibilityChannel: appendButtonVisibleHolder |
|
970 |
translateLabel: true |
|
971 |
labelChannel: appendLabelHolder |
|
972 |
tabable: true |
|
973 |
model: appendPressed |
|
16802 | 974 |
extent: (Point 143 32) |
15366 | 975 |
usePreferredHeight: true |
13741 | 976 |
) |
977 |
(ActionButtonSpec |
|
978 |
label: 'OK' |
|
979 |
name: 'okButton' |
|
980 |
translateLabel: true |
|
981 |
labelChannel: okLabelHolder |
|
982 |
tabable: true |
|
983 |
model: okPressed |
|
15766 | 984 |
enableChannel: okLabelEnabled |
13741 | 985 |
isDefault: true |
16802 | 986 |
extent: (Point 143 32) |
15366 | 987 |
usePreferredHeight: true |
13741 | 988 |
) |
989 |
) |
|
990 |
||
991 |
) |
|
992 |
keepSpaceForOSXResizeHandleH: true |
|
3892 | 993 |
) |
13741 | 994 |
) |
995 |
||
996 |
) |
|
997 |
) |
|
3892 | 998 |
! ! |
999 |
||
1000 |
!FileDialog class methodsFor:'menu specs'! |
|
1001 |
||
9113 | 1002 |
mainMenu |
1003 |
"This resource specification was automatically generated |
|
1004 |
by the MenuEditor of ST/X." |
|
1005 |
||
1006 |
"Do not manually edit this!! If it is corrupted, |
|
1007 |
the MenuEditor may not be able to read the specification." |
|
1008 |
||
1009 |
" |
|
1010 |
MenuEditor new openOnClass:FileDialog andSelector:#mainMenu |
|
1011 |
(Menu new fromLiteralArrayEncoding:(FileDialog mainMenu)) startUp |
|
1012 |
" |
|
1013 |
||
1014 |
<resource: #menu> |
|
1015 |
||
1016 |
^ |
|
1017 |
#(Menu |
|
1018 |
( |
|
1019 |
(MenuItem |
|
1020 |
label: 'Directory' |
|
1021 |
translateLabel: true |
|
1022 |
submenu: |
|
1023 |
(Menu |
|
1024 |
( |
|
1025 |
(MenuItem |
|
1026 |
label: 'Up' |
|
1027 |
itemValue: doGoDirectoryUp |
|
1028 |
translateLabel: true |
|
1029 |
) |
|
1030 |
(MenuItem |
|
1031 |
label: '-' |
|
1032 |
) |
|
1033 |
(MenuItem |
|
1034 |
activeHelpKey: directoryBack |
|
1035 |
enabled: enableBack |
|
1036 |
label: 'Back' |
|
1037 |
itemValue: doBack |
|
1038 |
translateLabel: true |
|
1039 |
) |
|
1040 |
(MenuItem |
|
1041 |
activeHelpKey: directoryBack |
|
1042 |
enabled: enableForward |
|
1043 |
label: 'Forward' |
|
1044 |
itemValue: doForward |
|
1045 |
translateLabel: true |
|
1046 |
) |
|
1047 |
(MenuItem |
|
1048 |
label: '-' |
|
1049 |
) |
|
1050 |
(MenuItem |
|
1051 |
enabled: enableHome |
|
1052 |
label: 'Home Directory' |
|
1053 |
itemValue: doGotoHomeDirectory |
|
1054 |
translateLabel: true |
|
1055 |
) |
|
1056 |
(MenuItem |
|
1057 |
label: 'Bookmarks' |
|
1058 |
translateLabel: true |
|
1059 |
submenuChannel: bookmarksMenu |
|
1060 |
) |
|
1061 |
(MenuItem |
|
1062 |
label: 'Visited Directories' |
|
1063 |
translateLabel: true |
|
1064 |
submenuChannel: visitedDirectoriesMenu |
|
1065 |
) |
|
1066 |
) |
|
1067 |
nil |
|
1068 |
nil |
|
1069 |
) |
|
1070 |
) |
|
1071 |
(MenuItem |
|
1072 |
label: 'View' |
|
1073 |
translateLabel: true |
|
1074 |
submenu: |
|
1075 |
(Menu |
|
1076 |
( |
|
1077 |
(MenuItem |
|
1078 |
label: 'Sort' |
|
1079 |
translateLabel: true |
|
1080 |
submenuChannel: sortMenu |
|
1081 |
) |
|
1082 |
(MenuItem |
|
1083 |
label: 'Show' |
|
1084 |
translateLabel: true |
|
1085 |
submenuChannel: showMenuSpecForDialog |
|
1086 |
) |
|
1087 |
(MenuItem |
|
1088 |
label: '-' |
|
1089 |
) |
|
1090 |
(MenuItem |
|
1091 |
label: 'Update' |
|
1092 |
itemValue: updateCurrentDirectory |
|
1093 |
translateLabel: true |
|
1094 |
) |
|
1095 |
) |
|
1096 |
nil |
|
1097 |
nil |
|
1098 |
) |
|
1099 |
) |
|
1100 |
) |
|
1101 |
nil |
|
1102 |
nil |
|
1103 |
) |
|
1104 |
! |
|
1105 |
||
3892 | 1106 |
toolBarMenu |
1107 |
"This resource specification was automatically generated |
|
1108 |
by the MenuEditor of ST/X." |
|
1109 |
||
1110 |
"Do not manually edit this!! If it is corrupted, |
|
1111 |
the MenuEditor may not be able to read the specification." |
|
1112 |
||
1113 |
" |
|
1114 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
1115 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
1116 |
" |
|
1117 |
||
1118 |
<resource: #menu> |
|
1119 |
||
1120 |
^ |
|
5873 | 1121 |
#(Menu |
1122 |
( |
|
1123 |
(MenuItem |
|
1124 |
activeHelpKey: directoryBack |
|
1125 |
enabled: enableBack |
|
1126 |
label: 'Back' |
|
1127 |
itemValue: doBack |
|
1128 |
translateLabel: true |
|
1129 |
isButton: true |
|
1130 |
submenuChannel: menuDirHistoryBack |
|
6087 | 1131 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 1132 |
keepLinkedMenu: true |
3892 | 1133 |
) |
5873 | 1134 |
(MenuItem |
1135 |
label: '' |
|
3892 | 1136 |
) |
5873 | 1137 |
(MenuItem |
1138 |
activeHelpKey: directoryForward |
|
1139 |
enabled: enableForward |
|
1140 |
label: 'Forward' |
|
1141 |
itemValue: doForward |
|
1142 |
translateLabel: true |
|
1143 |
isButton: true |
|
1144 |
submenuChannel: menuDirHistoryForward |
|
6087 | 1145 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 1146 |
keepLinkedMenu: true |
3892 | 1147 |
) |
5873 | 1148 |
(MenuItem |
6462 | 1149 |
label: '-' |
1150 |
) |
|
1151 |
(MenuItem |
|
1152 |
activeHelpKey: directoryUp |
|
1153 |
enabled: enableDirectoryUp |
|
1154 |
label: 'DirectoryUp' |
|
1155 |
itemValue: doGoDirectoryUp |
|
1156 |
translateLabel: true |
|
1157 |
isButton: true |
|
1158 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 1159 |
) |
5873 | 1160 |
(MenuItem |
1161 |
activeHelpKey: fileHome |
|
1162 |
enabled: enableHome |
|
1163 |
label: 'Home' |
|
1164 |
itemValue: doGotoHomeDirectory |
|
1165 |
translateLabel: true |
|
1166 |
isButton: true |
|
6096 | 1167 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 1168 |
) |
5873 | 1169 |
(MenuItem |
8092 | 1170 |
activeHelpKey: fileDesktop |
8586 | 1171 |
enabled: enableGotoDesktop |
8092 | 1172 |
label: 'Desktop' |
1173 |
itemValue: doGotoDesktopDirectory |
|
1174 |
translateLabel: true |
|
1175 |
isButton: true |
|
1176 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
1177 |
) |
|
1178 |
(MenuItem |
|
6098 | 1179 |
activeHelpKey: fileGotoBookmark |
1180 |
label: 'Bookmarks' |
|
1181 |
translateLabel: true |
|
1182 |
isButton: true |
|
9113 | 1183 |
submenuChannel: gotoBookmarksMenu |
6098 | 1184 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
1185 |
) |
|
1186 |
(MenuItem |
|
5873 | 1187 |
label: '-' |
1188 |
isVisible: newDirectoryVisibilityHolder |
|
3923 | 1189 |
) |
5873 | 1190 |
(MenuItem |
6122 | 1191 |
label: 'New Directory...' |
5873 | 1192 |
itemValue: newDirectory |
1193 |
translateLabel: true |
|
1194 |
isButton: true |
|
1195 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 1196 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 1197 |
) |
8585 | 1198 |
(MenuItem |
1199 |
label: '-' |
|
1200 |
isVisible: browseVisibleHolder |
|
1201 |
) |
|
1202 |
(MenuItem |
|
1203 |
activeHelpKey: openFileBrowser |
|
1204 |
label: 'Browse' |
|
1205 |
itemValue: doBrowseDirectory |
|
1206 |
translateLabel: true |
|
1207 |
isButton: true |
|
15725 | 1208 |
isVisible: browseMenuItemVisibleHolder |
8585 | 1209 |
labelImage: (ResourceRetriever ToolbarIconLibrary startFileBrowserIcon) |
1210 |
) |
|
3892 | 1211 |
) |
1212 |
nil |
|
1213 |
nil |
|
1214 |
) |
|
9113 | 1215 |
! |
1216 |
||
1217 |
viewInContentsBrowserMenu |
|
1218 |
^ DirectoryContentsBrowser showMenuSpec |
|
3892 | 1219 |
! ! |
1220 |
||
8182 | 1221 |
!FileDialog class methodsFor:'plugIn spec'! |
1222 |
||
1223 |
aspectSelectors |
|
1224 |
"This resource specification was automatically generated |
|
1225 |
by the UIPainter of ST/X." |
|
1226 |
||
1227 |
"Do not manually edit this. If it is corrupted, |
|
1228 |
the UIPainter may not be able to read the specification." |
|
1229 |
||
1230 |
"Return a description of exported aspects; |
|
1231 |
these can be connected to aspects of an embedding application |
|
1232 |
(if this app is embedded in a subCanvas)." |
|
1233 |
||
1234 |
^ #( |
|
1235 |
#filenameHolder |
|
1236 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1237 |
#rootDirectoryHolder |
8182 | 1238 |
). |
1239 |
||
1240 |
! ! |
|
1241 |
||
3892 | 1242 |
!FileDialog methodsFor:'accessing'! |
1243 |
||
3996 | 1244 |
currentSelectedFiles |
1245 |
||
1246 |
| selectedFiles| |
|
1247 |
||
1248 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
12828 | 1249 |
^ selectedFiles reject:[:aFile| aFile isDirectory ]. |
3996 | 1250 |
! |
1251 |
||
3892 | 1252 |
directory |
1253 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1254 |
||
1255 |
^ directory |
|
1256 |
! |
|
1257 |
||
1258 |
directory:something |
|
1259 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1260 |
||
1261 |
directory := something. |
|
1262 |
! |
|
1263 |
||
1264 |
initialText |
|
13090 | 1265 |
^ resources string:(initialText ? 'File Dialog') |
3892 | 1266 |
! |
1267 |
||
1268 |
initialText:something |
|
1269 |
initialText := something. |
|
1270 |
! |
|
1271 |
||
1272 |
pattern |
|
1273 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1274 |
||
1275 |
^ pattern |
|
1276 |
! |
|
1277 |
||
1278 |
pattern:something |
|
1279 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1280 |
||
1281 |
pattern := something. |
|
1282 |
! |
|
1283 |
||
1284 |
result |
|
1285 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1286 |
||
1287 |
^ result |
|
1288 |
! |
|
1289 |
||
1290 |
result:something |
|
1291 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1292 |
||
1293 |
result := something. |
|
1294 |
! |
|
1295 |
||
3904 | 1296 |
selectedDirectories |
1297 |
||
1298 |
| selectedFiles| |
|
1299 |
||
1300 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1301 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1302 |
! |
|
1303 |
||
3892 | 1304 |
startFilename |
1305 |
startFilename isNil ifTrue:[ |
|
1306 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1307 |
]. |
|
1308 |
^ startFilename |
|
1309 |
! |
|
1310 |
||
1311 |
startFilename:something |
|
1312 |
startFilename := something. |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1315 |
!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
|
1316 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1317 |
asLoadDialog |
4804 | 1318 |
^ self isLoadDialog |
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1321 |
asLoadDialog:aBoolean |
4804 | 1322 |
self beLoadDialog:aBoolean |
1323 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1324 |
|
4804 | 1325 |
beLoadDialog:aBoolean |
1326 |
||
1327 |
isLoadDialog := aBoolean |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1330 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1331 |
"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
|
1332 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1333 |
^ doubleClickAction |
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1336 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1337 |
"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
|
1338 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1339 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1340 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1341 |
|
4804 | 1342 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1343 |
|
4804 | 1344 |
^ isLoadDialog ? true |
1345 |
! |
|
1346 |
||
1347 |
multipleSelect |
|
1348 |
^ multipleSelect ? false |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1351 |
multipleSelect:aBoolean |
4804 | 1352 |
multipleSelect := aBoolean. |
1353 |
treeBrowser notNil ifTrue:[ |
|
1354 |
treeBrowser multipleSelect:aBoolean. |
|
1355 |
]. |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1358 |
!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
|
1359 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1360 |
addButton:aButton |
6068 | 1361 |
|buttonPanel okButton| |
1362 |
||
1363 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1364 |
okButton := self okButton. |
|
1365 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1366 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1367 |
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
|
1368 |
] ifFalse:[ |
6068 | 1369 |
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
|
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1373 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1374 |
^ (self componentAt:#okButton) |
3892 | 1375 |
! |
1376 |
||
3904 | 1377 |
treeBrowser |
1378 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1379 |
||
1380 |
^ treeBrowser |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1383 |
!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
|
1384 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1385 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1386 |
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
|
1387 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1388 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1389 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1390 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1391 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1392 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1393 |
^ newDirectoryVisibilityHolder |
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1396 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1397 |
self buttonPanelVisibleHolder value:true |
3904 | 1398 |
! |
1399 |
||
3892 | 1400 |
viewFiles |
1401 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1402 |
||
1403 |
^ viewFiles |
|
1404 |
! |
|
1405 |
||
1406 |
viewFiles:something |
|
1407 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1408 |
||
1409 |
viewFiles := something. |
|
1410 |
! ! |
|
1411 |
||
1412 |
!FileDialog methodsFor:'aspects'! |
|
1413 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1414 |
appendButtonVisibleHolder |
15451 | 1415 |
"if set, an additional 'append' button is shown |
1416 |
(to let user append to a file, instead of overwriting the file)" |
|
1417 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1418 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1419 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1420 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1421 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1422 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1423 |
|
5193 | 1424 |
appendLabelHolder |
1425 |
appendLabelHolder isNil ifTrue:[ |
|
1426 |
appendLabelHolder := 'Append' asValue. |
|
1427 |
]. |
|
1428 |
^ appendLabelHolder |
|
1429 |
! |
|
1430 |
||
4804 | 1431 |
aspectOrNil:aKey forSubApplication:aSubApp |
1432 |
"this hook provides an aspect for a subApp" |
|
1433 |
||
1434 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1435 |
directory notNil ifTrue:[ |
|
1436 |
^ (OrderedCollection with:directory) asValue |
|
1437 |
] |
|
1438 |
]. |
|
1439 |
^ nil |
|
1440 |
! |
|
1441 |
||
15451 | 1442 |
browseMenuItemVisible:aBoolean |
1443 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1444 |
||
1445 |
self browseMenuItemVisibleHolder value:aBoolean |
|
1446 |
! |
|
1447 |
||
1448 |
browseMenuItemVisibleHolder |
|
1449 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1450 |
||
5969 | 1451 |
browseVisibleHolder isNil ifTrue:[ |
8585 | 1452 |
browseVisibleHolder := true "false" asValue. |
5969 | 1453 |
]. |
1454 |
^ browseVisibleHolder. |
|
1455 |
! |
|
1456 |
||
15451 | 1457 |
browseVisibleHolder |
1458 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1459 |
||
1460 |
<resource: #obsolete> |
|
1461 |
^ self browseMenuItemVisibleHolder. |
|
1462 |
! |
|
1463 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1464 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1465 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1466 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1467 |
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
|
1468 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1469 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1470 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1471 |
|
3892 | 1472 |
cancelLabelHolder |
1473 |
||
1474 |
cancelLabelHolder isNil ifTrue:[ |
|
1475 |
cancelLabelHolder := 'Cancel' asValue. |
|
1476 |
]. |
|
1477 |
^ cancelLabelHolder. |
|
1478 |
! |
|
1479 |
||
1480 |
enableBack |
|
4804 | 1481 |
^ treeBrowser enableBack. |
3892 | 1482 |
! |
1483 |
||
1484 |
enableDirectoryUp |
|
4804 | 1485 |
^ treeBrowser enableDirectoryUp. |
3892 | 1486 |
! |
1487 |
||
1488 |
enableForward |
|
4804 | 1489 |
^ treeBrowser enableForward. |
3892 | 1490 |
! |
1491 |
||
8169 | 1492 |
enableGotoDesktop |
1493 |
^ treeBrowser enableGotoDesktop. |
|
1494 |
! |
|
1495 |
||
3892 | 1496 |
enableHome |
4804 | 1497 |
^ treeBrowser enableHome. |
3892 | 1498 |
! |
1499 |
||
9269
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1500 |
fileEntryFieldHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1501 |
"for directoryTreeBrowser" |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1502 |
|
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1503 |
^ self filenameHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1504 |
! |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1505 |
|
3892 | 1506 |
filenameHolder |
1507 |
"Return a value holder with the filename. |
|
1508 |
Shown in the filename input-field. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1509 |
Being the selection in the tree." |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1510 |
|
3892 | 1511 |
|holder| |
7581 | 1512 |
|
3892 | 1513 |
holder := builder bindingAt:#filenameHolder. |
1514 |
||
7581 | 1515 |
holder isNil ifTrue:[ |
13001 | 1516 |
holder := startFilename asValue. |
3892 | 1517 |
holder addDependent:self. |
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1518 |
builder aspectAt:#filenameHolder put:holder. |
3892 | 1519 |
]. |
1520 |
||
1521 |
^ holder. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1522 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1523 |
"Modified: / 09-07-2010 / 19:25:15 / cg" |
3892 | 1524 |
! |
1525 |
||
8183 | 1526 |
filenameHolder:aHolder |
8182 | 1527 |
"needed when used as subcanvas" |
8183 | 1528 |
|
1529 |
|holder| |
|
8182 | 1530 |
|
8183 | 1531 |
holder := builder aspectAt:#filenameHolder. |
1532 |
holder notNil ifTrue:[ |
|
1533 |
holder removeDependent:self |
|
1534 |
]. |
|
8182 | 1535 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1536 |
aHolder addDependent:self |
8182 | 1537 |
! |
1538 |
||
3904 | 1539 |
filenameLabelHolder |
1540 |
"Return a value holder for the input string. |
|
1541 |
" |
|
1542 |
filenameLabelHolder isNil ifTrue:[ |
|
1543 |
filenameLabelHolder := 'Filename:' asValue. |
|
1544 |
]. |
|
1545 |
^ filenameLabelHolder |
|
1546 |
! |
|
1547 |
||
3892 | 1548 |
filterHolder |
8183 | 1549 |
"Return a value holder for filter" |
3892 | 1550 |
|
1551 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1552 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1553 |
]. |
1554 |
^ filterHolder |
|
1555 |
! |
|
1556 |
||
8183 | 1557 |
filterHolder:aHolder |
1558 |
"needed when used as subcanvas" |
|
1559 |
||
1560 |
filterHolder := aHolder. |
|
1561 |
! |
|
1562 |
||
9113 | 1563 |
gotoBookmarksMenu |
6098 | 1564 |
<resource: #programMenu> |
1565 |
||
9113 | 1566 |
^ treeBrowser gotoBookmarksMenu |
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1567 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1568 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1569 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1570 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1571 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1572 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1573 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1574 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1575 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1576 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1577 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1578 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1579 |
"/ treeBrowser setCurrentFileName:dirName. |
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 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1584 |
"/ ^ menu |
6098 | 1585 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1586 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1587 |
! |
1588 |
||
6065 | 1589 |
listOfDeviceDrives |
1590 |
||
1591 |
listOfDeviceDrives isNil ifTrue:[ |
|
1592 |
listOfDeviceDrives := Filename volumes. |
|
1593 |
]. |
|
1594 |
^ listOfDeviceDrives |
|
1595 |
! |
|
1596 |
||
15766 | 1597 |
okLabelEnabled |
1598 |
<resource: #uiAspect> |
|
1599 |
||
1600 |
okLabelEnabled isNil ifTrue:[ |
|
1601 |
isLoadDialog ifTrue:[ |
|
17410 | 1602 |
okLabelEnabled := |
1603 |
BlockValue |
|
1604 |
with:[:filename| |
|
1605 |
|ok| |
|
1606 |
||
1607 |
ok := true. |
|
1608 |
||
1609 |
multipleSelect ifTrue:[ |
|
1610 |
ok := treeBrowser selectedFiles notEmpty |
|
1611 |
and:[ treeBrowser selectedFiles conform:[:each | each isRegularFile] ] |
|
1612 |
] ifFalse:[ |
|
1613 |
filename isEmptyOrNil ifTrue:[ |
|
1614 |
ok := false |
|
1615 |
] ifFalse:[ |
|
1616 |
|physicalFilename| |
|
1617 |
||
1618 |
physicalFilename := filename asFilename physicalFilename. |
|
1619 |
physicalFilename isNil ifTrue:[ |
|
1620 |
ok := false |
|
1621 |
] ifFalse:[ |
|
1622 |
viewFiles |
|
1623 |
ifTrue:[ ok := physicalFilename isRegularFile ] |
|
1624 |
ifFalse:[ ok := physicalFilename isDirectory ] |
|
1625 |
]. |
|
1626 |
] |
|
1627 |
]. |
|
1628 |
ok |
|
1629 |
] |
|
1630 |
argument:self filenameHolder. |
|
15766 | 1631 |
] ifFalse:[ |
1632 |
okLabelEnabled := true. |
|
1633 |
]. |
|
1634 |
]. |
|
1635 |
^ okLabelEnabled. |
|
17410 | 1636 |
|
1637 |
"Modified: / 14-02-2017 / 13:00:40 / cg" |
|
15766 | 1638 |
! |
1639 |
||
3892 | 1640 |
okLabelHolder |
16185 | 1641 |
<resource: #uiAspect> |
3892 | 1642 |
|
1643 |
okLabelHolder isNil ifTrue:[ |
|
1644 |
okLabelHolder := 'OK' asValue. |
|
1645 |
]. |
|
1646 |
^ okLabelHolder. |
|
6065 | 1647 |
! |
1648 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1649 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1650 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1651 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1652 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1653 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1654 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1655 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1656 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1657 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1658 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1659 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1660 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1661 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1662 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1663 |
|
6065 | 1664 |
selectedDeviceDrive |
1665 |
||
1666 |
selectedDeviceDrive isNil ifTrue:[ |
|
1667 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1668 |
selectedDeviceDrive addDependent:self. |
|
1669 |
]. |
|
1670 |
^ selectedDeviceDrive |
|
9110 | 1671 |
! |
1672 |
||
9113 | 1673 |
showDirectoryTree |
1674 |
^ false |
|
1675 |
! |
|
1676 |
||
1677 |
showDiskUsageHolder |
|
1678 |
^ treeBrowser showDiskUsageHolder |
|
1679 |
! |
|
1680 |
||
9110 | 1681 |
showHiddenFiles |
9113 | 1682 |
^ treeBrowser showHiddenFiles |
1683 |
! |
|
1684 |
||
1685 |
shownFiles |
|
1686 |
^ treeBrowser shownFiles |
|
1687 |
! |
|
1688 |
||
1689 |
sortCaselessInTreeBrowser |
|
1690 |
^ treeBrowser sortCaselessInTreeBrowser |
|
1691 |
! |
|
1692 |
||
1693 |
sortInTreeVisibilityHolder |
|
1694 |
^ true |
|
1695 |
! |
|
1696 |
||
1697 |
sortPropertyInTree |
|
1698 |
^ treeBrowser sortBlockProperty |
|
1699 |
! |
|
1700 |
||
1701 |
viewDirsInContentsBrowser |
|
1702 |
^ false |
|
1703 |
! |
|
1704 |
||
1705 |
viewFilesInDirectoryTree |
|
1706 |
^ false |
|
1707 |
! |
|
1708 |
||
1709 |
viewNoteBookApplicationHolder |
|
9110 | 1710 |
^ false |
3892 | 1711 |
! ! |
1712 |
||
1713 |
!FileDialog methodsFor:'change & update'! |
|
1714 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1715 |
buttonPanelVisibilityChanged |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1716 |
|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
|
1717 |
|
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1718 |
panel := builder componentAt:#FilePanel. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1719 |
panel isNil ifTrue:[ |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1720 |
filePart := builder componentAt:#FilePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1721 |
]. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1722 |
partAbove := panel ? filePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1723 |
partAbove notNil ifTrue:[ |
5598 | 1724 |
buttonPanelVisibleHolder value ifTrue:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1725 |
partAbove layout bottomOffset:-40 |
5598 | 1726 |
] ifFalse:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1727 |
partAbove layout bottomOffset:0 |
5598 | 1728 |
]. |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1729 |
partAbove containerChangedSize "/ force resize |
5598 | 1730 |
] |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1731 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1732 |
|
9765 | 1733 |
fileSelectionChanged |
1734 |
|files newFile entryFieldFilename filenameHolder| |
|
1735 |
||
1736 |
filenameHolder := self filenameHolder. |
|
1737 |
||
1738 |
files := treeBrowser currentFileNameHolder value. |
|
1739 |
||
1740 |
(files isEmpty) ifTrue:[ |
|
1741 |
newFile := nil. |
|
1742 |
] ifFalse:[ |
|
1743 |
files size == 1 ifTrue:[ |
|
1744 |
newFile := files first. |
|
1745 |
] ifFalse:[ |
|
1746 |
newFile := ''. |
|
1747 |
]. |
|
1748 |
]. |
|
1749 |
(filenameHolder value notNil |
|
1750 |
and:[newFile notNil |
|
1751 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
1752 |
entryFieldFilename := filenameHolder value asFilename. |
|
1753 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
1754 |
entryFieldFilename isDirectory ifFalse:[ |
|
1755 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
|
1756 |
]. |
|
1757 |
]. |
|
1758 |
]. |
|
1759 |
filenameHolder value:newFile withoutNotifying:self. |
|
17410 | 1760 |
|
9765 | 1761 |
OperatingSystem supportsVolumes ifTrue:[ |
1762 |
| volume | |
|
1763 |
volume := (files size >= 1) |
|
1764 |
ifTrue:[files first volume] |
|
1765 |
ifFalse:nil. |
|
1766 |
self selectedDeviceDrive value:volume. |
|
1767 |
]. |
|
1768 |
||
1769 |
"Created: / 14-02-2011 / 17:54:08 / cg" |
|
17410 | 1770 |
"Modified (format): / 14-02-2017 / 12:50:11 / cg" |
9765 | 1771 |
! |
1772 |
||
6065 | 1773 |
selectedDeviceDriveChanged |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1774 |
|newDrive curSel newFile| |
6065 | 1775 |
|
1776 |
newDrive := self selectedDeviceDrive value. |
|
1777 |
curSel := treeBrowser currentFileNameHolder value. |
|
1778 |
curSel notEmpty ifTrue:[ |
|
1779 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1780 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1781 |
|
6065 | 1782 |
newDrive notNil ifTrue:[ |
1783 |
newFile := newDrive asFilename. |
|
1784 |
newFile isReadable ifTrue:[ |
|
1785 |
treeBrowser gotoFile:newFile. |
|
1786 |
^self. |
|
1787 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1788 |
self warn:'Cannot open drive %1' with:newFile asFilename volume. |
6065 | 1789 |
]. |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1790 |
|
16477 | 1791 |
newDrive := curSel notEmpty |
1792 |
ifTrue:[ curSel first volume ] |
|
1793 |
ifFalse:[ |
|
1794 |
OperatingSystem isMSWINDOWSlike ifTrue:['C:'] ifFalse:['/'] |
|
1795 |
"/ Filename defaultVolumeName. |
|
1796 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1797 |
self selectedDeviceDrive value:newDrive. |
6065 | 1798 |
! |
1799 |
||
3892 | 1800 |
update:something with:aParameter from:changedObject |
9765 | 1801 |
|newLabel fn| |
3892 | 1802 |
|
1803 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
9765 | 1804 |
self fileSelectionChanged. |
1805 |
^ self. |
|
3892 | 1806 |
]. |
4804 | 1807 |
|
6065 | 1808 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1809 |
self selectedDeviceDriveChanged. |
|
1810 |
^ self. |
|
1811 |
]. |
|
3904 | 1812 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1813 |
changedObject value ifTrue:[ |
|
4804 | 1814 |
newLabel := 'Filename:'. |
3904 | 1815 |
] ifFalse:[ |
4804 | 1816 |
newLabel := 'Directory:'. |
1817 |
]. |
|
1818 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1819 |
]. |
9765 | 1820 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1821 |
fn := changedObject value asFilename. |
1822 |
(fn exists) ifFalse:[^ self]. |
|
17410 | 1823 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
5949 | 1824 |
fn isDirectory ifTrue:[ |
1825 |
treeBrowser expandEnforceSelectedItems. |
|
1826 |
]. |
|
3892 | 1827 |
]. |
1828 |
^ super update:something with:aParameter from:changedObject |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1829 |
|
9765 | 1830 |
"Modified: / 14-02-2011 / 17:54:35 / cg" |
17410 | 1831 |
"Modified (format): / 14-02-2017 / 12:50:30 / cg" |
3892 | 1832 |
! ! |
1833 |
||
12816 | 1834 |
!FileDialog methodsFor:'construction-adding'! |
1835 |
||
1836 |
addComponent: aView |
|
12875 | 1837 |
verticalPanelView addComponent: aView |
12816 | 1838 |
|
1839 |
"Created: / 03-06-2013 / 17:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1840 |
! ! |
|
1841 |
||
3892 | 1842 |
!FileDialog methodsFor:'event handling'! |
1843 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1844 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1845 |
"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
|
1846 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1847 |
^ appendWasPressed |
3892 | 1848 |
! ! |
1849 |
||
1850 |
!FileDialog methodsFor:'initialization & release'! |
|
1851 |
||
5932 | 1852 |
closeDownViews |
9765 | 1853 |
self rememberExtent. |
5932 | 1854 |
super closeDownViews. |
9765 | 1855 |
|
1856 |
"Modified: / 14-02-2011 / 17:55:14 / cg" |
|
5932 | 1857 |
! |
1858 |
||
1859 |
closeWindow |
|
9765 | 1860 |
self rememberExtent. |
5932 | 1861 |
super closeWindow. |
9765 | 1862 |
|
1863 |
"Modified: / 14-02-2011 / 17:55:55 / cg" |
|
5932 | 1864 |
! |
1865 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1866 |
commonPostOpen |
8182 | 1867 |
|selection| |
3892 | 1868 |
|
17316 | 1869 |
super commonPostOpen. |
1870 |
||
3892 | 1871 |
"/ 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
|
1872 |
|
3892 | 1873 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1874 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1875 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1876 |
|
6409 | 1877 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1878 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1879 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1880 |
|
1881 |
self isLoadDialog ifTrue:[ |
|
4796 | 1882 |
treeBrowser newVisibilityHolder value:false. |
1883 |
treeBrowser allowFileOperations value:false. |
|
1884 |
self newDirectoryVisibilityHolder value:false. |
|
1885 |
]. |
|
5927 | 1886 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1887 |
|
1888 |
selection := treeBrowser treeSelectionHolder value. |
|
1889 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1890 |
selection := selection asCollection first. |
5929 | 1891 |
selection enforcedExpand. |
1892 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1893 |
]. |
|
4796 | 1894 |
! |
1895 |
||
6409 | 1896 |
initialRootDirectory |
1897 |
"returns the directory the browser is open on |
|
1898 |
" |
|
1899 |
|root| |
|
1900 |
||
9678 | 1901 |
initialRoot isNil ifTrue:[ |
6409 | 1902 |
|
9678 | 1903 |
(root := self directory) notNil ifTrue:[ |
1904 |
root := root asFilename. |
|
6409 | 1905 |
|
1906 |
root isDirectory ifFalse:[ |
|
9678 | 1907 |
root := root directory. |
1908 |
root isDirectory ifFalse:[ |
|
1909 |
root := nil. |
|
1910 |
] |
|
6409 | 1911 |
] |
9678 | 1912 |
]. |
1913 |
root isNil ifTrue:[ |
|
1914 |
root := Filename currentDirectory. |
|
1915 |
]. |
|
1916 |
initialRoot := root asAbsoluteFilename. |
|
6409 | 1917 |
]. |
9678 | 1918 |
^ initialRoot |
1919 |
||
1920 |
"Modified: / 27-12-2010 / 09:56:30 / cg" |
|
6409 | 1921 |
! |
1922 |
||
15767 | 1923 |
initialize |
15768 | 1924 |
super initialize. |
15767 | 1925 |
isLoadDialog := false. |
1926 |
! |
|
1927 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1928 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1929 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1930 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1931 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1932 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1933 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1934 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1935 |
filterField := aWidget. |
4796 | 1936 |
! |
1937 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1938 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1939 |
treeBrowser := aSubCanvasView client. |
6409 | 1940 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
9113 | 1941 |
treeBrowser sortPropertyInTree:(treeBrowser sortBlockProperty). |
9553 | 1942 |
treeBrowser showHiddenFiles value:true. |
1943 |
||
1944 |
"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
|
1945 |
! |
4796 | 1946 |
|
12875 | 1947 |
postBuildVerticalPanelView:aView |
1948 |
verticalPanelView := aView. |
|
12816 | 1949 |
|
1950 |
"Created: / 03-06-2013 / 17:41:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1951 |
! |
|
1952 |
||
13004 | 1953 |
postBuildWith:aBuilder |
1954 |
|win hMin| |
|
1955 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1956 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1957 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1958 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1959 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1960 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1961 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1962 |
|
13004 | 1963 |
win := aBuilder window . |
13187 | 1964 |
win minExtent notNil ifTrue:[ |
1965 |
"minExtent is nil if window is not a TopView" |
|
1966 |
hMin := (win margin * 2) |
|
1967 |
+ (aBuilder menuBar isNil ifTrue:[0] ifFalse:[aBuilder menuBar preferredHeight]) |
|
1968 |
+ (aBuilder componentAt:#FilenameEntryField) height |
|
1969 |
+ (aBuilder componentAt:#ToolBar1) preferredHeight |
|
1970 |
+ (aBuilder componentAt:#ButtonPanel) preferredHeight. |
|
13004 | 1971 |
|
13187 | 1972 |
win minExtent:(win minExtent x @ hMin). |
1973 |
]. |
|
13090 | 1974 |
win topView label:self initialText. |
13004 | 1975 |
|
6632 | 1976 |
super postBuildWith:aBuilder |
5932 | 1977 |
! |
1978 |
||
8182 | 1979 |
postOpenAsSubcanvasWith:aBuilder |
1980 |
super postOpenAsSubcanvasWith:aBuilder. |
|
1981 |
||
1982 |
"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
|
1983 |
self hideButtonPanel. |
8183 | 1984 |
|
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
1985 |
"filenameHolder contains the initial file name, or nil" |
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1986 |
self startFilename:self filenameHolder value. |
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
1987 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
8182 | 1988 |
! |
1989 |
||
12816 | 1990 |
preOpenWith:aBuilder |
12883 | 1991 |
"called right before being opened" |
1992 |
||
13025 | 1993 |
|delta| |
8182 | 1994 |
|
12816 | 1995 |
"Increase height of the window so height of the file part |
12875 | 1996 |
remain the same. This cares for any components added by a hook" |
1997 |
||
1998 |
verticalPanelView notNil ifTrue:[ |
|
12883 | 1999 |
delta := verticalPanelView preferredHeight - verticalPanelView height. |
2000 |
delta > 0 ifTrue:[ |
|
2001 |
"/ components where added (possibly in the aboutToOpenBoxNotifiction |
|
2002 |
aBuilder window height: (aBuilder window height + delta). |
|
12875 | 2003 |
]. |
12883 | 2004 |
|
2005 |
"/ sumH := 0. |
|
2006 |
"/ verticalPanelView subViews from:2 do:[:view| |
|
2007 |
"/ sumH := sumH + view preferredHeight. |
|
2008 |
"/ ]. |
|
2009 |
"/ sumH ~~ 0 ifTrue:[ |
|
2010 |
"/ newVPanelHeight := verticalPanelView preferredHeight374 |
|
2011 |
"/ aBuilder window height: aBuilder window height + sumH. |
|
2012 |
"/ ]. |
|
8182 | 2013 |
]. |
12816 | 2014 |
|
14151 | 2015 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
2016 |
||
12816 | 2017 |
"Created: / 03-06-2013 / 18:19:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8182 | 2018 |
! |
2019 |
||
9765 | 2020 |
rememberExtent |
5932 | 2021 |
self class lastExtent:self window topView extent. |
9765 | 2022 |
|
2023 |
"Created: / 14-02-2011 / 17:55:11 / cg" |
|
4796 | 2024 |
! ! |
2025 |
||
9113 | 2026 |
!FileDialog methodsFor:'menus'! |
2027 |
||
2028 |
bookmarksMenu |
|
2029 |
^ treeBrowser bookmarksMenu |
|
2030 |
! |
|
2031 |
||
2032 |
directoryMenu |
|
2033 |
^ treeBrowser directoryMenu |
|
2034 |
! |
|
2035 |
||
2036 |
showMenuSpecForDialog |
|
2037 |
^ treeBrowser class showMenuSpecForDialog |
|
2038 |
! |
|
2039 |
||
2040 |
sortMenu |
|
2041 |
^ treeBrowser class sortInTreeMenu |
|
2042 |
! |
|
2043 |
||
2044 |
visitedDirectoriesMenu |
|
2045 |
^ treeBrowser visitedDirectoriesMenu |
|
2046 |
! ! |
|
2047 |
||
4796 | 2048 |
!FileDialog methodsFor:'private'! |
2049 |
||
2050 |
returnWasPressedInFilterField |
|
8663 | 2051 |
|wg ev| |
4796 | 2052 |
|
8663 | 2053 |
((wg := self windowGroup) notNil |
2054 |
and:[ (ev := wg lastEvent) notNil |
|
2055 |
and:[ ev isKeyEvent |
|
2056 |
and:[ ev key == #Return |
|
2057 |
and:[ (ev targetView isSameOrComponentOf:filterField) |
|
2058 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]]) ifTrue:[ |
|
4796 | 2059 |
^ true |
2060 |
]. |
|
2061 |
^ false |
|
2062 |
! |
|
2063 |
||
2064 |
returnWasPressedInFilterOrFilenameField |
|
2065 |
|ev| |
|
2066 |
||
2067 |
ev := self windowGroup lastEvent. |
|
2068 |
(ev notNil |
|
2069 |
and:[ev isKeyEvent |
|
2070 |
and:[ev key == #Return |
|
2071 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
2072 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
2073 |
^ true |
|
2074 |
]. |
|
2075 |
^ false |
|
2076 |
! ! |
|
2077 |
||
6065 | 2078 |
!FileDialog methodsFor:'queries'! |
2079 |
||
2080 |
driveSelectorVisible |
|
2081 |
^ OperatingSystem isMSDOSlike |
|
2082 |
! ! |
|
2083 |
||
4796 | 2084 |
!FileDialog methodsFor:'user actions'! |
2085 |
||
2086 |
appendPressed |
|
2087 |
appendWasPressed := true. |
|
2088 |
self commonAcceptAction. |
|
2089 |
! |
|
2090 |
||
2091 |
commonAcceptAction |
|
2092 |
filenameField accept. |
|
2093 |
self result:(self filenameHolder value asString). |
|
2094 |
||
2095 |
^ super doAccept |
|
2096 |
! |
|
2097 |
||
2098 |
doAccept |
|
2099 |
"force accept - ignore in filterField" |
|
2100 |
||
2101 |
self returnWasPressedInFilterField ifTrue:[ |
|
2102 |
^ self |
|
2103 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2104 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2105 |
"/ 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
|
2106 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2107 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2108 |
]. |
4796 | 2109 |
appendWasPressed := false. |
2110 |
self commonAcceptAction. |
|
2111 |
! |
|
2112 |
||
2113 |
doBack |
|
2114 |
||
2115 |
treeBrowser doBack. |
|
2116 |
! |
|
2117 |
||
5966 | 2118 |
doBrowseDirectory |
17651 | 2119 |
FileBrowser default openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
5966 | 2120 |
|
17651 | 2121 |
"Modified: / 01-09-2017 / 14:05:09 / cg" |
5966 | 2122 |
! |
2123 |
||
4796 | 2124 |
doCancel |
2125 |
||
2126 |
self result:nil. |
|
2127 |
^ super doCancel. |
|
2128 |
! |
|
2129 |
||
2130 |
doForward |
|
2131 |
||
2132 |
treeBrowser doForward. |
|
2133 |
! |
|
2134 |
||
2135 |
doGoDirectoryUp |
|
2136 |
||
2137 |
treeBrowser doGoDirectoryUp. |
|
2138 |
! |
|
2139 |
||
8092 | 2140 |
doGotoDesktopDirectory |
2141 |
||
2142 |
treeBrowser doGotoDesktopDirectory. |
|
2143 |
! |
|
2144 |
||
4796 | 2145 |
doGotoHomeDirectory |
2146 |
||
2147 |
treeBrowser doGotoHomeDirectory. |
|
2148 |
! |
|
2149 |
||
2150 |
menuDirHistory:backOrForward |
|
2151 |
||
2152 |
^ treeBrowser menuDirHistory:backOrForward. |
|
2153 |
! |
|
2154 |
||
2155 |
menuDirHistoryBack |
|
2156 |
||
2157 |
^ treeBrowser menuDirHistory:#back. |
|
2158 |
! |
|
2159 |
||
2160 |
menuDirHistoryForward |
|
2161 |
||
2162 |
^ treeBrowser menuDirHistory:#forward. |
|
2163 |
! |
|
2164 |
||
2165 |
newDirectory |
|
17380 | 2166 |
"forward to the treebrowser component, which already has this functionality" |
2167 |
||
2168 |
^ treeBrowser newDirectory |
|
4796 | 2169 |
|
17380 | 2170 |
"Modified (comment): / 04-02-2017 / 14:41:43 / cg" |
4796 | 2171 |
! |
2172 |
||
2173 |
okPressed |
|
2174 |
self doAccept |
|
9113 | 2175 |
! |
2176 |
||
2177 |
updateCurrentDirectory |
|
2178 |
treeBrowser updateCurrentDirectory |
|
4796 | 2179 |
! ! |
2180 |
||
2181 |
!FileDialog class methodsFor:'documentation'! |
|
2182 |
||
2183 |
version |
|
15725 | 2184 |
^ '$Header$' |
12883 | 2185 |
! |
2186 |
||
2187 |
version_CVS |
|
15725 | 2188 |
^ '$Header$' |
9110 | 2189 |
! |
2190 |
||
12816 | 2191 |
version_HG |
2192 |
||
2193 |
^ '$Changeset: <not expanded> $' |
|
2194 |
! |
|
2195 |
||
2196 |
version_SVN |
|
15725 | 2197 |
^ '$Id$' |
4796 | 2198 |
! ! |
12816 | 2199 |