--- a/Win32FileDialog.st Sun Jan 12 23:30:25 2014 +0000
+++ b/Win32FileDialog.st Wed Apr 01 10:38:01 2015 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 2008 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -21,7 +21,7 @@
category:'Interface-Tools-File'
!
-ByteArray subclass:#OpenFilenameStructure
+ByteArray variableByteSubclass:#OpenFilenameStructure
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
@@ -33,7 +33,7 @@
copyright
"
COPYRIGHT (c) 2008 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -59,7 +59,7 @@
!
startUp
- "Private - Initialize the class variables.
+ "Private - Initialize the class variables.
This is called during startup."
InitialDirectory := Directory pathName: Disk drivePathName.
@@ -79,7 +79,7 @@
"Modified: / 26-10-2010 / 18:47:46 / cg"
!
-setInitialDirectory:aName
+setInitialDirectory:aName
InitialDirectory := Directory pathName:aName
"Modified: / 26-10-2010 / 18:47:48 / cg"
@@ -87,18 +87,18 @@
!Win32FileDialog class methodsFor:'constants'!
-commonDialogConstantAt:aString
+commonDialogConstantAt:aString
^ self commonDialogConstants at:aString
- ifAbsent:[
- Transcript showCR:'Common Dialog Constant ' , aString , ' notfound!!'
- ]
+ ifAbsent:[
+ Transcript showCR:'Common Dialog Constant ' , aString , ' notfound!!'
+ ]
"Modified: / 26-10-2010 / 18:47:51 / cg"
!
commonDialogConstants
CommonDialogConstants isNil ifTrue:[
- CommonDialogConstants := self generateCommonDialogConstants
+ CommonDialogConstants := self generateCommonDialogConstants
].
^ CommonDialogConstants
@@ -110,92 +110,92 @@
dictionary := Dictionary new.
dictionary
- at:'CcPreventfullopen' put:4;
- at:'FrShowhelp' put:128;
- at:'PdEnablesetuptemplate' put:32768;
- at:'FrNoupdown' put:1024;
- at:'CfNosimulations' put:4096;
- at:'OfnPathmustexist' put:2048;
- at:'CfWysiwyg' put:32768;
- at:'PdReturndc' put:256;
- at:'PdEnableprinthook' put:4096;
- at:'CfInittologfontstruct' put:64;
- at:'CfScalableonly' put:131072;
- at:'PdPrinttofile' put:32;
- at:'CfEffects' put:256;
- at:'PdShowhelp' put:2048;
- at:'OfnEnabletemplatehandle' put:128;
- at:'CfBoth' put:3;
- at:'OfnReadonly' put:1;
- at:'PdNopagenums' put:8;
- at:'PdDisableprinttofile' put:524288;
- at:'PdHideprinttofile' put:1048576;
- at:'OfnAllowmultiselect' put:512;
- at:'CfPrinterfonts' put:2;
- at:'CfEnabletemplatehandle' put:32;
- at:'PdSelection' put:1;
- at:'OfnHidereadonly' put:4;
- at:'PdPrintsetup' put:64;
- at:'OfnExtentiondifferent' put:1024;
- at:'FrReplaceall' put:32;
- at:'FrMatchcase' put:4;
- at:'OfnFilemustexist' put:4096;
- at:'PdCollate' put:16;
- at:'CfFixedpitchonly' put:16384;
- at:'PdEnablesetuphook' put:8192;
- at:'OfnShareaware' put:16384;
- at:'CcEnablehook' put:16;
- at:'CfEnabletemplate' put:16;
- at:'Findmsgstring' put:'commdlgFindreplace';
- at:'CfLimitsize' put:8192;
- at:'OfnNochangedir' put:8;
- at:'OfnCreateprompt' put:8192;
- at:'ScreenFonttype' put:8192;
- at:'PdUsedevmodecopies' put:262144;
- at:'CcRgbinit' put:1;
- at:'FrFindnext' put:8;
- at:'CfUsestyle' put:128;
- at:'FrEnablehook' put:256;
- at:'PdEnableprinttemplatehandle' put:65536;
- at:'CfShowhelp' put:4;
- at:'FrNowholeword' put:4096.
+ at:'CcPreventfullopen' put:4;
+ at:'FrShowhelp' put:128;
+ at:'PdEnablesetuptemplate' put:32768;
+ at:'FrNoupdown' put:1024;
+ at:'CfNosimulations' put:4096;
+ at:'OfnPathmustexist' put:2048;
+ at:'CfWysiwyg' put:32768;
+ at:'PdReturndc' put:256;
+ at:'PdEnableprinthook' put:4096;
+ at:'CfInittologfontstruct' put:64;
+ at:'CfScalableonly' put:131072;
+ at:'PdPrinttofile' put:32;
+ at:'CfEffects' put:256;
+ at:'PdShowhelp' put:2048;
+ at:'OfnEnabletemplatehandle' put:128;
+ at:'CfBoth' put:3;
+ at:'OfnReadonly' put:1;
+ at:'PdNopagenums' put:8;
+ at:'PdDisableprinttofile' put:524288;
+ at:'PdHideprinttofile' put:1048576;
+ at:'OfnAllowmultiselect' put:512;
+ at:'CfPrinterfonts' put:2;
+ at:'CfEnabletemplatehandle' put:32;
+ at:'PdSelection' put:1;
+ at:'OfnHidereadonly' put:4;
+ at:'PdPrintsetup' put:64;
+ at:'OfnExtentiondifferent' put:1024;
+ at:'FrReplaceall' put:32;
+ at:'FrMatchcase' put:4;
+ at:'OfnFilemustexist' put:4096;
+ at:'PdCollate' put:16;
+ at:'CfFixedpitchonly' put:16384;
+ at:'PdEnablesetuphook' put:8192;
+ at:'OfnShareaware' put:16384;
+ at:'CcEnablehook' put:16;
+ at:'CfEnabletemplate' put:16;
+ at:'Findmsgstring' put:'commdlgFindreplace';
+ at:'CfLimitsize' put:8192;
+ at:'OfnNochangedir' put:8;
+ at:'OfnCreateprompt' put:8192;
+ at:'ScreenFonttype' put:8192;
+ at:'PdUsedevmodecopies' put:262144;
+ at:'CcRgbinit' put:1;
+ at:'FrFindnext' put:8;
+ at:'CfUsestyle' put:128;
+ at:'FrEnablehook' put:256;
+ at:'PdEnableprinttemplatehandle' put:65536;
+ at:'CfShowhelp' put:4;
+ at:'FrNowholeword' put:4096.
dictionary
- at:'ShareExist' put:16448;
- at:'OfnOverwriteprompt' put:2;
- at:'OfnEnablehook' put:32;
- at:'OfnShowhelp' put:16;
- at:'CcEnabletemplatehandle' put:64;
- at:'SimulatedFonttype' put:32768;
- at:'FrDown' put:1;
- at:'PdEnableprinttemplate' put:16384;
- at:'CfNovectorfonts' put:2048;
- at:'PdNoselection' put:4;
- at:'CfAnsionly' put:1024;
- at:'OfnNovalidate' put:256;
- at:'CfScreenfonts' put:1;
- at:'FrWholeword' put:2;
- at:'FrEnabletemplatehandle' put:8192;
- at:'PdAllpages' put:0;
- at:'CfForcefontexist' put:65536;
- at:'CcEnabletemplate' put:32;
- at:'PdPagenums' put:2;
- at:'FrReplace' put:16;
- at:'PdEnablesetuptemplatehandle' put:131072;
- at:'CfApply' put:512;
- at:'OfnEnabletemplate' put:64;
- at:'DnDefaultprn' put:1;
- at:'PdNowarning' put:128;
- at:'CfTtonly' put:262144;
- at:'PrinterFonttype' put:16384;
- at:'CcShowhelp' put:8;
- at:'CcFullopen' put:2;
- at:'PdReturnic' put:512;
- at:'FrEnabletemplate' put:512;
- at:'FrDialogterm' put:64;
- at:'Helpmsgstring' put:'commdlgHelp';
- at:'PdReturndefault' put:1024;
- at:'FrNomatchcase' put:2048;
- at:'CfEnablehook' put:8.
+ at:'ShareExist' put:16448;
+ at:'OfnOverwriteprompt' put:2;
+ at:'OfnEnablehook' put:32;
+ at:'OfnShowhelp' put:16;
+ at:'CcEnabletemplatehandle' put:64;
+ at:'SimulatedFonttype' put:32768;
+ at:'FrDown' put:1;
+ at:'PdEnableprinttemplate' put:16384;
+ at:'CfNovectorfonts' put:2048;
+ at:'PdNoselection' put:4;
+ at:'CfAnsionly' put:1024;
+ at:'OfnNovalidate' put:256;
+ at:'CfScreenfonts' put:1;
+ at:'FrWholeword' put:2;
+ at:'FrEnabletemplatehandle' put:8192;
+ at:'PdAllpages' put:0;
+ at:'CfForcefontexist' put:65536;
+ at:'CcEnabletemplate' put:32;
+ at:'PdPagenums' put:2;
+ at:'FrReplace' put:16;
+ at:'PdEnablesetuptemplatehandle' put:131072;
+ at:'CfApply' put:512;
+ at:'OfnEnabletemplate' put:64;
+ at:'DnDefaultprn' put:1;
+ at:'PdNowarning' put:128;
+ at:'CfTtonly' put:262144;
+ at:'PrinterFonttype' put:16384;
+ at:'CcShowhelp' put:8;
+ at:'CcFullopen' put:2;
+ at:'PdReturnic' put:512;
+ at:'FrEnabletemplate' put:512;
+ at:'FrDialogterm' put:64;
+ at:'Helpmsgstring' put:'commdlgHelp';
+ at:'PdReturndefault' put:1024;
+ at:'FrNomatchcase' put:2048;
+ at:'CfEnablehook' put:8.
^ dictionary
"Modified: / 26-10-2010 / 18:47:57 / cg"
@@ -221,7 +221,7 @@
!Win32FileDialog class methodsFor:'filters'!
-filterPatternDescription:filterPattern
+filterPatternDescription:filterPattern
^ self filterPatternDescriptions at:filterPattern ifAbsent:''
"Modified: / 26-10-2010 / 18:48:24 / cg"
@@ -229,26 +229,26 @@
filterPatternDescriptions
FilterPatternDescriptions isNil ifTrue:[
- FilterPatternDescriptions := self generateFilterPatternDescriptions
+ FilterPatternDescriptions := self generateFilterPatternDescriptions
].
^ FilterPatternDescriptions
"Modified: / 26-10-2010 / 18:48:25 / cg"
!
-filtersFor:pattern
+filtersFor:pattern
|filters filterPatterns|
pattern isEmptyOrNil ifTrue:[
- ^ nil
+ ^ nil
].
filters := OrderedCollection new.
filterPatterns := pattern subStrings:$;.
- filterPatterns do:[:filterPattern |
- filterPattern notEmpty ifTrue:[
- filters add:(Array with:(self filterPatternDescription:filterPattern)
- with:filterPattern)
- ].
+ filterPatterns do:[:filterPattern |
+ filterPattern notEmpty ifTrue:[
+ filters add:(Array with:(self filterPatternDescription:filterPattern)
+ with:filterPattern)
+ ].
].
^ filters asArray
@@ -257,30 +257,32 @@
generateFilterPatternDescriptions
^ (Dictionary new)
- at:'*.txt' put:'Text files (*.txt)';
- at:'*.st' put:'Smalltalk files (*.st)';
- at:'*.csv' put:'CSV files (*.csv)';
- at:'*.xml' put:'XML files (*.xml)';
- at:'*.zip' put:'ZIP files (*.zip)';
- at:'*.xls' put:'Excel files (*.xls)';
- at:'*.ent' put:'SGML Entity files (*.ent)';
- at:'*.ccs' put:'CCS files (*.ccs)';
- at:'*.ini' put:'Configuration files (*.ini)';
- at:'*.prn' put:'Printer Text files (*.prn)';
- at:'*.dir' put:'DapasX Database files (*.dir)';
- at:'*.dat' put:'DapasX Database files (*.dat)';
- at:'*.prg' put:'DapasX Program files (*.prg)';
- at:'*.dcf' put:'DapasX Options files (*.dcf)';
- at:'*.ext' put:'DapasX Backup files (*.ext)';
- at:'*.mpl' put:'DapasX Project files (*.mpl)';
- yourself
+ at:'*.txt' put:'Text files (*.txt)';
+ at:'*.st' put:'Smalltalk files (*.st)';
+ at:'*.java' put:'Java files (*.java)';
+ at:'*.csv' put:'CSV files (*.csv)';
+ at:'*.xml' put:'XML files (*.xml)';
+ at:'*.zip' put:'ZIP files (*.zip)';
+ at:'*.xls' put:'Excel files (*.xls)';
+ at:'*.ent' put:'SGML Entity files (*.ent)';
+ at:'*.ccs' put:'CCS files (*.ccs)';
+ at:'*.dll' put:'Shared Library files (*.dll)';
+ at:'*.ini' put:'Configuration files (*.ini)';
+ at:'*.prn' put:'Printer Text files (*.prn)';
+ at:'*.dir' put:'DapasX Database files (*.dir)';
+ at:'*.dat' put:'DapasX Database files (*.dat)';
+ at:'*.prg' put:'DapasX Program files (*.prg)';
+ at:'*.dcf' put:'DapasX Options files (*.dcf)';
+ at:'*.ext' put:'DapasX Backup files (*.ext)';
+ at:'*.mpl' put:'DapasX Project files (*.mpl)';
+ yourself
"Modified: / 26-10-2010 / 18:48:28 / cg"
! !
!Win32FileDialog class methodsFor:'opening'!
-fileDialogFor:ownerWindow save:isSaveDialog
+fileDialogFor:ownerWindow save:isSaveDialog
title:titleOrNil inDirectory:dirPathOrNil initialAnswer:initialOrNil
filter:pattern extension:extensionOrNil
@@ -296,15 +298,15 @@
filterArrayOrNil := self filtersFor: pattern.
- filePath :=
- self new
- openFor:ownerWindow
- save:isSaveDialog
- title:titleOrNil
- inDirectory:dirPathOrNil
- initialAnswer:initialOrNil
- filter:filterArrayOrNil
- extension:extensionOrNil.
+ filePath :=
+ self new
+ openFor:ownerWindow
+ save:isSaveDialog
+ title:titleOrNil
+ inDirectory:dirPathOrNil
+ initialAnswer:initialOrNil
+ filter:filterArrayOrNil
+ extension:extensionOrNil.
^ filePath
! !
@@ -316,9 +318,9 @@
self addFilter: '*.*' description: 'All Files (*.*)'.
!
-addFilter:aFilter description:aDescription
+addFilter:aFilter description:aDescription
"Add aFilter and aDescription to the list of File dialog filters."
-
+
filters add:(Association key:aFilter value:aDescription).
"Modified: / 26-10-2010 / 18:45:27 / cg"
@@ -330,9 +332,9 @@
"Modified: / 26-10-2010 / 18:45:29 / cg"
!
-defExtension:aDefExtension
+defExtension:aDefExtension
"Specifies the default extension of File dialog."
-
+
defExtension := aDefExtension.
"Modified: / 26-10-2010 / 18:45:54 / cg"
@@ -340,21 +342,21 @@
defFilter
"Answers the aDefFilterString as the default filter of File dialog."
-
+
^ defFilter
"Modified: / 26-10-2010 / 18:45:56 / cg"
!
-defFilter:aDefFilterString
+defFilter:aDefFilterString
"Specifies the aDefFilterString as the default filter of File dialog."
-
+
defFilter := aDefFilterString
"Modified: / 26-10-2010 / 18:45:58 / cg"
!
-defFilterIndex:defaultFilterIndex
+defFilterIndex:defaultFilterIndex
defFilterIndex := defaultFilterIndex.
"Modified: / 26-10-2010 / 18:46:01 / cg"
@@ -362,26 +364,26 @@
directory
"Answer the selected directory."
-
+
InitialDirectory isNil ifTrue:[
- ^ Filename currentDirectory pathName asFilename
+ ^ Filename currentDirectory pathName asFilename
].
^ InitialDirectory "? OperatingSystem getCurrentDirectory asFilename"
"Modified: / 26-10-2010 / 18:46:03 / cg"
!
-directory:directory
+directory:directory
"Sets the initial directory."
-
+
|aFilename|
directory isNil ifTrue:[
- ^ self.
+ ^ self.
].
aFilename := directory asFilename.
aFilename exists ifTrue:[
- InitialDirectory := aFilename
+ InitialDirectory := aFilename
].
"Modified: / 26-10-2010 / 18:46:06 / cg"
@@ -389,7 +391,7 @@
file
"Answer the selected file."
-
+
^ fileName
"Modified: / 26-10-2010 / 18:46:10 / cg"
@@ -405,7 +407,7 @@
self breakPoint:#fm.
fileName := aFileSpec.
"/ array := Filename splitPath: aFileSpec in: self directory .
-"/ dir :=
+"/ dir :=
"/ (( String with: ( array at: 1 ) with: $: ),
"/ ( ( array at: 2 ) isEmpty ifTrue: [ '\' ] ifFalse: [ array at: 2 ] )) asFilename.
"/ dir exists ifFalse: [ dir := OperatingSystem getCurrentDirectory asFilename ].
@@ -423,33 +425,33 @@
| filterString count defaultFilterIndex defaultFilter|
smalltalkFileFilters notNil ifTrue: [
- self
- addFilter: '*.cls' description: 'Class Files (*.CLS)';
- addFilter: '*.mth' description: 'Method Files (*.MTH)';
- addFilter: '*.st' description: 'Smalltalk Files (*.ST)';
- addFilter: '*.bnd' description: 'Library Bind Files (*.BND)';
- addFilter: '*.map' description: 'Library Map Files (*.MAP)';
- addFilter: '*.ini' description: 'Initialization Files (*.INI)';
- addFilter: '*.obj' description: 'Object Files (*.OBJ)';
- addFilter: '*.log' description: 'Log Files (*.LOG)'
+ self
+ addFilter: '*.cls' description: 'Class Files (*.CLS)';
+ addFilter: '*.mth' description: 'Method Files (*.MTH)';
+ addFilter: '*.st' description: 'Smalltalk Files (*.ST)';
+ addFilter: '*.bnd' description: 'Library Bind Files (*.BND)';
+ addFilter: '*.map' description: 'Library Map Files (*.MAP)';
+ addFilter: '*.ini' description: 'Initialization Files (*.INI)';
+ addFilter: '*.obj' description: 'Object Files (*.OBJ)';
+ addFilter: '*.log' description: 'Log Files (*.LOG)'
].
defaultFilter := self defFilter.
(fileName notEmptyOrNil and:[defaultFilter isNil]) ifTrue:[
- |initialFilenameSuffix|
- initialFilenameSuffix := fileName asFilename suffix.
- initialFilenameSuffix notEmptyOrNil ifTrue:[
- defaultFilter := '*.', initialFilenameSuffix.
- ].
+ |initialFilenameSuffix|
+ initialFilenameSuffix := fileName asFilename suffix.
+ initialFilenameSuffix notEmptyOrNil ifTrue:[
+ defaultFilter := '*.', initialFilenameSuffix.
+ ].
].
filterString := String new.
count := 0.
defaultFilterIndex := 0.
filters do: [:assoc |
- count := count + 1.
- assoc key = defaultFilter ifTrue: [ defaultFilterIndex := count ].
- filterString := filterString, assoc value, #[0] asString, assoc key , #[0] asString.
+ count := count + 1.
+ assoc key = defaultFilter ifTrue: [ defaultFilterIndex := count ].
+ filterString := filterString, assoc value, #[0] asString, assoc key , #[0] asString.
].
self defFilterIndex: defaultFilterIndex.
@@ -461,16 +463,16 @@
flags
"Private - Answers the dialog box current flags.
For compatibility reasons -> use style instead"
-
+
^ openFileNameStruct flags
"Modified: / 26-10-2010 / 18:46:38 / cg"
!
-flags:flags
+flags:flags
"Private - Specifies the dialog box creation flags.
Kept for compatibility reasons. Use style: instead"
-
+
self style:flags
"Modified: / 26-10-2010 / 18:46:42 / cg"
@@ -478,24 +480,24 @@
hideReadonly
"Hides the file dialog's Readonly check box. "
-
- self
- style:(self style bitOr: (self class commonDialogConstantAt:'OfnHidereadonly'))
+
+ self
+ style:(self style bitOr: (self class commonDialogConstantAt:'OfnHidereadonly'))
"Modified: / 26-10-2010 / 18:46:48 / cg"
!
-initialFileName:filename
+initialFileName:filename
"Sets the initial fileName string in the File Dialog."
-
+
|aString|
filename isNil ifTrue:[
- ^ self.
+ ^ self.
].
aString := filename.
filename isFilename ifTrue:[
- aString := filename baseName
+ aString := filename baseName
].
fileName := aString.
@@ -504,27 +506,27 @@
overwritePrompt
"Prompt if the user attempts to overwrite a file"
-
- self style:(self style
- bitOr: (self class commonDialogConstantAt:'OfnOverwriteprompt'))
+
+ self style:(self style
+ bitOr: (self class commonDialogConstantAt:'OfnOverwriteprompt'))
"Modified: / 26-10-2010 / 18:47:19 / cg"
!
-owner:ownerWindow
+owner:ownerWindow
"Sets the owner of the Dialog box."
-
+
|mainView handle|
ownerWindow isNil ifTrue:[
- ^ self
+ ^ self
].
mainView := ownerWindow windowGroup mainView.
mainView notNil ifTrue:[
- handle := mainView id.
- handle notNil ifTrue:[
- parent := handle address
- ].
+ handle := mainView id.
+ handle notNil ifTrue:[
+ parent := handle address
+ ].
].
"/ super owner: anOwner.
@@ -546,9 +548,9 @@
shareAware
"Allows a previously opened file to be opened
(e.g. change.log)"
-
- self
- style:(self style bitOr: (self class commonDialogConstantAt:'OfnShareaware'))
+
+ self
+ style:(self style bitOr: (self class commonDialogConstantAt:'OfnShareaware'))
"Modified: / 26-10-2010 / 18:47:36 / cg"
!
@@ -564,10 +566,10 @@
style := something.
!
-title:aTitle
+title:aTitle
"Specifies the string to be placed in the title bar of the
File dialog."
-
+
title := aTitle
"Modified: / 26-10-2010 / 18:47:41 / cg"
@@ -577,13 +579,13 @@
dapasOpenFile
"Brings up the default open file dialog "
-
+
self
- hideReadonly;
- shareAware;
- addFilter:'*.*' description:'All Files (*.*)'.
+ hideReadonly;
+ shareAware;
+ addFilter:'*.*' description:'All Files (*.*)'.
self defFilter isNil ifTrue:[
- self defFilter:'*.*'
+ self defFilter:'*.*'
].
self open.
@@ -592,11 +594,11 @@
dapasSaveFile
"Brings up the file save dialog."
-
+
self
- hideReadonly;
- overwritePrompt;
- addFilter:'*.*' description:'All Files (*.*)'.
+ hideReadonly;
+ overwritePrompt;
+ addFilter:'*.*' description:'All Files (*.*)'.
self save.
"Modified: / 26-10-2010 / 18:45:52 / cg"
@@ -604,13 +606,13 @@
openFileXml
"Brings up the default open file dialog "
-
+
self
- hideReadonly;
- shareAware;
- addFilter:'*.xml' description:'XML-Files'.
+ hideReadonly;
+ shareAware;
+ addFilter:'*.xml' description:'XML-Files'.
self defFilter isNil ifTrue:[
- self defFilter:'*.*'
+ self defFilter:'*.*'
].
self open.
@@ -619,14 +621,14 @@
openFileXmlZip
"Brings up the default open file dialog "
-
+
self
- hideReadonly;
- shareAware;
- addFilter:'*.xml' description:'XML-Datei';
- addFilter:'*.zip' description:'ZIP-Datei'.
+ hideReadonly;
+ shareAware;
+ addFilter:'*.xml' description:'XML-Datei';
+ addFilter:'*.zip' description:'ZIP-Datei'.
self defFilter isNil ifTrue:[
- self defFilter:'*.*'
+ self defFilter:'*.*'
].
self open.
@@ -637,22 +639,22 @@
cleanUp
"Private - Free openFileNameStruct."
-
+
self style:self flags.
lpstrFilter notNil ifTrue:[
- lpstrFilter free
+ lpstrFilter free
].
lpstrFile notNil ifTrue:[
- lpstrFile free
+ lpstrFile free
].
lpstrInitialDir notNil ifTrue:[
- lpstrInitialDir free
+ lpstrInitialDir free
].
lpstrTitle notNil ifTrue:[
- lpstrTitle free
+ lpstrTitle free
].
lpstrDefExt notNil ifTrue:[
- lpstrDefExt free
+ lpstrDefExt free
].
openFileNameStruct := nil
@@ -661,7 +663,7 @@
initialize
"Private - Initialize openFileNameStruct"
-
+
super initialize.
openFileNameStruct := OpenFilenameStructure new.
openFileNameStruct lStructSize:openFileNameStruct sizeInBytes.
@@ -680,11 +682,11 @@
sema := Semaphore new.
[
- [
- self basicOpen
- ] ensure:[
- sema signal.
- ].
+ [
+ self basicOpen
+ ] ensure:[
+ sema signal.
+ ].
] fork.
sema wait.
^ rslt
@@ -694,43 +696,44 @@
basicOpen
"Brings up the open file dialog."
-
+
|rslt openFileNameStructExternalBytes|
[
- self fillStruct.
- parent notNil ifTrue:[
- openFileNameStruct hwndOwner:parent.
- ].
- style notNil ifTrue:[
- openFileNameStruct flags:style
- ].
- openFileNameStructExternalBytes := ExternalBytes from:openFileNameStruct asByteArray.
- rslt := OperatingSystem getOpenFilename:openFileNameStructExternalBytes address.
- rslt ifTrue:[
- self getFileName
- ] ifFalse:[
- fileName := nil.
- error := OperatingSystem commDlgExtendedError.
- ].
+ self fillStruct.
+ parent notNil ifTrue:[
+ openFileNameStruct hwndOwner:parent.
+ ].
+ style notNil ifTrue:[
+ openFileNameStruct flags:style
+ ].
+ openFileNameStructExternalBytes := ExternalBytes from:openFileNameStruct asByteArray.
+ rslt := OperatingSystem getOpenFilename:openFileNameStructExternalBytes.
+ rslt ifTrue:[
+ self getFileName
+ ] ifFalse:[
+ fileName := nil.
+ error := OperatingSystem commDlgExtendedError.
+ ].
] ensure:[
- openFileNameStructExternalBytes free.
- self cleanUp.
+ openFileNameStructExternalBytes free.
+ self cleanUp.
].
"Created: / 23-01-2011 / 10:58:30 / cg"
+ "Modified: / 11-02-2014 / 11:24:23 / cg"
!
open
"Brings up the open file dialog."
-
+
true "false" ifTrue:[
- self synchronousOpen.
+ self synchronousOpen.
] ifFalse:[
- self asynchronousOpen.
+ self asynchronousOpen.
].
(error notNil and:[ error ~= 0 ]) ifTrue:[
- self error:error
+ self error:error
].
"Modified: / 23-01-2011 / 11:05:46 / cg"
@@ -739,63 +742,63 @@
openFile
"Brings up the default open file dialog. The title is set to 'Open File'
and fileSpec is set to '*.*'."
-
+
self openFile:'*.*'.
"Modified: / 26-10-2010 / 18:47:00 / cg"
!
-openFile:initialFileName
+openFile:initialFileName
"Brings up the default open file dialog. The title is set to 'Open File'
and fileSpec is set to patternString."
-
+
self title:'Open'.
initialFileName notNil ifTrue:[
- self initialFileName:initialFileName
+ self initialFileName:initialFileName
].
self
- hideReadonly;
- shareAware;
- addAllFilesFilter;
- addFilter:'*.txt' description:'Text Files (*.txt)'.
+ hideReadonly;
+ shareAware;
+ addAllFilesFilter;
+ addFilter:'*.txt' description:'Text Files (*.txt)'.
Smalltalk isStandAloneApp ifFalse:[
- self addSmalltalkFileFilters
+ self addSmalltalkFileFilters
].
self defFilter isNil ifTrue:[
- self defFilter:'*.*'
+ self defFilter:'*.*'
].
self open.
"Modified: / 26-10-2010 / 18:47:03 / cg"
!
-openFor:ownerWindow save:isSaveDialog title:titleOrNil inDirectory:dirPathOrNil initialAnswer:initialOrNil filter:filterArrayOrNil extension:extensionOrNil
+openFor:ownerWindow save:isSaveDialog title:titleOrNil inDirectory:dirPathOrNil initialAnswer:initialOrNil filter:filterArrayOrNil extension:extensionOrNil
self
- owner:ownerWindow;
- title:titleOrNil;
- initialFileName:initialOrNil;
- defFilter:extensionOrNil;
- directory:dirPathOrNil.
+ owner:ownerWindow;
+ title:titleOrNil;
+ initialFileName:initialOrNil;
+ defFilter:extensionOrNil;
+ directory:dirPathOrNil.
filterArrayOrNil notNil ifTrue:[
- filterArrayOrNil do:[:each |
- self addFilter:each last description:each first
- ].
+ filterArrayOrNil do:[:each |
+ self addFilter:each last description:each first
+ ].
].
self addAllFilesFilter.
-
+
"/ self defFilter isNil ifTrue:[ self defFilter: '*.*'].
-
+
isSaveDialog ifTrue:[
- self
- hideReadonly;
- overwritePrompt;
- save.
+ self
+ hideReadonly;
+ overwritePrompt;
+ save.
] ifFalse:[
- self
- hideReadonly;
- shareAware;
- open.
+ self
+ hideReadonly;
+ shareAware;
+ open.
].
^ self file
@@ -804,58 +807,57 @@
save
"Brings up the save file dialog."
-
+
|error rslt openFileNameStructExternalBytes|
[
- self fillStruct.
- parent notNil ifTrue:[
- openFileNameStruct hwndOwner:parent.
- ].
- style notNil ifTrue:[
- openFileNameStruct flags:style
- ].
- openFileNameStructExternalBytes := ExternalBytes
- from:openFileNameStruct asByteArray.
- rslt := OperatingSystem
- getSaveFilename:openFileNameStructExternalBytes address.
- rslt ifTrue:[
- self getFileName
- ] ifFalse:[
- fileName := nil.
- error := OperatingSystem commDlgExtendedError.
- ].
+ self fillStruct.
+ parent notNil ifTrue:[
+ openFileNameStruct hwndOwner:parent.
+ ].
+ style notNil ifTrue:[
+ openFileNameStruct flags:style
+ ].
+ openFileNameStructExternalBytes := ExternalBytes
+ from:openFileNameStruct asByteArray.
+ rslt := OperatingSystem getSaveFilename:openFileNameStructExternalBytes.
+ rslt ifTrue:[
+ self getFileName
+ ] ifFalse:[
+ fileName := nil.
+ error := OperatingSystem commDlgExtendedError.
+ ].
] ensure:[
- openFileNameStructExternalBytes free.
- self cleanUp.
+ openFileNameStructExternalBytes free.
+ self cleanUp.
].
(error notNil and:[ error ~= 0 ]) ifTrue:[
- self error:error
+ self error:error
].
- "Modified: / 27-10-2010 / 11:28:19 / cg"
+ "Modified: / 11-02-2014 / 21:13:43 / cg"
!
-saveFile:aString
+saveFile:aString
"Brings up the save file dialog with aString as the
default name. The title is set to 'Save File'."
-
+
self saveTitle:'Save File' fileName:aString
"Modified: / 26-10-2010 / 18:47:32 / cg"
!
-saveTitle:aTitle fileName:initialFileName
+saveTitle:aTitle fileName:initialFileName
"Brings up the file save dialog with aTitle and aString
as the default name."
-
+
self
- title:aTitle;
- initialFileName:initialFileName;
- hideReadonly;
- overwritePrompt;
- addAllFilesFilter;
- addFilter:'*.txt' description:'Text Files (*.txt)'.
+ title:aTitle;
+ initialFileName:initialFileName;
+ hideReadonly;
+ overwritePrompt;
+ addAllFilesFilter;
+ addFilter:'*.txt' description:'Text Files (*.txt)'.
self save.
"Modified: / 26-10-2010 / 18:47:35 / cg"
@@ -863,7 +865,7 @@
synchronousOpen
"Brings up the open file dialog."
-
+
self basicOpen.
"Modified: / 23-01-2011 / 10:59:20 / cg"
@@ -884,26 +886,26 @@
lpstrInitialDir := ExternalBytes newNullTerminatedFromString: self directory pathName.
openFileNameStruct
- lpstrFile: lpstrFile address ;
- nMaxFile: 512;
- lpstrFilter: lpstrFilter address ;
- nFilterIndex: defFilterIndex ; "set by filters"
- lpstrInitialDir: lpstrInitialDir address.
+ lpstrFile: lpstrFile address ;
+ nMaxFile: 512;
+ lpstrFilter: lpstrFilter address ;
+ nFilterIndex: defFilterIndex ; "set by filters"
+ lpstrInitialDir: lpstrInitialDir address.
( temp := defExtension) notNil ifTrue: [
- lpstrDefExt := ExternalBytes newNullTerminatedFromString: temp.
- openFileNameStruct lpstrDefExt: lpstrDefExt address].
+ lpstrDefExt := ExternalBytes newNullTerminatedFromString: temp.
+ openFileNameStruct lpstrDefExt: lpstrDefExt address].
( temp := title ) notNil ifTrue: [
- lpstrTitle := ExternalBytes newNullTerminatedFromString: temp.
- openFileNameStruct lpstrTitle: lpstrTitle address ].
+ lpstrTitle := ExternalBytes newNullTerminatedFromString: temp.
+ openFileNameStruct lpstrTitle: lpstrTitle address ].
"Modified: / 27-10-2010 / 10:56:01 / cg"
!
getFileName
"Private - get the filename"
-
+
|directory|
self style:self flags.
@@ -945,7 +947,7 @@
hInstance
"Get the receiver's hInstance field."
- ^ self doubleWordAt: 8+1
+ ^ self doubleWordAt: 8+1
!
hInstance: anObject
@@ -957,7 +959,7 @@
hwndOwner
"Get the receiver's hwndOwner field."
- ^ self doubleWordAt: 4+1
+ ^ self doubleWordAt: 4+1
!
hwndOwner: anObject
@@ -969,7 +971,7 @@
lCustData
"Get the receiver's lCustData field."
- ^ self doubleWordAt: 64+1
+ ^ self doubleWordAt: 64+1
!
lCustData: anObject
@@ -993,7 +995,7 @@
lpfnHook
"Get the receiver's lpfnHook field."
- ^ self doubleWordAt: 68+1
+ ^ self doubleWordAt: 68+1
!
lpfnHook: anObject
@@ -1005,7 +1007,7 @@
lpstrCustomFilter
"Get the receiver's lpstrCustomFilter field."
- ^ self doubleWordAt: 16+1
+ ^ self doubleWordAt: 16+1
!
lpstrCustomFilter: anObject
@@ -1017,7 +1019,7 @@
lpstrDefExt
"Get the receiver's lpstrDefExt field."
- ^ self doubleWordAt: 60+1
+ ^ self doubleWordAt: 60+1
!
lpstrDefExt: anObject
@@ -1029,7 +1031,7 @@
lpstrFile
"Get the receiver's lpstrFile field."
- ^ self doubleWordAt: 28+1
+ ^ self doubleWordAt: 28+1
!
lpstrFile: anObject
@@ -1041,7 +1043,7 @@
lpstrFileTitle
"Get the receiver's lpstrFileTitle field."
- ^ self doubleWordAt: 36+1
+ ^ self doubleWordAt: 36+1
!
lpstrFileTitle: anObject
@@ -1053,7 +1055,7 @@
lpstrFilter
"Get the receiver's lpstrFilter field."
- ^ self doubleWordAt: 12+1
+ ^ self doubleWordAt: 12+1
!
lpstrFilter: anObject
@@ -1065,7 +1067,7 @@
lpstrInitialDir
"Get the receiver's lpstrInitialDir field."
- ^ self doubleWordAt: 44+1
+ ^ self doubleWordAt: 44+1
!
lpstrInitialDir: anObject
@@ -1077,7 +1079,7 @@
lpstrTemplateName
"Get the receiver's lpstrTemplateName field."
- ^ self doubleWordAt: 72+1
+ ^ self doubleWordAt: 72+1
!
lpstrTemplateName: anObject
@@ -1101,7 +1103,7 @@
nFileExtension
"Get the receiver's nFileExtension field."
- ^ self unsignedShortAt: 58+1
+ ^ self unsignedShortAt: 58+1
!
nFileExtension: anObject
@@ -1113,7 +1115,7 @@
nFileOffset
"Get the receiver's nFileOffset field."
- ^ self unsignedShortAt: 56+1
+ ^ self unsignedShortAt: 56+1
!
nFileOffset: anObject
@@ -1125,7 +1127,7 @@
nFilterIndex
"Get the receiver's nFilterIndex field."
- ^ self doubleWordAt: 24+1
+ ^ self doubleWordAt: 24+1
!
nFilterIndex: anObject
@@ -1194,31 +1196,22 @@
aStream nextPutAll:'lpstrInitialDir: ', self lpstrInitialDir printString; cr.
aStream nextPutAll:'lpstrTemplateName: ', self lpstrTemplateName printString; cr.
aStream nextPutAll:'lStructSize: ', self lStructSize printString; cr.
- aStream nextPutAll:'nFileExtension: ', self nFileExtension printString; cr.
- aStream nextPutAll:'nFileOffset: ', self nFileOffset printString; cr.
- aStream nextPutAll:'nFilterIndex: ', self nFilterIndex printString; cr.
- aStream nextPutAll:'nMaxCustFilter: ', self nMaxCustFilter printString; cr.
- aStream nextPutAll:'nMaxFile: ', self nMaxFile printString; cr.
- aStream nextPutAll:'nMaxFileTitle: ', self nMaxFileTitle printString; cr.
+ aStream nextPutAll:'nFileExtension: ', self nFileExtension printString; cr.
+ aStream nextPutAll:'nFileOffset: ', self nFileOffset printString; cr.
+ aStream nextPutAll:'nFilterIndex: ', self nFilterIndex printString; cr.
+ aStream nextPutAll:'nMaxCustFilter: ', self nMaxCustFilter printString; cr.
+ aStream nextPutAll:'nMaxFile: ', self nMaxFile printString; cr.
+ aStream nextPutAll:'nMaxFileTitle: ', self nMaxFileTitle printString; cr.
! !
!Win32FileDialog class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.14 2013-09-24 19:56:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.17 2014-11-13 13:50:30 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.14 2013-09-24 19:56:30 cg Exp $'
-!
-
-version_HG
-
- ^ '$Changeset: <not expanded> $'
-!
-
-version_SVN
- ^ '$Id: Win32FileDialog.st 8074 2012-11-30 17:23:39Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.17 2014-11-13 13:50:30 cg Exp $'
! !