55 " |
55 " |
56 ! |
56 ! |
57 |
57 |
58 examples |
58 examples |
59 " |
59 " |
60 [exBegin] |
60 [exBegin] |
61 FileDialog open |
61 FileDialog open |
62 [exEnd] |
62 [exEnd] |
63 |
63 |
64 [exBegin] |
64 [exBegin] |
65 FileDialog |
65 FileDialog |
66 requestFileName:'enter a fileName:' |
66 requestFileName:'enter a fileName:' |
67 default:'' |
67 default:'' |
68 version:nil |
68 version:nil |
69 ifFail:['none'] |
69 ifFail:['none'] |
70 pattern:'*.conf' |
70 pattern:'*.conf' |
71 fromDirectory:'/etc' |
71 fromDirectory:'/etc' |
72 whenBoxCreatedEvaluate:nil. |
72 whenBoxCreatedEvaluate:nil. |
73 [exEnd] |
73 [exEnd] |
74 [exBegin] |
74 [exBegin] |
75 |fd| |
75 |fd| |
76 |
76 |
77 fd := FileDialog new. |
77 fd := FileDialog new. |
78 fd multipleSelect:true. |
78 fd multipleSelect:true. |
79 fd open |
79 fd open |
80 [exEnd] |
80 [exEnd] |
81 " |
81 " |
82 ! |
82 ! |
83 |
83 |
84 todo |
84 todo |
85 " |
85 " |
86 - make the filedialog windows like f |
86 - make the filedialog windows like f |
87 filename entry field shows only the filename not the whole directory |
87 filename entry field shows only the filename not the whole directory |
88 the tree allways starts in currrent directory |
88 the tree allways starts in currrent directory |
89 the parent tree is shown in a compobox where the perents are selectable |
89 the parent tree is shown in a compobox where the perents are selectable |
90 - do not expand the ~ or relative pathnames to absolute pathnames |
90 - do not expand the ~ or relative pathnames to absolute pathnames |
91 " |
91 " |
92 ! ! |
92 ! ! |
93 |
93 |
94 !FileDialogV2 class methodsFor:'instance creation'! |
94 !FileDialogV2 class methodsFor:'instance creation'! |
95 |
95 |
96 requestDirectoryName:title default:aFileName ifFail:failBlock |
96 requestDirectoryName:title default:aFileName ifFail:failBlock |
97 "same as requestFileName, but only show directories" |
97 "same as requestFileName, but only show directories" |
98 |
98 |
99 ^ self |
99 ^ self |
100 requestDirectoryName:title |
100 requestDirectoryName:title |
101 default:aFileName |
101 default:aFileName |
102 ok:nil |
102 ok:nil |
103 abort:nil |
103 abort:nil |
104 version:nil |
104 version:nil |
105 pattern:nil |
105 pattern:nil |
106 fromDirectory:nil |
106 fromDirectory:nil |
107 ifFail:failBlock |
107 ifFail:failBlock |
108 whenBoxCreatedEvaluate:nil |
108 whenBoxCreatedEvaluate:nil |
109 asLoadDialog:nil. |
109 asLoadDialog:nil. |
110 |
110 |
111 " |
111 " |
112 FileDialogV2 |
112 FileDialogV2 |
113 requestDirectoryName:'which directory ?' |
113 requestDirectoryName:'which directory ?' |
114 default:Filename currentDirectory pathName |
114 default:Filename currentDirectory pathName |
115 ifFail:'none' |
115 ifFail:'none' |
116 " |
116 " |
117 ! |
117 ! |
118 |
118 |
119 requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
119 requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
120 "same as requestFileName, but only show directories" |
120 "same as requestFileName, but only show directories" |
121 |
121 |
122 ^ self |
122 ^ self |
123 requestDirectoryName:title |
123 requestDirectoryName:title |
124 default:aFileName |
124 default:aFileName |
125 ok:okText |
125 ok:okText |
126 abort:abortText |
126 abort:abortText |
127 version:nil |
127 version:nil |
128 pattern:nil |
128 pattern:nil |
129 fromDirectory:nil |
129 fromDirectory:nil |
130 ifFail:failBlock |
130 ifFail:failBlock |
131 whenBoxCreatedEvaluate:nil |
131 whenBoxCreatedEvaluate:nil |
132 asLoadDialog:nil. |
132 asLoadDialog:nil. |
133 |
133 |
134 " |
134 " |
135 FileDialog |
135 FileDialog |
136 requestDirectoryName:'which directory ?' |
136 requestDirectoryName:'which directory ?' |
137 default:Filename currentDirectory pathName |
137 default:Filename currentDirectory pathName |
138 ok:'Yes' |
138 ok:'Yes' |
139 abort:'No' |
139 abort:'No' |
140 ifFail:'none' |
140 ifFail:'none' |
141 " |
141 " |
142 ! |
142 ! |
143 |
143 |
144 requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
144 requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
145 "same as requestFileName, but only show directories" |
145 "same as requestFileName, but only show directories" |
146 |
146 |
147 ^ self |
147 ^ self |
148 requestDirectoryName:title |
148 requestDirectoryName:title |
149 default:aFileName |
149 default:aFileName |
150 ok:okText |
150 ok:okText |
151 abort:abortText |
151 abort:abortText |
152 version:nil |
152 version:nil |
153 pattern:nil |
153 pattern:nil |
154 fromDirectory:nil |
154 fromDirectory:nil |
155 ifFail:failBlock |
155 ifFail:failBlock |
156 whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
156 whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
157 asLoadDialog:nil. |
157 asLoadDialog:nil. |
158 |
158 |
159 " |
159 " |
160 FileDialog |
160 FileDialog |
161 requestDirectoryName:'which directory ?' |
161 requestDirectoryName:'which directory ?' |
162 default:Filename currentDirectory pathName |
162 default:Filename currentDirectory pathName |
163 ok:'Yes' |
163 ok:'Yes' |
164 abort:'No' |
164 abort:'No' |
165 ifFail:'none' |
165 ifFail:'none' |
166 " |
166 " |
167 ! |
167 ! |
168 |
168 |
169 requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
169 requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
170 "same as requestFileName, but only show directories" |
170 "same as requestFileName, but only show directories" |
171 |
171 |
172 |enteredFileName instance enteredFileNameString| |
172 |enteredFileName instance enteredFileNameString| |
173 |
173 |
174 instance := self |
174 instance := self |
175 startApplicationFor:titleString |
175 startApplicationFor:titleString |
176 default:aFileName |
176 default:aFileName |
177 ok:okText |
177 ok:okText |
178 abort:abortText |
178 abort:abortText |
179 ifFail:failBlock |
179 ifFail:failBlock |
180 pattern:pattern |
180 pattern:pattern |
181 fromDirectory:aDirectoryPath |
181 fromDirectory:aDirectoryPath |
182 whenBoxCreatedEvaluate:boxCreatedCallback |
182 whenBoxCreatedEvaluate:boxCreatedCallback |
183 asLoadDialog:aBoolean |
183 asLoadDialog:aBoolean |
184 viewFiles:false |
184 viewFiles:false |
185 multipleSelect:false. |
185 multipleSelect:false. |
186 |
186 |
187 enteredFileNameString := instance result. |
187 enteredFileNameString := instance result. |
188 enteredFileNameString isNil ifTrue:[ |
188 enteredFileNameString isNil ifTrue:[ |
189 ^ failBlock value |
189 ^ failBlock value |
190 ]. |
190 ]. |
191 enteredFileName := enteredFileNameString asFilename. |
191 enteredFileName := enteredFileNameString asFilename. |
192 enteredFileNameString := enteredFileName asString. |
192 enteredFileNameString := enteredFileName asString. |
193 (enteredFileName notNil |
193 (enteredFileName notNil |
194 and:[enteredFileNameString notEmpty]) ifTrue:[ |
194 and:[enteredFileNameString notEmpty]) ifTrue:[ |
195 versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
195 versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
196 versionSymbol == #mustBeNew ifTrue:[ |
196 versionSymbol == #mustBeNew ifTrue:[ |
197 "/ file may not exist |
197 "/ file may not exist |
198 enteredFileName exists ifTrue:[^ '']. |
198 enteredFileName exists ifTrue:[^ '']. |
199 ]. |
199 ]. |
200 versionSymbol == #new ifTrue:[ |
200 versionSymbol == #new ifTrue:[ |
201 "/ file may not exist |
201 "/ file may not exist |
202 enteredFileName exists ifTrue:[ |
202 enteredFileName exists ifTrue:[ |
203 (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
203 (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
204 ifFalse:[^ '']. |
204 ifFalse:[^ '']. |
205 ]. |
205 ]. |
206 ]. |
206 ]. |
207 versionSymbol == #mustBeOld ifTrue:[ |
207 versionSymbol == #mustBeOld ifTrue:[ |
208 enteredFileName exists ifFalse:[^ '']. |
208 enteredFileName exists ifFalse:[^ '']. |
209 ]. |
209 ]. |
210 versionSymbol == #old ifTrue:[ |
210 versionSymbol == #old ifTrue:[ |
211 "/ file may not exist |
211 "/ file may not exist |
212 enteredFileName exists ifFalse:[ |
212 enteredFileName exists ifFalse:[ |
213 (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
213 (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
214 ifFalse:[^ '']. |
214 ifFalse:[^ '']. |
215 ]. |
215 ]. |
216 ]. |
216 ]. |
217 FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
217 FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
218 ]. |
218 ]. |
219 ^ enteredFileNameString |
219 ^ enteredFileNameString |
220 |
220 |
221 " |
221 " |
222 FileDialog |
222 FileDialog |
223 requestDirectoryName:'which directory ?' |
223 requestDirectoryName:'which directory ?' |
224 default:Filename currentDirectory pathName |
224 default:Filename currentDirectory pathName |
225 ifFail:nil |
225 ifFail:nil |
226 " |
226 " |
227 " |
227 " |
228 FileDialog |
228 FileDialog |
229 requestDirectoryName:'which directory ?' |
229 requestDirectoryName:'which directory ?' |
230 default:Filename currentDirectory pathName |
230 default:Filename currentDirectory pathName |
231 ok:nil |
231 ok:nil |
232 abort:nil |
232 abort:nil |
233 version:nil |
233 version:nil |
234 pattern:nil |
234 pattern:nil |
235 fromDirectory:nil |
235 fromDirectory:nil |
236 ifFail:nil |
236 ifFail:nil |
237 whenBoxCreatedEvaluate:nil |
237 whenBoxCreatedEvaluate:nil |
238 asLoadDialog:true |
238 asLoadDialog:true |
239 " |
239 " |
240 ! |
240 ! |
241 |
241 |
242 requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
242 requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
243 "same as requestFileName, but only show directories" |
243 "same as requestFileName, but only show directories" |
244 |
244 |
245 ^ self |
245 ^ self |
246 requestDirectoryName:title |
246 requestDirectoryName:title |
247 default:aFileName |
247 default:aFileName |
248 ok:okText |
248 ok:okText |
249 abort:nil |
249 abort:nil |
250 version:nil |
250 version:nil |
251 pattern:nil |
251 pattern:nil |
252 fromDirectory:nil |
252 fromDirectory:nil |
253 ifFail:failBlock |
253 ifFail:failBlock |
254 whenBoxCreatedEvaluate:nil |
254 whenBoxCreatedEvaluate:nil |
255 asLoadDialog:nil. |
255 asLoadDialog:nil. |
256 |
256 |
257 " |
257 " |
258 FileDialogV2 |
258 FileDialogV2 |
259 requestDirectoryName:'which directory ?' |
259 requestDirectoryName:'which directory ?' |
260 default:Filename currentDirectory pathName |
260 default:Filename currentDirectory pathName |
261 ok:'Yes' |
261 ok:'Yes' |
262 ifFail:'none' |
262 ifFail:'none' |
263 " |
263 " |
264 ! |
264 ! |
265 |
265 |
266 requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
266 requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
267 |
267 |
268 ^ self |
268 ^ self |
269 requestFileName:titleString |
269 requestFileName:titleString |
270 default:defaultName |
270 default:defaultName |
271 ok:okText |
271 ok:okText |
272 abort:abortText |
272 abort:abortText |
273 version:nil |
273 version:nil |
274 ifFail:nil |
274 ifFail:nil |
275 pattern:pattern |
275 pattern:pattern |
276 fromDirectory:aDirectoryPathOrNil |
276 fromDirectory:aDirectoryPathOrNil |
277 whenBoxCreatedEvaluate:boxCreatedCallback |
277 whenBoxCreatedEvaluate:boxCreatedCallback |
278 ! |
278 ! |
279 |
279 |
280 requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
280 requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
281 "launch a Dialog, which allows user to enter a filename. |
281 "launch a Dialog, which allows user to enter a filename. |
282 The files presented initially are those in aDirectoryPathOrNil, or the |
282 The files presented initially are those in aDirectoryPathOrNil, or the |
284 The box will show okText in its okButton, abortText in the abortButton. |
284 The box will show okText in its okButton, abortText in the abortButton. |
285 The matchPattern is set to pattern initially. |
285 The matchPattern is set to pattern initially. |
286 Return the string, or nil if cancel was pressed |
286 Return the string, or nil if cancel was pressed |
287 The version argument allows validation of the files existance; |
287 The version argument allows validation of the files existance; |
288 it may be any of: |
288 it may be any of: |
289 #mustBeNew - fail (return empty string) if the file exists |
289 #mustBeNew - fail (return empty string) if the file exists |
290 #new - confirm if the file exists |
290 #new - confirm if the file exists |
291 #mustBeOld - fail if the file does not exist |
291 #mustBeOld - fail if the file does not exist |
292 #old - confirm if the file does not exist |
292 #old - confirm if the file does not exist |
293 #any (other) - no validation |
293 #any (other) - no validation |
294 " |
294 " |
295 |
295 |
296 ^ self |
296 ^ self |
297 requestFileName:titleString |
297 requestFileName:titleString |
298 default:defaultName |
298 default:defaultName |
299 ok:okText |
299 ok:okText |
300 abort:abortText |
300 abort:abortText |
301 version:versionSymbol |
301 version:versionSymbol |
302 ifFail:failBlock |
302 ifFail:failBlock |
303 pattern:pattern |
303 pattern:pattern |
304 fromDirectory:aDirectoryPath |
304 fromDirectory:aDirectoryPath |
305 whenBoxCreatedEvaluate:boxCreatedCallback |
305 whenBoxCreatedEvaluate:boxCreatedCallback |
306 asLoadDialog:nil |
306 asLoadDialog:nil |
307 ! |
307 ! |
308 |
308 |
309 requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
309 requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
310 "launch a Dialog, which allows user to enter a filename. |
310 "launch a Dialog, which allows user to enter a filename. |
311 The files presented initially are those in aDirectoryPathOrNil, or the |
311 The files presented initially are those in aDirectoryPathOrNil, or the |
313 The box will show okText in its okButton, abortText in the abortButton. |
313 The box will show okText in its okButton, abortText in the abortButton. |
314 The matchPattern is set to pattern initially. |
314 The matchPattern is set to pattern initially. |
315 Return the string, or nil if cancel was pressed |
315 Return the string, or nil if cancel was pressed |
316 The version argument allows validation of the files existance; |
316 The version argument allows validation of the files existance; |
317 it may be any of: |
317 it may be any of: |
318 #mustBeNew - fail (return empty string) if the file exists |
318 #mustBeNew - fail (return empty string) if the file exists |
319 #new - confirm if the file exists |
319 #new - confirm if the file exists |
320 #mustBeOld - fail if the file does not exist |
320 #mustBeOld - fail if the file does not exist |
321 #old - confirm if the file does not exist |
321 #old - confirm if the file does not exist |
322 #any (other) - no validation |
322 #any (other) - no validation |
323 " |
323 " |
324 |
324 |
325 |
325 |
326 | instance enteredFileName enteredFileNameString| |
326 | instance enteredFileName enteredFileNameString| |
327 |
327 |
328 instance := self |
328 instance := self |
329 startApplicationFor:titleString |
329 startApplicationFor:titleString |
330 default:defaultName |
330 default:defaultName |
331 ok:okText |
331 ok:okText |
332 abort:abortText |
332 abort:abortText |
333 ifFail:failBlock |
333 ifFail:failBlock |
334 pattern:pattern |
334 pattern:pattern |
335 fromDirectory:aDirectoryPath |
335 fromDirectory:aDirectoryPath |
336 whenBoxCreatedEvaluate:boxCreatedCallback |
336 whenBoxCreatedEvaluate:boxCreatedCallback |
337 asLoadDialog:aBoolean |
337 asLoadDialog:aBoolean |
338 viewFiles:true |
338 viewFiles:true |
339 multipleSelect:false. |
339 multipleSelect:false. |
340 |
340 |
341 enteredFileNameString := instance result. |
341 enteredFileNameString := instance result. |
342 (enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[ |
342 (enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[ |
343 ^ failBlock value |
343 ^ failBlock value |
344 ]. |
344 ]. |
345 enteredFileName := enteredFileNameString asFilename. |
345 enteredFileName := enteredFileNameString asFilename. |
346 enteredFileNameString := enteredFileName asString. |
346 enteredFileNameString := enteredFileName asString. |
347 |
347 |
348 (enteredFileName notNil |
348 (enteredFileName notNil |
349 and:[enteredFileNameString notEmpty]) ifTrue:[ |
349 and:[enteredFileNameString notEmpty]) ifTrue:[ |
350 FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
350 FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
351 versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
351 versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
352 versionSymbol == #mustBeNew ifTrue:[ |
352 versionSymbol == #mustBeNew ifTrue:[ |
353 "/ file may not exist |
353 "/ file may not exist |
354 enteredFileName exists ifTrue:[^ '']. |
354 enteredFileName exists ifTrue:[^ '']. |
355 ]. |
355 ]. |
356 versionSymbol == #new ifTrue:[ |
356 versionSymbol == #new ifTrue:[ |
357 "/ file may not exist |
357 "/ file may not exist |
358 enteredFileName exists ifTrue:[ |
358 enteredFileName exists ifTrue:[ |
359 (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
359 (Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
360 ifFalse:[^ '']. |
360 ifFalse:[^ '']. |
361 ]. |
361 ]. |
362 ]. |
362 ]. |
363 versionSymbol == #mustBeOld ifTrue:[ |
363 versionSymbol == #mustBeOld ifTrue:[ |
364 enteredFileName exists ifFalse:[^ '']. |
364 enteredFileName exists ifFalse:[^ '']. |
365 ]. |
365 ]. |
366 versionSymbol == #old ifTrue:[ |
366 versionSymbol == #old ifTrue:[ |
367 "/ file may not exist |
367 "/ file may not exist |
368 enteredFileName exists ifFalse:[ |
368 enteredFileName exists ifFalse:[ |
369 (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
369 (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
370 ifFalse:[^ '']. |
370 ifFalse:[^ '']. |
371 ]. |
371 ]. |
372 ]. |
372 ]. |
373 ]. |
373 ]. |
374 ^ enteredFileNameString |
374 ^ enteredFileNameString |
375 " |
375 " |
376 FileDialog |
376 FileDialog |
377 requestFileName:'enter a fileName:' |
377 requestFileName:'enter a fileName:' |
378 default:'' |
378 default:'' |
379 ok:nil |
379 ok:nil |
380 abort:nil |
380 abort:nil |
381 version:nil |
381 version:nil |
382 ifFail:['none'] |
382 ifFail:['none'] |
383 pattern:'*' |
383 pattern:'*' |
384 fromDirectory:Filename currentDirectory pathName |
384 fromDirectory:Filename currentDirectory pathName |
385 whenBoxCreatedEvaluate:nil |
385 whenBoxCreatedEvaluate:nil |
386 asLoadDialog:true |
386 asLoadDialog:true |
387 " |
387 " |
388 ! |
388 ! |
389 |
389 |
390 requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
390 requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
391 |
391 |
392 ^ self |
392 ^ self |
393 requestFileName:titleString |
393 requestFileName:titleString |
394 default:defaultName |
394 default:defaultName |
395 ok:nil |
395 ok:nil |
396 abort:nil |
396 abort:nil |
397 version:versionSymbol |
397 version:versionSymbol |
398 ifFail:failBlock |
398 ifFail:failBlock |
399 pattern:pattern |
399 pattern:pattern |
400 fromDirectory:aDirectoryPathOrNil |
400 fromDirectory:aDirectoryPathOrNil |
401 whenBoxCreatedEvaluate:boxCreatedCallback |
401 whenBoxCreatedEvaluate:boxCreatedCallback |
402 |
402 |
403 " |
|
404 FileDialog |
|
405 requestFileName:'enter a fileName:' |
|
406 default:'' |
|
407 version:nil |
|
408 ifFail:['none'] |
|
409 pattern:'*.conf' |
|
410 fromDirectory:Filename currentDirectory pathName |
|
411 whenBoxCreatedEvaluate:nil. |
|
412 Dialog |
|
413 requestFileName:'enter a fileName:' |
|
414 default:'' |
|
415 version:nil |
|
416 ifFail:['none'] |
|
417 pattern:'*.conf' |
|
418 fromDirectory:Filename currentDirectory pathName |
|
419 whenBoxCreatedEvaluate:nil |
|
420 " |
|
421 " |
403 " |
422 FileDialog |
404 FileDialog |
423 requestFileName:'enter a fileName:' |
405 requestFileName:'enter a fileName:' |
424 default:'' |
406 default:'' |
425 version:#old |
407 version:nil |
426 ifFail:['none'] |
408 ifFail:['none'] |
427 pattern:'*.conf' |
409 pattern:'*.conf' |
428 fromDirectory:Filename currentDirectory pathName |
410 fromDirectory:Filename currentDirectory pathName |
429 whenBoxCreatedEvaluate:nil |
411 whenBoxCreatedEvaluate:nil. |
|
412 Dialog |
|
413 requestFileName:'enter a fileName:' |
|
414 default:'' |
|
415 version:nil |
|
416 ifFail:['none'] |
|
417 pattern:'*.conf' |
|
418 fromDirectory:Filename currentDirectory pathName |
|
419 whenBoxCreatedEvaluate:nil |
430 " |
420 " |
431 " |
421 " |
432 FileDialog |
422 FileDialog |
433 requestFileName:'enter a fileName:' |
423 requestFileName:'enter a fileName:' |
434 default:'' |
424 default:'' |
435 version:#mustBeNew |
425 version:#old |
436 ifFail:['none'] |
426 ifFail:['none'] |
437 pattern:'*.conf' |
427 pattern:'*.conf' |
438 fromDirectory:Filename currentDirectory pathName |
428 fromDirectory:Filename currentDirectory pathName |
439 whenBoxCreatedEvaluate:nil |
429 whenBoxCreatedEvaluate:nil |
|
430 " |
|
431 " |
|
432 FileDialog |
|
433 requestFileName:'enter a fileName:' |
|
434 default:'' |
|
435 version:#mustBeNew |
|
436 ifFail:['none'] |
|
437 pattern:'*.conf' |
|
438 fromDirectory:Filename currentDirectory pathName |
|
439 whenBoxCreatedEvaluate:nil |
440 " |
440 " |
441 ! |
441 ! |
442 |
442 |
443 requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
443 requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
444 "launch a Dialog, which allows user to enter a filename. |
444 "launch a Dialog, which allows user to enter a filename. |
485 " |
485 " |
486 |
486 |
487 |
487 |
488 | instance enteredFileNames lastDirectory| |
488 | instance enteredFileNames lastDirectory| |
489 |
489 |
490 instance := self |
490 instance := self |
491 startApplicationFor:titleString |
491 startApplicationFor:titleString |
492 default:defaultName |
492 default:defaultName |
493 ok:okText |
493 ok:okText |
494 abort:abortText |
494 abort:abortText |
495 ifFail:failBlock |
495 ifFail:failBlock |
496 pattern:pattern |
496 pattern:pattern |
497 fromDirectory:aDirectoryPath |
497 fromDirectory:aDirectoryPath |
498 whenBoxCreatedEvaluate:boxCreatedCallback |
498 whenBoxCreatedEvaluate:boxCreatedCallback |
499 asLoadDialog:asLoadDialog |
499 asLoadDialog:asLoadDialog |
500 viewFiles:true |
500 viewFiles:true |
501 multipleSelect:true. |
501 multipleSelect:true. |
502 |
502 |
503 enteredFileNames := instance currentSelectedFiles. |
503 enteredFileNames := instance currentSelectedFiles. |
504 (enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
504 (enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
505 ^ failBlock value |
505 ^ failBlock value |
506 ]. |
506 ]. |
507 lastDirectory := enteredFileNames first. |
507 lastDirectory := enteredFileNames first. |
508 lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
508 lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
509 FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
509 FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
510 ^ enteredFileNames |
510 ^ enteredFileNames |
511 |
511 |
512 " |
512 " |
513 FileDialog |
513 FileDialog |
514 requestFileNames:'enter a fileName:' |
514 requestFileNames:'enter a fileName:' |
515 default:'' |
515 default:'' |
516 ok:nil |
516 ok:nil |
517 abort:nil |
517 abort:nil |
518 ifFail:['none'] |
518 ifFail:['none'] |
519 pattern:'*.conf' |
519 pattern:'*.conf' |
520 fromDirectory:Filename currentDirectory pathName |
520 fromDirectory:Filename currentDirectory pathName |
521 whenBoxCreatedEvaluate:nil |
521 whenBoxCreatedEvaluate:nil |
522 asLoadDialog:true. |
522 asLoadDialog:true. |
523 " |
523 " |
524 ! |
524 ! |
525 |
525 |
526 startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
526 startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
527 "launch a Dialog, which allows user to enter a filename. |
527 "launch a Dialog, which allows user to enter a filename. |
530 The box will show okText in its okButton, abortText in the abortButton. |
530 The box will show okText in its okButton, abortText in the abortButton. |
531 The matchPattern is set to pattern initially. |
531 The matchPattern is set to pattern initially. |
532 Return the string, or nil if cancel was pressed |
532 Return the string, or nil if cancel was pressed |
533 The version argument allows validation of the files existance; |
533 The version argument allows validation of the files existance; |
534 it may be any of: |
534 it may be any of: |
535 #mustBeNew - fail (return empty string) if the file exists |
535 #mustBeNew - fail (return empty string) if the file exists |
536 #new - confirm if the file exists |
536 #new - confirm if the file exists |
537 #mustBeOld - fail if the file does not exist |
537 #mustBeOld - fail if the file does not exist |
538 #old - confirm if the file does not exist |
538 #old - confirm if the file does not exist |
539 #any (other) - no validation |
539 #any (other) - no validation |
540 " |
540 " |
541 |
541 |
542 |
542 |
543 |defaultDir instance defaultFile okText abortText initialDefaultFileName| |
543 |defaultDir instance defaultFile okText abortText initialDefaultFileName| |
544 |
544 |
545 initialDefaultFileName := initialDefaultFileNameArg. |
545 initialDefaultFileName := initialDefaultFileNameArg. |
546 initialDefaultFileName notNil ifTrue:[ |
546 initialDefaultFileName notNil ifTrue:[ |
547 initialDefaultFileName := initialDefaultFileName asFilename |
547 initialDefaultFileName := initialDefaultFileName asFilename |
548 ]. |
548 ]. |
549 |
549 |
550 okText := okTextArg. |
550 okText := okTextArg. |
551 okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
551 okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
552 abortText := abortTextArg. |
552 abortText := abortTextArg. |
553 abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
553 abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
554 |
554 |
555 defaultDir := aDirectoryPath. |
555 defaultDir := aDirectoryPath. |
556 "/ defaultDir isNil ifTrue:[ |
556 "/ defaultDir isNil ifTrue:[ |
557 "/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
557 "/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
558 "/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
558 "/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
559 "/ ] ifFalse:[ |
559 "/ ] ifFalse:[ |
560 "/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
560 "/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
561 "/ defaultDir isNil ifTrue:[ |
561 "/ defaultDir isNil ifTrue:[ |
562 "/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
562 "/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
563 "/ ]. |
563 "/ ]. |
564 "/ defaultDir asFilename exists ifFalse:[ |
564 "/ defaultDir asFilename exists ifFalse:[ |
565 "/ defaultDir := nil |
565 "/ defaultDir := nil |
566 "/ ]. |
566 "/ ]. |
567 "/ ] |
567 "/ ] |
568 "/ ]. |
568 "/ ]. |
569 (initialDefaultFileName notNil |
569 (initialDefaultFileName notNil |
570 and:[initialDefaultFileName isAbsolute |
570 and:[initialDefaultFileName isAbsolute |
571 and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
571 and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
572 defaultDir := initialDefaultFileName asAbsoluteFilename. |
572 defaultDir := initialDefaultFileName asAbsoluteFilename. |
573 viewFiles ifTrue:[ |
573 viewFiles ifTrue:[ |
574 defaultDir := defaultDir directory. |
574 defaultDir := defaultDir directory. |
575 ]. |
575 ]. |
576 ] ifFalse:[ |
576 ] ifFalse:[ |
577 defaultDir isNil ifTrue:[ |
577 defaultDir isNil ifTrue:[ |
578 defaultDir := FileSelectionBox lastFileSelectionDirectory. |
578 defaultDir := FileSelectionBox lastFileSelectionDirectory. |
579 defaultDir isNil ifTrue:[ |
579 defaultDir isNil ifTrue:[ |
580 defaultDir := Filename currentDirectory asAbsoluteFilename. |
580 defaultDir := Filename currentDirectory asAbsoluteFilename. |
581 ]. |
581 ]. |
582 defaultDir asFilename exists ifFalse:[ |
582 defaultDir asFilename exists ifFalse:[ |
583 defaultDir := nil |
583 defaultDir := nil |
584 ]. |
584 ]. |
585 ] |
585 ] |
586 ]. |
586 ]. |
587 defaultDir := defaultDir asFilename asAbsoluteFilename. |
587 defaultDir := defaultDir asFilename asAbsoluteFilename. |
588 "/ [defaultDir exists] whileFalse:[ |
588 "/ [defaultDir exists] whileFalse:[ |
589 "/ defaultDir := defaultDir directory. |
589 "/ defaultDir := defaultDir directory. |
590 "/ ]. |
590 "/ ]. |
591 |
591 |
592 viewFiles ifFalse:[ |
592 viewFiles ifFalse:[ |
593 defaultFile := defaultDir asAbsoluteFilename. |
593 defaultFile := defaultDir asAbsoluteFilename. |
594 ] ifTrue:[ |
594 ] ifTrue:[ |
595 (initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[ |
595 (initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[ |
596 defaultFile := defaultDir construct:initialDefaultFileName baseName. |
596 defaultFile := defaultDir construct:initialDefaultFileName baseName. |
597 ]. |
597 ]. |
598 ]. |
598 ]. |
599 defaultFile isNil ifTrue:[ |
599 defaultFile isNil ifTrue:[ |
600 defaultFile := defaultDir. |
600 defaultFile := defaultDir. |
601 ]. |
601 ]. |
602 |
602 |
603 instance := self new. |
603 instance := self new. |
604 defaultDir notNil ifTrue:[instance directory:defaultDir]. |
604 defaultDir notNil ifTrue:[instance directory:defaultDir]. |
605 instance multipleSelect:multipleSelect ? false. |
605 instance multipleSelect:multipleSelect ? false. |
710 FileDialogV2 open |
686 FileDialogV2 open |
711 " |
687 " |
712 |
688 |
713 <resource: #canvas> |
689 <resource: #canvas> |
714 |
690 |
715 ^ |
691 ^ |
716 #(FullSpec |
692 #(FullSpec |
717 name: windowSpec |
693 name: windowSpec |
718 window: |
694 window: |
719 (WindowSpec |
695 (WindowSpec |
720 label: 'FileDialogV2' |
696 label: 'FileDialogV2' |
721 name: 'FileDialogV2' |
697 name: 'FileDialogV2' |
722 min: (Point 10 10) |
698 min: (Point 10 10) |
723 max: (Point 1024 768) |
699 max: (Point 1024 768) |
724 bounds: (Rectangle 0 0 400 400) |
700 bounds: (Rectangle 0 0 400 400) |
725 ) |
701 ) |
726 component: |
702 component: |
727 (SpecCollection |
703 (SpecCollection |
728 collection: ( |
704 collection: ( |
729 (ViewSpec |
705 (ViewSpec |
730 name: 'FilePart' |
706 name: 'FilePart' |
731 layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
707 layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
732 component: |
708 component: |
733 (SpecCollection |
709 (SpecCollection |
734 collection: ( |
710 collection: ( |
735 (MenuPanelSpec |
711 (MenuPanelSpec |
736 name: 'ToolBar1' |
712 name: 'ToolBar1' |
737 layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
713 layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
738 tabable: true |
714 tabable: true |
739 menu: toolBarMenu |
715 menu: toolBarMenu |
740 textDefault: true |
716 textDefault: true |
741 ) |
717 ) |
742 (SubCanvasSpec |
718 (SubCanvasSpec |
743 name: 'DirectoryContentsBrowser' |
719 name: 'DirectoryContentsBrowser' |
744 layout: (LayoutFrame 0 0.0 57 0 0 1.0 -30 1) |
720 layout: (LayoutFrame 0 0.0 57 0 0 1.0 -30 1) |
745 tabable: true |
721 tabable: true |
746 hasHorizontalScrollBar: false |
722 hasHorizontalScrollBar: false |
747 hasVerticalScrollBar: false |
723 hasVerticalScrollBar: false |
748 majorKey: DirectoryContentsBrowser |
724 majorKey: DirectoryContentsBrowser |
749 createNewApplication: true |
725 createNewApplication: true |
750 createNewBuilder: true |
726 createNewBuilder: true |
751 postBuildCallback: postBuildTreeBrowser: |
727 postBuildCallback: postBuildTreeBrowser: |
752 ) |
728 ) |
753 (VariableHorizontalPanelSpec |
729 (VariableHorizontalPanelSpec |
754 name: 'VariableHorizontalPanel1' |
730 name: 'VariableHorizontalPanel1' |
755 layout: (LayoutFrame 0 0 32 0 0 1 57 0) |
731 layout: (LayoutFrame 0 0 32 0 0 1 57 0) |
756 level: 1 |
732 level: 1 |
757 showHandle: false |
733 showHandle: false |
758 barLevel: 0 |
734 barLevel: 0 |
759 component: |
735 component: |
760 (SpecCollection |
736 (SpecCollection |
761 collection: ( |
737 collection: ( |
762 (ViewSpec |
738 (ViewSpec |
763 name: 'Box1' |
739 name: 'Box1' |
764 ) |
740 ) |
765 (ViewSpec |
741 (ViewSpec |
766 name: 'Box2' |
742 name: 'Box2' |
767 component: |
743 component: |
768 (SpecCollection |
744 (SpecCollection |
769 collection: ( |
745 collection: ( |
770 (LabelSpec |
746 (LabelSpec |
771 label: 'Filter:' |
747 label: 'Filter:' |
772 name: 'FilterLabel' |
748 name: 'FilterLabel' |
773 layout: (LayoutFrame 8 0 2 0 59 0 -2 1) |
749 layout: (LayoutFrame 8 0 2 0 59 0 -2 1) |
774 translateLabel: true |
750 translateLabel: true |
775 adjust: right |
751 adjust: right |
776 ) |
752 ) |
777 (InputFieldSpec |
753 (InputFieldSpec |
778 name: 'FilterEntryField' |
754 name: 'FilterEntryField' |
779 layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1) |
755 layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1) |
780 model: filterHolder |
756 model: filterHolder |
781 immediateAccept: true |
757 immediateAccept: true |
782 acceptOnReturn: true |
758 acceptOnReturn: true |
783 acceptOnTab: true |
759 acceptOnTab: true |
784 acceptOnLostFocus: true |
760 acceptOnLostFocus: true |
785 acceptOnPointerLeave: false |
761 acceptOnPointerLeave: false |
786 postBuildCallback: postBuildFilterField: |
762 postBuildCallback: postBuildFilterField: |
787 ) |
763 ) |
788 ) |
764 ) |
789 |
765 |
790 ) |
766 ) |
791 ) |
767 ) |
792 ) |
768 ) |
793 |
769 |
794 ) |
770 ) |
795 handles: (Any 0.5 1.0) |
771 handles: (Any 0.5 1.0) |
796 ) |
772 ) |
797 (LabelSpec |
773 (LabelSpec |
798 label: 'Filename:' |
774 label: 'Filename:' |
799 name: 'FilenameLabel' |
775 name: 'FilenameLabel' |
800 layout: (LayoutFrame 3 0 -21 1 73 0 -1 1) |
776 layout: (LayoutFrame 3 0 -21 1 73 0 -1 1) |
801 translateLabel: true |
777 translateLabel: true |
802 labelChannel: filenameLabelHolder |
778 labelChannel: filenameLabelHolder |
803 adjust: left |
779 adjust: left |
804 ) |
780 ) |
805 (FilenameInputFieldSpec |
781 (FilenameInputFieldSpec |
806 name: 'FilenameEntryField' |
782 name: 'FilenameEntryField' |
807 layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1) |
783 layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1) |
808 tabable: true |
784 tabable: true |
809 model: filenameHolder |
785 model: filenameHolder |
810 immediateAccept: false |
786 immediateAccept: false |
811 acceptOnPointerLeave: false |
787 acceptOnPointerLeave: false |
812 hasKeyboardFocusInitially: true |
788 hasKeyboardFocusInitially: true |
813 postBuildCallback: postBuildFileNameField: |
789 postBuildCallback: postBuildFileNameField: |
814 ) |
790 ) |
815 ) |
791 ) |
816 |
792 |
817 ) |
793 ) |
818 ) |
794 ) |
819 (HorizontalPanelViewSpec |
795 (HorizontalPanelViewSpec |
820 name: 'ButtonPanel' |
796 name: 'ButtonPanel' |
821 layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
797 layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
822 visibilityChannel: buttonPanelVisibleHolder |
798 visibilityChannel: buttonPanelVisibleHolder |
823 horizontalLayout: fitSpace |
799 horizontalLayout: fitSpace |
824 verticalLayout: center |
800 verticalLayout: center |
825 horizontalSpace: 3 |
801 horizontalSpace: 3 |
826 verticalSpace: 3 |
802 verticalSpace: 3 |
827 reverseOrderIfOKAtLeft: true |
803 reverseOrderIfOKAtLeft: true |
828 component: |
804 component: |
829 (SpecCollection |
805 (SpecCollection |
830 collection: ( |
806 collection: ( |
831 (ActionButtonSpec |
807 (ActionButtonSpec |
832 label: 'Cancel' |
808 label: 'Cancel' |
833 name: 'cancelButton' |
809 name: 'cancelButton' |
834 translateLabel: true |
810 translateLabel: true |
835 labelChannel: cancelLabelHolder |
811 labelChannel: cancelLabelHolder |
836 tabable: true |
812 tabable: true |
837 model: doCancel |
813 model: doCancel |
838 extent: (Point 129 22) |
814 extent: (Point 129 22) |
839 ) |
815 ) |
840 (ActionButtonSpec |
816 (ActionButtonSpec |
841 label: 'Append' |
817 label: 'Append' |
842 name: 'appendButton' |
818 name: 'appendButton' |
843 visibilityChannel: appendButtonVisibleHolder |
819 visibilityChannel: appendButtonVisibleHolder |
844 translateLabel: true |
820 translateLabel: true |
845 labelChannel: appendLabelHolder |
821 labelChannel: appendLabelHolder |
846 tabable: true |
822 tabable: true |
847 model: appendPressed |
823 model: appendPressed |
848 extent: (Point 129 22) |
824 extent: (Point 129 22) |
849 ) |
825 ) |
850 (ActionButtonSpec |
826 (ActionButtonSpec |
851 label: 'OK' |
827 label: 'OK' |
852 name: 'okButton' |
828 name: 'okButton' |
853 translateLabel: true |
829 translateLabel: true |
854 labelChannel: okLabelHolder |
830 labelChannel: okLabelHolder |
855 tabable: true |
831 tabable: true |
856 model: okPressed |
832 model: okPressed |
857 isDefault: true |
833 isDefault: true |
858 extent: (Point 130 22) |
834 extent: (Point 130 22) |
859 ) |
835 ) |
860 ) |
836 ) |
861 |
837 |
862 ) |
838 ) |
863 ) |
839 ) |
864 ) |
840 ) |
865 |
841 |
866 ) |
842 ) |
867 ) |
843 ) |
868 ! ! |
844 ! ! |
869 |
845 |
870 !FileDialogV2 class methodsFor:'menu specs'! |
846 !FileDialogV2 class methodsFor:'menu specs'! |
871 |
847 |
881 (Menu new fromLiteralArrayEncoding:(FileDialogV2 toolBarMenu)) startUp |
857 (Menu new fromLiteralArrayEncoding:(FileDialogV2 toolBarMenu)) startUp |
882 " |
858 " |
883 |
859 |
884 <resource: #menu> |
860 <resource: #menu> |
885 |
861 |
886 ^ |
862 ^ |
887 #(Menu |
863 #(Menu |
888 ( |
864 ( |
889 (MenuItem |
865 (MenuItem |
890 activeHelpKey: directoryBack |
866 activeHelpKey: directoryBack |
891 enabled: enableBack |
867 enabled: enableBack |
892 label: 'Back' |
868 label: 'Back' |
893 itemValue: doBack |
869 itemValue: doBack |
894 translateLabel: true |
870 translateLabel: true |
895 isButton: true |
871 isButton: true |
896 submenuChannel: menuDirHistoryBack |
872 submenuChannel: menuDirHistoryBack |
897 labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon) |
873 labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon) |
898 keepLinkedMenu: true |
874 keepLinkedMenu: true |
899 ) |
875 ) |
900 (MenuItem |
876 (MenuItem |
901 activeHelpKey: directoryForward |
877 activeHelpKey: directoryForward |
902 enabled: enableForward |
878 enabled: enableForward |
903 label: 'Forward' |
879 label: 'Forward' |
904 itemValue: doForward |
880 itemValue: doForward |
905 translateLabel: true |
881 translateLabel: true |
906 isButton: true |
882 isButton: true |
907 submenuChannel: menuDirHistoryForward |
883 submenuChannel: menuDirHistoryForward |
908 labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon) |
884 labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon) |
909 keepLinkedMenu: true |
885 keepLinkedMenu: true |
910 ) |
886 ) |
911 (MenuItem |
887 (MenuItem |
912 label: '-' |
888 label: '-' |
913 ) |
889 ) |
914 (MenuItem |
890 (MenuItem |
915 activeHelpKey: directoryUp |
891 activeHelpKey: directoryUp |
916 enabled: enableDirectoryUp |
892 enabled: enableDirectoryUp |
917 label: 'DirectoryUp' |
893 label: 'DirectoryUp' |
918 itemValue: doGoDirectoryUp |
894 itemValue: doGoDirectoryUp |
919 translateLabel: true |
895 translateLabel: true |
920 isButton: true |
896 isButton: true |
921 labelImage: (ResourceRetriever ToolbarIconLibrary directoryUpIcon) |
897 labelImage: (ResourceRetriever ToolbarIconLibrary directoryUpIcon) |
922 ) |
898 ) |
923 (MenuItem |
899 (MenuItem |
924 label: '' |
900 label: '' |
925 ) |
901 ) |
926 (MenuItem |
902 (MenuItem |
927 activeHelpKey: fileHome |
903 activeHelpKey: fileHome |
928 enabled: enableHome |
904 enabled: enableHome |
929 label: 'Home' |
905 label: 'Home' |
930 itemValue: doGotoHomeDirectory |
906 itemValue: doGotoHomeDirectory |
931 translateLabel: true |
907 translateLabel: true |
932 isButton: true |
908 isButton: true |
933 labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
909 labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
934 ) |
910 ) |
935 (MenuItem |
911 (MenuItem |
936 activeHelpKey: fileGotoBookmark |
912 activeHelpKey: fileGotoBookmark |
937 label: 'Bookmarks' |
913 label: 'Bookmarks' |
938 translateLabel: true |
914 translateLabel: true |
939 isButton: true |
915 isButton: true |
940 submenuChannel: gotoBookmarksMenuSpec |
916 submenuChannel: gotoBookmarksMenuSpec |
941 labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
917 labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
942 ) |
918 ) |
943 (MenuItem |
919 (MenuItem |
944 label: '-' |
920 label: '-' |
945 isVisible: browseVisibleHolder |
921 isVisible: browseVisibleHolder |
946 ) |
922 ) |
947 (MenuItem |
923 (MenuItem |
948 activeHelpKey: fileBrowse |
924 activeHelpKey: fileBrowse |
949 label: 'Browse' |
925 label: 'Browse' |
950 itemValue: doBrowseDirectory |
926 itemValue: doBrowseDirectory |
951 translateLabel: true |
927 translateLabel: true |
952 isButton: true |
928 isButton: true |
953 isVisible: browseVisibleHolder |
929 isVisible: browseVisibleHolder |
954 labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon) |
930 labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon) |
955 ) |
931 ) |
956 (MenuItem |
932 (MenuItem |
957 label: '-' |
933 label: '-' |
958 ) |
934 ) |
959 (MenuItem |
935 (MenuItem |
960 label: 'New Directory...' |
936 label: 'New Directory...' |
961 itemValue: newDirectory |
937 itemValue: newDirectory |
962 translateLabel: true |
938 translateLabel: true |
963 isButton: true |
939 isButton: true |
964 isVisible: newDirectoryVisibilityHolder |
940 isVisible: newDirectoryVisibilityHolder |
965 labelImage: (ResourceRetriever ToolbarIconLibrary newDirectoryIcon) |
941 labelImage: (ResourceRetriever ToolbarIconLibrary newDirectoryIcon) |
966 ) |
942 ) |
967 (MenuItem |
943 (MenuItem |
968 label: 'viewDetails' |
944 label: 'viewDetails' |
969 translateLabel: true |
945 translateLabel: true |
970 isButton: true |
946 isButton: true |
971 startGroup: right |
947 startGroup: right |
972 hideMenuOnActivated: false |
948 hideMenuOnActivated: false |
973 indication: viewDetails |
949 indication: viewDetails |
974 labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon) |
950 labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon) |
975 ) |
951 ) |
976 (MenuItem |
952 (MenuItem |
977 activeHelpKey: toggleDetails |
953 activeHelpKey: toggleDetails |
978 label: 'viewDetails' |
954 label: 'viewDetails' |
979 translateLabel: true |
955 translateLabel: true |
980 isButton: true |
956 isButton: true |
981 startGroup: right |
957 startGroup: right |
982 isVisible: false |
958 isVisible: false |
983 indication: viewDetails |
959 indication: viewDetails |
984 submenuChannel: viewDetailsMenuSpec |
960 submenuChannel: viewDetailsMenuSpec |
985 labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon) |
961 labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon) |
986 ) |
962 ) |
987 (MenuItem |
963 (MenuItem |
988 activeHelpKey: selectDetails |
964 activeHelpKey: selectDetails |
989 label: '' |
965 label: '' |
990 isButton: true |
966 isButton: true |
991 startGroup: right |
967 startGroup: right |
992 submenuChannel: viewDetailsMenuSpec |
968 submenuChannel: viewDetailsMenuSpec |
993 labelImage: (ResourceRetriever ToolbarIconLibrary empty1x20Icon) |
969 labelImage: (ResourceRetriever ToolbarIconLibrary empty1x20Icon) |
994 ) |
970 ) |
995 ) |
971 ) |
996 nil |
972 nil |
997 nil |
973 nil |
998 ) |
974 ) |
999 |
975 |
1000 "Modified: / 06-12-2006 / 12:08:39 / cg" |
976 "Modified: / 06-12-2006 / 12:08:39 / cg" |
1001 ! ! |
977 ! ! |
1002 |
978 |
1396 buttonPanelVisibilityChanged |
1372 buttonPanelVisibilityChanged |
1397 |filePart| |
1373 |filePart| |
1398 |
1374 |
1399 filePart := builder componentAt:#FilePart. |
1375 filePart := builder componentAt:#FilePart. |
1400 filePart notNil ifTrue:[ |
1376 filePart notNil ifTrue:[ |
1401 buttonPanelVisibleHolder value ifTrue:[ |
1377 buttonPanelVisibleHolder value ifTrue:[ |
1402 filePart layout bottomOffset:-40 |
1378 filePart layout bottomOffset:-40 |
1403 ] ifFalse:[ |
1379 ] ifFalse:[ |
1404 filePart layout bottomOffset:0 |
1380 filePart layout bottomOffset:0 |
1405 ]. |
1381 ]. |
1406 filePart containerChangedSize "/ force resize |
1382 filePart containerChangedSize "/ force resize |
1407 ] |
1383 ] |
1408 ! |
1384 ! |
1409 |
1385 |
1410 update:something with:aParameter from:changedObject |
1386 update:something with:aParameter from:changedObject |
1411 |files newFile newLabel fn entryFieldFilename| |
1387 |files newFile newLabel fn entryFieldFilename| |
1412 |
1388 |
1413 changedObject == contentsBrowser currentFileNameHolder ifTrue:[ |
1389 changedObject == contentsBrowser currentFileNameHolder ifTrue:[ |
1414 files := changedObject value. |
1390 files := changedObject value. |
1415 |
1391 |
1416 (files isEmpty) ifTrue:[ |
1392 (files isEmpty) ifTrue:[ |
1417 newFile := nil. |
1393 newFile := nil. |
1418 ] ifFalse:[ |
1394 ] ifFalse:[ |
1419 files size == 1 ifTrue:[ |
1395 files size == 1 ifTrue:[ |
1420 newFile := files first. |
1396 newFile := files first. |
1421 ] ifFalse:[ |
1397 ] ifFalse:[ |
1422 newFile := ''. |
1398 newFile := ''. |
1423 ]. |
1399 ]. |
1424 ]. |
1400 ]. |
1425 (self filenameHolder value notNil and:[newFile asFilename isDirectory]) ifTrue:[ |
1401 (self filenameHolder value notNil and:[newFile asFilename isDirectory]) ifTrue:[ |
1426 entryFieldFilename := self filenameHolder value asFilename. |
1402 entryFieldFilename := self filenameHolder value asFilename. |
1427 self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
1403 self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
1428 entryFieldFilename isDirectory not ifTrue:[ |
1404 entryFieldFilename isDirectory not ifTrue:[ |
1429 newFile := newFile asFilename construct:entryFieldFilename baseName. |
1405 newFile := newFile asFilename construct:entryFieldFilename baseName. |
1430 ]. |
1406 ]. |
1431 ]. |
1407 ]. |
1432 ]. |
1408 ]. |
1433 self filenameHolder value:newFile withoutNotifying:self. |
1409 self filenameHolder value:newFile withoutNotifying:self. |
1434 ]. |
1410 ]. |
1435 |
1411 |
1436 changedObject == contentsBrowser viewFilesInDirectoryTree ifTrue:[ |
1412 changedObject == contentsBrowser viewFilesInDirectoryTree ifTrue:[ |
1437 changedObject value ifTrue:[ |
1413 changedObject value ifTrue:[ |
1438 newLabel := 'Filename:'. |
1414 newLabel := 'Filename:'. |
1439 ] ifFalse:[ |
1415 ] ifFalse:[ |
1440 newLabel := 'Directory:'. |
1416 newLabel := 'Directory:'. |
1441 ]. |
1417 ]. |
1442 self filenameLabelHolder value:(resources string:newLabel) |
1418 self filenameLabelHolder value:(resources string:newLabel) |
1443 ]. |
1419 ]. |
1444 changedObject == self filenameHolder ifTrue:[ |
1420 changedObject == self filenameHolder ifTrue:[ |
1445 fn := changedObject value asFilename. |
1421 fn := changedObject value asFilename. |
1446 (fn exists) ifFalse:[^ self]. |
1422 (fn exists) ifFalse:[^ self]. |
1447 contentsBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
1423 contentsBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
1448 ]. |
1424 ]. |
1449 ^ super update:something with:aParameter from:changedObject |
1425 ^ super update:something with:aParameter from:changedObject |
1450 ! ! |
1426 ! ! |
1451 |
1427 |
1452 !FileDialogV2 methodsFor:'event handling'! |
1428 !FileDialogV2 methodsFor:'event handling'! |