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