6140 ! |
6140 ! |
6141 |
6141 |
6142 doLoadFromFile |
6142 doLoadFromFile |
6143 "opens a dialog for loading an image from a file" |
6143 "opens a dialog for loading an image from a file" |
6144 |
6144 |
6145 |img file filters| |
6145 |img file filters title| |
6146 |
6146 |
6147 self checkModified ifFalse:[ ^ self ]. |
6147 self checkModified ifFalse:[ ^ self ]. |
6148 |
6148 |
6149 imageSeqNr := nil. |
6149 imageSeqNr := nil. |
6150 img := self image. |
6150 img := self image. |
6151 img notNil ifTrue: [ |
6151 img notNil ifTrue: [ |
6152 file := img fileName |
6152 file := img fileName |
6153 ]. |
6153 ]. |
6154 |
6154 |
6155 filters := FileSelectionBrowser loadImageFileNameFilters. |
6155 title := (resources string:'Load Image From'). |
6156 |
6156 |
6157 file notNil ifTrue:[ |
6157 UserPreferences current useNativeFileDialog ifTrue:[ |
6158 file := FileSelectionBrowser |
6158 self withWaitCursorDo:[ |
6159 request:'Load Image From' |
6159 file := Display |
6160 fileName:file |
6160 nativeFileDialogFor:(self window topView id) |
6161 withFileFilters:filters. |
6161 save:false |
6162 ] ifFalse:[ |
6162 title:title |
6163 file := FileSelectionBrowser |
6163 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory]) |
6164 request:'Load Image From' |
6164 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png']) |
6165 inDirectory:LastDirectory |
6165 flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR) |
6166 withFileFilters:filters. |
6166 filter: |
6167 ]. |
6167 { |
|
6168 { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp;*.jpg' } . |
|
6169 { (resources string:'All Files') . '*.*' } |
|
6170 } |
|
6171 extension:'png' |
|
6172 blocking:false. |
|
6173 ]. |
|
6174 ] ifFalse:[ |
|
6175 filters := FileSelectionBrowser loadImageFileNameFilters. |
|
6176 file notNil ifTrue:[ |
|
6177 file := FileSelectionBrowser |
|
6178 request:title |
|
6179 fileName:file |
|
6180 withFileFilters:filters. |
|
6181 ] ifFalse:[ |
|
6182 file := FileSelectionBrowser |
|
6183 request:title |
|
6184 inDirectory:LastDirectory |
|
6185 withFileFilters:filters. |
|
6186 ]. |
|
6187 ]. |
|
6188 |
6168 file notNil ifTrue:[ |
6189 file notNil ifTrue:[ |
6169 LastDirectory := file asFilename directoryName. |
6190 LastDirectory := file asFilename directoryName. |
6170 self loadFromFile:file |
6191 self loadFromFile:file |
6171 ] |
6192 ] |
|
6193 |
|
6194 "Modified: / 09-11-2010 / 14:25:56 / cg" |
6172 ! |
6195 ! |
6173 |
6196 |
6174 doLoadFromURL |
6197 doLoadFromURL |
6175 "opens a dialog for loading an image from a URL" |
6198 "opens a dialog for loading an image from a URL" |
6176 |
6199 |
6384 file := img fileName |
6407 file := img fileName |
6385 ]. |
6408 ]. |
6386 |
6409 |
6387 filters := FileSelectionBrowser saveImageFileNameFilters. |
6410 filters := FileSelectionBrowser saveImageFileNameFilters. |
6388 |
6411 |
6389 (FileSelectionBrowser isNil or:[DirectoryView isNil]) ifTrue:[ |
6412 UserPreferences current useNativeFileDialog ifTrue:[ |
6390 file notNil ifTrue:[ |
6413 self withWaitCursorDo:[ |
6391 file := Dialog requestFileName:'Save Image To' |
6414 file := Display |
6392 default:file |
6415 nativeFileDialogFor:(self window topView id) |
6393 pattern:(filters first). |
6416 save:true |
|
6417 title:(resources string:'Save Image To') |
|
6418 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory]) |
|
6419 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png']) |
|
6420 flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR) |
|
6421 filter: |
|
6422 { |
|
6423 { (resources string:'Image Files') . '*.tif;*.png;*.gif;*.bmp' } . |
|
6424 { (resources string:'All Files') . '*.*' } |
|
6425 } |
|
6426 extension:'png' |
|
6427 blocking:false. |
|
6428 ]. |
|
6429 ] ifFalse:[ |
|
6430 (FileSelectionBrowser isNil or:[DirectoryView isNil]) ifTrue:[ |
|
6431 file notNil ifTrue:[ |
|
6432 file := Dialog requestFileName:'Save Image To' |
|
6433 default:file |
|
6434 pattern:(filters first). |
|
6435 ] ifFalse:[ |
|
6436 file := Dialog |
|
6437 requestFileName:'Save Image To' |
|
6438 default:'image.png' |
|
6439 pattern:(filters first) |
|
6440 fromDirectory:LastDirectory. |
|
6441 ]. |
6394 ] ifFalse:[ |
6442 ] ifFalse:[ |
6395 file := Dialog |
6443 file notNil ifTrue:[ |
6396 requestFileName:'Save Image To' |
6444 file := FileSelectionBrowser |
6397 default:'image.png' |
6445 request:'Save Image To' |
6398 pattern:(filters first) |
6446 fileName:file |
6399 fromDirectory:LastDirectory. |
6447 withFileFilters:filters. |
6400 ]. |
6448 ] ifFalse:[ |
6401 ] ifFalse:[ |
6449 file := FileSelectionBrowser |
6402 file notNil ifTrue:[ |
6450 request:'Save Image To' |
6403 file := FileSelectionBrowser |
6451 inDirectory:LastDirectory |
6404 request:'Save Image To' |
6452 withFileFilters:filters. |
6405 fileName:file |
6453 ]. |
6406 withFileFilters:filters. |
|
6407 ] ifFalse:[ |
|
6408 file := FileSelectionBrowser |
|
6409 request:'Save Image To' |
|
6410 inDirectory:LastDirectory |
|
6411 withFileFilters:filters. |
|
6412 ]. |
6454 ]. |
6413 ]. |
6455 ]. |
6414 file notNil ifTrue:[ |
6456 file notNil ifTrue:[ |
6415 imageEditView saveImageFileAs:file. |
6457 imageEditView saveImageFileAs:file. |
6416 LastDirectory := file asFilename directoryName. |
6458 LastDirectory := file asFilename directoryName. |
6417 self updateLabelsAndHistory. |
6459 self updateLabelsAndHistory. |
6418 self clearModified. |
6460 self clearModified. |
6419 ] |
6461 ] |
6420 |
6462 |
6421 "Modified: / 18-10-2010 / 14:25:17 / cg" |
6463 "Modified: / 09-11-2010 / 14:25:41 / cg" |
6422 ! |
6464 ! |
6423 |
6465 |
6424 doSaveImageMaskFileAs |
6466 doSaveImageMaskFileAs |
6425 "opens a dialog for saving mask of current image to a file" |
6467 "opens a dialog for saving mask of current image to a file" |
6426 |
6468 |