#FEATURE by sr
authorsr
Tue, 23 Oct 2018 10:20:43 +0200
changeset 3623 861c9acf54ed
parent 3622 b9821260d1ab
child 3624 2b1381d671fc
#FEATURE by sr call new implementation of native file dialog class: ImageEditor changed: #doLoadFromFile #doSaveImageFileAs
ImageEditor.st
--- a/ImageEditor.st	Sun Oct 14 14:50:43 2018 +0200
+++ b/ImageEditor.st	Tue Oct 23 10:20:43 2018 +0200
@@ -9219,20 +9219,23 @@
     (UserPreferences current useNativeFileDialog
      and:[Screen current isWindowsPlatform]) ifTrue:[
         self withWaitCursorDo:[
+            file isNil ifTrue:[
+                file := LastDirectory.
+                file notNil ifTrue:[
+                    file := file asFilename / 'image.png'.
+                ].
+            ].
+
             file := Screen current
-                nativeFileDialogFor:(self window topView id)
-                save:false
-                title:title
-                inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
-                initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
-                "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
-                filter:
-                  {
-                          { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp;*.jpg'  } .
-                          { (resources string:'All Files') . '*.*'  } 
-                  }
-                extension:nil
-                "blocking:false".
+                nativeFileDialogWithTitle:title
+                defaultFilename:file
+                owningTopView:self window topView
+                filter:{
+                    {(resources string:'Image Files'). '*.tif;*.png;*.gif;*.bmp;*.jpg'}.
+                    {(resources string:'All Files').   '*.*'} 
+                }
+                filterIndex:nil
+                doSave:false.
         ].
     ] ifFalse:[    
         filters := FileSelectionBrowser loadImageFileNameFilters.
@@ -9255,6 +9258,7 @@
     ]
 
     "Modified: / 16-02-2017 / 10:53:41 / cg"
+    "Modified: / 23-10-2018 / 10:02:51 / sr"
 !
 
 doLoadFromURL
@@ -9558,21 +9562,23 @@
     (UserPreferences current useNativeFileDialog
      and:[Screen current isWindowsPlatform]) ifTrue:[
         self withWaitCursorDo:[
-            "/ windows only
+            file isNil ifTrue:[
+                file := LastDirectory.
+                file notNil ifTrue:[
+                    file := file asFilename / 'image.png'.
+                ].
+            ].    
+
             file := Screen current
-                nativeFileDialogFor:(self window topView id)
-                save:true
-                title:(resources string:'Save Image in File')
-                inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
-                initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
-                "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
-                filter:
-                  {
-                          { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp'  } .
-                          { (resources string:'All Files') . '*.*'  } 
-                  }
-                extension:nil
-                "blocking:false".
+                nativeFileDialogWithTitle:(resources string:'Save Image in File')
+                defaultFilename:file 
+                owningTopView:self window topView
+                filter:{
+                    {(resources string:'Image Files'). '*.tif;*.png;*.gif;*.bmp'}.
+                    {(resources string:'All Files').   '*.*'} 
+                }
+                filterIndex:nil
+                doSave:true.
         ].
     ] ifFalse:[ 
         img fileName isNil ifTrue:[
@@ -9617,6 +9623,7 @@
     ]
 
     "Modified: / 27-02-2017 / 01:26:05 / cg"
+    "Modified: / 23-10-2018 / 10:02:44 / sr"
 !
 
 doSaveImageMaskFileAs