#FEATURE by cg draft
authorClaus Gittinger <cg@exept.de>
Fri, 20 Jan 2017 17:00:03 +0100
changeset 3375 d2a64b772792
parent 3374 2cb3e68941a8
child 3376 c508738114fa
#FEATURE by cg class: ImageEditor class definition added: #clearModifiedAndRememberSavedImage #savedImage comment/format in: #doSaveButtonImageToFileAs #documentation #openOnClass:andSelector: #openOnFile: #openOnImage: changed: #doSaveImageFile (send #clearModifiedAndRememberSavedImage instead of #clearModified) #doSaveImageFileAs (send #clearModifiedAndRememberSavedImage instead of #clearModified) #doSaveMethod (send #clearModifiedAndRememberSavedImage instead of #clearModified) #doSaveMethodAs (send #clearModifiedAndRememberSavedImage instead of #clearModified)
ImageEditor.st
--- a/ImageEditor.st	Fri Jan 20 16:37:38 2017 +0100
+++ b/ImageEditor.st	Fri Jan 20 17:00:03 2017 +0100
@@ -17,7 +17,7 @@
 	instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode
 		selectedColorIndex postOpenAction imageSeqNr drawingColormap
 		lastShiftUsedWrap lastGrabbedScreenArea
-		allowedToChangeImageDimensionAndDepth'
+		allowedToChangeImageDimensionAndDepth savedImage'
 	classVariableNames:'LastDirectory LastSizeString MaskClipboard LastColormapMode
 		DefaultRelativeSizes LastURL'
 	poolDictionaries:''
@@ -43,6 +43,8 @@
 documentation
 "
     Image Editor allows you to create, design, modify or just inspect images.
+    It is also used subclasses as a tool to post-process captured screen images and
+    bitmaps in expecco.
 
     [start with:]
         ImageEditor open
@@ -137,9 +139,11 @@
 openOnClass:aClass andSelector:aSelector
     "opens an Image Editor on aClass and aSelector"
 
-    self openLoadingImageWith:[:editor | 
-        editor loadFromClass:aClass theNonMetaclass andSelector:aSelector.
-    ] modal:false.
+    self 
+        openLoadingImageWith:[:editor | 
+            editor loadFromClass:aClass theNonMetaclass andSelector:aSelector
+        ] 
+        modal:false.
 
     "
      self openOnClass:self andSelector:#leftMouseKeyIcon
@@ -152,9 +156,9 @@
 openOnFile:aFileName
     "opens an Image Editor on aFileName"
 
-    self openLoadingImageWith:[:editor | 
-        editor loadFromFile:aFileName.
-    ] modal:false.
+    self    
+        openLoadingImageWith:[:editor | editor loadFromFile:aFileName ] 
+        modal:false.
 
     "
      self openOnFile: '../../goodies/bitmaps/gifImages/back.gif'
@@ -166,9 +170,9 @@
 openOnImage:anImage
     "opens an Image Editor on anImage"
 
-    self openLoadingImageWith:[:editor | 
-        editor loadFromImage: anImage.
-    ] modal:false
+    self 
+        openLoadingImageWith:[:editor | editor loadFromImage: anImage ] 
+        modal:false
 
     "
      self openOnImage: Icon startIcon
@@ -3890,6 +3894,13 @@
 
 resourceClass:aClass
     imageEditView resourceClass:aClass
+!
+
+savedImage
+    "if user did a save, return what was saved last.
+     Otherwise, this returns nil"
+
+    ^ savedImage
 ! !
 
 !ImageEditor methodsFor:'accessing-behavior'!
@@ -4923,6 +4934,13 @@
     "Modified: / 29.7.1998 / 18:55:24 / cg"
 !
 
+clearModifiedAndRememberSavedImage
+    "called after a save-to-file/or whereever operation"
+    
+    self clearModified.
+    savedImage := self image.
+!
+
 pointFromString:aString
     |p s x y|
 
@@ -7443,7 +7461,8 @@
 !
 
 doSaveButtonImageToFileAs
-    "opens a dialog for saving current image to a file"
+    "opens a dialog for saving current image to a file.
+     Saved as a button image (i.e. with a frame around)"
 
     imageEditView saveButtonImageToFileAs.
     self updateLabelsAndHistory.
@@ -7453,7 +7472,7 @@
     "saves current image to current file"
 
     imageEditView save.
-    self clearModified.
+    self clearModifiedAndRememberSavedImage.
 !
 
 doSaveImageFileAs
@@ -7517,7 +7536,7 @@
         imageEditView saveImageFileAs:file.
         LastDirectory := file asFilename directoryName.
         self updateLabelsAndHistory.
-        self clearModified.
+        self clearModifiedAndRememberSavedImage.
     ]
 
     "Modified: / 14-12-2010 / 13:51:47 / cg"
@@ -7534,7 +7553,7 @@
 
     imageEditView saveMethod ifTrue:[
         self updateLabelsAndHistory.
-        self clearModified.
+        self clearModifiedAndRememberSavedImage.
     ]
 !
 
@@ -7543,7 +7562,7 @@
 
     imageEditView saveMethodAs ifTrue:[
         self updateLabelsAndHistory.
-        self clearModified.
+        self clearModifiedAndRememberSavedImage.
     ]
 !