#UI_ENHANCEMENT by cg expecco_2_11_0 expecco_2_11_1
authorClaus Gittinger <cg@exept.de>
Fri, 20 Jan 2017 16:37:38 +0100
changeset 3374 2cb3e68941a8
parent 3373 2713168bbe02
child 3375 d2a64b772792
#UI_ENHANCEMENT by cg class: ImageEditor more flexibility to make menu items invisible in subclasses. added: #isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible #isStandAloneAndMethodSaveAndLoadMenuItemsVisible #methodSaveAndLoadMenuItemsVisible #modeMenuVisible changed: #helpSpec #menu #menuFile #menuToolbar
ImageEditor.st
--- a/ImageEditor.st	Fri Jan 20 15:56:05 2017 +0100
+++ b/ImageEditor.st	Fri Jan 20 16:37:38 2017 +0100
@@ -275,14 +275,245 @@
      the UIHelpTool may not be able to read the specification."
 
     "
-     UIHelpTool openOnClass:ImageEditor    
+     UIHelpTool openOnClass:ImageEditor
     "
 
     <resource: #help>
 
-    ^ super helpSpec addPairsFrom:(self localHelpTexts)
-
-    "Modified: / 19-01-2012 / 13:29:42 / cg"
+    ^ super helpSpec addPairsFrom:#(
+
+#colorMap
+'ColorMap functions'
+
+#colorMap1
+'Convert to depth-1 image'
+
+#colorMap1M
+'Convert to depth-1 image plus mask'
+
+#colorMap2
+'Convert to depth-2 image'
+
+#colorMap24
+'Convert to depth-24 image (rgb)'
+
+#colorMap2M
+'Convert to depth-2 image plus mask'
+
+#colorMap32
+'Convert to depth-32 image (rgba)'
+
+#colorMap4
+'Convert to depth-4 image'
+
+#colorMap4M
+'Convert to depth-4 image plus mask'
+
+#colorMap8
+'Convert to depth-8 image'
+
+#colorMap8M
+'Convert to depth-8 image plus mask'
+
+#colorMapTable
+'Shows a list of used colors of the image'
+
+#compressColormap
+'Remove unneeded entries from the colorMap'
+
+#cropAll
+'Find and remove all borders'
+
+#cropBottom
+'Find and remove bottom border'
+
+#cropLeft
+'Find and remove left border'
+
+#cropManual
+'Specify border(s) to remove.'
+
+#cropRight
+'Find and remove right border'
+
+#cropTop
+'Find and remove top border'
+
+#drawModeBox
+'Rectangle Drawing Mode'
+
+#drawModeCircle
+'Circle Drawing Mode'
+
+#drawModeCopy
+'Area Copy Mode'
+
+#drawModeFill
+'Flood Fill Mode'
+
+#drawModeFilledBox
+'Filled Rectangle Drawing Mode'
+
+#drawModePaste
+'Paste Mode'
+
+#drawModePasteUnder
+'Paste-Under Mode'
+
+#drawModePasteWithMask
+'Paste-with-Mask Mode'
+
+#drawModePoint
+'Point Drawing Mode'
+
+#drawModeSpecial
+'Special operations (select rectangle, then choose operation)'
+
+#drawModeSpray
+'Spray Drawing Mode'
+
+#edit3DProjection
+''
+
+#editFlipHorizontal
+'Flip the image horizontally'
+
+#editFlipVertical
+'Flip the image vertically'
+
+#editMagnifyImage
+'Magnify the image'
+
+#editNegate
+'Invert the images colors'
+
+#editResize
+'Resize the image (preserving the old image)'
+
+#editRotate
+'Rotate the image'
+
+#fileEditMask
+''
+
+#fileGrabImageFromScreen
+'Pick an image from the screen (specify area)'
+
+#fileGrabImageFromWindow
+'Pick an image from a window on the screen (click on window)'
+
+#fileLoadFromClass
+'Select and load an image from a resource method'
+
+#fileLoadFromFile
+'Select and load an image from a file'
+
+#fileLoadFromURL
+'Load an image from the net, given its URL'
+
+#fileNewImage
+'Create a new image'
+
+#fileNewImageFromClipboard
+'Create a new image and initialize it from the clipboard'
+
+#fileNewMaskFromClipboard
+'Paste the image in the clipboard as a mask. Must be a depth-1 image'
+
+#filePrint
+'Print the image on a postscript printer'
+
+#fileSave
+'Save the image'
+
+#fileSaveAs
+'Save the image to a file'
+
+#fileSaveButtonImageAs
+'Save an image of a button with the image to a file (for html use)'
+
+#fileSaveMaskAs
+'Save the mask of the image to a file'
+
+#fileSaveMethod
+'Save the image as resource method in the current class and selector'
+
+#fileSaveMethodAs
+'Save the image as resource method in a class'
+
+#magnificationNumber
+'Shows the current magnification'
+
+#magnifyImageDown
+'Decrease magnification'
+
+#magnifyImageUp
+'Increase magnification'
+
+#mouseKeyColorMode
+'Toggle between left and right mouse button color'
+
+#nextImageInSequence
+'Go to the next image in the animated gif image sequence.'
+
+#previewView
+'Shows a preview of the image'
+
+#previousImageInSequence
+'Go to the previous image in the animated gif image sequence.'
+
+#settingsGridMagnification
+'Change the grid magnification of the edit view'
+
+#xdrawModeBox
+'Rectangle'
+
+#xdrawModeCopy
+'Copy'
+
+#xdrawModeFill
+'Flood-fill'
+
+#xdrawModeFilledBox
+'Filled rectangle'
+
+#xdrawModePaste
+'Paste'
+
+#xdrawModePasteUnder
+'Paste under'
+
+#xdrawModePasteWithMask
+'Paste with Mask'
+
+#xdrawModePoint
+'Point'
+
+#xfileGrabImage
+'Pick from screen'
+
+#xfileLoadFromClass
+'Load from method...'
+
+#xfileLoadFromFile
+'Load from file...'
+
+#xfileNewImage
+'New image'
+
+#xfileSaveAs
+'Save to file...'
+
+#xfileSaveMaskAs
+'Save mask to file...'
+
+#xfileSaveMethod
+'Save as method'
+
+#xfileSaveMethodAs
+'Save as Method...'
+
+)
 !
 
 localHelpTexts
