author | Claus Gittinger <cg@exept.de> |
Thu, 21 Aug 2008 23:15:12 +0200 | |
changeset 8250 | 60e3fd1433b3 |
parent 8191 | 1779a8c3730d |
child 8585 | 55e239825e8d |
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 |
||
3892 | 14 |
SimpleDialog subclass:#FileDialog |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
15 |
instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
16 |
multipleSelect doubleClickAction cancelLabelHolder okLabelHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
17 |
startFilename result filterField filenameField viewFiles |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
18 |
filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
19 |
appendButtonVisibleHolder appendWasPressed |
6065 | 20 |
buttonPanelVisibleHolder appendLabelHolder browseVisibleHolder |
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
21 |
selectedDeviceDrive listOfDeviceDrives rootDirectoryHolder' |
5931 | 22 |
classVariableNames:'LastExtent' |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
23 |
poolDictionaries:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
24 |
category:'Interface-Tools-File' |
3892 | 25 |
! |
26 |
||
27 |
!FileDialog class methodsFor:'documentation'! |
|
28 |
||
5140 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
3892 | 43 |
documentation |
44 |
" |
|
45 |
documentation to be added. |
|
46 |
||
47 |
[author:] |
|
48 |
Martin Walser (martin@vercingetorix) |
|
49 |
||
50 |
[instance variables:] |
|
51 |
||
52 |
[class variables:] |
|
53 |
||
54 |
[see also:] |
|
55 |
||
56 |
" |
|
57 |
! |
|
58 |
||
59 |
examples |
|
60 |
" |
|
61 |
[exBegin] |
|
62 |
FileDialog open |
|
63 |
[exEnd] |
|
64 |
||
65 |
[exBegin] |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
66 |
FileDialog |
4804 | 67 |
requestFileName:'enter a fileName:' |
68 |
default:'' |
|
69 |
version:nil |
|
70 |
ifFail:['none'] |
|
71 |
pattern:'*.conf' |
|
72 |
fromDirectory:'/etc' |
|
73 |
whenBoxCreatedEvaluate:nil. |
|
74 |
[exEnd] |
|
75 |
[exBegin] |
|
76 |
|fd| |
|
77 |
||
78 |
fd := FileDialog new. |
|
79 |
fd multipleSelect:true. |
|
80 |
fd open |
|
3892 | 81 |
[exEnd] |
82 |
" |
|
5062 | 83 |
! |
84 |
||
85 |
todo |
|
86 |
" |
|
87 |
- make the filedialog windows like f |
|
88 |
filename entry field shows only the filename not the whole directory |
|
89 |
the tree allways starts in currrent directory |
|
90 |
the parent tree is shown in a compobox where the perents are selectable |
|
91 |
- do not expand the ~ or relative pathnames to absolute pathnames |
|
92 |
" |
|
3892 | 93 |
! ! |
94 |
||
95 |
!FileDialog class methodsFor:'instance creation'! |
|
96 |
||
97 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
98 |
"same as requestFileName, but only show directories" |
|
99 |
||
4795 | 100 |
^ self |
101 |
requestDirectoryName:title |
|
102 |
default:aFileName |
|
103 |
ok:nil |
|
104 |
abort:nil |
|
105 |
version:nil |
|
106 |
pattern:nil |
|
107 |
fromDirectory:nil |
|
108 |
ifFail:failBlock |
|
109 |
whenBoxCreatedEvaluate:nil |
|
110 |
asLoadDialog:nil. |
|
3892 | 111 |
|
112 |
" |
|
3904 | 113 |
FileDialog |
3892 | 114 |
requestDirectoryName:'which directory ?' |
4627 | 115 |
default:Filename currentDirectory pathName |
3892 | 116 |
ifFail:'none' |
117 |
" |
|
118 |
! |
|
119 |
||
5336 | 120 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
121 |
"same as requestFileName, but only show directories" |
|
122 |
||
123 |
^ self |
|
124 |
requestDirectoryName:title |
|
125 |
default:aFileName |
|
126 |
ok:okText |
|
127 |
abort:abortText |
|
128 |
version:nil |
|
129 |
pattern:nil |
|
130 |
fromDirectory:nil |
|
131 |
ifFail:failBlock |
|
132 |
whenBoxCreatedEvaluate:nil |
|
133 |
asLoadDialog:nil. |
|
134 |
||
135 |
" |
|
136 |
FileDialog |
|
137 |
requestDirectoryName:'which directory ?' |
|
138 |
default:Filename currentDirectory pathName |
|
139 |
ok:'Yes' |
|
140 |
abort:'No' |
|
141 |
ifFail:'none' |
|
142 |
" |
|
143 |
! |
|
144 |
||
5823 | 145 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
146 |
"same as requestFileName, but only show directories" |
|
147 |
||
148 |
^ self |
|
149 |
requestDirectoryName:title |
|
150 |
default:aFileName |
|
151 |
ok:okText |
|
152 |
abort:abortText |
|
153 |
version:nil |
|
154 |
pattern:nil |
|
155 |
fromDirectory:nil |
|
156 |
ifFail:failBlock |
|
157 |
whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
|
158 |
asLoadDialog:nil. |
|
159 |
||
160 |
" |
|
161 |
FileDialog |
|
162 |
requestDirectoryName:'which directory ?' |
|
163 |
default:Filename currentDirectory pathName |
|
164 |
ok:'Yes' |
|
165 |
abort:'No' |
|
166 |
ifFail:'none' |
|
167 |
" |
|
168 |
! |
|
169 |
||
3956 | 170 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 171 |
"same as requestFileName, but only show directories" |
172 |
||
3956 | 173 |
|enteredFileName instance enteredFileNameString| |
3892 | 174 |
|
4795 | 175 |
instance := self |
176 |
startApplicationFor:titleString |
|
177 |
default:aFileName |
|
178 |
ok:okText |
|
179 |
abort:abortText |
|
180 |
ifFail:failBlock |
|
181 |
pattern:pattern |
|
182 |
fromDirectory:aDirectoryPath |
|
183 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
184 |
asLoadDialog:aBoolean |
|
5329 | 185 |
viewFiles:false |
4795 | 186 |
multipleSelect:false. |
3892 | 187 |
|
188 |
enteredFileNameString := instance result. |
|
189 |
enteredFileNameString isNil ifTrue:[ |
|
190 |
^ failBlock value |
|
191 |
]. |
|
192 |
enteredFileName := enteredFileNameString asFilename. |
|
193 |
enteredFileNameString := enteredFileName asString. |
|
194 |
(enteredFileName notNil |
|
195 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
196 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
197 |
versionSymbol == #mustBeNew ifTrue:[ |
|
198 |
"/ file may not exist |
|
199 |
enteredFileName exists ifTrue:[^ '']. |
|
200 |
]. |
|
201 |
versionSymbol == #new ifTrue:[ |
|
202 |
"/ file may not exist |
|
203 |
enteredFileName exists ifTrue:[ |
|
6356 | 204 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 205 |
ifFalse:[^ '']. |
206 |
]. |
|
207 |
]. |
|
208 |
versionSymbol == #mustBeOld ifTrue:[ |
|
209 |
enteredFileName exists ifFalse:[^ '']. |
|
210 |
]. |
|
211 |
versionSymbol == #old ifTrue:[ |
|
212 |
"/ file may not exist |
|
213 |
enteredFileName exists ifFalse:[ |
|
6356 | 214 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 215 |
ifFalse:[^ '']. |
216 |
]. |
|
217 |
]. |
|
218 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
219 |
]. |
|
220 |
^ enteredFileNameString |
|
221 |
||
222 |
" |
|
223 |
FileDialog |
|
224 |
requestDirectoryName:'which directory ?' |
|
4627 | 225 |
default:Filename currentDirectory pathName |
3892 | 226 |
ifFail:nil |
227 |
" |
|
3956 | 228 |
" |
229 |
FileDialog |
|
230 |
requestDirectoryName:'which directory ?' |
|
4627 | 231 |
default:Filename currentDirectory pathName |
3956 | 232 |
ok:nil |
233 |
abort:nil |
|
234 |
version:nil |
|
235 |
pattern:nil |
|
236 |
fromDirectory:nil |
|
237 |
ifFail:nil |
|
238 |
whenBoxCreatedEvaluate:nil |
|
239 |
asLoadDialog:true |
|
240 |
" |
|
3892 | 241 |
! |
242 |
||
5336 | 243 |
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
244 |
"same as requestFileName, but only show directories" |
|
245 |
||
246 |
^ self |
|
247 |
requestDirectoryName:title |
|
248 |
default:aFileName |
|
249 |
ok:okText |
|
250 |
abort:nil |
|
251 |
version:nil |
|
252 |
pattern:nil |
|
253 |
fromDirectory:nil |
|
254 |
ifFail:failBlock |
|
255 |
whenBoxCreatedEvaluate:nil |
|
256 |
asLoadDialog:nil. |
|
257 |
||
258 |
" |
|
259 |
FileDialog |
|
260 |
requestDirectoryName:'which directory ?' |
|
261 |
default:Filename currentDirectory pathName |
|
262 |
ok:'Yes' |
|
263 |
ifFail:'none' |
|
264 |
" |
|
265 |
! |
|
266 |
||
3892 | 267 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
268 |
||
4795 | 269 |
^ self |
270 |
requestFileName:titleString |
|
271 |
default:defaultName |
|
272 |
ok:okText |
|
273 |
abort:abortText |
|
274 |
version:nil |
|
275 |
ifFail:nil |
|
276 |
pattern:pattern |
|
277 |
fromDirectory:aDirectoryPathOrNil |
|
278 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 279 |
! |
280 |
||
281 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
282 |
"launch a Dialog, which allows user to enter a filename. |
|
283 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
284 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
285 |
The box will show okText in its okButton, abortText in the abortButton. |
|
286 |
The matchPattern is set to pattern initially. |
|
287 |
Return the string, or nil if cancel was pressed |
|
288 |
The version argument allows validation of the files existance; |
|
289 |
it may be any of: |
|
290 |
#mustBeNew - fail (return empty string) if the file exists |
|
291 |
#new - confirm if the file exists |
|
292 |
#mustBeOld - fail if the file does not exist |
|
293 |
#old - confirm if the file does not exist |
|
294 |
#any (other) - no validation |
|
295 |
" |
|
296 |
||
4795 | 297 |
^ self |
298 |
requestFileName:titleString |
|
299 |
default:defaultName |
|
300 |
ok:okText |
|
301 |
abort:abortText |
|
302 |
version:versionSymbol |
|
303 |
ifFail:failBlock |
|
304 |
pattern:pattern |
|
305 |
fromDirectory:aDirectoryPath |
|
306 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
307 |
asLoadDialog:nil |
|
3956 | 308 |
! |
309 |
||
310 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
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 |
The version argument allows validation of the files existance; |
|
318 |
it may be any of: |
|
319 |
#mustBeNew - fail (return empty string) if the file exists |
|
320 |
#new - confirm if the file exists |
|
321 |
#mustBeOld - fail if the file does not exist |
|
322 |
#old - confirm if the file does not exist |
|
323 |
#any (other) - no validation |
|
324 |
" |
|
325 |
||
3892 | 326 |
|
3904 | 327 |
| instance enteredFileName enteredFileNameString| |
3892 | 328 |
|
4795 | 329 |
instance := self |
330 |
startApplicationFor:titleString |
|
331 |
default:defaultName |
|
332 |
ok:okText |
|
333 |
abort:abortText |
|
334 |
ifFail:failBlock |
|
335 |
pattern:pattern |
|
336 |
fromDirectory:aDirectoryPath |
|
337 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
338 |
asLoadDialog:aBoolean |
|
5329 | 339 |
viewFiles:true |
4795 | 340 |
multipleSelect:false. |
3892 | 341 |
|
342 |
enteredFileNameString := instance result. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
343 |
(enteredFileNameString isEmptyOrNil) ifTrue:[ |
3892 | 344 |
^ failBlock value |
345 |
]. |
|
346 |
enteredFileName := enteredFileNameString asFilename. |
|
5867 | 347 |
enteredFileNameString := enteredFileName asString. |
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
348 |
|
3892 | 349 |
(enteredFileName notNil |
350 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
4666 | 351 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
3892 | 352 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
353 |
versionSymbol == #mustBeNew ifTrue:[ |
|
354 |
"/ file may not exist |
|
355 |
enteredFileName exists ifTrue:[^ '']. |
|
356 |
]. |
|
357 |
versionSymbol == #new ifTrue:[ |
|
358 |
"/ file may not exist |
|
359 |
enteredFileName exists ifTrue:[ |
|
6356 | 360 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 361 |
ifFalse:[^ '']. |
362 |
]. |
|
363 |
]. |
|
364 |
versionSymbol == #mustBeOld ifTrue:[ |
|
365 |
enteredFileName exists ifFalse:[^ '']. |
|
366 |
]. |
|
367 |
versionSymbol == #old ifTrue:[ |
|
368 |
"/ file may not exist |
|
369 |
enteredFileName exists ifFalse:[ |
|
6356 | 370 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 371 |
ifFalse:[^ '']. |
372 |
]. |
|
373 |
]. |
|
374 |
]. |
|
375 |
^ enteredFileNameString |
|
3956 | 376 |
" |
377 |
FileDialog |
|
378 |
requestFileName:'enter a fileName:' |
|
379 |
default:'' |
|
380 |
ok:nil |
|
381 |
abort:nil |
|
382 |
version:nil |
|
383 |
ifFail:['none'] |
|
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
384 |
pattern:'*' |
4627 | 385 |
fromDirectory:Filename currentDirectory pathName |
3956 | 386 |
whenBoxCreatedEvaluate:nil |
387 |
asLoadDialog:true |
|
388 |
" |
|
3892 | 389 |
! |
390 |
||
391 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
392 |
||
4795 | 393 |
^ self |
394 |
requestFileName:titleString |
|
395 |
default:defaultName |
|
396 |
ok:nil |
|
397 |
abort:nil |
|
398 |
version:versionSymbol |
|
399 |
ifFail:failBlock |
|
400 |
pattern:pattern |
|
401 |
fromDirectory:aDirectoryPathOrNil |
|
402 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 403 |
|
404 |
" |
|
405 |
FileDialog |
|
406 |
requestFileName:'enter a fileName:' |
|
407 |
default:'' |
|
408 |
version:nil |
|
409 |
ifFail:['none'] |
|
410 |
pattern:'*.conf' |
|
4627 | 411 |
fromDirectory:Filename currentDirectory pathName |
3892 | 412 |
whenBoxCreatedEvaluate:nil. |
413 |
Dialog |
|
414 |
requestFileName:'enter a fileName:' |
|
415 |
default:'' |
|
416 |
version:nil |
|
417 |
ifFail:['none'] |
|
418 |
pattern:'*.conf' |
|
4627 | 419 |
fromDirectory:Filename currentDirectory pathName |
3892 | 420 |
whenBoxCreatedEvaluate:nil |
421 |
" |
|
422 |
" |
|
423 |
FileDialog |
|
424 |
requestFileName:'enter a fileName:' |
|
425 |
default:'' |
|
426 |
version:#old |
|
427 |
ifFail:['none'] |
|
428 |
pattern:'*.conf' |
|
4627 | 429 |
fromDirectory:Filename currentDirectory pathName |
3892 | 430 |
whenBoxCreatedEvaluate:nil |
431 |
" |
|
432 |
" |
|
433 |
FileDialog |
|
434 |
requestFileName:'enter a fileName:' |
|
435 |
default:'' |
|
436 |
version:#mustBeNew |
|
437 |
ifFail:['none'] |
|
438 |
pattern:'*.conf' |
|
4627 | 439 |
fromDirectory:Filename currentDirectory pathName |
3892 | 440 |
whenBoxCreatedEvaluate:nil |
441 |
" |
|
3904 | 442 |
! |
443 |
||
444 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
445 |
"launch a Dialog, which allows user to enter a filename. |
|
446 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
447 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
448 |
The box will show okText in its okButton, abortText in the abortButton. |
|
449 |
The matchPattern is set to pattern initially. |
|
3905 | 450 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 451 |
" |
452 |
||
453 |
||
4795 | 454 |
^ self |
455 |
requestFileNames:titleString |
|
456 |
default:defaultName |
|
457 |
ok:okText |
|
458 |
abort:abortText |
|
459 |
ifFail:failBlock |
|
460 |
pattern:pattern |
|
461 |
fromDirectory:aDirectoryPath |
|
462 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
463 |
asLoadDialog:nil. |
|
3956 | 464 |
|
465 |
||
466 |
" |
|
467 |
FileDialog |
|
468 |
requestFileNames:'enter a fileName:' |
|
469 |
default:'' |
|
470 |
ok:nil |
|
471 |
abort:nil |
|
472 |
ifFail:['none'] |
|
473 |
pattern:'*.conf' |
|
4627 | 474 |
fromDirectory:Filename currentDirectory pathName |
3956 | 475 |
whenBoxCreatedEvaluate:nil. |
476 |
" |
|
477 |
! |
|
478 |
||
479 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
480 |
"launch a Dialog, which allows user to enter a filename. |
|
481 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
482 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
483 |
The box will show okText in its okButton, abortText in the abortButton. |
|
484 |
The matchPattern is set to pattern initially. |
|
485 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
486 |
" |
|
487 |
||
488 |
||
3904 | 489 |
| instance enteredFileNames lastDirectory| |
490 |
||
4795 | 491 |
instance := self |
492 |
startApplicationFor:titleString |
|
493 |
default:defaultName |
|
494 |
ok:okText |
|
495 |
abort:abortText |
|
496 |
ifFail:failBlock |
|
497 |
pattern:pattern |
|
498 |
fromDirectory:aDirectoryPath |
|
499 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
500 |
asLoadDialog:asLoadDialog |
|
5329 | 501 |
viewFiles:true |
4795 | 502 |
multipleSelect:true. |
3904 | 503 |
|
3996 | 504 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 505 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
506 |
^ failBlock value |
|
507 |
]. |
|
508 |
lastDirectory := enteredFileNames first. |
|
509 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
510 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
511 |
^ enteredFileNames |
|
512 |
||
513 |
" |
|
514 |
FileDialog |
|
515 |
requestFileNames:'enter a fileName:' |
|
516 |
default:'' |
|
517 |
ok:nil |
|
518 |
abort:nil |
|
519 |
ifFail:['none'] |
|
520 |
pattern:'*.conf' |
|
4627 | 521 |
fromDirectory:Filename currentDirectory pathName |
3956 | 522 |
whenBoxCreatedEvaluate:nil |
523 |
asLoadDialog:true. |
|
3904 | 524 |
" |
525 |
! |
|
526 |
||
5790 | 527 |
startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
3904 | 528 |
"launch a Dialog, which allows user to enter a filename. |
529 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
530 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
531 |
The box will show okText in its okButton, abortText in the abortButton. |
|
532 |
The matchPattern is set to pattern initially. |
|
533 |
Return the string, or nil if cancel was pressed |
|
534 |
The version argument allows validation of the files existance; |
|
535 |
it may be any of: |
|
536 |
#mustBeNew - fail (return empty string) if the file exists |
|
537 |
#new - confirm if the file exists |
|
538 |
#mustBeOld - fail if the file does not exist |
|
539 |
#old - confirm if the file does not exist |
|
540 |
#any (other) - no validation |
|
541 |
" |
|
542 |
||
543 |
||
5790 | 544 |
|defaultDir instance defaultFile okText abortText initialDefaultFileName| |
545 |
||
546 |
initialDefaultFileName := initialDefaultFileNameArg. |
|
547 |
initialDefaultFileName notNil ifTrue:[ |
|
548 |
initialDefaultFileName := initialDefaultFileName asFilename |
|
549 |
]. |
|
5163 | 550 |
|
551 |
okText := okTextArg. |
|
552 |
okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
|
553 |
abortText := abortTextArg. |
|
554 |
abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
|
3904 | 555 |
|
556 |
defaultDir := aDirectoryPath. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
557 |
"/ defaultDir isNil ifTrue:[ |
5790 | 558 |
"/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
559 |
"/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
560 |
"/ ] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
561 |
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
562 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
563 |
"/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
564 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
565 |
"/ defaultDir asFilename exists ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
566 |
"/ defaultDir := nil |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
567 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
568 |
"/ ] |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
569 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
570 |
(initialDefaultFileName notNil |
5790 | 571 |
and:[initialDefaultFileName isAbsolute |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
572 |
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
5790 | 573 |
defaultDir := initialDefaultFileName asAbsoluteFilename. |
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
574 |
true "viewFiles" ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
575 |
defaultFile := defaultDir asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
576 |
defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
577 |
]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
578 |
] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
579 |
defaultDir isNil ifTrue:[ |
5193 | 580 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
581 |
defaultDir isNil ifTrue:[ |
|
582 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
583 |
]. |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
584 |
defaultDir asFilename exists ifFalse:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
585 |
defaultDir := nil |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
586 |
]. |
3956 | 587 |
] |
3904 | 588 |
]. |
4206 | 589 |
defaultDir := defaultDir asFilename asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
590 |
"/ [defaultDir exists] whileFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
591 |
"/ defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
592 |
"/ ]. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
593 |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
594 |
defaultFile isNil ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
595 |
viewFiles ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
596 |
defaultFile := defaultDir asAbsoluteFilename. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
597 |
] ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
598 |
(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
|
599 |
defaultFile := defaultDir construct:initialDefaultFileName baseName. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
600 |
] ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
601 |
defaultFile := defaultDir. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
602 |
]. |
3956 | 603 |
]. |
3904 | 604 |
]. |
3956 | 605 |
|
3904 | 606 |
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
|
607 |
defaultDir notNil ifTrue:[instance directory:defaultDir]. |
3958 | 608 |
instance multipleSelect:multipleSelect ? false. |
3904 | 609 |
instance startFilename:defaultFile. |
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
610 |
instance pattern:((pattern isEmptyOrNil) ifTrue:['*'] ifFalse:[pattern]). |
3904 | 611 |
instance initialText:titleString. |
612 |
instance okLabelHolder value:okText. |
|
613 |
instance cancelLabelHolder value:abortText. |
|
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
614 |
|
4804 | 615 |
instance beLoadDialog:asLoadDialog ? false. |
5329 | 616 |
instance viewFiles:viewFiles ? true. |
3953 | 617 |
self setDoubleClickActionFor:instance. |
3904 | 618 |
instance allButOpenInterface:#windowSpec. |
619 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
620 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
621 |
Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
7571 | 622 |
instance treeBrowser sortCaselessInTreeBrowser value: (Filename isCaseSensitive not). |
3904 | 623 |
instance openWindowModal. |
624 |
^ instance |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
625 |
|
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
626 |
"Modified: / 23-08-2006 / 12:24:54 / cg" |
7571 | 627 |
"Modified: / 13-12-2006 / 16:25:42 / User" |
3892 | 628 |
! ! |
629 |
||
630 |
!FileDialog class methodsFor:'accessing'! |
|
631 |
||
6650 | 632 |
classResources |
633 |
^ AbstractFileBrowser classResources |
|
634 |
! |
|
635 |
||
5931 | 636 |
lastExtent |
637 |
^ LastExtent |
|
638 |
! |
|
639 |
||
640 |
lastExtent:anExtent |
|
641 |
LastExtent := anExtent |
|
642 |
! |
|
643 |
||
3953 | 644 |
setDoubleClickActionFor:instance |
645 |
||
646 |
instance doubleClickAction:[:anIndex| |
|
647 |
| item | |
|
648 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
649 |
item notNil ifTrue:[ |
|
5329 | 650 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 651 |
instance doAccept. |
652 |
] |
|
653 |
] |
|
654 |
]. |
|
3892 | 655 |
! ! |
656 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
657 |
!FileDialog class methodsFor:'active help'! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
658 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
659 |
flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
660 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
661 |
|
5966 | 662 |
|spec| |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
663 |
|
6098 | 664 |
spec := AbstractFileBrowser flyByHelpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
665 |
|
5966 | 666 |
#fileBrowse |
667 |
'Browse' |
|
668 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
669 |
). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
670 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
671 |
"/ hist := self directoryHistory. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
672 |
"/ hist notNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
673 |
"/ hist canForward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
674 |
"/ spec at:#directoryForward put:(self classResources string:'Forward to: %1' with:hist nextForwardItem). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
675 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
676 |
"/ hist canBackward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
677 |
"/ spec at:#directoryBack put:(self classResources string:'Back to: %1' with:hist nextBackwardItem). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
678 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
679 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
680 |
^ spec. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
681 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
682 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
683 |
self flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
684 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
685 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
686 |
|
3892 | 687 |
!FileDialog class methodsFor:'interface specs'! |
688 |
||
689 |
windowSpec |
|
690 |
"This resource specification was automatically generated |
|
691 |
by the UIPainter of ST/X." |
|
692 |
||
693 |
"Do not manually edit this!! If it is corrupted, |
|
694 |
the UIPainter may not be able to read the specification." |
|
695 |
||
696 |
" |
|
697 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
698 |
FileDialog new openInterface:#windowSpec |
|
699 |
FileDialog open |
|
700 |
" |
|
701 |
||
702 |
<resource: #canvas> |
|
703 |
||
704 |
^ |
|
5229 | 705 |
#(FullSpec |
706 |
name: windowSpec |
|
707 |
window: |
|
708 |
(WindowSpec |
|
709 |
label: 'FileDialog' |
|
710 |
name: 'FileDialog' |
|
711 |
min: (Point 10 10) |
|
712 |
max: (Point 1024 768) |
|
5873 | 713 |
bounds: (Rectangle 0 0 407 400) |
3892 | 714 |
) |
5229 | 715 |
component: |
716 |
(SpecCollection |
|
717 |
collection: ( |
|
718 |
(ViewSpec |
|
719 |
name: 'FilePart' |
|
720 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
721 |
component: |
|
722 |
(SpecCollection |
|
723 |
collection: ( |
|
724 |
(MenuPanelSpec |
|
725 |
name: 'ToolBar1' |
|
8250 | 726 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0) |
5229 | 727 |
tabable: true |
728 |
menu: toolBarMenu |
|
729 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
730 |
) |
5229 | 731 |
(VariableHorizontalPanelSpec |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
732 |
name: 'DeviceAndFilterPanel' |
8250 | 733 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0) |
5229 | 734 |
level: 1 |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
735 |
showHandle: true |
5229 | 736 |
component: |
737 |
(SpecCollection |
|
738 |
collection: ( |
|
739 |
(ViewSpec |
|
740 |
name: 'Box1' |
|
6065 | 741 |
component: |
742 |
(SpecCollection |
|
743 |
collection: ( |
|
744 |
(ComboListSpec |
|
745 |
name: 'ComboList1' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
746 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1) |
6065 | 747 |
visibilityChannel: driveSelectorVisible |
748 |
model: selectedDeviceDrive |
|
749 |
comboList: listOfDeviceDrives |
|
750 |
useIndex: false |
|
751 |
hidePullDownMenuButton: false |
|
752 |
) |
|
753 |
) |
|
754 |
||
755 |
) |
|
4804 | 756 |
) |
5229 | 757 |
(ViewSpec |
758 |
name: 'Box2' |
|
759 |
component: |
|
760 |
(SpecCollection |
|
761 |
collection: ( |
|
762 |
(LabelSpec |
|
763 |
label: 'Filter:' |
|
764 |
name: 'FilterLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
765 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1) |
5229 | 766 |
translateLabel: true |
767 |
adjust: right |
|
4804 | 768 |
) |
5229 | 769 |
(InputFieldSpec |
770 |
name: 'FilterEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
771 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1) |
5229 | 772 |
model: filterHolder |
773 |
immediateAccept: true |
|
774 |
acceptOnReturn: true |
|
775 |
acceptOnTab: true |
|
776 |
acceptOnLostFocus: true |
|
777 |
acceptOnPointerLeave: false |
|
778 |
postBuildCallback: postBuildFilterField: |
|
4804 | 779 |
) |
780 |
) |
|
781 |
||
782 |
) |
|
783 |
) |
|
784 |
) |
|
785 |
||
786 |
) |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
787 |
handles: (Any 0.18427518427518 1.0) |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
788 |
) |
8250 | 789 |
(SubCanvasSpec |
790 |
name: 'DirectoryTreeBrowser' |
|
791 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -30 1) |
|
792 |
tabable: true |
|
793 |
hasHorizontalScrollBar: false |
|
794 |
hasVerticalScrollBar: false |
|
795 |
majorKey: DirectoryTreeBrowser |
|
796 |
subAspectHolders: |
|
797 |
(Array |
|
798 |
||
799 |
(SubChannelInfoSpec |
|
800 |
subAspect: filterModel |
|
801 |
aspect: filterHolder |
|
802 |
) |
|
803 |
(SubChannelInfoSpec |
|
804 |
subAspect: rootHolder |
|
805 |
aspect: rootDirectoryHolder |
|
806 |
) |
|
807 |
) |
|
808 |
createNewApplication: true |
|
809 |
createNewBuilder: true |
|
810 |
postBuildCallback: postBuildTreeBrowser: |
|
811 |
) |
|
5230 | 812 |
(LabelSpec |
813 |
label: 'Filename:' |
|
814 |
name: 'FilenameLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
815 |
layout: (LayoutFrame 3 0 -25 1 73 0 -1 1) |
5230 | 816 |
translateLabel: true |
817 |
labelChannel: filenameLabelHolder |
|
818 |
adjust: left |
|
819 |
) |
|
820 |
(FilenameInputFieldSpec |
|
821 |
name: 'FilenameEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
822 |
layout: (LayoutFrame 70 0 -25 1 -4 1 -1 1) |
5230 | 823 |
tabable: true |
824 |
model: filenameHolder |
|
825 |
immediateAccept: false |
|
826 |
acceptOnPointerLeave: false |
|
5853 | 827 |
hasKeyboardFocusInitially: true |
5230 | 828 |
postBuildCallback: postBuildFileNameField: |
829 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
830 |
) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
831 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
832 |
) |
3892 | 833 |
) |
5229 | 834 |
(HorizontalPanelViewSpec |
835 |
name: 'ButtonPanel' |
|
836 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
837 |
visibilityChannel: buttonPanelVisibleHolder |
|
838 |
horizontalLayout: fitSpace |
|
839 |
verticalLayout: center |
|
840 |
horizontalSpace: 3 |
|
841 |
verticalSpace: 3 |
|
842 |
reverseOrderIfOKAtLeft: true |
|
843 |
component: |
|
844 |
(SpecCollection |
|
845 |
collection: ( |
|
846 |
(ActionButtonSpec |
|
847 |
label: 'Cancel' |
|
848 |
name: 'cancelButton' |
|
849 |
translateLabel: true |
|
850 |
labelChannel: cancelLabelHolder |
|
851 |
tabable: true |
|
852 |
model: doCancel |
|
5873 | 853 |
extent: (Point 131 22) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
854 |
) |
5229 | 855 |
(ActionButtonSpec |
856 |
label: 'Append' |
|
857 |
name: 'appendButton' |
|
858 |
visibilityChannel: appendButtonVisibleHolder |
|
859 |
translateLabel: true |
|
860 |
labelChannel: appendLabelHolder |
|
861 |
tabable: true |
|
862 |
model: appendPressed |
|
5873 | 863 |
extent: (Point 132 22) |
3892 | 864 |
) |
5229 | 865 |
(ActionButtonSpec |
866 |
label: 'OK' |
|
867 |
name: 'okButton' |
|
868 |
translateLabel: true |
|
869 |
labelChannel: okLabelHolder |
|
870 |
tabable: true |
|
871 |
model: okPressed |
|
872 |
isDefault: true |
|
5873 | 873 |
extent: (Point 132 22) |
3892 | 874 |
) |
875 |
) |
|
876 |
||
877 |
) |
|
878 |
) |
|
879 |
) |
|
880 |
||
881 |
) |
|
882 |
) |
|
883 |
! ! |
|
884 |
||
885 |
!FileDialog class methodsFor:'menu specs'! |
|
886 |
||
887 |
toolBarMenu |
|
888 |
"This resource specification was automatically generated |
|
889 |
by the MenuEditor of ST/X." |
|
890 |
||
891 |
"Do not manually edit this!! If it is corrupted, |
|
892 |
the MenuEditor may not be able to read the specification." |
|
893 |
||
894 |
" |
|
895 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
896 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
897 |
" |
|
898 |
||
899 |
<resource: #menu> |
|
900 |
||
901 |
^ |
|
5873 | 902 |
#(Menu |
903 |
( |
|
904 |
(MenuItem |
|
905 |
activeHelpKey: directoryBack |
|
906 |
enabled: enableBack |
|
907 |
label: 'Back' |
|
908 |
itemValue: doBack |
|
909 |
translateLabel: true |
|
910 |
isButton: true |
|
911 |
submenuChannel: menuDirHistoryBack |
|
6087 | 912 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 913 |
keepLinkedMenu: true |
3892 | 914 |
) |
5873 | 915 |
(MenuItem |
916 |
label: '' |
|
3892 | 917 |
) |
5873 | 918 |
(MenuItem |
919 |
activeHelpKey: directoryForward |
|
920 |
enabled: enableForward |
|
921 |
label: 'Forward' |
|
922 |
itemValue: doForward |
|
923 |
translateLabel: true |
|
924 |
isButton: true |
|
925 |
submenuChannel: menuDirHistoryForward |
|
6087 | 926 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 927 |
keepLinkedMenu: true |
3892 | 928 |
) |
5873 | 929 |
(MenuItem |
6462 | 930 |
label: '-' |
931 |
) |
|
932 |
(MenuItem |
|
933 |
activeHelpKey: directoryUp |
|
934 |
enabled: enableDirectoryUp |
|
935 |
label: 'DirectoryUp' |
|
936 |
itemValue: doGoDirectoryUp |
|
937 |
translateLabel: true |
|
938 |
isButton: true |
|
939 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 940 |
) |
5873 | 941 |
(MenuItem |
942 |
activeHelpKey: fileHome |
|
943 |
enabled: enableHome |
|
944 |
label: 'Home' |
|
945 |
itemValue: doGotoHomeDirectory |
|
946 |
translateLabel: true |
|
947 |
isButton: true |
|
6096 | 948 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 949 |
) |
5873 | 950 |
(MenuItem |
8092 | 951 |
activeHelpKey: fileDesktop |
952 |
enabled: enableHome |
|
953 |
label: 'Desktop' |
|
954 |
itemValue: doGotoDesktopDirectory |
|
955 |
translateLabel: true |
|
956 |
isButton: true |
|
957 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
958 |
) |
|
959 |
(MenuItem |
|
6098 | 960 |
activeHelpKey: fileGotoBookmark |
961 |
label: 'Bookmarks' |
|
962 |
translateLabel: true |
|
963 |
isButton: true |
|
964 |
submenuChannel: gotoBookmarksMenuSpec |
|
965 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
|
966 |
) |
|
967 |
(MenuItem |
|
5873 | 968 |
label: '-' |
5966 | 969 |
isVisible: browseVisibleHolder |
970 |
) |
|
971 |
(MenuItem |
|
972 |
activeHelpKey: fileBrowse |
|
973 |
label: 'Browse' |
|
974 |
itemValue: doBrowseDirectory |
|
975 |
translateLabel: true |
|
976 |
isButton: true |
|
977 |
isVisible: browseVisibleHolder |
|
978 |
labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon) |
|
979 |
) |
|
980 |
(MenuItem |
|
981 |
label: '-' |
|
5873 | 982 |
isVisible: newDirectoryVisibilityHolder |
3923 | 983 |
) |
5873 | 984 |
(MenuItem |
6122 | 985 |
label: 'New Directory...' |
5873 | 986 |
itemValue: newDirectory |
987 |
translateLabel: true |
|
988 |
isButton: true |
|
989 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 990 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 991 |
) |
3892 | 992 |
) |
993 |
nil |
|
994 |
nil |
|
995 |
) |
|
996 |
! ! |
|
997 |
||
8182 | 998 |
!FileDialog class methodsFor:'plugIn spec'! |
999 |
||
1000 |
aspectSelectors |
|
1001 |
"This resource specification was automatically generated |
|
1002 |
by the UIPainter of ST/X." |
|
1003 |
||
1004 |
"Do not manually edit this. If it is corrupted, |
|
1005 |
the UIPainter may not be able to read the specification." |
|
1006 |
||
1007 |
"Return a description of exported aspects; |
|
1008 |
these can be connected to aspects of an embedding application |
|
1009 |
(if this app is embedded in a subCanvas)." |
|
1010 |
||
1011 |
^ #( |
|
1012 |
#filenameHolder |
|
1013 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1014 |
#rootDirectoryHolder |
8182 | 1015 |
). |
1016 |
||
1017 |
! ! |
|
1018 |
||
3892 | 1019 |
!FileDialog methodsFor:'accessing'! |
1020 |
||
3996 | 1021 |
currentSelectedFiles |
1022 |
||
1023 |
| selectedFiles| |
|
1024 |
||
1025 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1026 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
1027 |
! |
|
1028 |
||
3892 | 1029 |
directory |
1030 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1031 |
||
1032 |
^ directory |
|
1033 |
! |
|
1034 |
||
1035 |
directory:something |
|
1036 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1037 |
||
1038 |
directory := something. |
|
1039 |
! |
|
1040 |
||
1041 |
initialText |
|
1042 |
||
5598 | 1043 |
initialText isNil ifTrue:[ |
1044 |
^ resources string:'File Dialog'. |
|
1045 |
]. |
|
1046 |
^ resources string:initialText |
|
3892 | 1047 |
! |
1048 |
||
1049 |
initialText:something |
|
1050 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
1051 |
||
1052 |
initialText := something. |
|
1053 |
! |
|
1054 |
||
1055 |
pattern |
|
1056 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1057 |
||
1058 |
^ pattern |
|
1059 |
! |
|
1060 |
||
1061 |
pattern:something |
|
1062 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1063 |
||
1064 |
pattern := something. |
|
1065 |
! |
|
1066 |
||
1067 |
result |
|
1068 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1069 |
||
1070 |
^ result |
|
1071 |
! |
|
1072 |
||
1073 |
result:something |
|
1074 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1075 |
||
1076 |
result := something. |
|
1077 |
! |
|
1078 |
||
3904 | 1079 |
selectedDirectories |
1080 |
||
1081 |
| selectedFiles| |
|
1082 |
||
1083 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1084 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1085 |
! |
|
1086 |
||
3892 | 1087 |
startFilename |
1088 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
1089 |
||
1090 |
startFilename isNil ifTrue:[ |
|
1091 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1092 |
]. |
|
1093 |
^ startFilename |
|
1094 |
! |
|
1095 |
||
1096 |
startFilename:something |
|
1097 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
1098 |
||
1099 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1100 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1101 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1102 |
!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
|
1103 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1104 |
asLoadDialog |
4804 | 1105 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1106 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1107 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1108 |
asLoadDialog:aBoolean |
4804 | 1109 |
self beLoadDialog:aBoolean |
1110 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1111 |
|
4804 | 1112 |
beLoadDialog:aBoolean |
1113 |
||
1114 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1115 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1116 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1117 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1118 |
"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
|
1119 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1120 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1121 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1122 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1123 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1124 |
"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
|
1125 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1126 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1127 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1128 |
|
4804 | 1129 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1130 |
|
4804 | 1131 |
^ isLoadDialog ? true |
1132 |
! |
|
1133 |
||
1134 |
multipleSelect |
|
1135 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1136 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1137 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1138 |
multipleSelect:aBoolean |
4804 | 1139 |
multipleSelect := aBoolean. |
1140 |
treeBrowser notNil ifTrue:[ |
|
1141 |
treeBrowser multipleSelect:aBoolean. |
|
1142 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1143 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1144 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1145 |
!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
|
1146 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1147 |
addButton:aButton |
6068 | 1148 |
|buttonPanel okButton| |
1149 |
||
1150 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1151 |
okButton := self okButton. |
|
1152 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1153 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1154 |
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
|
1155 |
] ifFalse:[ |
6068 | 1156 |
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
|
1157 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1158 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1159 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1160 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1161 |
^ (self componentAt:#okButton) |
3892 | 1162 |
! |
1163 |
||
3904 | 1164 |
treeBrowser |
1165 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1166 |
||
1167 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1168 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1169 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1170 |
!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
|
1171 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1172 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1173 |
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
|
1174 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1175 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1176 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1177 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1178 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1179 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1180 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1181 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1182 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1183 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1184 |
self buttonPanelVisibleHolder value:true |
3904 | 1185 |
! |
1186 |
||
3892 | 1187 |
viewFiles |
1188 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1189 |
||
1190 |
^ viewFiles |
|
1191 |
! |
|
1192 |
||
1193 |
viewFiles:something |
|
1194 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1195 |
||
1196 |
viewFiles := something. |
|
1197 |
! ! |
|
1198 |
||
1199 |
!FileDialog methodsFor:'aspects'! |
|
1200 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1201 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1202 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1203 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1204 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1205 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1206 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1207 |
|
5193 | 1208 |
appendLabelHolder |
1209 |
appendLabelHolder isNil ifTrue:[ |
|
1210 |
appendLabelHolder := 'Append' asValue. |
|
1211 |
]. |
|
1212 |
^ appendLabelHolder |
|
1213 |
! |
|
1214 |
||
4804 | 1215 |
aspectOrNil:aKey forSubApplication:aSubApp |
1216 |
"this hook provides an aspect for a subApp" |
|
1217 |
||
1218 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1219 |
directory notNil ifTrue:[ |
|
1220 |
^ (OrderedCollection with:directory) asValue |
|
1221 |
] |
|
1222 |
]. |
|
1223 |
^ nil |
|
1224 |
! |
|
1225 |
||
5969 | 1226 |
browseVisibleHolder |
1227 |
browseVisibleHolder isNil ifTrue:[ |
|
1228 |
browseVisibleHolder := false asValue. |
|
1229 |
]. |
|
1230 |
^ browseVisibleHolder. |
|
1231 |
! |
|
1232 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1233 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1234 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1235 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1236 |
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
|
1237 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1238 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1239 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1240 |
|
3892 | 1241 |
cancelLabelHolder |
1242 |
||
1243 |
cancelLabelHolder isNil ifTrue:[ |
|
1244 |
cancelLabelHolder := 'Cancel' asValue. |
|
1245 |
]. |
|
1246 |
^ cancelLabelHolder. |
|
1247 |
! |
|
1248 |
||
1249 |
enableBack |
|
4804 | 1250 |
^ treeBrowser enableBack. |
3892 | 1251 |
! |
1252 |
||
1253 |
enableDirectoryUp |
|
4804 | 1254 |
^ treeBrowser enableDirectoryUp. |
3892 | 1255 |
! |
1256 |
||
1257 |
enableForward |
|
4804 | 1258 |
^ treeBrowser enableForward. |
3892 | 1259 |
! |
1260 |
||
8169 | 1261 |
enableGotoDesktop |
1262 |
^ treeBrowser enableGotoDesktop. |
|
1263 |
! |
|
1264 |
||
3892 | 1265 |
enableHome |
4804 | 1266 |
^ treeBrowser enableHome. |
3892 | 1267 |
! |
1268 |
||
1269 |
filenameHolder |
|
1270 |
"Return a value holder with the filename. |
|
1271 |
Shown in the filename input-field. |
|
1272 |
Being the selection in the tree. |
|
1273 |
" |
|
1274 |
|holder| |
|
7581 | 1275 |
|
3892 | 1276 |
holder := builder bindingAt:#filenameHolder. |
1277 |
||
7581 | 1278 |
holder isNil ifTrue:[ |
3892 | 1279 |
holder := ValueHolder new. |
1280 |
holder addDependent:self. |
|
1281 |
builder aspectAt:#filenameHolder |
|
1282 |
put:holder. |
|
1283 |
]. |
|
1284 |
||
1285 |
^ holder. |
|
1286 |
! |
|
1287 |
||
8183 | 1288 |
filenameHolder:aHolder |
8182 | 1289 |
"needed when used as subcanvas" |
8183 | 1290 |
|
1291 |
|holder| |
|
8182 | 1292 |
|
8183 | 1293 |
holder := builder aspectAt:#filenameHolder. |
1294 |
holder notNil ifTrue:[ |
|
1295 |
holder removeDependent:self |
|
1296 |
]. |
|
8182 | 1297 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1298 |
aHolder addDependent:self |
8182 | 1299 |
! |
1300 |
||
3904 | 1301 |
filenameLabelHolder |
1302 |
"Return a value holder for the input string. |
|
1303 |
" |
|
1304 |
filenameLabelHolder isNil ifTrue:[ |
|
1305 |
filenameLabelHolder := 'Filename:' asValue. |
|
1306 |
]. |
|
1307 |
^ filenameLabelHolder |
|
1308 |
! |
|
1309 |
||
3892 | 1310 |
filterHolder |
8183 | 1311 |
"Return a value holder for filter" |
3892 | 1312 |
|
1313 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1314 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1315 |
]. |
1316 |
^ filterHolder |
|
1317 |
! |
|
1318 |
||
8183 | 1319 |
filterHolder:aHolder |
1320 |
"needed when used as subcanvas" |
|
1321 |
||
1322 |
filterHolder := aHolder. |
|
1323 |
! |
|
1324 |
||
6098 | 1325 |
gotoBookmarksMenuSpec |
1326 |
<resource: #programMenu> |
|
1327 |
||
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1328 |
^ treeBrowser gotoBookmarksMenuSpec |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1329 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1330 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1331 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1332 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1333 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1334 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1335 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1336 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1337 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1338 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1339 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1340 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1341 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1342 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1343 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1344 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1345 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1346 |
"/ ^ menu |
6098 | 1347 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1348 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1349 |
! |
1350 |
||
6065 | 1351 |
listOfDeviceDrives |
1352 |
||
1353 |
listOfDeviceDrives isNil ifTrue:[ |
|
1354 |
listOfDeviceDrives := Filename volumes. |
|
1355 |
]. |
|
1356 |
^ listOfDeviceDrives |
|
1357 |
! |
|
1358 |
||
3892 | 1359 |
okLabelHolder |
1360 |
"automatically generated by UIPainter ..." |
|
1361 |
||
1362 |
"*** the code below creates a default model when invoked." |
|
1363 |
"*** (which may not be the one you wanted)" |
|
1364 |
"*** Please change as required and accept it in the browser." |
|
1365 |
"*** (and replace this comment by something more useful ;-)" |
|
1366 |
||
1367 |
okLabelHolder isNil ifTrue:[ |
|
1368 |
okLabelHolder := 'OK' asValue. |
|
1369 |
]. |
|
1370 |
^ okLabelHolder. |
|
6065 | 1371 |
! |
1372 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1373 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1374 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1375 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1376 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1377 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1378 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1379 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1380 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1381 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1382 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1383 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1384 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1385 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1386 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1387 |
|
6065 | 1388 |
selectedDeviceDrive |
1389 |
||
1390 |
selectedDeviceDrive isNil ifTrue:[ |
|
1391 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1392 |
selectedDeviceDrive addDependent:self. |
|
1393 |
]. |
|
1394 |
^ selectedDeviceDrive |
|
3892 | 1395 |
! ! |
1396 |
||
1397 |
!FileDialog methodsFor:'change & update'! |
|
1398 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1399 |
buttonPanelVisibilityChanged |
5598 | 1400 |
|filePart| |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1401 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1402 |
filePart := builder componentAt:#FilePart. |
5598 | 1403 |
filePart notNil ifTrue:[ |
1404 |
buttonPanelVisibleHolder value ifTrue:[ |
|
1405 |
filePart layout bottomOffset:-40 |
|
1406 |
] ifFalse:[ |
|
1407 |
filePart layout bottomOffset:0 |
|
1408 |
]. |
|
1409 |
filePart containerChangedSize "/ force resize |
|
1410 |
] |
|
4728
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 |
|
6065 | 1413 |
selectedDeviceDriveChanged |
1414 |
||
1415 |
| newDrive curSel newFile| |
|
1416 |
||
1417 |
newDrive := self selectedDeviceDrive value. |
|
1418 |
curSel := treeBrowser currentFileNameHolder value. |
|
1419 |
curSel notEmpty ifTrue:[ |
|
1420 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1421 |
]. |
|
1422 |
newDrive notNil ifTrue:[ |
|
1423 |
newFile := newDrive asFilename. |
|
1424 |
||
1425 |
newFile isReadable ifTrue:[ |
|
1426 |
treeBrowser gotoFile:newFile. |
|
1427 |
^self. |
|
1428 |
]. |
|
1429 |
]. |
|
1430 |
curSel notEmpty ifTrue:[ |
|
1431 |
self selectedDeviceDrive value:(curSel first volume). |
|
1432 |
] ifFalse:[ |
|
1433 |
self selectedDeviceDrive value:'C:'. |
|
1434 |
]. |
|
1435 |
! |
|
1436 |
||
3892 | 1437 |
update:something with:aParameter from:changedObject |
5867 | 1438 |
|files newFile newLabel fn entryFieldFilename| |
3892 | 1439 |
|
1440 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1441 |
files := changedObject value. |
3892 | 1442 |
|
1443 |
(files isEmpty) ifTrue:[ |
|
4804 | 1444 |
newFile := nil. |
3892 | 1445 |
] ifFalse:[ |
1446 |
files size == 1 ifTrue:[ |
|
4804 | 1447 |
newFile := files first. |
3892 | 1448 |
] ifFalse:[ |
4804 | 1449 |
newFile := ''. |
3892 | 1450 |
]. |
1451 |
]. |
|
5924 | 1452 |
(self filenameHolder value notNil |
1453 |
and:[newFile notNil |
|
1454 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
5867 | 1455 |
entryFieldFilename := self filenameHolder value asFilename. |
1456 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6122
diff
changeset
|
1457 |
entryFieldFilename isDirectory ifFalse:[ |
5867 | 1458 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
1459 |
]. |
|
1460 |
]. |
|
1461 |
]. |
|
4804 | 1462 |
self filenameHolder value:newFile withoutNotifying:self. |
6065 | 1463 |
OperatingSystem supportsVolumes ifTrue:[ |
1464 |
| volume | |
|
1465 |
volume := (files size >= 1) |
|
1466 |
ifTrue:[files first volume] |
|
1467 |
ifFalse:nil. |
|
1468 |
self selectedDeviceDrive value:volume. |
|
1469 |
]. |
|
3892 | 1470 |
]. |
4804 | 1471 |
|
6065 | 1472 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1473 |
self selectedDeviceDriveChanged. |
|
1474 |
^ self. |
|
1475 |
]. |
|
3904 | 1476 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1477 |
changedObject value ifTrue:[ |
|
4804 | 1478 |
newLabel := 'Filename:'. |
3904 | 1479 |
] ifFalse:[ |
4804 | 1480 |
newLabel := 'Directory:'. |
1481 |
]. |
|
1482 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1483 |
]. |
3892 | 1484 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1485 |
fn := changedObject value asFilename. |
1486 |
(fn exists) ifFalse:[^ self]. |
|
1487 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
|
5949 | 1488 |
fn isDirectory ifTrue:[ |
1489 |
treeBrowser expandEnforceSelectedItems. |
|
1490 |
]. |
|
3892 | 1491 |
]. |
1492 |
^ super update:something with:aParameter from:changedObject |
|
1493 |
! ! |
|
1494 |
||
1495 |
!FileDialog methodsFor:'event handling'! |
|
1496 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1497 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1498 |
"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
|
1499 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1500 |
^ appendWasPressed |
3892 | 1501 |
! ! |
1502 |
||
1503 |
!FileDialog methodsFor:'initialization & release'! |
|
1504 |
||
5932 | 1505 |
closeDownViews |
1506 |
self remarkExtent. |
|
1507 |
super closeDownViews. |
|
1508 |
! |
|
1509 |
||
1510 |
closeWindow |
|
1511 |
self remarkExtent. |
|
1512 |
super closeWindow. |
|
1513 |
! |
|
1514 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1515 |
commonPostOpen |
8182 | 1516 |
|selection| |
3892 | 1517 |
|
1518 |
"/ 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
|
1519 |
|
3892 | 1520 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1521 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1522 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1523 |
|
6409 | 1524 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1525 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1526 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1527 |
|
1528 |
self isLoadDialog ifTrue:[ |
|
4796 | 1529 |
treeBrowser newVisibilityHolder value:false. |
1530 |
treeBrowser allowFileOperations value:false. |
|
1531 |
self newDirectoryVisibilityHolder value:false. |
|
1532 |
]. |
|
5927 | 1533 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1534 |
|
1535 |
selection := treeBrowser treeSelectionHolder value. |
|
1536 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1537 |
selection := selection asCollection first. |
5929 | 1538 |
selection enforcedExpand. |
1539 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1540 |
]. |
|
4796 | 1541 |
! |
1542 |
||
6409 | 1543 |
initialRootDirectory |
1544 |
"returns the directory the browser is open on |
|
1545 |
" |
|
1546 |
|root| |
|
1547 |
||
1548 |
(root := self directory) notNil ifTrue:[ |
|
1549 |
root := root asFilename. |
|
1550 |
||
1551 |
root isDirectory ifFalse:[ |
|
1552 |
root := root directory. |
|
1553 |
||
1554 |
root isDirectory ifFalse:[ |
|
1555 |
root := nil. |
|
1556 |
] |
|
1557 |
] |
|
1558 |
]. |
|
1559 |
root isNil ifTrue:[ |
|
1560 |
root := Filename currentDirectory. |
|
1561 |
]. |
|
1562 |
^ root asAbsoluteFilename |
|
1563 |
! |
|
1564 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1565 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1566 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1567 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1568 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1569 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1570 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1571 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1572 |
filterField := aWidget. |
4796 | 1573 |
! |
1574 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1575 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1576 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1577 |
treeBrowser := aSubCanvasView client. |
6409 | 1578 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1579 |
! |
4796 | 1580 |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1581 |
postBuildWith:aBuilder |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1582 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1583 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1584 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1585 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1586 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1587 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1588 |
|
6632 | 1589 |
super postBuildWith:aBuilder |
5932 | 1590 |
! |
1591 |
||
8182 | 1592 |
postOpenAsSubcanvasWith:aBuilder |
1593 |
super postOpenAsSubcanvasWith:aBuilder. |
|
1594 |
||
1595 |
"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
|
1596 |
self hideButtonPanel. |
8183 | 1597 |
|
1598 |
"filenameHolder contains the initial file name" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1599 |
self startFilename:self filenameHolder value. |
8183 | 1600 |
treeBrowser currentFileNameHolder value:(Array with:self filenameHolder value). |
8182 | 1601 |
! |
1602 |
||
1603 |
postOpenWith:aBuilder |
|
1604 |
|lastExtent| |
|
1605 |
||
1606 |
super postOpenWith:aBuilder. |
|
8183 | 1607 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename). |
8182 | 1608 |
|
1609 |
lastExtent := self class lastExtent. |
|
1610 |
lastExtent notNil ifTrue:[ |
|
1611 |
self window topView extent:lastExtent. |
|
1612 |
]. |
|
1613 |
self window label:self initialText. |
|
1614 |
! |
|
1615 |
||
5932 | 1616 |
remarkExtent |
1617 |
self class lastExtent:self window topView extent. |
|
4796 | 1618 |
! ! |
1619 |
||
1620 |
!FileDialog methodsFor:'private'! |
|
1621 |
||
1622 |
returnWasPressedInFilterField |
|
1623 |
|ev| |
|
1624 |
||
1625 |
ev := self windowGroup lastEvent. |
|
1626 |
(ev notNil |
|
1627 |
and:[ev isKeyEvent |
|
1628 |
and:[ev key == #Return |
|
1629 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1630 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1631 |
^ true |
|
1632 |
]. |
|
1633 |
^ false |
|
1634 |
! |
|
1635 |
||
1636 |
returnWasPressedInFilterOrFilenameField |
|
1637 |
|ev| |
|
1638 |
||
1639 |
ev := self windowGroup lastEvent. |
|
1640 |
(ev notNil |
|
1641 |
and:[ev isKeyEvent |
|
1642 |
and:[ev key == #Return |
|
1643 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1644 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1645 |
^ true |
|
1646 |
]. |
|
1647 |
^ false |
|
1648 |
! ! |
|
1649 |
||
6065 | 1650 |
!FileDialog methodsFor:'queries'! |
1651 |
||
1652 |
driveSelectorVisible |
|
1653 |
^ OperatingSystem isMSDOSlike |
|
1654 |
! ! |
|
1655 |
||
4796 | 1656 |
!FileDialog methodsFor:'user actions'! |
1657 |
||
1658 |
appendPressed |
|
1659 |
appendWasPressed := true. |
|
1660 |
self commonAcceptAction. |
|
1661 |
! |
|
1662 |
||
1663 |
commonAcceptAction |
|
1664 |
filenameField accept. |
|
1665 |
self result:(self filenameHolder value asString). |
|
1666 |
||
1667 |
^ super doAccept |
|
1668 |
! |
|
1669 |
||
1670 |
doAccept |
|
1671 |
"force accept - ignore in filterField" |
|
1672 |
||
1673 |
self returnWasPressedInFilterField ifTrue:[ |
|
1674 |
^ self |
|
1675 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1676 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1677 |
"/ 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
|
1678 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1679 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1680 |
]. |
4796 | 1681 |
appendWasPressed := false. |
1682 |
self commonAcceptAction. |
|
1683 |
! |
|
1684 |
||
1685 |
doBack |
|
1686 |
||
1687 |
treeBrowser doBack. |
|
1688 |
! |
|
1689 |
||
5966 | 1690 |
doBrowseDirectory |
1691 |
UserPreferences fileBrowserClass openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
|
1692 |
||
1693 |
||
1694 |
! |
|
1695 |
||
4796 | 1696 |
doCancel |
1697 |
||
1698 |
self result:nil. |
|
1699 |
^ super doCancel. |
|
1700 |
! |
|
1701 |
||
1702 |
doForward |
|
1703 |
||
1704 |
treeBrowser doForward. |
|
1705 |
! |
|
1706 |
||
1707 |
doGoDirectoryUp |
|
1708 |
||
1709 |
treeBrowser doGoDirectoryUp. |
|
1710 |
! |
|
1711 |
||
8092 | 1712 |
doGotoDesktopDirectory |
1713 |
||
1714 |
treeBrowser doGotoDesktopDirectory. |
|
1715 |
! |
|
1716 |
||
4796 | 1717 |
doGotoHomeDirectory |
1718 |
||
1719 |
treeBrowser doGotoHomeDirectory. |
|
1720 |
! |
|
1721 |
||
1722 |
menuDirHistory:backOrForward |
|
1723 |
||
1724 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1725 |
! |
|
1726 |
||
1727 |
menuDirHistoryBack |
|
1728 |
||
1729 |
^ treeBrowser menuDirHistory:#back. |
|
1730 |
! |
|
1731 |
||
1732 |
menuDirHistoryForward |
|
1733 |
||
1734 |
^ treeBrowser menuDirHistory:#forward. |
|
1735 |
! |
|
1736 |
||
1737 |
newDirectory |
|
1738 |
||
1739 |
^ treeBrowser newDirectory |
|
1740 |
! |
|
1741 |
||
1742 |
okPressed |
|
1743 |
self doAccept |
|
1744 |
! ! |
|
1745 |
||
1746 |
!FileDialog class methodsFor:'documentation'! |
|
1747 |
||
1748 |
version |
|
8250 | 1749 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.100 2008-08-21 21:15:12 cg Exp $' |
4796 | 1750 |
! ! |