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