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