ImageEditor.st
changeset 3623 861c9acf54ed
parent 3598 76dd8e2f2fd8
child 3624 2b1381d671fc
equal deleted inserted replaced
3622:b9821260d1ab 3623:861c9acf54ed
  9217     title := (resources string:'Load Image from File:').
  9217     title := (resources string:'Load Image from File:').
  9218 
  9218 
  9219     (UserPreferences current useNativeFileDialog
  9219     (UserPreferences current useNativeFileDialog
  9220      and:[Screen current isWindowsPlatform]) ifTrue:[
  9220      and:[Screen current isWindowsPlatform]) ifTrue:[
  9221         self withWaitCursorDo:[
  9221         self withWaitCursorDo:[
       
  9222             file isNil ifTrue:[
       
  9223                 file := LastDirectory.
       
  9224                 file notNil ifTrue:[
       
  9225                     file := file asFilename / 'image.png'.
       
  9226                 ].
       
  9227             ].
       
  9228 
  9222             file := Screen current
  9229             file := Screen current
  9223                 nativeFileDialogFor:(self window topView id)
  9230                 nativeFileDialogWithTitle:title
  9224                 save:false
  9231                 defaultFilename:file
  9225                 title:title
  9232                 owningTopView:self window topView
  9226                 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
  9233                 filter:{
  9227                 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
  9234                     {(resources string:'Image Files'). '*.tif;*.png;*.gif;*.bmp;*.jpg'}.
  9228                 "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
  9235                     {(resources string:'All Files').   '*.*'} 
  9229                 filter:
  9236                 }
  9230                   {
  9237                 filterIndex:nil
  9231                           { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp;*.jpg'  } .
  9238                 doSave:false.
  9232                           { (resources string:'All Files') . '*.*'  } 
       
  9233                   }
       
  9234                 extension:nil
       
  9235                 "blocking:false".
       
  9236         ].
  9239         ].
  9237     ] ifFalse:[    
  9240     ] ifFalse:[    
  9238         filters := FileSelectionBrowser loadImageFileNameFilters.
  9241         filters := FileSelectionBrowser loadImageFileNameFilters.
  9239         file notNil ifTrue:[
  9242         file notNil ifTrue:[
  9240             file := FileSelectionBrowser
  9243             file := FileSelectionBrowser
  9253         LastDirectory := file asFilename directoryName.
  9256         LastDirectory := file asFilename directoryName.
  9254         self loadFromFile:file
  9257         self loadFromFile:file
  9255     ]
  9258     ]
  9256 
  9259 
  9257     "Modified: / 16-02-2017 / 10:53:41 / cg"
  9260     "Modified: / 16-02-2017 / 10:53:41 / cg"
       
  9261     "Modified: / 23-10-2018 / 10:02:51 / sr"
  9258 !
  9262 !
  9259 
  9263 
  9260 doLoadFromURL
  9264 doLoadFromURL
  9261     "opens a dialog for loading an image from a URL"
  9265     "opens a dialog for loading an image from a URL"
  9262 
  9266 
  9556     filters := FileSelectionBrowser saveImageFileNameFilters.
  9560     filters := FileSelectionBrowser saveImageFileNameFilters.
  9557 
  9561 
  9558     (UserPreferences current useNativeFileDialog
  9562     (UserPreferences current useNativeFileDialog
  9559      and:[Screen current isWindowsPlatform]) ifTrue:[
  9563      and:[Screen current isWindowsPlatform]) ifTrue:[
  9560         self withWaitCursorDo:[
  9564         self withWaitCursorDo:[
  9561             "/ windows only
  9565             file isNil ifTrue:[
       
  9566                 file := LastDirectory.
       
  9567                 file notNil ifTrue:[
       
  9568                     file := file asFilename / 'image.png'.
       
  9569                 ].
       
  9570             ].    
       
  9571 
  9562             file := Screen current
  9572             file := Screen current
  9563                 nativeFileDialogFor:(self window topView id)
  9573                 nativeFileDialogWithTitle:(resources string:'Save Image in File')
  9564                 save:true
  9574                 defaultFilename:file 
  9565                 title:(resources string:'Save Image in File')
  9575                 owningTopView:self window topView
  9566                 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
  9576                 filter:{
  9567                 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
  9577                     {(resources string:'Image Files'). '*.tif;*.png;*.gif;*.bmp'}.
  9568                 "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
  9578                     {(resources string:'All Files').   '*.*'} 
  9569                 filter:
  9579                 }
  9570                   {
  9580                 filterIndex:nil
  9571                           { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp'  } .
  9581                 doSave:true.
  9572                           { (resources string:'All Files') . '*.*'  } 
       
  9573                   }
       
  9574                 extension:nil
       
  9575                 "blocking:false".
       
  9576         ].
  9582         ].
  9577     ] ifFalse:[ 
  9583     ] ifFalse:[ 
  9578         img fileName isNil ifTrue:[
  9584         img fileName isNil ifTrue:[
  9579             LastDirectory notNil ifTrue:[
  9585             LastDirectory notNil ifTrue:[
  9580                 file isNil ifTrue:[
  9586                 file isNil ifTrue:[
  9615         self updateLabelsAndHistory.
  9621         self updateLabelsAndHistory.
  9616         self clearModifiedAndRememberImageSavedAsFile:file.
  9622         self clearModifiedAndRememberImageSavedAsFile:file.
  9617     ]
  9623     ]
  9618 
  9624 
  9619     "Modified: / 27-02-2017 / 01:26:05 / cg"
  9625     "Modified: / 27-02-2017 / 01:26:05 / cg"
       
  9626     "Modified: / 23-10-2018 / 10:02:44 / sr"
  9620 !
  9627 !
  9621 
  9628 
  9622 doSaveImageMaskFileAs
  9629 doSaveImageMaskFileAs
  9623     "opens a dialog for saving mask of current image to a file"
  9630     "opens a dialog for saving mask of current image to a file"
  9624 
  9631