Win32FileDialog.st
changeset 8037 04b0b1939a14
parent 8015 4e27ebbd5d79
child 8260 bd2f4ccb4fec
--- a/Win32FileDialog.st	Mon Mar 31 17:46:54 2008 +0200
+++ b/Win32FileDialog.st	Mon Mar 31 18:14:43 2008 +0200
@@ -305,8 +305,10 @@
 
 directory
         "Answer the selected directory."
-
-    ^ InitialDirectory ? OperatingSystem getCurrentDirectory asFilename
+    InitialDirectory isNil ifTrue:[
+        ^ Filename currentDirectory pathName asFilename
+    ].
+    ^ InitialDirectory "? OperatingSystem getCurrentDirectory asFilename"
 !
 
 directory: directory
@@ -377,7 +379,7 @@
     filters do: [:assoc |
         count := count + 1.
         assoc key = defaultFilter ifTrue: [ defaultFilterIndex := count ].
-        filterString := filterString, assoc value asAsciiZ, assoc key asAsciiZ 
+        filterString := filterString, assoc value, #[0] asString, assoc key , #[0] asString. 
     ].
 
     self defFilterIndex: defaultFilterIndex.
@@ -707,17 +709,17 @@
 
     | temp |
 
-    temp := fileName asAsciiZ.
-    lpstrFile := ExternalBytes new: 512.
+    temp := fileName "asAsciiZ".
+    lpstrFile := ExternalBytes new:512 withAll:0.
     lpstrFile 
         replaceBytesFrom:1 
         to:temp size 
         with:temp 
         startingAt:1.
 
-    lpstrFilter := ExternalBytes fromString: self filters.
+    lpstrFilter := ExternalBytes newNullTerminatedFromString: self filters.
 
-    lpstrInitialDir := ExternalBytes fromString: self directory pathName.
+    lpstrInitialDir := ExternalBytes newNullTerminatedFromString: self directory pathName.
 
     openFileNameStruct
         lpstrFile: lpstrFile address ;
@@ -727,11 +729,11 @@
         lpstrInitialDir: lpstrInitialDir address.
 
     ( temp := defExtension) notNil ifTrue: [
-        lpstrDefExt := ExternalBytes fromString: temp.
+        lpstrDefExt := ExternalBytes newNullTerminatedFromString: temp.
         openFileNameStruct lpstrDefExt: lpstrDefExt address].
 
     ( temp := title ) notNil ifTrue: [
-        lpstrTitle := ExternalBytes fromString: temp.
+        lpstrTitle := ExternalBytes newNullTerminatedFromString: temp.
         openFileNameStruct lpstrTitle: lpstrTitle address ].
 !
 
@@ -765,241 +767,241 @@
 flags
     "Answer the receiver's flags field as a Smalltalk object."
 
-    ^ self doubleWordAtOffset: 52
+    ^ self doubleWordAt: 52+1
 !
 
 flags: anObject
     "Set the receiver's flags field as a Smalltalk object."
 
-    ^ self doubleWordAtOffset: 52 put: anObject
+    ^ self doubleWordAt: 52+1 put: anObject
 !
 
 hInstance
     "Get the receiver's hInstance field."
 
-    ^ self doubleWordAtOffset: 4 
+    ^ self doubleWordAt: 8+1 
 !
 
 hInstance: anObject
     "Set the receiver's hInstance field to the value of anObject."
 
-    self doubleWordAtOffset: 8 put: anObject
+    self doubleWordAt: 8+1 put: anObject
 !
 
 hwndOwner
     "Get the receiver's hwndOwner field."
 
-    ^ self doubleWordAtOffset: 4 
+    ^ self doubleWordAt: 4+1 
 !
 
 hwndOwner: anObject
     "Set the receiver's hwndOwner field to the value of anObject."
 
-    self doubleWordAtOffset: 4 put: anObject
+    self doubleWordAt: 4+1 put: anObject
 !
 
 lCustData
     "Get the receiver's lCustData field."
 
-    ^ self doubleWordAtOffset: 64 
+    ^ self doubleWordAt: 64+1 
 !
 
 lCustData: anObject
     "Set the receiver's lCustData field as a Smalltalk object."
 
-    ^ self doubleWordAtOffset: 64 put: anObject
+    ^ self doubleWordAt: 64+1 put: anObject
 !
 
 lStructSize
     "Get the receiver's lStructSize field."
 
-    ^ self doubleWordAtOffset: 0
+    ^ self doubleWordAt: 0+1
 !
 
 lStructSize: anObject
     "Set the receiver's lStructSize field to the value of anObject."
 
-    self doubleWordAtOffset: 0 put: anObject
+    self doubleWordAt:0+1 put:anObject
 !
 
 lpfnHook
     "Get the receiver's lpfnHook field."
 
-    ^ self doubleWordAtOffset: 68 
+    ^ self doubleWordAt: 68+1 
 !
 
 lpfnHook: anObject
     "Set the receiver's lpfnHook field to the value of anObject."
 
-    self doubleWordAtOffset: 68 put: anObject
+    self doubleWordAt: 68+1 put: anObject
 !
 
 lpstrCustomFilter
     "Get the receiver's lpstrCustomFilter field."
 
-    ^ self doubleWordAtOffset: 16 
+    ^ self doubleWordAt: 16+1 
 !
 
 lpstrCustomFilter: anObject
     "Set the receiver's lpstrCustomFilter field to the value of anObject."
 
-    self doubleWordAtOffset: 16 put: anObject
+    self doubleWordAt: 16+1 put: anObject
 !
 
 lpstrDefExt
     "Get the receiver's lpstrDefExt field."
 
