#FEATURE by cg draft
authorClaus Gittinger <cg@exept.de>
Sat, 18 Feb 2017 00:50:14 +0100
changeset 3411 fd6472405fd0
parent 3410 9b25f06de776
child 3412 bd8ab9274cbd
#FEATURE by cg class: ImageEditor added: #hasMaskHolder comment/format in: #openModalOnFile: changed: #doEditMask #hasMask #menuEdit #menuFile
ImageEditor.st
--- a/ImageEditor.st	Sat Feb 18 00:49:47 2017 +0100
+++ b/ImageEditor.st	Sat Feb 18 00:50:14 2017 +0100
@@ -110,13 +110,17 @@
 openModalOnFile:aFileName
     "opens an Image Editor on aFileName"
 
-    self openLoadingImageWith:[:editor | 
-        editor loadFromFile:aFileName.
-    ] modal:true.
+    self 
+        openLoadingImageWith:[:editor | 
+            editor loadFromFile:aFileName.
+        ] 
+        modal:true.
 
     "
      self openModalOnFile: '../../goodies/bitmaps/gifImages/back.gif'
     "
+
+    "Modified (format): / 18-02-2017 / 00:17:52 / cg"
 !
 
 openModalOnImage:anImage
@@ -2969,7 +2973,7 @@
           )
          (MenuItem
             activeHelpKey: fileEditMask
-            enabled: imageIsLoadedHolder
+            enabled: hasMaskHolder
             label: 'Edit Mask'
             itemValue: doEditMask
             translateLabel: true
@@ -3021,7 +3025,7 @@
         nil
       )
 
-    "Modified: / 16-02-2017 / 11:01:52 / cg"
+    "Modified: / 18-02-2017 / 00:41:45 / cg"
 !
 
 menuFile
@@ -3138,7 +3142,7 @@
           )
          (MenuItem
             activeHelpKey: fileSaveMaskAs
-            enabled: imageIsLoadedHolder
+            enabled: hasMaskHolder
             label: 'Save Mask to File...'
             itemValue: doSaveImageMaskFileAs
           )
@@ -3200,6 +3204,8 @@
         nil
         nil
       )
+
+    "Modified: / 18-02-2017 / 00:41:36 / cg"
 !
 
 menuMouseButtonColors
@@ -5202,9 +5208,18 @@
 !
 
 hasMask
+    self image isNil ifTrue:[^ false].
+    self image mask isNil ifTrue:[^ false].
     ^ colorMapMode value notNil and:[colorMapMode value startsWith:'mask']
 
-    "Created: / 18.8.1998 / 17:17:38 / cg"
+    "Created: / 18-08-1998 / 17:17:38 / cg"
+    "Modified: / 18-02-2017 / 00:40:25 / cg"
+!
+
+hasMaskHolder
+    ^ [ self hasMask ]
+
+    "Created: / 18-02-2017 / 00:41:19 / cg"
 !
 
 modified
@@ -6948,7 +6963,13 @@
 !
 
 doEditMask
-    self image mask edit
+    |mask|
+
+    (mask := self image mask) notNil ifTrue:[
+        mask edit
+    ].
+
+    "Modified: / 18-02-2017 / 00:38:51 / cg"
 !
 
 doFlipHorizontal