author | Claus Gittinger <cg@exept.de> |
Fri, 15 Jun 2018 04:00:37 +0200 | |
changeset 18220 | d1ebaddf1100 |
parent 18037 | 9e48562729d9 |
child 18268 | bfcc157b2ed9 |
permissions | -rw-r--r-- |
17990 | 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 |
" |
|
17527 | 127 |
- make the filedialog windows like |
128 |
filename entry field shows only the filename not the whole directory |
|
129 |
the tree always starts in current directory |
|
130 |
the parent tree is shown in a combobox where the perents are selectable |
|
9769 | 131 |
|
17527 | 132 |
- do not expand the ~ or relative pathnames to absolute pathnames |
5062 | 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 |
|
17919 | 756 |
helpSpec |
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 |
|
17919 | 769 |
^ FileBrowserV2 helpSpec 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 |
|
18037 | 1059 |
enabled: enableDocuments |
1060 |
label: 'Documents Directory' |
|
1061 |
itemValue: doGotoDocumentsDirectory |
|
1062 |
translateLabel: true |
|
1063 |
) |
|
1064 |
(MenuItem |
|
1065 |
enabled: enableDownloads |
|
1066 |
label: 'Downloads Directory' |
|
1067 |
itemValue: doGotoDownloadsDirectory |
|
1068 |
translateLabel: true |
|
1069 |
) |
|
1070 |
(MenuItem |
|
9113 | 1071 |
label: 'Bookmarks' |
1072 |
translateLabel: true |
|
1073 |
submenuChannel: bookmarksMenu |
|
1074 |
) |
|
1075 |
(MenuItem |
|
1076 |
label: 'Visited Directories' |
|
1077 |
translateLabel: true |
|
1078 |
submenuChannel: visitedDirectoriesMenu |
|
1079 |
) |
|
1080 |
) |
|
1081 |
nil |
|
1082 |
nil |
|
1083 |
) |
|
1084 |
) |
|
1085 |
(MenuItem |
|
1086 |
label: 'View' |
|
1087 |
translateLabel: true |
|
1088 |
submenu: |
|
1089 |
(Menu |
|
1090 |
( |
|
1091 |
(MenuItem |
|
1092 |
label: 'Sort' |
|
1093 |
translateLabel: true |
|
1094 |
submenuChannel: sortMenu |
|
1095 |
) |
|
1096 |
(MenuItem |
|
1097 |
label: 'Show' |
|
1098 |
translateLabel: true |
|
1099 |
submenuChannel: showMenuSpecForDialog |
|
1100 |
) |
|
1101 |
(MenuItem |
|
1102 |
label: '-' |
|
1103 |
) |
|
1104 |
(MenuItem |
|
1105 |
label: 'Update' |
|
1106 |
itemValue: updateCurrentDirectory |
|
1107 |
translateLabel: true |
|
1108 |
) |
|
1109 |
) |
|
1110 |
nil |
|
1111 |
nil |
|
1112 |
) |
|
1113 |
) |
|
1114 |
) |
|
1115 |
nil |
|
1116 |
nil |
|
1117 |
) |
|
1118 |
! |
|
1119 |
||
3892 | 1120 |
toolBarMenu |
1121 |
"This resource specification was automatically generated |
|
1122 |
by the MenuEditor of ST/X." |
|
1123 |
||
1124 |
"Do not manually edit this!! If it is corrupted, |
|
1125 |
the MenuEditor may not be able to read the specification." |
|
1126 |
||
1127 |
" |
|
1128 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
1129 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
1130 |
" |
|
1131 |
||
1132 |
<resource: #menu> |
|
1133 |
||
1134 |
^ |
|
5873 | 1135 |
#(Menu |
1136 |
( |
|
1137 |
(MenuItem |
|
1138 |
activeHelpKey: directoryBack |
|
1139 |
enabled: enableBack |
|
1140 |
label: 'Back' |
|
1141 |
itemValue: doBack |
|
1142 |
translateLabel: true |
|
1143 |
isButton: true |
|
1144 |
submenuChannel: menuDirHistoryBack |
|
6087 | 1145 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 1146 |
keepLinkedMenu: true |
3892 | 1147 |
) |
5873 | 1148 |
(MenuItem |
1149 |
label: '' |
|
3892 | 1150 |
) |
5873 | 1151 |
(MenuItem |
1152 |
activeHelpKey: directoryForward |
|
1153 |
enabled: enableForward |
|
1154 |
label: 'Forward' |
|
1155 |
itemValue: doForward |
|
1156 |
translateLabel: true |
|
1157 |
isButton: true |
|
1158 |
submenuChannel: menuDirHistoryForward |
|
6087 | 1159 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 1160 |
keepLinkedMenu: true |
3892 | 1161 |
) |
5873 | 1162 |
(MenuItem |
6462 | 1163 |
label: '-' |
1164 |
) |
|
1165 |
(MenuItem |
|
1166 |
activeHelpKey: directoryUp |
|
1167 |
enabled: enableDirectoryUp |
|
1168 |
label: 'DirectoryUp' |
|
1169 |
itemValue: doGoDirectoryUp |
|
1170 |
translateLabel: true |
|
1171 |
isButton: true |
|
1172 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 1173 |
) |
5873 | 1174 |
(MenuItem |
1175 |
activeHelpKey: fileHome |
|
1176 |
enabled: enableHome |
|
1177 |
label: 'Home' |
|
1178 |
itemValue: doGotoHomeDirectory |
|
1179 |
translateLabel: true |
|
1180 |
isButton: true |
|
6096 | 1181 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 1182 |
) |
5873 | 1183 |
(MenuItem |
8092 | 1184 |
activeHelpKey: fileDesktop |
8586 | 1185 |
enabled: enableGotoDesktop |
8092 | 1186 |
label: 'Desktop' |
1187 |
itemValue: doGotoDesktopDirectory |
|
1188 |
translateLabel: true |
|
1189 |
isButton: true |
|
1190 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
1191 |
) |
|
1192 |
(MenuItem |
|
6098 | 1193 |
activeHelpKey: fileGotoBookmark |
1194 |
label: 'Bookmarks' |
|
1195 |
translateLabel: true |
|
1196 |
isButton: true |
|
9113 | 1197 |
submenuChannel: gotoBookmarksMenu |
6098 | 1198 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
1199 |
) |
|
1200 |
(MenuItem |
|
5873 | 1201 |
label: '-' |
1202 |
isVisible: newDirectoryVisibilityHolder |
|
3923 | 1203 |
) |
5873 | 1204 |
(MenuItem |
6122 | 1205 |
label: 'New Directory...' |
5873 | 1206 |
itemValue: newDirectory |
1207 |
translateLabel: true |
|
1208 |
isButton: true |
|
1209 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 1210 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 1211 |
) |
8585 | 1212 |
(MenuItem |
1213 |
label: '-' |
|
1214 |
isVisible: browseVisibleHolder |
|
1215 |
) |
|
1216 |
(MenuItem |
|
1217 |
activeHelpKey: openFileBrowser |
|
1218 |
label: 'Browse' |
|
1219 |
itemValue: doBrowseDirectory |
|
1220 |
translateLabel: true |
|
1221 |
isButton: true |
|
15725 | 1222 |
isVisible: browseMenuItemVisibleHolder |
8585 | 1223 |
labelImage: (ResourceRetriever ToolbarIconLibrary startFileBrowserIcon) |
1224 |
) |
|
3892 | 1225 |
) |
1226 |
nil |
|
1227 |
nil |
|
1228 |
) |
|
9113 | 1229 |
! |
1230 |
||
1231 |
viewInContentsBrowserMenu |
|
1232 |
^ DirectoryContentsBrowser showMenuSpec |
|
3892 | 1233 |
! ! |
1234 |
||
8182 | 1235 |
!FileDialog class methodsFor:'plugIn spec'! |
1236 |
||
1237 |
aspectSelectors |
|
1238 |
"This resource specification was automatically generated |
|
1239 |
by the UIPainter of ST/X." |
|
1240 |
||
1241 |
"Do not manually edit this. If it is corrupted, |
|
1242 |
the UIPainter may not be able to read the specification." |
|
1243 |
||
1244 |
"Return a description of exported aspects; |
|
1245 |
these can be connected to aspects of an embedding application |
|
1246 |
(if this app is embedded in a subCanvas)." |
|
1247 |
||
1248 |
^ #( |
|
1249 |
#filenameHolder |
|
1250 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1251 |
#rootDirectoryHolder |
8182 | 1252 |
). |
1253 |
||
1254 |
! ! |
|
1255 |
||
3892 | 1256 |
!FileDialog methodsFor:'accessing'! |
1257 |
||
3996 | 1258 |
currentSelectedFiles |
1259 |
||
1260 |
| selectedFiles| |
|
1261 |
||
1262 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
12828 | 1263 |
^ selectedFiles reject:[:aFile| aFile isDirectory ]. |
3996 | 1264 |
! |
1265 |
||
18015 | 1266 |
defaultWindowExtent |
1267 |
"return my default window extent or nil. |
|
1268 |
Return nil if the defaul extent should be computed by other means." |
|
1269 |
||
1270 |
^ LastExtent |
|
1271 |
||
1272 |
"Created: / 20-03-2018 / 11:26:14 / stefan" |
|
1273 |
! |
|
1274 |
||
3892 | 1275 |
directory |
1276 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1277 |
||
1278 |
^ directory |
|
1279 |
! |
|
1280 |
||
1281 |
directory:something |
|
1282 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1283 |
||
1284 |
directory := something. |
|
1285 |
! |
|
1286 |
||
1287 |
initialText |
|
13090 | 1288 |
^ resources string:(initialText ? 'File Dialog') |
3892 | 1289 |
! |
1290 |
||
1291 |
initialText:something |
|
1292 |
initialText := something. |
|
1293 |
! |
|
1294 |
||
1295 |
pattern |
|
1296 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1297 |
||
1298 |
^ pattern |
|
1299 |
! |
|
1300 |
||
1301 |
pattern:something |
|
1302 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1303 |
||
1304 |
pattern := something. |
|
1305 |
! |
|
1306 |
||
1307 |
result |
|
1308 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1309 |
||
1310 |
^ result |
|
1311 |
! |
|
1312 |
||
1313 |
result:something |
|
1314 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1315 |
||
1316 |
result := something. |
|
1317 |
! |
|
1318 |
||
3904 | 1319 |
selectedDirectories |
1320 |
||
1321 |
| selectedFiles| |
|
1322 |
||
1323 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1324 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1325 |
! |
|
1326 |
||
3892 | 1327 |
startFilename |
1328 |
startFilename isNil ifTrue:[ |
|
1329 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1330 |
]. |
|
1331 |
^ startFilename |
|
1332 |
! |
|
1333 |
||
1334 |
startFilename:something |
|
1335 |
startFilename := something. |
|
4728
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 |
!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
|
1339 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1340 |
asLoadDialog |
4804 | 1341 |
^ self isLoadDialog |
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1344 |
asLoadDialog:aBoolean |
4804 | 1345 |
self beLoadDialog:aBoolean |
1346 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1347 |
|
4804 | 1348 |
beLoadDialog:aBoolean |
1349 |
||
1350 |
isLoadDialog := aBoolean |
|
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 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1354 |
"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
|
1355 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1356 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1357 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1358 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1359 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1360 |
"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
|
1361 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1362 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1363 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1364 |
|
4804 | 1365 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1366 |
|
4804 | 1367 |
^ isLoadDialog ? true |
1368 |
! |
|
1369 |
||
1370 |
multipleSelect |
|
1371 |
^ multipleSelect ? false |
|
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 |
multipleSelect:aBoolean |
4804 | 1375 |
multipleSelect := aBoolean. |
1376 |
treeBrowser notNil ifTrue:[ |
|
1377 |
treeBrowser multipleSelect:aBoolean. |
|
1378 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1379 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1380 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1381 |
!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
|
1382 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1383 |
addButton:aButton |
6068 | 1384 |
|buttonPanel okButton| |
1385 |
||
1386 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1387 |
okButton := self okButton. |
|
1388 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1389 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1390 |
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
|
1391 |
] ifFalse:[ |
6068 | 1392 |
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
|
1393 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1394 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1395 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1396 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1397 |
^ (self componentAt:#okButton) |
3892 | 1398 |
! |
1399 |
||
3904 | 1400 |
treeBrowser |
1401 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1402 |
||
1403 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1404 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1405 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1406 |
!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
|
1407 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1408 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1409 |
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
|
1410 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1411 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1412 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1413 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1414 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1415 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1416 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1417 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1418 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1419 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1420 |
self buttonPanelVisibleHolder value:true |
3904 | 1421 |
! |
1422 |
||
3892 | 1423 |
viewFiles |
1424 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1425 |
||
1426 |
^ viewFiles |
|
1427 |
! |
|
1428 |
||
1429 |
viewFiles:something |
|
1430 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1431 |
||
1432 |
viewFiles := something. |
|
1433 |
! ! |
|
1434 |
||
1435 |
!FileDialog methodsFor:'aspects'! |
|
1436 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1437 |
appendButtonVisibleHolder |
15451 | 1438 |
"if set, an additional 'append' button is shown |
1439 |
(to let user append to a file, instead of overwriting the file)" |
|
1440 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1441 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1442 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1443 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1444 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1445 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1446 |
|
5193 | 1447 |
appendLabelHolder |
1448 |
appendLabelHolder isNil ifTrue:[ |
|
1449 |
appendLabelHolder := 'Append' asValue. |
|
1450 |
]. |
|
1451 |
^ appendLabelHolder |
|
1452 |
! |
|
1453 |
||
4804 | 1454 |
aspectOrNil:aKey forSubApplication:aSubApp |
1455 |
"this hook provides an aspect for a subApp" |
|
1456 |
||
1457 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1458 |
directory notNil ifTrue:[ |
|
1459 |
^ (OrderedCollection with:directory) asValue |
|
1460 |
] |
|
1461 |
]. |
|
1462 |
^ nil |
|
1463 |
! |
|
1464 |
||
15451 | 1465 |
browseMenuItemVisible:aBoolean |
1466 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1467 |
||
1468 |
self browseMenuItemVisibleHolder value:aBoolean |
|
1469 |
! |
|
1470 |
||
1471 |
browseMenuItemVisibleHolder |
|
1472 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1473 |
||
5969 | 1474 |
browseVisibleHolder isNil ifTrue:[ |
8585 | 1475 |
browseVisibleHolder := true "false" asValue. |
5969 | 1476 |
]. |
1477 |
^ browseVisibleHolder. |
|
1478 |
! |
|
1479 |
||
15451 | 1480 |
browseVisibleHolder |
1481 |
"controls if an 'open filebrowser' menu item is to be shown in the toolbar" |
|
1482 |
||
1483 |
<resource: #obsolete> |
|
1484 |
^ self browseMenuItemVisibleHolder. |
|
1485 |
! |
|
1486 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1487 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1488 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1489 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1490 |
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
|
1491 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1492 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1493 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1494 |
|
3892 | 1495 |
cancelLabelHolder |
1496 |
||
1497 |
cancelLabelHolder isNil ifTrue:[ |
|
1498 |
cancelLabelHolder := 'Cancel' asValue. |
|
1499 |
]. |
|
1500 |
^ cancelLabelHolder. |
|
1501 |
! |
|
1502 |
||
1503 |
enableBack |
|
4804 | 1504 |
^ treeBrowser enableBack. |
3892 | 1505 |
! |
1506 |
||
1507 |
enableDirectoryUp |
|
4804 | 1508 |
^ treeBrowser enableDirectoryUp. |
3892 | 1509 |
! |
1510 |
||
1511 |
enableForward |
|
4804 | 1512 |
^ treeBrowser enableForward. |
3892 | 1513 |
! |
1514 |
||
8169 | 1515 |
enableGotoDesktop |
1516 |
^ treeBrowser enableGotoDesktop. |
|
1517 |
! |
|
1518 |
||
3892 | 1519 |
enableHome |
4804 | 1520 |
^ treeBrowser enableHome. |
3892 | 1521 |
! |
1522 |
||
9269
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1523 |
fileEntryFieldHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1524 |
"for directoryTreeBrowser" |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1525 |
|
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1526 |
^ self filenameHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1527 |
! |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1528 |
|
3892 | 1529 |
filenameHolder |
1530 |
"Return a value holder with the filename. |
|
1531 |
Shown in the filename input-field. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1532 |
Being the selection in the tree." |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1533 |
|
3892 | 1534 |
|holder| |
7581 | 1535 |
|
3892 | 1536 |
holder := builder bindingAt:#filenameHolder. |
1537 |
||
7581 | 1538 |
holder isNil ifTrue:[ |
13001 | 1539 |
holder := startFilename asValue. |
3892 | 1540 |
holder addDependent:self. |
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1541 |
builder aspectAt:#filenameHolder put:holder. |
3892 | 1542 |
]. |
1543 |
||
1544 |
^ holder. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1545 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1546 |
"Modified: / 09-07-2010 / 19:25:15 / cg" |
3892 | 1547 |
! |
1548 |
||
8183 | 1549 |
filenameHolder:aHolder |
8182 | 1550 |
"needed when used as subcanvas" |
8183 | 1551 |
|
1552 |
|holder| |
|
8182 | 1553 |
|
8183 | 1554 |
holder := builder aspectAt:#filenameHolder. |
1555 |
holder notNil ifTrue:[ |
|
1556 |
holder removeDependent:self |
|
1557 |
]. |
|
8182 | 1558 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1559 |
aHolder addDependent:self |
8182 | 1560 |
! |
1561 |
||
3904 | 1562 |
filenameLabelHolder |
1563 |
"Return a value holder for the input string. |
|
1564 |
" |
|
1565 |
filenameLabelHolder isNil ifTrue:[ |
|
1566 |
filenameLabelHolder := 'Filename:' asValue. |
|
1567 |
]. |
|
1568 |
^ filenameLabelHolder |
|
1569 |
! |
|
1570 |
||
3892 | 1571 |
filterHolder |
8183 | 1572 |
"Return a value holder for filter" |
3892 | 1573 |
|
1574 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1575 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1576 |
]. |
1577 |
^ filterHolder |
|
1578 |
! |
|
1579 |
||
8183 | 1580 |
filterHolder:aHolder |
1581 |
"needed when used as subcanvas" |
|
1582 |
||
1583 |
filterHolder := aHolder. |
|
1584 |
! |
|
1585 |
||
9113 | 1586 |
gotoBookmarksMenu |
6098 | 1587 |
<resource: #programMenu> |
1588 |
||
9113 | 1589 |
^ treeBrowser gotoBookmarksMenu |
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1590 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1591 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1592 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1593 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1594 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1595 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1596 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1597 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1598 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1599 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1600 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1601 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1602 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1603 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1604 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1605 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1606 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1607 |
"/ ^ menu |
6098 | 1608 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1609 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1610 |
! |
1611 |
||
6065 | 1612 |
listOfDeviceDrives |
1613 |
||
1614 |
listOfDeviceDrives isNil ifTrue:[ |
|
1615 |
listOfDeviceDrives := Filename volumes. |
|
1616 |
]. |
|
1617 |
^ listOfDeviceDrives |
|
1618 |
! |
|
1619 |
||
15766 | 1620 |
okLabelEnabled |
1621 |
<resource: #uiAspect> |
|
1622 |
||
1623 |
okLabelEnabled isNil ifTrue:[ |
|
1624 |
isLoadDialog ifTrue:[ |
|
17410 | 1625 |
okLabelEnabled := |
1626 |
BlockValue |
|
1627 |
with:[:filename| |
|
1628 |
|ok| |
|
1629 |
||
1630 |
ok := true. |
|
1631 |
||
1632 |
multipleSelect ifTrue:[ |
|
1633 |
ok := treeBrowser selectedFiles notEmpty |
|
1634 |
and:[ treeBrowser selectedFiles conform:[:each | each isRegularFile] ] |
|
1635 |
] ifFalse:[ |
|
1636 |
filename isEmptyOrNil ifTrue:[ |
|
1637 |
ok := false |
|
1638 |
] ifFalse:[ |
|
1639 |
|physicalFilename| |
|
1640 |
||
1641 |
physicalFilename := filename asFilename physicalFilename. |
|
1642 |
physicalFilename isNil ifTrue:[ |
|
1643 |
ok := false |
|
1644 |
] ifFalse:[ |
|
1645 |
viewFiles |
|
1646 |
ifTrue:[ ok := physicalFilename isRegularFile ] |
|
1647 |
ifFalse:[ ok := physicalFilename isDirectory ] |
|
1648 |
]. |
|
1649 |
] |
|
1650 |
]. |
|
1651 |
ok |
|
1652 |
] |
|
1653 |
argument:self filenameHolder. |
|
15766 | 1654 |
] ifFalse:[ |
1655 |
okLabelEnabled := true. |
|
1656 |
]. |
|
1657 |
]. |
|
1658 |
^ okLabelEnabled. |
|
17410 | 1659 |
|
1660 |
"Modified: / 14-02-2017 / 13:00:40 / cg" |
|
15766 | 1661 |
! |
1662 |
||
3892 | 1663 |
okLabelHolder |
16185 | 1664 |
<resource: #uiAspect> |
3892 | 1665 |
|
1666 |
okLabelHolder isNil ifTrue:[ |
|
1667 |
okLabelHolder := 'OK' asValue. |
|
1668 |
]. |
|
1669 |
^ okLabelHolder. |
|
6065 | 1670 |
! |
1671 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1672 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1673 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1674 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1675 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1676 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1677 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1678 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1679 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1680 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1681 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1682 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1683 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1684 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1685 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1686 |
|
6065 | 1687 |
selectedDeviceDrive |
1688 |
||
1689 |
selectedDeviceDrive isNil ifTrue:[ |
|
1690 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1691 |
selectedDeviceDrive addDependent:self. |
|
1692 |
]. |
|
1693 |
^ selectedDeviceDrive |
|
9110 | 1694 |
! |
1695 |
||
9113 | 1696 |
showDirectoryTree |
1697 |
^ false |
|
1698 |
! |
|
1699 |
||
1700 |
showDiskUsageHolder |
|
1701 |
^ treeBrowser showDiskUsageHolder |
|
1702 |
! |
|
1703 |
||
9110 | 1704 |
showHiddenFiles |
9113 | 1705 |
^ treeBrowser showHiddenFiles |
1706 |
! |
|
1707 |
||
1708 |
shownFiles |
|
1709 |
^ treeBrowser shownFiles |
|
1710 |
! |
|
1711 |
||
1712 |
sortCaselessInTreeBrowser |
|
1713 |
^ treeBrowser sortCaselessInTreeBrowser |
|
1714 |
! |
|
1715 |
||
1716 |
sortInTreeVisibilityHolder |
|
1717 |
^ true |
|
1718 |
! |
|
1719 |
||
1720 |
sortPropertyInTree |
|
1721 |
^ treeBrowser sortBlockProperty |
|
1722 |
! |
|
1723 |
||
1724 |
viewDirsInContentsBrowser |
|
1725 |
^ false |
|
1726 |
! |
|
1727 |
||
1728 |
viewFilesInDirectoryTree |
|
1729 |
^ false |
|
1730 |
! |
|
1731 |
||
1732 |
viewNoteBookApplicationHolder |
|
9110 | 1733 |
^ false |
3892 | 1734 |
! ! |
1735 |
||
1736 |
!FileDialog methodsFor:'change & update'! |
|
1737 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1738 |
buttonPanelVisibilityChanged |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1739 |
|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
|
1740 |
|
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1741 |
panel := builder componentAt:#FilePanel. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1742 |
panel isNil ifTrue:[ |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1743 |
filePart := builder componentAt:#FilePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1744 |
]. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1745 |
partAbove := panel ? filePart. |
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1746 |
partAbove notNil ifTrue:[ |
5598 | 1747 |
buttonPanelVisibleHolder value ifTrue:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1748 |
partAbove layout bottomOffset:-40 |
5598 | 1749 |
] ifFalse:[ |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1750 |
partAbove layout bottomOffset:0 |
5598 | 1751 |
]. |
12848
90fde21c7de4
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
12828
diff
changeset
|
1752 |
partAbove containerChangedSize "/ force resize |
5598 | 1753 |
] |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1754 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1755 |
|
9765 | 1756 |
fileSelectionChanged |
1757 |
|files newFile entryFieldFilename filenameHolder| |
|
1758 |
||
1759 |
filenameHolder := self filenameHolder. |
|
1760 |
||
1761 |
files := treeBrowser currentFileNameHolder value. |
|
1762 |
||
1763 |
(files isEmpty) ifTrue:[ |
|
1764 |
newFile := nil. |
|
1765 |
] ifFalse:[ |
|
1766 |
files size == 1 ifTrue:[ |
|
1767 |
newFile := files first. |
|
1768 |
] ifFalse:[ |
|
1769 |
newFile := ''. |
|
1770 |
]. |
|
1771 |
]. |
|
1772 |
(filenameHolder value notNil |
|
1773 |
and:[newFile notNil |
|
1774 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
1775 |
entryFieldFilename := filenameHolder value asFilename. |
|
1776 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
1777 |
entryFieldFilename isDirectory ifFalse:[ |
|
1778 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
|
1779 |
]. |
|
1780 |
]. |
|
1781 |
]. |
|
1782 |
filenameHolder value:newFile withoutNotifying:self. |
|
17410 | 1783 |
|
9765 | 1784 |
OperatingSystem supportsVolumes ifTrue:[ |
1785 |
| volume | |
|
1786 |
volume := (files size >= 1) |
|
1787 |
ifTrue:[files first volume] |
|
1788 |
ifFalse:nil. |
|
1789 |
self selectedDeviceDrive value:volume. |
|
1790 |
]. |
|
1791 |
||
1792 |
"Created: / 14-02-2011 / 17:54:08 / cg" |
|
17410 | 1793 |
"Modified (format): / 14-02-2017 / 12:50:11 / cg" |
9765 | 1794 |
! |
1795 |
||
6065 | 1796 |
selectedDeviceDriveChanged |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1797 |
|newDrive curSel newFile| |
6065 | 1798 |
|
1799 |
newDrive := self selectedDeviceDrive value. |
|
1800 |
curSel := treeBrowser currentFileNameHolder value. |
|
1801 |
curSel notEmpty ifTrue:[ |
|
1802 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1803 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1804 |
|
6065 | 1805 |
newDrive notNil ifTrue:[ |
1806 |
newFile := newDrive asFilename. |
|
1807 |
newFile isReadable ifTrue:[ |
|
1808 |
treeBrowser gotoFile:newFile. |
|
1809 |
^self. |
|
1810 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1811 |
self warn:'Cannot open drive %1' with:newFile asFilename volume. |
6065 | 1812 |
]. |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1813 |
|
16477 | 1814 |
newDrive := curSel notEmpty |
1815 |
ifTrue:[ curSel first volume ] |
|
1816 |
ifFalse:[ |
|
1817 |
OperatingSystem isMSWINDOWSlike ifTrue:['C:'] ifFalse:['/'] |
|
1818 |
"/ Filename defaultVolumeName. |
|
1819 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1820 |
self selectedDeviceDrive value:newDrive. |
6065 | 1821 |
! |
1822 |
||
3892 | 1823 |
update:something with:aParameter from:changedObject |
9765 | 1824 |
|newLabel fn| |
3892 | 1825 |
|
1826 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
9765 | 1827 |
self fileSelectionChanged. |
1828 |
^ self. |
|
3892 | 1829 |
]. |
4804 | 1830 |
|
6065 | 1831 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1832 |
self selectedDeviceDriveChanged. |
|
1833 |
^ self. |
|
1834 |
]. |
|
3904 | 1835 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1836 |
changedObject value ifTrue:[ |
|
4804 | 1837 |
newLabel := 'Filename:'. |
3904 | 1838 |
] ifFalse:[ |
4804 | 1839 |
newLabel := 'Directory:'. |
1840 |
]. |
|
1841 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1842 |
]. |
9765 | 1843 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1844 |
fn := changedObject value asFilename. |
1845 |
(fn exists) ifFalse:[^ self]. |
|
17410 | 1846 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
5949 | 1847 |
fn isDirectory ifTrue:[ |
1848 |
treeBrowser expandEnforceSelectedItems. |
|
1849 |
]. |
|
3892 | 1850 |
]. |
1851 |
^ super update:something with:aParameter from:changedObject |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1852 |
|
9765 | 1853 |
"Modified: / 14-02-2011 / 17:54:35 / cg" |
17410 | 1854 |
"Modified (format): / 14-02-2017 / 12:50:30 / cg" |
3892 | 1855 |
! ! |
1856 |
||
12816 | 1857 |
!FileDialog methodsFor:'construction-adding'! |
1858 |
||
1859 |
addComponent: aView |
|
12875 | 1860 |
verticalPanelView addComponent: aView |
12816 | 1861 |
|
1862 |
"Created: / 03-06-2013 / 17:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1863 |
! ! |
|
1864 |
||
3892 | 1865 |
!FileDialog methodsFor:'event handling'! |
1866 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1867 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1868 |
"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
|
1869 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1870 |
^ appendWasPressed |
3892 | 1871 |
! ! |
1872 |
||
1873 |
!FileDialog methodsFor:'initialization & release'! |
|
1874 |
||
5932 | 1875 |
closeDownViews |
9765 | 1876 |
self rememberExtent. |
5932 | 1877 |
super closeDownViews. |
9765 | 1878 |
|
1879 |
"Modified: / 14-02-2011 / 17:55:14 / cg" |
|
5932 | 1880 |
! |
1881 |
||
1882 |
closeWindow |
|
9765 | 1883 |
self rememberExtent. |
5932 | 1884 |
super closeWindow. |
9765 | 1885 |
|
1886 |
"Modified: / 14-02-2011 / 17:55:55 / cg" |
|
5932 | 1887 |
! |
1888 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1889 |
commonPostOpen |
8182 | 1890 |
|selection| |
3892 | 1891 |
|
17316 | 1892 |
super commonPostOpen. |
1893 |
||
3892 | 1894 |
"/ 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
|
1895 |
|
3892 | 1896 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1897 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1898 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1899 |
|
6409 | 1900 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1901 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1902 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1903 |
|
1904 |
self isLoadDialog ifTrue:[ |
|
4796 | 1905 |
treeBrowser newVisibilityHolder value:false. |
1906 |
treeBrowser allowFileOperations value:false. |
|
1907 |
self newDirectoryVisibilityHolder value:false. |
|
1908 |
]. |
|
5927 | 1909 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1910 |
|
1911 |
selection := treeBrowser treeSelectionHolder value. |
|
1912 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1913 |
selection := selection asCollection first. |
5929 | 1914 |
selection enforcedExpand. |
1915 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1916 |
]. |
|
4796 | 1917 |
! |
1918 |
||
6409 | 1919 |
initialRootDirectory |
1920 |
"returns the directory the browser is open on |
|
1921 |
" |
|
1922 |
|root| |
|
1923 |
||
9678 | 1924 |
initialRoot isNil ifTrue:[ |
6409 | 1925 |
|
9678 | 1926 |
(root := self directory) notNil ifTrue:[ |
1927 |
root := root asFilename. |
|
6409 | 1928 |
|
1929 |
root isDirectory ifFalse:[ |
|
9678 | 1930 |
root := root directory. |
1931 |
root isDirectory ifFalse:[ |
|
1932 |
root := nil. |
|
1933 |
] |
|
6409 | 1934 |
] |
9678 | 1935 |
]. |
1936 |
root isNil ifTrue:[ |
|
1937 |
root := Filename currentDirectory. |
|
1938 |
]. |
|
1939 |
initialRoot := root asAbsoluteFilename. |
|
6409 | 1940 |
]. |
9678 | 1941 |
^ initialRoot |
1942 |
||
1943 |
"Modified: / 27-12-2010 / 09:56:30 / cg" |
|
6409 | 1944 |
! |
1945 |
||
15767 | 1946 |
initialize |
15768 | 1947 |
super initialize. |
15767 | 1948 |
isLoadDialog := false. |
1949 |
! |
|
1950 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1951 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1952 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1953 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1954 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1955 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1956 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1957 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1958 |
filterField := aWidget. |
4796 | 1959 |
! |
1960 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1961 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1962 |
treeBrowser := aSubCanvasView client. |
6409 | 1963 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
9113 | 1964 |
treeBrowser sortPropertyInTree:(treeBrowser sortBlockProperty). |
9553 | 1965 |
treeBrowser showHiddenFiles value:true. |
1966 |
||
1967 |
"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
|
1968 |
! |
4796 | 1969 |
|
12875 | 1970 |
postBuildVerticalPanelView:aView |
1971 |
verticalPanelView := aView. |
|
12816 | 1972 |
|
1973 |
"Created: / 03-06-2013 / 17:41:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1974 |
! |
|
1975 |
||
13004 | 1976 |
postBuildWith:aBuilder |
1977 |
|win hMin| |
|
1978 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1979 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1980 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1981 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1982 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1983 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1984 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1985 |
|
13004 | 1986 |
win := aBuilder window . |
13187 | 1987 |
win minExtent notNil ifTrue:[ |
1988 |
"minExtent is nil if window is not a TopView" |
|
1989 |
hMin := (win margin * 2) |
|
1990 |
+ (aBuilder menuBar isNil ifTrue:[0] ifFalse:[aBuilder menuBar preferredHeight]) |
|
1991 |
+ (aBuilder componentAt:#FilenameEntryField) height |
|
1992 |
+ (aBuilder componentAt:#ToolBar1) preferredHeight |
|
1993 |
+ (aBuilder componentAt:#ButtonPanel) preferredHeight. |
|
13004 | 1994 |
|
13187 | 1995 |
win minExtent:(win minExtent x @ hMin). |
1996 |
]. |
|
13090 | 1997 |
win topView label:self initialText. |
13004 | 1998 |
|
6632 | 1999 |
super postBuildWith:aBuilder |
5932 | 2000 |
! |
2001 |
||
8182 | 2002 |
postOpenAsSubcanvasWith:aBuilder |
2003 |
super postOpenAsSubcanvasWith:aBuilder. |
|
2004 |
||
2005 |
"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
|
2006 |
self hideButtonPanel. |
8183 | 2007 |
|
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
2008 |
"filenameHolder contains the initial file name, or nil" |
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
2009 |
self startFilename:self filenameHolder value. |
9809
fa5280b1259f
changed: #postOpenAsSubcanvasWith:
Stefan Vogel <sv@exept.de>
parents:
9769
diff
changeset
|
2010 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
8182 | 2011 |
! |
2012 |
||
12816 | 2013 |
preOpenWith:aBuilder |
12883 | 2014 |
"called right before being opened" |
2015 |
||
18015 | 2016 |
verticalPanelView notNil ifTrue:[ |
2017 |
"/ SV: disabled, because dialogs where opened full height: |
|
2018 |
"/ "Increase height of the window so height of the file part |
|
2019 |
"/ remains the same. This cares for any components added by a hook" |
|
2020 |
"/ |
|
2021 |
"/ |delta| |
|
2022 |
"/ |
|
2023 |
"/ delta := verticalPanelView preferredHeight - verticalPanelView height. |
|
2024 |
"/ delta > 0 ifTrue:[ |
|
2025 |
"/ "/ components where added (possibly in the aboutToOpenBoxNotifiction |
|
2026 |
"/ aBuilder window height: (aBuilder window height + delta). |
|
2027 |
"/ ]. |
|
12875 | 2028 |
|
18015 | 2029 |
"/ This code was disabled without comment: |
12883 | 2030 |
"/ sumH := 0. |
2031 |
"/ verticalPanelView subViews from:2 do:[:view| |
|
2032 |
"/ sumH := sumH + view preferredHeight. |
|
2033 |
"/ ]. |
|
2034 |
"/ sumH ~~ 0 ifTrue:[ |
|
18015 | 2035 |
"/ newVPanelHeight := verticalPanelView preferredHeight. |
12883 | 2036 |
"/ aBuilder window height: aBuilder window height + sumH. |
2037 |
"/ ]. |
|
8182 | 2038 |
]. |
12816 | 2039 |
|
14151 | 2040 |
treeBrowser currentFileNameHolder value:(Array with:self startFilename). |
2041 |
||
12816 | 2042 |
"Created: / 03-06-2013 / 18:19:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18015 | 2043 |
"Modified (format): / 20-03-2018 / 11:34:26 / stefan" |
8182 | 2044 |
! |
2045 |
||
9765 | 2046 |
rememberExtent |
18015 | 2047 |
"if the user changed the size of the dialog, the next time the dialog |
2048 |
is opened with this size. |
|
2049 |
But ignore height changes < 40 pixels. On some systems the height of the title bar |
|
2050 |
is added to the height. (https://expeccoalm.exept.de/D160693)" |
|
2051 |
||
2052 |
|currentExtent| |
|
2053 |
||
2054 |
currentExtent := self window topView extent. |
|
2055 |
(LastExtent isNil or:[(LastExtent y - currentExtent y) abs > 40]) ifTrue:[ |
|
2056 |
self class lastExtent:currentExtent. |
|
2057 |
]. |
|
9765 | 2058 |
|
2059 |
"Created: / 14-02-2011 / 17:55:11 / cg" |
|
18015 | 2060 |
"Modified: / 20-03-2018 / 11:44:06 / stefan" |
4796 | 2061 |
! ! |
2062 |
||
9113 | 2063 |
!FileDialog methodsFor:'menus'! |
2064 |
||
2065 |
bookmarksMenu |
|
2066 |
^ treeBrowser bookmarksMenu |
|
2067 |
! |
|
2068 |
||
2069 |
directoryMenu |
|
2070 |
^ treeBrowser directoryMenu |
|
2071 |
! |
|
2072 |
||
2073 |
showMenuSpecForDialog |
|
2074 |
^ treeBrowser class showMenuSpecForDialog |
|
2075 |
! |
|
2076 |
||
2077 |
sortMenu |
|
2078 |
^ treeBrowser class sortInTreeMenu |
|
2079 |
! |
|
2080 |
||
2081 |
visitedDirectoriesMenu |
|
2082 |
^ treeBrowser visitedDirectoriesMenu |
|
2083 |
! ! |
|
2084 |
||
4796 | 2085 |
!FileDialog methodsFor:'private'! |
2086 |
||
2087 |
returnWasPressedInFilterField |
|
8663 | 2088 |
|wg ev| |
4796 | 2089 |
|
8663 | 2090 |
((wg := self windowGroup) notNil |
2091 |
and:[ (ev := wg lastEvent) notNil |
|
2092 |
and:[ ev isKeyEvent |
|
2093 |
and:[ ev key == #Return |
|
2094 |
and:[ (ev targetView isSameOrComponentOf:filterField) |
|
2095 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]]) ifTrue:[ |
|
4796 | 2096 |
^ true |
2097 |
]. |
|
2098 |
^ false |
|
2099 |
! |
|
2100 |
||
2101 |
returnWasPressedInFilterOrFilenameField |
|
17990 | 2102 |
|wg ev| |
4796 | 2103 |
|
17990 | 2104 |
((wg := self windowGroup) notNil |
2105 |
and:[(ev := wg lastEvent) notNil |
|
2106 |
and:[ev notNil |
|
4796 | 2107 |
and:[ev isKeyEvent |
2108 |
and:[ev key == #Return |
|
2109 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
17990 | 2110 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]]]) ifTrue:[ |
4796 | 2111 |
^ true |
2112 |
]. |
|
2113 |
^ false |
|
2114 |
! ! |
|
2115 |
||
6065 | 2116 |
!FileDialog methodsFor:'queries'! |
2117 |
||
2118 |
driveSelectorVisible |
|
2119 |
^ OperatingSystem isMSDOSlike |
|
2120 |
! ! |
|
2121 |
||
4796 | 2122 |
!FileDialog methodsFor:'user actions'! |
2123 |
||
2124 |
appendPressed |
|
2125 |
appendWasPressed := true. |
|
2126 |
self commonAcceptAction. |
|
2127 |
! |
|
2128 |
||
2129 |
commonAcceptAction |
|
2130 |
filenameField accept. |
|
2131 |
self result:(self filenameHolder value asString). |
|
2132 |
||
2133 |
^ super doAccept |
|
2134 |
! |
|
2135 |
||
2136 |
doAccept |
|
2137 |
"force accept - ignore in filterField" |
|
2138 |
||
2139 |
self returnWasPressedInFilterField ifTrue:[ |
|
2140 |
^ self |
|
2141 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2142 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2143 |
"/ 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
|
2144 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2145 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
2146 |
]. |
4796 | 2147 |
appendWasPressed := false. |
2148 |
self commonAcceptAction. |
|
2149 |
! |
|
2150 |
||
2151 |
doBack |
|
2152 |
||
2153 |
treeBrowser doBack. |
|
2154 |
! |
|
2155 |
||
5966 | 2156 |
doBrowseDirectory |
17651 | 2157 |
FileBrowser default openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
5966 | 2158 |
|
17651 | 2159 |
"Modified: / 01-09-2017 / 14:05:09 / cg" |
5966 | 2160 |
! |
2161 |
||
4796 | 2162 |
doCancel |
2163 |
||
2164 |
self result:nil. |
|
2165 |
^ super doCancel. |
|
2166 |
! |
|
2167 |
||
2168 |
doForward |
|
2169 |
||
2170 |
treeBrowser doForward. |
|
2171 |
! |
|
2172 |
||
2173 |
doGoDirectoryUp |
|
2174 |
||
2175 |
treeBrowser doGoDirectoryUp. |
|
2176 |
! |
|
2177 |
||
8092 | 2178 |
doGotoDesktopDirectory |
2179 |
||
2180 |
treeBrowser doGotoDesktopDirectory. |
|
2181 |
! |
|
2182 |
||
18037 | 2183 |
doGotoDocumentsDirectory |
2184 |
||
2185 |
treeBrowser doGotoDocumentsDirectory. |
|
2186 |
! |
|
2187 |
||
2188 |
doGotoDownloadsDirectory |
|
2189 |
||
2190 |
treeBrowser doGotoDownloadsDirectory. |
|
2191 |
! |
|
2192 |
||
4796 | 2193 |
doGotoHomeDirectory |
2194 |
||
2195 |
treeBrowser doGotoHomeDirectory. |
|
2196 |
! |
|
2197 |
||
2198 |
menuDirHistory:backOrForward |
|
2199 |
||
2200 |
^ treeBrowser menuDirHistory:backOrForward. |
|
2201 |
! |
|
2202 |
||
2203 |
menuDirHistoryBack |
|
2204 |
||
2205 |
^ treeBrowser menuDirHistory:#back. |
|
2206 |
! |
|
2207 |
||
2208 |
menuDirHistoryForward |
|
2209 |
||
2210 |
^ treeBrowser menuDirHistory:#forward. |
|
2211 |
! |
|
2212 |
||
2213 |
newDirectory |
|
17380 | 2214 |
"forward to the treebrowser component, which already has this functionality" |
2215 |
||
2216 |
^ treeBrowser newDirectory |
|
4796 | 2217 |
|
17380 | 2218 |
"Modified (comment): / 04-02-2017 / 14:41:43 / cg" |
4796 | 2219 |
! |
2220 |
||
2221 |
okPressed |
|
2222 |
self doAccept |
|
9113 | 2223 |
! |
2224 |
||
2225 |
updateCurrentDirectory |
|
2226 |
treeBrowser updateCurrentDirectory |
|
4796 | 2227 |
! ! |
2228 |
||
2229 |
!FileDialog class methodsFor:'documentation'! |
|
2230 |
||
2231 |
version |
|
15725 | 2232 |
^ '$Header$' |
12883 | 2233 |
! |
2234 |
||
2235 |
version_CVS |
|
15725 | 2236 |
^ '$Header$' |
9110 | 2237 |
! |
2238 |
||
12816 | 2239 |
version_HG |
2240 |
||
2241 |
^ '$Changeset: <not expanded> $' |
|
2242 |
! |
|
2243 |
||
2244 |
version_SVN |
|
15725 | 2245 |
^ '$Id$' |
4796 | 2246 |
! ! |
12816 | 2247 |