x
authorClaus Gittinger <cg@exept.de>
Wed, 27 Oct 2010 11:40:27 +0200
changeset 9606 fab06c8023c2
parent 9605 6649f3dd8e5f
child 9607 63f0d2689895
x
Win32FileDialog.st
--- a/Win32FileDialog.st	Wed Oct 27 11:40:16 2010 +0200
+++ b/Win32FileDialog.st	Wed Oct 27 11:40:27 2010 +0200
@@ -15,8 +15,7 @@
 	instanceVariableNames:'fileName openFileNameStruct filters lpstrFilter lpstrFile
 		lpstrInitialDir lpstrTitle lpstrDefExt defFilter defExtension
 		style title smalltalkFileFilters defFilterIndex parent'
-	classVariableNames:'InitialDirectory CommonDialogConstants FilterPatternDescriptions
-		Lock'
+	classVariableNames:'InitialDirectory CommonDialogConstants FilterPatternDescriptions'
 	poolDictionaries:''
 	category:'Interface-Tools-File'
 !
@@ -554,7 +553,10 @@
 !
 
 style
-    ^ style ? 8
+    style isNil ifTrue:[^ self class commonDialogConstantAt:'OfnNochangedir'].
+    ^ style
+
+    "Modified: / 27-10-2010 / 11:07:41 / cg"
 !
 
 style:something
@@ -662,11 +664,12 @@
     super initialize.
     openFileNameStruct := OpenFilenameStructure new.
     openFileNameStruct lStructSize:openFileNameStruct sizeInBytes.
+
     fileName := String new.
     filters := OrderedCollection new.
     self style:(self class commonDialogConstantAt:'OfnNochangedir')
 
-    "Modified: / 26-10-2010 / 18:46:52 / cg"
+    "Modified: / 27-10-2010 / 10:56:21 / cg"
 ! !
 
 !Win32FileDialog methodsFor:'opening'!
@@ -676,36 +679,32 @@
     
     |error rslt openFileNameStructExternalBytes|
 
-    Lock 
-        critical:[
-            [
-                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.
-                ].
-            ] ensure:[
-                openFileNameStructExternalBytes free.
-                self cleanUp.
-            ].
+    [
+        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.
+        ].
+    ] ensure:[
+        openFileNameStructExternalBytes free.
+        self cleanUp.
+    ].
     (error notNil and:[ error ~= 0 ]) ifTrue:[
         self error:error
     ].
 
-    "Modified: / 26-10-2010 / 18:46:55 / cg"
+    "Modified: / 27-10-2010 / 11:28:09 / cg"
 !
 
 openFile
@@ -748,6 +747,7 @@
         initialFileName:initialOrNil;
         defFilter:extensionOrNil;
         directory:dirPathOrNil.
+
     filterArrayOrNil notNil ifTrue:[
         filterArrayOrNil do:[:each | 
             self addFilter:each last description:each first
@@ -770,7 +770,7 @@
     ].
     ^ self file
 
-    "Modified: / 26-10-2010 / 18:47:16 / cg"
+    "Modified: / 27-10-2010 / 11:10:38 / cg"
 !
 
 save
@@ -778,36 +778,33 @@
     
     |error rslt openFileNameStructExternalBytes|
 
-    Lock 
-        critical:[
-            [
-                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.
-                ].
-            ] ensure:[
-                openFileNameStructExternalBytes free.
-                self cleanUp.
-            ].
+    [
+        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.
+        ].
+    ] ensure:[
+        openFileNameStructExternalBytes free.
+        self cleanUp.
+    ].
     (error notNil and:[ error ~= 0 ]) ifTrue:[
         self error:error
     ].
 
-    "Modified: / 26-10-2010 / 18:47:29 / cg"
+    "Modified: / 27-10-2010 / 11:28:19 / cg"
 !
 
 saveFile:aString 
@@ -844,14 +841,9 @@
 
     temp := fileName "asAsciiZ".
     lpstrFile := ExternalBytes new:512 withAll:0.
-    lpstrFile 
-        replaceBytesFrom:1 
-        to:temp size 
-        with:temp 
-        startingAt:1.
+    lpstrFile replaceBytesFrom:1 to:temp size with:temp startingAt:1.
 
     lpstrFilter := ExternalBytes newNullTerminatedFromString: self filters.
-
     lpstrInitialDir := ExternalBytes newNullTerminatedFromString: self directory pathName.
 
     openFileNameStruct
@@ -869,7 +861,7 @@
         lpstrTitle := ExternalBytes newNullTerminatedFromString: temp.
         openFileNameStruct lpstrTitle: lpstrTitle address ].
 
-    "Modified: / 26-10-2010 / 18:46:28 / cg"
+    "Modified: / 27-10-2010 / 10:56:01 / cg"
 !
 
 getFileName
@@ -1176,11 +1168,11 @@
 !Win32FileDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.9 2010-10-26 16:49:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.10 2010-10-27 09:40:27 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.9 2010-10-26 16:49:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Win32FileDialog.st,v 1.10 2010-10-27 09:40:27 cg Exp $'
 ! !
 
 Win32FileDialog initialize!