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