@@ -2202,6 +2433,7 @@
             label: 'Mode'
             translateLabel: true
             submenuChannel: modeMenu
+            isVisible: modeMenuVisible
           )
          (MenuItem
             label: 'Colors'
@@ -2843,6 +3075,7 @@
             activeHelpKey: fileLoadFromClass
             label: 'Load...'
             itemValue: doLoadFromClass
+            isVisible: methodSaveAndLoadMenuItemsVisible
           )
          (MenuItem
             activeHelpKey: fileLoadFromFile
@@ -2891,12 +3124,14 @@
             enabled: imageIsLoadedAndClassDefined
             label: 'Save'
             itemValue: doSaveMethod
+            isVisible: methodSaveAndLoadMenuItemsVisible
           )
          (MenuItem
             activeHelpKey: fileSaveMethodAs
             enabled: imageIsLoadedHolder
             label: 'Save As...'
             itemValue: doSaveMethodAs
+            isVisible: methodSaveAndLoadMenuItemsVisible
           )
          (MenuItem
             activeHelpKey: fileSaveAs
@@ -3130,7 +3365,6 @@
             activeHelpKey: fileNewImage
             label: 'newImage'
             itemValue: doNewImage
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary newImageIcon)
           )
@@ -3138,7 +3372,6 @@
             activeHelpKey: fileGrabImageFromScreen
             label: 'grabScreenImage'
             itemValue: grabScreenImage
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary snapshot24x24Icon)
           )
@@ -3149,9 +3382,8 @@
             activeHelpKey: fileLoadFromClass
             label: 'loadFromClass'
             itemValue: doLoadFromClass
-            translateLabel: true
             isButton: true
-            isVisible: isStandAlone
+            isVisible: isStandAloneAndMethodSaveAndLoadMenuItemsVisible
             submenuChannel: menuHistory
             labelImage: (ResourceRetriever XPToolbarIconLibrary loadImageFromMethodIcon)
             keepLinkedMenu: true
@@ -3161,9 +3393,8 @@
             enabled: imageIsLoadedHolder
             label: 'fileSaveMethodAs'
             itemValue: doSaveMethodAs
-            translateLabel: true
             isButton: true
-            isVisible: isStandAlone
+            isVisible: isStandAloneAndMethodSaveAndLoadMenuItemsVisible
             labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageAsMethodAsIcon)
           )
          (MenuItem
@@ -3171,19 +3402,18 @@
             enabled: imageIsLoadedHolder
             label: 'saveAsMethod'
             itemValue: doSaveMethod
-            translateLabel: true
             isButton: true
-            isVisible: isNotStandAlone
+            isVisible: isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
             labelImage: (ResourceRetriever ToolbarIconLibrary saveImageAsMethodIcon)
           )
          (MenuItem
             label: '-'
+            isVisible: methodSaveAndLoadMenuItemsVisible
           )
          (MenuItem
             activeHelpKey: fileLoadFromFile
             label: 'loadFromFile'
             itemValue: doLoadFromFile
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary loadImageFromFileIcon)
           )
@@ -3192,7 +3422,6 @@
             enabled: imageIsLoadedHolder
             label: 'saveAsFile'
             itemValue: doSaveImageFileAs
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary saveImageToFileAsIcon)
           )
@@ -3204,7 +3433,6 @@
             enabled: canUndoHolder
             label: 'Undo'
             itemValue: doUndo
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
           )
@@ -3217,7 +3445,6 @@
             enabled: imageHasPreviousImageHolder
             label: 'Previous Image'
             itemValue: previousImageInSequence
-            translateLabel: true
             isVisible: imageHasImageSequenceHolder
             labelImage: (ResourceRetriever ToolbarIconLibrary leftArrow24x24Icon)
           )
@@ -3226,7 +3453,6 @@
             enabled: imageHasNextImageHolder
             label: 'Next Image'
             itemValue: nextImageInSequence
-            translateLabel: true
             isVisible: imageHasImageSequenceHolder
             labelImage: (ResourceRetriever ToolbarIconLibrary rightArrow24x24Icon)
           )
@@ -4624,6 +4850,24 @@
     "Modified: / 16.3.1999 / 21:45:07 / cg"
 ! !
 
+!ImageEditor methodsFor:'menu item visibility'!
+
+isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
+    ^ self isNotStandAlone and:[ self methodSaveAndLoadMenuItemsVisible ]
+!
+
+isStandAloneAndMethodSaveAndLoadMenuItemsVisible
+    ^ self isStandAlone and:[ self methodSaveAndLoadMenuItemsVisible ]
+!
+
+methodSaveAndLoadMenuItemsVisible
+    ^ true
+!
+
+modeMenuVisible
+    ^ true
+! !
+
 !ImageEditor methodsFor:'menu modes'!
 
 colorMapMode