ImageEditView.st
changeset 5286 23ec6e6fd179
parent 5277 4d6ef5c2aa64
child 5314 ecbb23555428
--- a/ImageEditView.st	Tue Oct 18 12:13:30 2016 +0200
+++ b/ImageEditView.st	Tue Oct 18 18:02:16 2016 +0200
@@ -2680,7 +2680,7 @@
             (self confirm:(ex errorString,'\\Debug?' withCRs)) ifTrue:[ ex reject ].
             ^ false                                 
         ] do: [   
-            |img depth bestDepth colorsUsed numColorsUsed category imageStoreStream sel mthd imageKey|
+            |img imageSaved depth bestDepth colorsUsed numColorsUsed category imageStoreStream sel mthd imageKey|
 
             img := self image.
             depth := bestDepth := img depth.
@@ -2695,17 +2695,24 @@
                     ]
                 ].
             ].
+            imageSaved := img.
             bestDepth < depth ifTrue:[
-                (Dialog 
-                    confirm:(resources stringWithCRs:'Hint:\\You can save some code space, by converting the image from a depth-%1 to a depth-%2 image first.\(only %3 colors used)\\Save anyway?'
-                                with:depth with:bestDepth with:numColorsUsed))
-                ifFalse:[
+                |answer|
+                
+                answer := Dialog 
+                    confirmWithCancel:(resources stringWithCRs:'Hint:\\You can save some code space, by converting the image from a depth-%1 to a depth-%2 image first.\(only %3 colors used)\\Convert before saving?'
+                                 with:depth with:bestDepth with:numColorsUsed).
+                answer isNil ifTrue:[
+                    "/ cancelled
                     ^ false
-                ]
+                ].
+                answer == true ifTrue:[
+                    imageSaved := (Image implementorForDepth:bestDepth) fromImage:imageSaved 
+                ].    
             ].
 
             SmalltalkCodeGeneratorTool
-                createImageSpecMethodFor:self image 
+                createImageSpecMethodFor:imageSaved
                 comment:(ResourceSpecEditor codeGenerationCommentForClass: ImageEditor) 
                 in:resourceClass class
                 selector:resourceSelector.