author | Claus Gittinger <cg@exept.de> |
Mon, 02 Mar 2015 14:39:16 +0100 | |
changeset 15497 | c05f957c8150 |
parent 14829 | 82b109435616 |
child 15566 | 184cea584be5 |
child 16169 | 5a669206c213 |
permissions | -rw-r--r-- |
8277 | 1 |
" |
2 |
COPYRIGHT (c) 2008 by eXept Software AG |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
3 |
All Rights Reserved |
8277 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
8015 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
Object subclass:#Win32FileDialog |
|
15 |
instanceVariableNames:'fileName openFileNameStruct filters lpstrFilter lpstrFile |
|
16 |
lpstrInitialDir lpstrTitle lpstrDefExt defFilter defExtension |
|
9698 | 17 |
style title smalltalkFileFilters defFilterIndex parent error' |
13577 | 18 |
classVariableNames:'Lock InitialDirectory CommonDialogConstants |
19 |
FilterPatternDescriptions' |
|
8015 | 20 |
poolDictionaries:'' |
21 |
category:'Interface-Tools-File' |
|
22 |
! |
|
23 |
||
24 |
ByteArray variableByteSubclass:#OpenFilenameStructure |
|
25 |
instanceVariableNames:'' |
|
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:Win32FileDialog |
|
29 |
! |
|
30 |
||
8277 | 31 |
!Win32FileDialog class methodsFor:'documentation'! |
32 |
||
33 |
copyright |
|
34 |
" |
|
35 |
COPYRIGHT (c) 2008 by eXept Software AG |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
36 |
All Rights Reserved |
8277 | 37 |
|
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
9598 | 45 |
! |
46 |
||
47 |
documentation |
|
48 |
" |
|
49 |
interface to windows file dialogs |
|
50 |
" |
|
8277 | 51 |
! ! |
8015 | 52 |
|
8260 | 53 |
!Win32FileDialog class methodsFor:'initialization'! |
54 |
||
9597 | 55 |
initialize |
56 |
Lock := RecursionLock new. |
|
57 |
||
58 |
"Created: / 26-10-2010 / 12:51:23 / cg" |
|
59 |
! |
|
60 |
||
8260 | 61 |
startUp |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
62 |
"Private - Initialize the class variables. |
9345 | 63 |
This is called during startup." |
8260 | 64 |
|
65 |
InitialDirectory := Directory pathName: Disk drivePathName. |
|
66 |
! ! |
|
67 |
||
8015 | 68 |
!Win32FileDialog class methodsFor:'instance creation'! |
69 |
||
70 |
new |
|
9345 | 71 |
^ self basicNew initialize |
8015 | 72 |
! ! |
73 |
||
74 |
!Win32FileDialog class methodsFor:'accessing'! |
|
75 |
||
76 |
getInitialDirectory |
|
9598 | 77 |
^ InitialDirectory |
8015 | 78 |
|
9598 | 79 |
"Modified: / 26-10-2010 / 18:47:46 / cg" |
8015 | 80 |
! |
81 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
82 |
setInitialDirectory:aName |
9598 | 83 |
InitialDirectory := Directory pathName:aName |
8015 | 84 |
|
9598 | 85 |
"Modified: / 26-10-2010 / 18:47:48 / cg" |
8015 | 86 |
! ! |
87 |
||
88 |
!Win32FileDialog class methodsFor:'constants'! |
|
89 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
90 |
commonDialogConstantAt:aString |
9598 | 91 |
^ self commonDialogConstants at:aString |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
92 |
ifAbsent:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
93 |
Transcript showCR:'Common Dialog Constant ' , aString , ' notfound!!' |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
94 |
] |
8015 | 95 |
|
9598 | 96 |
"Modified: / 26-10-2010 / 18:47:51 / cg" |
8015 | 97 |
! |
98 |
||
99 |
commonDialogConstants |
|
9345 | 100 |
CommonDialogConstants isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
101 |
CommonDialogConstants := self generateCommonDialogConstants |
9345 | 102 |
]. |
8015 | 103 |
^ CommonDialogConstants |
9598 | 104 |
|
105 |
"Modified: / 26-10-2010 / 18:47:54 / cg" |
|
8015 | 106 |
! |
107 |
||
108 |
generateCommonDialogConstants |
|
109 |
|dictionary| |
|
110 |
||
111 |
dictionary := Dictionary new. |
|
112 |
dictionary |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
113 |
at:'CcPreventfullopen' put:4; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
114 |
at:'FrShowhelp' put:128; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
115 |
at:'PdEnablesetuptemplate' put:32768; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
116 |
at:'FrNoupdown' put:1024; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
117 |
at:'CfNosimulations' put:4096; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
118 |
at:'OfnPathmustexist' put:2048; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
119 |
at:'CfWysiwyg' put:32768; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
120 |
at:'PdReturndc' put:256; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
121 |
at:'PdEnableprinthook' put:4096; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
122 |
at:'CfInittologfontstruct' put:64; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
123 |
at:'CfScalableonly' put:131072; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
124 |
at:'PdPrinttofile' put:32; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
125 |
at:'CfEffects' put:256; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
126 |
at:'PdShowhelp' put:2048; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
127 |
at:'OfnEnabletemplatehandle' put:128; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
128 |
at:'CfBoth' put:3; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
129 |
at:'OfnReadonly' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
130 |
at:'PdNopagenums' put:8; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
131 |
at:'PdDisableprinttofile' put:524288; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
132 |
at:'PdHideprinttofile' put:1048576; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
133 |
at:'OfnAllowmultiselect' put:512; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
134 |
at:'CfPrinterfonts' put:2; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
135 |
at:'CfEnabletemplatehandle' put:32; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
136 |
at:'PdSelection' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
137 |
at:'OfnHidereadonly' put:4; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
138 |
at:'PdPrintsetup' put:64; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
139 |
at:'OfnExtentiondifferent' put:1024; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
140 |
at:'FrReplaceall' put:32; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
141 |
at:'FrMatchcase' put:4; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
142 |
at:'OfnFilemustexist' put:4096; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
143 |
at:'PdCollate' put:16; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
144 |
at:'CfFixedpitchonly' put:16384; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
145 |
at:'PdEnablesetuphook' put:8192; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
146 |
at:'OfnShareaware' put:16384; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
147 |
at:'CcEnablehook' put:16; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
148 |
at:'CfEnabletemplate' put:16; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
149 |
at:'Findmsgstring' put:'commdlgFindreplace'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
150 |
at:'CfLimitsize' put:8192; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
151 |
at:'OfnNochangedir' put:8; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
152 |
at:'OfnCreateprompt' put:8192; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
153 |
at:'ScreenFonttype' put:8192; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
154 |
at:'PdUsedevmodecopies' put:262144; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
155 |
at:'CcRgbinit' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
156 |
at:'FrFindnext' put:8; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
157 |
at:'CfUsestyle' put:128; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
158 |
at:'FrEnablehook' put:256; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
159 |
at:'PdEnableprinttemplatehandle' put:65536; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
160 |
at:'CfShowhelp' put:4; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
161 |
at:'FrNowholeword' put:4096. |
9598 | 162 |
dictionary |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
163 |
at:'ShareExist' put:16448; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
164 |
at:'OfnOverwriteprompt' put:2; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
165 |
at:'OfnEnablehook' put:32; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
166 |
at:'OfnShowhelp' put:16; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
167 |
at:'CcEnabletemplatehandle' put:64; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
168 |
at:'SimulatedFonttype' put:32768; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
169 |
at:'FrDown' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
170 |
at:'PdEnableprinttemplate' put:16384; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
171 |
at:'CfNovectorfonts' put:2048; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
172 |
at:'PdNoselection' put:4; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
173 |
at:'CfAnsionly' put:1024; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
174 |
at:'OfnNovalidate' put:256; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
175 |
at:'CfScreenfonts' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
176 |
at:'FrWholeword' put:2; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
177 |
at:'FrEnabletemplatehandle' put:8192; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
178 |
at:'PdAllpages' put:0; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
179 |
at:'CfForcefontexist' put:65536; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
180 |
at:'CcEnabletemplate' put:32; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
181 |
at:'PdPagenums' put:2; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
182 |
at:'FrReplace' put:16; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
183 |
at:'PdEnablesetuptemplatehandle' put:131072; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
184 |
at:'CfApply' put:512; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
185 |
at:'OfnEnabletemplate' put:64; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
186 |
at:'DnDefaultprn' put:1; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
187 |
at:'PdNowarning' put:128; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
188 |
at:'CfTtonly' put:262144; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
189 |
at:'PrinterFonttype' put:16384; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
190 |
at:'CcShowhelp' put:8; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
191 |
at:'CcFullopen' put:2; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
192 |
at:'PdReturnic' put:512; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
193 |
at:'FrEnabletemplate' put:512; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
194 |
at:'FrDialogterm' put:64; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
195 |
at:'Helpmsgstring' put:'commdlgHelp'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
196 |
at:'PdReturndefault' put:1024; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
197 |
at:'FrNomatchcase' put:2048; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
198 |
at:'CfEnablehook' put:8. |
8015 | 199 |
^ dictionary |
9598 | 200 |
|
201 |
"Modified: / 26-10-2010 / 18:47:57 / cg" |
|
8015 | 202 |
! ! |
203 |
||
204 |
!Win32FileDialog class methodsFor:'examples'! |
|
205 |
||
206 |
openFile |
|
9345 | 207 |
^ (Win32FileDialog new openFile: 'c:\untitled.txt') file. |
8015 | 208 |
|
209 |
" |
|
9345 | 210 |
self openFile |
8015 | 211 |
" |
212 |
! |
|
213 |
||
214 |
saveFile |
|
9345 | 215 |
^ (Win32FileDialog new saveFile: 'C:\vsw311\untitled.txt') file. |
8015 | 216 |
|
217 |
" |
|
9345 | 218 |
self saveFile |
8015 | 219 |
" |
220 |
! ! |
|
221 |
||
222 |
!Win32FileDialog class methodsFor:'filters'! |
|
223 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
224 |
filterPatternDescription:filterPattern |
9598 | 225 |
^ self filterPatternDescriptions at:filterPattern ifAbsent:'' |
8015 | 226 |
|
9598 | 227 |
"Modified: / 26-10-2010 / 18:48:24 / cg" |
8015 | 228 |
! |
229 |
||
230 |
filterPatternDescriptions |
|
9598 | 231 |
FilterPatternDescriptions isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
232 |
FilterPatternDescriptions := self generateFilterPatternDescriptions |
9598 | 233 |
]. |
234 |
^ FilterPatternDescriptions |
|
8015 | 235 |
|
9598 | 236 |
"Modified: / 26-10-2010 / 18:48:25 / cg" |
8015 | 237 |
! |
238 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
239 |
filtersFor:pattern |
8015 | 240 |
|filters filterPatterns| |
241 |
||
9598 | 242 |
pattern isEmptyOrNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
243 |
^ nil |
9598 | 244 |
]. |
8015 | 245 |
filters := OrderedCollection new. |
9598 | 246 |
filterPatterns := pattern subStrings:$;. |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
247 |
filterPatterns do:[:filterPattern | |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
248 |
filterPattern notEmpty ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
249 |
filters add:(Array with:(self filterPatternDescription:filterPattern) |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
250 |
with:filterPattern) |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
251 |
]. |
8015 | 252 |
]. |
253 |
^ filters asArray |
|
9598 | 254 |
|
255 |
"Modified: / 26-10-2010 / 18:48:26 / cg" |
|
8015 | 256 |
! |
257 |
||
258 |
generateFilterPatternDescriptions |
|
9598 | 259 |
^ (Dictionary new) |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
260 |
at:'*.txt' put:'Text files (*.txt)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
261 |
at:'*.st' put:'Smalltalk files (*.st)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
262 |
at:'*.java' put:'Java files (*.java)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
263 |
at:'*.csv' put:'CSV files (*.csv)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
264 |
at:'*.xml' put:'XML files (*.xml)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
265 |
at:'*.zip' put:'ZIP files (*.zip)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
266 |
at:'*.xls' put:'Excel files (*.xls)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
267 |
at:'*.ent' put:'SGML Entity files (*.ent)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
268 |
at:'*.ccs' put:'CCS files (*.ccs)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
269 |
at:'*.dll' put:'Shared Library files (*.dll)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
270 |
at:'*.ini' put:'Configuration files (*.ini)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
271 |
at:'*.prn' put:'Printer Text files (*.prn)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
272 |
at:'*.dir' put:'DapasX Database files (*.dir)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
273 |
at:'*.dat' put:'DapasX Database files (*.dat)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
274 |
at:'*.prg' put:'DapasX Program files (*.prg)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
275 |
at:'*.dcf' put:'DapasX Options files (*.dcf)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
276 |
at:'*.ext' put:'DapasX Backup files (*.ext)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
277 |
at:'*.mpl' put:'DapasX Project files (*.mpl)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
278 |
yourself |
8015 | 279 |
|
9598 | 280 |
"Modified: / 26-10-2010 / 18:48:28 / cg" |
8015 | 281 |
! ! |
282 |
||
283 |
!Win32FileDialog class methodsFor:'opening'! |
|
284 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
285 |
fileDialogFor:ownerWindow save:isSaveDialog |
9345 | 286 |
title:titleOrNil inDirectory:dirPathOrNil initialAnswer:initialOrNil |
287 |
filter:pattern extension:extensionOrNil |
|
8015 | 288 |
|
289 |
"start a native open-file dialog. |
|
290 |
If not cancelled, the selected fileName is returned; nil otherwise. |
|
291 |
Of course, this one looks like the |
|
292 |
Windows file dialog - no matter which viewStyle settings are active. |
|
293 |
Notice: if no ownerWindow is given, the dialog pops up at 0@0. |
|
294 |
||
295 |
EXPERIMENTAL & non-portable: use with caution" |
|
296 |
||
297 |
|filePath filterArrayOrNil| |
|
298 |
||
299 |
filterArrayOrNil := self filtersFor: pattern. |
|
300 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
301 |
filePath := |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
302 |
self new |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
303 |
openFor:ownerWindow |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
304 |
save:isSaveDialog |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
305 |
title:titleOrNil |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
306 |
inDirectory:dirPathOrNil |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
307 |
initialAnswer:initialOrNil |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
308 |
filter:filterArrayOrNil |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
309 |
extension:extensionOrNil. |
8015 | 310 |
|
311 |
^ filePath |
|
312 |
! ! |
|
313 |
||
314 |
!Win32FileDialog methodsFor:'accessing'! |
|
315 |
||
316 |
addAllFilesFilter |
|
317 |
||
318 |
self addFilter: '*.*' description: 'All Files (*.*)'. |
|
319 |
! |
|
320 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
321 |
addFilter:aFilter description:aDescription |
9598 | 322 |
"Add aFilter and aDescription to the list of File dialog filters." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
323 |
|
9598 | 324 |
filters add:(Association key:aFilter value:aDescription). |
8015 | 325 |
|
9598 | 326 |
"Modified: / 26-10-2010 / 18:45:27 / cg" |
8015 | 327 |
! |
328 |
||
329 |
addSmalltalkFileFilters |
|
9598 | 330 |
^ smalltalkFileFilters |
8015 | 331 |
|
9598 | 332 |
"Modified: / 26-10-2010 / 18:45:29 / cg" |
8015 | 333 |
! |
334 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
335 |
defExtension:aDefExtension |
9598 | 336 |
"Specifies the default extension of File dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
337 |
|
9598 | 338 |
defExtension := aDefExtension. |
8015 | 339 |
|
9598 | 340 |
"Modified: / 26-10-2010 / 18:45:54 / cg" |
8015 | 341 |
! |
342 |
||
343 |
defFilter |
|
9598 | 344 |
"Answers the aDefFilterString as the default filter of File dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
345 |
|
9598 | 346 |
^ defFilter |
8015 | 347 |
|
9598 | 348 |
"Modified: / 26-10-2010 / 18:45:56 / cg" |
8015 | 349 |
! |
350 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
351 |
defFilter:aDefFilterString |
9598 | 352 |
"Specifies the aDefFilterString as the default filter of File dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
353 |
|
9598 | 354 |
defFilter := aDefFilterString |
8015 | 355 |
|
9598 | 356 |
"Modified: / 26-10-2010 / 18:45:58 / cg" |
8015 | 357 |
! |
358 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
359 |
defFilterIndex:defaultFilterIndex |
9598 | 360 |
defFilterIndex := defaultFilterIndex. |
8015 | 361 |
|
9598 | 362 |
"Modified: / 26-10-2010 / 18:46:01 / cg" |
8015 | 363 |
! |
364 |
||
365 |
directory |
|
9598 | 366 |
"Answer the selected directory." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
367 |
|
8037 | 368 |
InitialDirectory isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
369 |
^ Filename currentDirectory pathName asFilename |
8037 | 370 |
]. |
371 |
^ InitialDirectory "? OperatingSystem getCurrentDirectory asFilename" |
|
9598 | 372 |
|
373 |
"Modified: / 26-10-2010 / 18:46:03 / cg" |
|
8015 | 374 |
! |
375 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
376 |
directory:directory |
9598 | 377 |
"Sets the initial directory." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
378 |
|
9598 | 379 |
|aFilename| |
8015 | 380 |
|
9598 | 381 |
directory isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
382 |
^ self. |
9598 | 383 |
]. |
384 |
aFilename := directory asFilename. |
|
385 |
aFilename exists ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
386 |
InitialDirectory := aFilename |
9598 | 387 |
]. |
8015 | 388 |
|
9598 | 389 |
"Modified: / 26-10-2010 / 18:46:06 / cg" |
8015 | 390 |
! |
391 |
||
392 |
file |
|
9598 | 393 |
"Answer the selected file." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
394 |
|
9598 | 395 |
^ fileName |
8015 | 396 |
|
9598 | 397 |
"Modified: / 26-10-2010 / 18:46:10 / cg" |
8015 | 398 |
! |
399 |
||
400 |
fileSpec: aFileSpec |
|
9598 | 401 |
"Sets the initial fileName and directory in the File Dialog." |
8015 | 402 |
|
9598 | 403 |
| array dir | |
8015 | 404 |
|
405 |
"SHOULD assign initial fileName and directory separately using #fileName: and #directory" |
|
406 |
||
8358 | 407 |
self breakPoint:#fm. |
8015 | 408 |
fileName := aFileSpec. |
409 |
"/ array := Filename splitPath: aFileSpec in: self directory . |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
410 |
"/ dir := |
8015 | 411 |
"/ (( String with: ( array at: 1 ) with: $: ), |
412 |
"/ ( ( array at: 2 ) isEmpty ifTrue: [ '\' ] ifFalse: [ array at: 2 ] )) asFilename. |
|
413 |
"/ dir exists ifFalse: [ dir := OperatingSystem getCurrentDirectory asFilename ]. |
|
414 |
"/ |
|
415 |
"/ self directory: dir. |
|
416 |
"/ fileName := array at: 3 |
|
9598 | 417 |
|
418 |
"Modified: / 26-10-2010 / 18:46:22 / cg" |
|
8015 | 419 |
! |
420 |
||
421 |
filters |
|
9598 | 422 |
"Private - answers a string containing all filters and sets up |
423 |
the defFilterIndex property" |
|
8015 | 424 |
|
425 |
| filterString count defaultFilterIndex defaultFilter| |
|
426 |
||
427 |
smalltalkFileFilters notNil ifTrue: [ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
428 |
self |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
429 |
addFilter: '*.cls' description: 'Class Files (*.CLS)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
430 |
addFilter: '*.mth' description: 'Method Files (*.MTH)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
431 |
addFilter: '*.st' description: 'Smalltalk Files (*.ST)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
432 |
addFilter: '*.bnd' description: 'Library Bind Files (*.BND)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
433 |
addFilter: '*.map' description: 'Library Map Files (*.MAP)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
434 |
addFilter: '*.ini' description: 'Initialization Files (*.INI)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
435 |
addFilter: '*.obj' description: 'Object Files (*.OBJ)'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
436 |
addFilter: '*.log' description: 'Log Files (*.LOG)' |
8015 | 437 |
]. |
438 |
||
439 |
defaultFilter := self defFilter. |
|
440 |
(fileName notEmptyOrNil and:[defaultFilter isNil]) ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
441 |
|initialFilenameSuffix| |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
442 |
initialFilenameSuffix := fileName asFilename suffix. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
443 |
initialFilenameSuffix notEmptyOrNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
444 |
defaultFilter := '*.', initialFilenameSuffix. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
445 |
]. |
8015 | 446 |
]. |
447 |
||
448 |
filterString := String new. |
|
449 |
count := 0. |
|
450 |
defaultFilterIndex := 0. |
|
451 |
filters do: [:assoc | |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
452 |
count := count + 1. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
453 |
assoc key = defaultFilter ifTrue: [ defaultFilterIndex := count ]. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
454 |
filterString := filterString, assoc value, #[0] asString, assoc key , #[0] asString. |
8015 | 455 |
]. |
456 |
||
457 |
self defFilterIndex: defaultFilterIndex. |
|
458 |
^filterString |
|
9598 | 459 |
|
460 |
"Modified: / 26-10-2010 / 18:46:35 / cg" |
|
8015 | 461 |
! |
462 |
||
463 |
flags |
|
9598 | 464 |
"Private - Answers the dialog box current flags. |
465 |
For compatibility reasons -> use style instead" |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
466 |
|
9598 | 467 |
^ openFileNameStruct flags |
8015 | 468 |
|
9598 | 469 |
"Modified: / 26-10-2010 / 18:46:38 / cg" |
8015 | 470 |
! |
471 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
472 |
flags:flags |
9598 | 473 |
"Private - Specifies the dialog box creation flags. |
474 |
Kept for compatibility reasons. Use style: instead" |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
475 |
|
9598 | 476 |
self style:flags |
8015 | 477 |
|
9598 | 478 |
"Modified: / 26-10-2010 / 18:46:42 / cg" |
8015 | 479 |
! |
480 |
||
481 |
hideReadonly |
|
9598 | 482 |
"Hides the file dialog's Readonly check box. " |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
483 |
|
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
484 |
self |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
485 |
style:(self style bitOr: (self class commonDialogConstantAt:'OfnHidereadonly')) |
8015 | 486 |
|
9598 | 487 |
"Modified: / 26-10-2010 / 18:46:48 / cg" |
8015 | 488 |
! |
489 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
490 |
initialFileName:filename |
9598 | 491 |
"Sets the initial fileName string in the File Dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
492 |
|
9598 | 493 |
|aString| |
8015 | 494 |
|
9598 | 495 |
filename isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
496 |
^ self. |
9598 | 497 |
]. |
8015 | 498 |
aString := filename. |
9598 | 499 |
filename isFilename ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
500 |
aString := filename baseName |
9598 | 501 |
]. |
8015 | 502 |
fileName := aString. |
9598 | 503 |
|
504 |
"Modified: / 26-10-2010 / 18:46:50 / cg" |
|
8015 | 505 |
! |
506 |
||
507 |
overwritePrompt |
|
9598 | 508 |
"Prompt if the user attempts to overwrite a file" |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
509 |
|
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
510 |
self style:(self style |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
511 |
bitOr: (self class commonDialogConstantAt:'OfnOverwriteprompt')) |
8015 | 512 |
|
9598 | 513 |
"Modified: / 26-10-2010 / 18:47:19 / cg" |
8015 | 514 |
! |
515 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
516 |
owner:ownerWindow |
9598 | 517 |
"Sets the owner of the Dialog box." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
518 |
|
8015 | 519 |
|mainView handle| |
520 |
||
9598 | 521 |
ownerWindow isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
522 |
^ self |
9598 | 523 |
]. |
8015 | 524 |
mainView := ownerWindow windowGroup mainView. |
525 |
mainView notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
526 |
handle := mainView id. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
527 |
handle notNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
528 |
parent := handle address |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
529 |
]. |
8015 | 530 |
]. |
531 |
||
9598 | 532 |
"/ super owner: anOwner. |
533 |
"/ owner isWindow |
|
534 |
"/ ifTrue: [ parent := owner ] |
|
535 |
"/ ifFalse: [ parent := owner mainView. |
|
536 |
"/ parent isWindow ifFalse: [ |
|
537 |
"/ parent := Notifier findWindow: WindowHandle queryActive ]]. |
|
538 |
||
539 |
"Modified: / 26-10-2010 / 18:47:22 / cg" |
|
8015 | 540 |
! |
541 |
||
542 |
pathMustExist |
|
11948 | 543 |
self style:(self style bitOr: 16r800). |
8015 | 544 |
|
9598 | 545 |
"Modified: / 26-10-2010 / 18:47:27 / cg" |
8015 | 546 |
! |
547 |
||
548 |
shareAware |
|
9598 | 549 |
"Allows a previously opened file to be opened |
550 |
(e.g. change.log)" |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
551 |
|
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
552 |
self |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
553 |
style:(self style bitOr: (self class commonDialogConstantAt:'OfnShareaware')) |
8015 | 554 |
|
9598 | 555 |
"Modified: / 26-10-2010 / 18:47:36 / cg" |
8015 | 556 |
! |
557 |
||
558 |
style |
|
9606 | 559 |
style isNil ifTrue:[^ self class commonDialogConstantAt:'OfnNochangedir']. |
560 |
^ style |
|
561 |
||
562 |
"Modified: / 27-10-2010 / 11:07:41 / cg" |
|
8015 | 563 |
! |
564 |
||
565 |
style:something |
|
566 |
style := something. |
|
567 |
! |
|
568 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
569 |
title:aTitle |
9598 | 570 |
"Specifies the string to be placed in the title bar of the |
571 |
File dialog." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
572 |
|
9598 | 573 |
title := aTitle |
8015 | 574 |
|
9598 | 575 |
"Modified: / 26-10-2010 / 18:47:41 / cg" |
8015 | 576 |
! ! |
577 |
||
578 |
!Win32FileDialog methodsFor:'dapas'! |
|
579 |
||
580 |
dapasOpenFile |
|
9598 | 581 |
"Brings up the default open file dialog " |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
582 |
|
9598 | 583 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
584 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
585 |
shareAware; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
586 |
addFilter:'*.*' description:'All Files (*.*)'. |
9598 | 587 |
self defFilter isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
588 |
self defFilter:'*.*' |
9598 | 589 |
]. |
590 |
self open. |
|
8015 | 591 |
|
9598 | 592 |
"Modified: / 26-10-2010 / 18:45:46 / cg" |
8015 | 593 |
! |
594 |
||
595 |
dapasSaveFile |
|
9598 | 596 |
"Brings up the file save dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
597 |
|
9598 | 598 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
599 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
600 |
overwritePrompt; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
601 |
addFilter:'*.*' description:'All Files (*.*)'. |
9598 | 602 |
self save. |
8015 | 603 |
|
9598 | 604 |
"Modified: / 26-10-2010 / 18:45:52 / cg" |
8015 | 605 |
! |
606 |
||
607 |
openFileXml |
|
9598 | 608 |
"Brings up the default open file dialog " |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
609 |
|
9598 | 610 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
611 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
612 |
shareAware; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
613 |
addFilter:'*.xml' description:'XML-Files'. |
9598 | 614 |
self defFilter isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
615 |
self defFilter:'*.*' |
9598 | 616 |
]. |
617 |
self open. |
|
8015 | 618 |
|
9598 | 619 |
"Modified: / 26-10-2010 / 18:49:00 / cg" |
8015 | 620 |
! |
621 |
||
622 |
openFileXmlZip |
|
9598 | 623 |
"Brings up the default open file dialog " |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
624 |
|
9598 | 625 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
626 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
627 |
shareAware; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
628 |
addFilter:'*.xml' description:'XML-Datei'; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
629 |
addFilter:'*.zip' description:'ZIP-Datei'. |
9598 | 630 |
self defFilter isNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
631 |
self defFilter:'*.*' |
9598 | 632 |
]. |
633 |
self open. |
|
8015 | 634 |
|
9598 | 635 |
"Modified: / 26-10-2010 / 18:47:14 / cg" |
8015 | 636 |
! ! |
637 |
||
9668 | 638 |
!Win32FileDialog methodsFor:'initialization & release'! |
8015 | 639 |
|
640 |
cleanUp |
|
9598 | 641 |
"Private - Free openFileNameStruct." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
642 |
|
9598 | 643 |
self style:self flags. |
644 |
lpstrFilter notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
645 |
lpstrFilter free |
9598 | 646 |
]. |
647 |
lpstrFile notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
648 |
lpstrFile free |
9598 | 649 |
]. |
650 |
lpstrInitialDir notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
651 |
lpstrInitialDir free |
9598 | 652 |
]. |
653 |
lpstrTitle notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
654 |
lpstrTitle free |
9598 | 655 |
]. |
656 |
lpstrDefExt notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
657 |
lpstrDefExt free |
9598 | 658 |
]. |
659 |
openFileNameStruct := nil |
|
8015 | 660 |
|
9598 | 661 |
"Modified: / 26-10-2010 / 18:45:33 / cg" |
8015 | 662 |
! |
663 |
||
664 |
initialize |
|
9598 | 665 |
"Private - Initialize openFileNameStruct" |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
666 |
|
8015 | 667 |
super initialize. |
9598 | 668 |
openFileNameStruct := OpenFilenameStructure new. |
669 |
openFileNameStruct lStructSize:openFileNameStruct sizeInBytes. |
|
9606 | 670 |
|
8015 | 671 |
fileName := String new. |
672 |
filters := OrderedCollection new. |
|
9598 | 673 |
self style:(self class commonDialogConstantAt:'OfnNochangedir') |
674 |
||
9606 | 675 |
"Modified: / 27-10-2010 / 10:56:21 / cg" |
8015 | 676 |
! ! |
677 |
||
678 |
!Win32FileDialog methodsFor:'opening'! |
|
679 |
||
9698 | 680 |
asynchronousOpen |
681 |
|rslt sema| |
|
682 |
||
683 |
sema := Semaphore new. |
|
684 |
[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
685 |
[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
686 |
self basicOpen |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
687 |
] ensure:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
688 |
sema signal. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
689 |
]. |
9698 | 690 |
] fork. |
691 |
sema wait. |
|
692 |
^ rslt |
|
693 |
||
694 |
"Created: / 23-01-2011 / 10:59:35 / cg" |
|
695 |
! |
|
696 |
||
697 |
basicOpen |
|
9597 | 698 |
"Brings up the open file dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
699 |
|
9698 | 700 |
|rslt openFileNameStructExternalBytes| |
8015 | 701 |
|
9606 | 702 |
[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
703 |
self fillStruct. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
704 |
parent notNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
705 |
openFileNameStruct hwndOwner:parent. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
706 |
]. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
707 |
style notNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
708 |
openFileNameStruct flags:style |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
709 |
]. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
710 |
openFileNameStructExternalBytes := ExternalBytes from:openFileNameStruct asByteArray. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
711 |
rslt := OperatingSystem getOpenFilename:openFileNameStructExternalBytes. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
712 |
rslt ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
713 |
self getFileName |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
714 |
] ifFalse:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
715 |
fileName := nil. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
716 |
error := OperatingSystem commDlgExtendedError. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
717 |
]. |
9606 | 718 |
] ensure:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
719 |
openFileNameStructExternalBytes free. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
720 |
self cleanUp. |
9606 | 721 |
]. |
9698 | 722 |
|
723 |
"Created: / 23-01-2011 / 10:58:30 / cg" |
|
13923 | 724 |
"Modified: / 11-02-2014 / 11:24:23 / cg" |
9698 | 725 |
! |
726 |
||
727 |
open |
|
728 |
"Brings up the open file dialog." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
729 |
|
9698 | 730 |
true "false" ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
731 |
self synchronousOpen. |
9698 | 732 |
] ifFalse:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
733 |
self asynchronousOpen. |
9698 | 734 |
]. |
9597 | 735 |
(error notNil and:[ error ~= 0 ]) ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
736 |
self error:error |
8015 | 737 |
]. |
738 |
||
9698 | 739 |
"Modified: / 23-01-2011 / 11:05:46 / cg" |
8015 | 740 |
! |
741 |
||
742 |
openFile |
|
9598 | 743 |
"Brings up the default open file dialog. The title is set to 'Open File' |
744 |
and fileSpec is set to '*.*'." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
745 |
|
9598 | 746 |
self openFile:'*.*'. |
8015 | 747 |
|
9598 | 748 |
"Modified: / 26-10-2010 / 18:47:00 / cg" |
8015 | 749 |
! |
750 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
751 |
openFile:initialFileName |
9598 | 752 |
"Brings up the default open file dialog. The title is set to 'Open File' |
753 |
and fileSpec is set to patternString." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
754 |
|
9598 | 755 |
self title:'Open'. |
756 |
initialFileName notNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
757 |
self initialFileName:initialFileName |
9598 | 758 |
]. |
8015 | 759 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
760 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
761 |
shareAware; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
762 |
addAllFilesFilter; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
763 |
addFilter:'*.txt' description:'Text Files (*.txt)'. |
9598 | 764 |
Smalltalk isStandAloneApp ifFalse:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
765 |
self addSmalltalkFileFilters |
9598 | 766 |
]. |
767 |
self defFilter isNil ifTrue:[ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
768 |
self defFilter:'*.*' |
9598 | 769 |
]. |
8015 | 770 |
self open. |
9598 | 771 |
|
772 |
"Modified: / 26-10-2010 / 18:47:03 / cg" |
|
8015 | 773 |
! |
774 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
775 |
openFor:ownerWindow save:isSaveDialog title:titleOrNil inDirectory:dirPathOrNil initialAnswer:initialOrNil filter:filterArrayOrNil extension:extensionOrNil |
9598 | 776 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
777 |
owner:ownerWindow; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
778 |
title:titleOrNil; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
779 |
initialFileName:initialOrNil; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
780 |
defFilter:extensionOrNil; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
781 |
directory:dirPathOrNil. |
9606 | 782 |
|
8015 | 783 |
filterArrayOrNil notNil ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
784 |
filterArrayOrNil do:[:each | |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
785 |
self addFilter:each last description:each first |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
786 |
]. |
8015 | 787 |
]. |
788 |
self addAllFilesFilter. |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
789 |
|
8015 | 790 |
"/ self defFilter isNil ifTrue:[ self defFilter: '*.*']. |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
791 |
|
9598 | 792 |
isSaveDialog ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
793 |
self |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
794 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
795 |
overwritePrompt; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
796 |
save. |
9598 | 797 |
] ifFalse:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
798 |
self |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
799 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
800 |
shareAware; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
801 |
open. |
9598 | 802 |
]. |
803 |
^ self file |
|
8015 | 804 |
|
9606 | 805 |
"Modified: / 27-10-2010 / 11:10:38 / cg" |
8015 | 806 |
! |
807 |
||
808 |
save |
|
9597 | 809 |
"Brings up the save file dialog." |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
810 |
|
9597 | 811 |
|error rslt openFileNameStructExternalBytes| |
8015 | 812 |
|
9606 | 813 |
[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
814 |
self fillStruct. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
815 |
parent notNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
816 |
openFileNameStruct hwndOwner:parent. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
817 |
]. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
818 |
style notNil ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
819 |
openFileNameStruct flags:style |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
820 |
]. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
821 |
openFileNameStructExternalBytes := ExternalBytes |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
822 |
from:openFileNameStruct asByteArray. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
823 |
rslt := OperatingSystem getSaveFilename:openFileNameStructExternalBytes. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
824 |
rslt ifTrue:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
825 |
self getFileName |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
826 |
] ifFalse:[ |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
827 |
fileName := nil. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
828 |
error := OperatingSystem commDlgExtendedError. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
829 |
]. |
9606 | 830 |
] ensure:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
831 |
openFileNameStructExternalBytes free. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
832 |
self cleanUp. |
9606 | 833 |
]. |
9597 | 834 |
(error notNil and:[ error ~= 0 ]) ifTrue:[ |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
835 |
self error:error |
8015 | 836 |
]. |
837 |
||
13924 | 838 |
"Modified: / 11-02-2014 / 21:13:43 / cg" |
8015 | 839 |
! |
840 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
841 |
saveFile:aString |
9598 | 842 |
"Brings up the save file dialog with aString as the |
843 |
default name. The title is set to 'Save File'." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
844 |
|
9598 | 845 |
self saveTitle:'Save File' fileName:aString |
8015 | 846 |
|
9598 | 847 |
"Modified: / 26-10-2010 / 18:47:32 / cg" |
8015 | 848 |
! |
849 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
850 |
saveTitle:aTitle fileName:initialFileName |
9598 | 851 |
"Brings up the file save dialog with aTitle and aString |
852 |
as the default name." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
853 |
|
9598 | 854 |
self |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
855 |
title:aTitle; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
856 |
initialFileName:initialFileName; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
857 |
hideReadonly; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
858 |
overwritePrompt; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
859 |
addAllFilesFilter; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
860 |
addFilter:'*.txt' description:'Text Files (*.txt)'. |
9598 | 861 |
self save. |
8015 | 862 |
|
9598 | 863 |
"Modified: / 26-10-2010 / 18:47:35 / cg" |
9698 | 864 |
! |
865 |
||
866 |
synchronousOpen |
|
867 |
"Brings up the open file dialog." |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
868 |
|
9698 | 869 |
self basicOpen. |
870 |
||
871 |
"Modified: / 23-01-2011 / 10:59:20 / cg" |
|
8015 | 872 |
! ! |
873 |
||
874 |
!Win32FileDialog methodsFor:'private'! |
|
875 |
||
876 |
fillStruct |
|
9598 | 877 |
"Private - fills the openFileNameStruct" |
8015 | 878 |
|
879 |
| temp | |
|
880 |
||
8037 | 881 |
temp := fileName "asAsciiZ". |
882 |
lpstrFile := ExternalBytes new:512 withAll:0. |
|
9606 | 883 |
lpstrFile replaceBytesFrom:1 to:temp size with:temp startingAt:1. |
8015 | 884 |
|
8037 | 885 |
lpstrFilter := ExternalBytes newNullTerminatedFromString: self filters. |
886 |
lpstrInitialDir := ExternalBytes newNullTerminatedFromString: self directory pathName. |
|
8015 | 887 |
|
888 |
openFileNameStruct |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
889 |
lpstrFile: lpstrFile address ; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
890 |
nMaxFile: 512; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
891 |
lpstrFilter: lpstrFilter address ; |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
892 |
nFilterIndex: defFilterIndex ; "set by filters" |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
893 |
lpstrInitialDir: lpstrInitialDir address. |
8015 | 894 |
|
895 |
( temp := defExtension) notNil ifTrue: [ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
896 |
lpstrDefExt := ExternalBytes newNullTerminatedFromString: temp. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
897 |
openFileNameStruct lpstrDefExt: lpstrDefExt address]. |
8015 | 898 |
|
899 |
( temp := title ) notNil ifTrue: [ |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
900 |
lpstrTitle := ExternalBytes newNullTerminatedFromString: temp. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
901 |
openFileNameStruct lpstrTitle: lpstrTitle address ]. |
9598 | 902 |
|
9606 | 903 |
"Modified: / 27-10-2010 / 10:56:01 / cg" |
8015 | 904 |
! |
905 |
||
906 |
getFileName |
|
9598 | 907 |
"Private - get the filename" |
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
908 |
|
9598 | 909 |
|directory| |
8015 | 910 |
|
9598 | 911 |
self style:self flags. |
912 |
fileName := lpstrFile stringAt:1. |
|
913 |
directory := fileName copyFrom:1 to:openFileNameStruct nFileOffset. |
|
914 |
self directory:directory asFilename. |
|
915 |
||
916 |
"Modified: / 26-10-2010 / 18:46:45 / cg" |
|
8015 | 917 |
! ! |
918 |
||
919 |
!Win32FileDialog::OpenFilenameStructure class methodsFor:'accessing'! |
|
920 |
||
921 |
sizeInBytes |
|
922 |
||
923 |
^ 76 |
|
924 |
! ! |
|
925 |
||
926 |
!Win32FileDialog::OpenFilenameStructure class methodsFor:'instance creation'! |
|
927 |
||
928 |
new |
|
929 |
||
930 |
^ super new: self sizeInBytes |
|
931 |
! ! |
|
932 |
||
933 |
!Win32FileDialog::OpenFilenameStructure methodsFor:'accessing'! |
|
934 |
||
935 |
flags |
|
936 |
"Answer the receiver's flags field as a Smalltalk object." |
|
937 |
||
8037 | 938 |
^ self doubleWordAt: 52+1 |
8015 | 939 |
! |
940 |
||
941 |
flags: anObject |
|
942 |
"Set the receiver's flags field as a Smalltalk object." |
|
943 |
||
8037 | 944 |
^ self doubleWordAt: 52+1 put: anObject |
8015 | 945 |
! |
946 |
||
947 |
hInstance |
|
948 |
"Get the receiver's hInstance field." |
|
949 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
950 |
^ self doubleWordAt: 8+1 |
8015 | 951 |
! |
952 |
||
953 |
hInstance: anObject |
|
954 |
"Set the receiver's hInstance field to the value of anObject." |
|
955 |
||
8037 | 956 |
self doubleWordAt: 8+1 put: anObject |
8015 | 957 |
! |
958 |
||
959 |
hwndOwner |
|
960 |
"Get the receiver's hwndOwner field." |
|
961 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
962 |
^ self doubleWordAt: 4+1 |
8015 | 963 |
! |
964 |
||
965 |
hwndOwner: anObject |
|
966 |
"Set the receiver's hwndOwner field to the value of anObject." |
|
967 |
||
8037 | 968 |
self doubleWordAt: 4+1 put: anObject |
8015 | 969 |
! |
970 |
||
971 |
lCustData |
|
972 |
"Get the receiver's lCustData field." |
|
973 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
974 |
^ self doubleWordAt: 64+1 |
8015 | 975 |
! |
976 |
||
977 |
lCustData: anObject |
|
978 |
"Set the receiver's lCustData field as a Smalltalk object." |
|
979 |
||
8037 | 980 |
^ self doubleWordAt: 64+1 put: anObject |
8015 | 981 |
! |
982 |
||
983 |
lStructSize |
|
984 |
"Get the receiver's lStructSize field." |
|
985 |
||
8037 | 986 |
^ self doubleWordAt: 0+1 |
8015 | 987 |
! |
988 |
||
989 |
lStructSize: anObject |
|
990 |
"Set the receiver's lStructSize field to the value of anObject." |
|
991 |
||
8037 | 992 |
self doubleWordAt:0+1 put:anObject |
8015 | 993 |
! |
994 |
||
995 |
lpfnHook |
|
996 |
"Get the receiver's lpfnHook field." |
|
997 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
998 |
^ self doubleWordAt: 68+1 |
8015 | 999 |
! |
1000 |
||
1001 |
lpfnHook: anObject |
|
1002 |
"Set the receiver's lpfnHook field to the value of anObject." |
|
1003 |
||
8037 | 1004 |
self doubleWordAt: 68+1 put: anObject |
8015 | 1005 |
! |
1006 |
||
1007 |
lpstrCustomFilter |
|
1008 |
"Get the receiver's lpstrCustomFilter field." |
|
1009 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1010 |
^ self doubleWordAt: 16+1 |
8015 | 1011 |
! |
1012 |
||
1013 |
lpstrCustomFilter: anObject |
|
1014 |
"Set the receiver's lpstrCustomFilter field to the value of anObject." |
|
1015 |
||
8037 | 1016 |
self doubleWordAt: 16+1 put: anObject |
8015 | 1017 |
! |
1018 |
||
1019 |
lpstrDefExt |
|
1020 |
"Get the receiver's lpstrDefExt field." |
|
1021 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1022 |
^ self doubleWordAt: 60+1 |
8015 | 1023 |
! |
1024 |
||
1025 |
lpstrDefExt: anObject |
|
1026 |
"Set the receiver's lpstrDefExt field to the value of anObject." |
|
1027 |
||
8037 | 1028 |
self doubleWordAt: 60+1 put: anObject |
8015 | 1029 |
! |
1030 |
||
1031 |
lpstrFile |
|
1032 |
"Get the receiver's lpstrFile field." |
|
1033 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1034 |
^ self doubleWordAt: 28+1 |
8015 | 1035 |
! |
1036 |
||
1037 |
lpstrFile: anObject |
|
1038 |
"Set the receiver's lpstrFile field to the value of anObject." |
|
1039 |
||
8037 | 1040 |
self doubleWordAt: 28+1 put: anObject |
8015 | 1041 |
! |
1042 |
||
1043 |
lpstrFileTitle |
|
1044 |
"Get the receiver's lpstrFileTitle field." |
|
1045 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1046 |
^ self doubleWordAt: 36+1 |
8015 | 1047 |
! |
1048 |
||
1049 |
lpstrFileTitle: anObject |
|
1050 |
"Set the receiver's lpstrFileTitle field to the value of anObject." |
|
1051 |
||
8037 | 1052 |
self doubleWordAt: 36+1 put: anObject |
8015 | 1053 |
! |
1054 |
||
1055 |
lpstrFilter |
|
1056 |
"Get the receiver's lpstrFilter field." |
|
1057 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1058 |
^ self doubleWordAt: 12+1 |
8015 | 1059 |
! |
1060 |
||
1061 |
lpstrFilter: anObject |
|
1062 |
"Set the receiver's lpstrFilter field to the value of anObject." |
|
1063 |
||
8037 | 1064 |
self doubleWordAt: 12+1 put: anObject |
8015 | 1065 |
! |
1066 |
||
1067 |
lpstrInitialDir |
|
1068 |
"Get the receiver's lpstrInitialDir field." |
|
1069 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1070 |
^ self doubleWordAt: 44+1 |
8015 | 1071 |
! |
1072 |
||
1073 |
lpstrInitialDir: anObject |
|
1074 |
"Set the receiver's lpstrInitialDir field to the value of anObject." |
|
1075 |
||
8037 | 1076 |
self doubleWordAt: 44+1 put: anObject |
8015 | 1077 |
! |
1078 |
||
1079 |
lpstrTemplateName |
|
1080 |
"Get the receiver's lpstrTemplateName field." |
|
1081 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1082 |
^ self doubleWordAt: 72+1 |
8015 | 1083 |
! |
1084 |
||
1085 |
lpstrTemplateName: anObject |
|
1086 |
"Set the receiver's lpstrTemplateName field to the value of anObject." |
|
1087 |
||
8037 | 1088 |
self doubleWordAt: 72+1 put: anObject |
8015 | 1089 |
! |
1090 |
||
1091 |
lpstrTitle |
|
1092 |
"Get the receiver's lpstrTitle field." |
|
1093 |
||
8037 | 1094 |
^ self doubleWordAt: 48+1 |
8015 | 1095 |
! |
1096 |
||
1097 |
lpstrTitle: anObject |
|
1098 |
"Set the receiver's lpstrTitle field to the value of anObject." |
|
1099 |
||
8037 | 1100 |
self doubleWordAt: 48+1 put: anObject |
8015 | 1101 |
! |
1102 |
||
1103 |
nFileExtension |
|
1104 |
"Get the receiver's nFileExtension field." |
|
1105 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1106 |
^ self unsignedShortAt: 58+1 |
8015 | 1107 |
! |
1108 |
||
1109 |
nFileExtension: anObject |
|
1110 |
"Set the receiver's nFileExtension field to the value of anObject." |
|
1111 |
||
8037 | 1112 |
self unsignedShortAt: 58+1 put: anObject |
8015 | 1113 |
! |
1114 |
||
1115 |
nFileOffset |
|
1116 |
"Get the receiver's nFileOffset field." |
|
1117 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1118 |
^ self unsignedShortAt: 56+1 |
8015 | 1119 |
! |
1120 |
||
1121 |
nFileOffset: anObject |
|
1122 |
"Set the receiver's nFileOffset field to the value of anObject." |
|
1123 |
||
8037 | 1124 |
self unsignedShortAt: 56+1 put: anObject |
8015 | 1125 |
! |
1126 |
||
1127 |
nFilterIndex |
|
1128 |
"Get the receiver's nFilterIndex field." |
|
1129 |
||
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1130 |
^ self doubleWordAt: 24+1 |
8015 | 1131 |
! |
1132 |
||
1133 |
nFilterIndex: anObject |
|
1134 |
"Set the receiver's nFilterIndex field to the value of anObject." |
|
1135 |
||
8037 | 1136 |
self doubleWordAt: 24+1 put: anObject |
8015 | 1137 |
! |
1138 |
||
1139 |
nMaxCustFilter |
|
1140 |
"Get the receiver's nMaxCustFilter field." |
|
1141 |
||
8037 | 1142 |
^ self doubleWordAt: 20+1 |
8015 | 1143 |
! |
1144 |
||
1145 |
nMaxCustFilter: anObject |
|
1146 |
"Set the receiver's nMaxCustFilter field to the value of anObject." |
|
1147 |
||
8037 | 1148 |
self doubleWordAt: 20+1 put: anObject |
8015 | 1149 |
! |
1150 |
||
1151 |
nMaxFile |
|
1152 |
"Get the receiver's nMaxFile field." |
|
1153 |
||
8037 | 1154 |
^ self doubleWordAt: 32+1 |
8015 | 1155 |
! |
1156 |
||
1157 |
nMaxFile: anObject |
|
1158 |
"Set the receiver's nMaxFile field to the value of anObject." |
|
1159 |
||
8037 | 1160 |
self doubleWordAt: 32+1 put: anObject |
8015 | 1161 |
! |
1162 |
||
1163 |
nMaxFileTitle |
|
1164 |
"Get the receiver's nMaxFileTitle field." |
|
1165 |
||
8037 | 1166 |
^ self doubleWordAt: 40+1 |
8015 | 1167 |
! |
1168 |
||
1169 |
nMaxFileTitle: anObject |
|
1170 |
"Set the receiver's nMaxFileTitle field to the value of anObject." |
|
1171 |
||
8037 | 1172 |
self doubleWordAt: 40+1 put: anObject |
8015 | 1173 |
! |
1174 |
||
1175 |
sizeInBytes |
|
1176 |
||
1177 |
^ self class sizeInBytes |
|
1178 |
! ! |
|
1179 |
||
1180 |
!Win32FileDialog::OpenFilenameStructure methodsFor:'printing'! |
|
1181 |
||
1182 |
printOn: aStream |
|
1183 |
||
1184 |
super printOn: aStream. |
|
1185 |
aStream cr. |
|
1186 |
aStream nextPutAll:'flags: ', self flags printString; cr. |
|
1187 |
aStream nextPutAll:'hInstance: ', self hInstance printString; cr. |
|
1188 |
aStream nextPutAll:'hwndOwner: ', self hwndOwner printString; cr. |
|
1189 |
aStream nextPutAll:'lCustData: ', self lCustData printString; cr. |
|
1190 |
aStream nextPutAll:'lpfnHook: ', self lpfnHook printString; cr. |
|
1191 |
aStream nextPutAll:'lpstrCustomFilter: ', self lpstrCustomFilter printString; cr. |
|
1192 |
aStream nextPutAll:'lpstrDefExt: ', self lpstrDefExt printString; cr. |
|
1193 |
aStream nextPutAll:'lpstrFile: ', self lpstrFile printString; cr. |
|
1194 |
aStream nextPutAll:'lpstrFileTitle: ', self lpstrFileTitle printString; cr. |
|
1195 |
aStream nextPutAll:'lpstrFilter: ', self lpstrFilter printString; cr. |
|
1196 |
aStream nextPutAll:'lpstrInitialDir: ', self lpstrInitialDir printString; cr. |
|
1197 |
aStream nextPutAll:'lpstrTemplateName: ', self lpstrTemplateName printString; cr. |
|
1198 |
aStream nextPutAll:'lStructSize: ', self lStructSize printString; cr. |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1199 |
aStream nextPutAll:'nFileExtension: ', self nFileExtension printString; cr. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1200 |
aStream nextPutAll:'nFileOffset: ', self nFileOffset printString; cr. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1201 |
aStream nextPutAll:'nFilterIndex: ', self nFilterIndex printString; cr. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1202 |
aStream nextPutAll:'nMaxCustFilter: ', self nMaxCustFilter printString; cr. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1203 |
aStream nextPutAll:'nMaxFile: ', self nMaxFile printString; cr. |
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1204 |
aStream nextPutAll:'nMaxFileTitle: ', self nMaxFileTitle printString; cr. |
8015 | 1205 |
! ! |
1206 |
||
1207 |
!Win32FileDialog class methodsFor:'documentation'! |
|
1208 |
||
1209 |
version |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1210 |
^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.17 2014-11-13 13:50:30 cg Exp $' |
9345 | 1211 |
! |
1212 |
||
1213 |
version_CVS |
|
14829
82b109435616
do not hardcode program files
Claus Gittinger <cg@exept.de>
parents:
13924
diff
changeset
|
1214 |
^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.17 2014-11-13 13:50:30 cg Exp $' |
8015 | 1215 |
! ! |
9597 | 1216 |
|
13577 | 1217 |
|
9597 | 1218 |
Win32FileDialog initialize! |