-    ^ self doubleWordAtOffset: 60 
+    ^ self doubleWordAt: 60+1 
 !
 
 lpstrDefExt: anObject
     "Set the receiver's lpstrDefExt field to the value of anObject."
 
-    self doubleWordAtOffset: 60 put: anObject
+    self doubleWordAt: 60+1 put: anObject
 !
 
 lpstrFile
     "Get the receiver's lpstrFile field."
 
-    ^ self doubleWordAtOffset: 28 
+    ^ self doubleWordAt: 28+1 
 !
 
 lpstrFile: anObject
     "Set the receiver's lpstrFile field to the value of anObject."
 
-    self doubleWordAtOffset: 28 put: anObject
+    self doubleWordAt: 28+1 put: anObject
 !
 
 lpstrFileTitle
     "Get the receiver's lpstrFileTitle field."
 
-    ^ self doubleWordAtOffset: 36 
+    ^ self doubleWordAt: 36+1 
 !
 
 lpstrFileTitle: anObject
     "Set the receiver's lpstrFileTitle field to the value of anObject."
 
-    self doubleWordAtOffset: 36 put: anObject
+    self doubleWordAt: 36+1 put: anObject
 !
 
 lpstrFilter
     "Get the receiver's lpstrFilter field."
 
-    ^ self doubleWordAtOffset: 12 
+    ^ self doubleWordAt: 12+1 
 !
 
 lpstrFilter: anObject
     "Set the receiver's lpstrFilter field to the value of anObject."
 
-    self doubleWordAtOffset: 12 put: anObject
+    self doubleWordAt: 12+1 put: anObject
 !
 
 lpstrInitialDir
     "Get the receiver's lpstrInitialDir field."
 
-    ^ self doubleWordAtOffset: 44 
+    ^ self doubleWordAt: 44+1 
 !
 
 lpstrInitialDir: anObject
     "Set the receiver's lpstrInitialDir field to the value of anObject."
 
-    self doubleWordAtOffset: 44 put: anObject
+    self doubleWordAt: 44+1 put: anObject
 !
 
 lpstrTemplateName
     "Get the receiver's lpstrTemplateName field."
 
-    ^ self doubleWordAtOffset: 72 
+    ^ self doubleWordAt: 72+1 
 !
 
 lpstrTemplateName: anObject
     "Set the receiver's lpstrTemplateName field to the value of anObject."
 
-    self doubleWordAtOffset: 72 put: anObject
+    self doubleWordAt: 72+1 put: anObject
 !
 
 lpstrTitle
     "Get the receiver's lpstrTitle field."
 
-    ^ self doubleWordAtOffset: 48 
+    ^ self doubleWordAt: 48+1
 !
 
 lpstrTitle: anObject
     "Set the receiver's lpstrTitle field to the value of anObject."
 
-    self doubleWordAtOffset: 48 put: anObject
+    self doubleWordAt: 48+1 put: anObject
 !
 
 nFileExtension
     "Get the receiver's nFileExtension field."
 
-    ^ self unsignedShortAtOffset: 58 
+    ^ self unsignedShortAt: 58+1 
 !
 
 nFileExtension: anObject
     "Set the receiver's nFileExtension field to the value of anObject."
 
-    self unsignedShortAtOffset: 58 put: anObject
+    self unsignedShortAt: 58+1 put: anObject
 !
 
 nFileOffset
     "Get the receiver's nFileOffset field."
 
-    ^ self unsignedShortAtOffset: 56 
+    ^ self unsignedShortAt: 56+1 
 !
 
 nFileOffset: anObject
     "Set the receiver's nFileOffset field to the value of anObject."
 
-    self unsignedShortAtOffset: 56 put: anObject
+    self unsignedShortAt: 56+1 put: anObject
 !
 
 nFilterIndex
     "Get the receiver's nFilterIndex field."
 
-    ^ self doubleWordAtOffset: 24 
+    ^ self doubleWordAt: 24+1 
 !
 
 nFilterIndex: anObject
     "Set the receiver's nFilterIndex field to the value of anObject."
 
-    self doubleWordAtOffset: 24 put: anObject
+    self doubleWordAt: 24+1 put: anObject
 !
 
 nMaxCustFilter
     "Get the receiver's nMaxCustFilter field."
 
-    ^ self doubleWordAtOffset: 20
+    ^ self doubleWordAt: 20+1
 !
 
 nMaxCustFilter: anObject
     "Set the receiver's nMaxCustFilter field to the value of anObject."
 
-    self doubleWordAtOffset: 20 put: anObject
+    self doubleWordAt: 20+1 put: anObject
 !
 
 nMaxFile
     "Get the receiver's nMaxFile field."
 
-    ^ self doubleWordAtOffset: 32
+    ^ self doubleWordAt: 32+1
 !
 
 nMaxFile: anObject
     "Set the receiver's nMaxFile field to the value of anObject."
 
-    self doubleWordAtOffset: 32 put: anObject
+    self doubleWordAt: 32+1 put: anObject
 !
 
 nMaxFileTitle
     "Get the receiver's nMaxFileTitle field."
 
-    ^ self doubleWordAtOffset: 40
+    ^ self doubleWordAt: 40+1
 !
 
 nMaxFileTitle: anObject
     "Set the receiver's nMaxFileTitle field to the value of anObject."
 
-    self doubleWordAtOffset: 40 put: anObject
+    self doubleWordAt: 40+1 put: anObject
 !
 
 sizeInBytes
@@ -1037,5 +1039,5 @@
 !Win32FileDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.1 2008-03-12 16:39:04 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.2 2008-03-31 16:14:43 cg Exp $'
 ! !