#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 33742cb3e68941a8
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
     1.1 --- a/ImageEditor.st	Fri Jan 20 15:56:05 2017 +0100
     1.2 +++ b/ImageEditor.st	Fri Jan 20 16:37:38 2017 +0100
     1.3 @@ -275,14 +275,245 @@
     1.4       the UIHelpTool may not be able to read the specification."
     1.5  
     1.6      "
     1.7 -     UIHelpTool openOnClass:ImageEditor    
     1.8 +     UIHelpTool openOnClass:ImageEditor
     1.9      "
    1.10  
    1.11      <resource: #help>
    1.12  
    1.13 -    ^ super helpSpec addPairsFrom:(self localHelpTexts)
    1.14 -
    1.15 -    "Modified: / 19-01-2012 / 13:29:42 / cg"
    1.16 +    ^ super helpSpec addPairsFrom:#(
    1.17 +
    1.18 +#colorMap
    1.19 +'ColorMap functions'
    1.20 +
    1.21 +#colorMap1
    1.22 +'Convert to depth-1 image'
    1.23 +
    1.24 +#colorMap1M
    1.25 +'Convert to depth-1 image plus mask'
    1.26 +
    1.27 +#colorMap2
    1.28 +'Convert to depth-2 image'
    1.29 +
    1.30 +#colorMap24
    1.31 +'Convert to depth-24 image (rgb)'
    1.32 +
    1.33 +#colorMap2M
    1.34 +'Convert to depth-2 image plus mask'
    1.35 +
    1.36 +#colorMap32
    1.37 +'Convert to depth-32 image (rgba)'
    1.38 +
    1.39 +#colorMap4
    1.40 +'Convert to depth-4 image'
    1.41 +
    1.42 +#colorMap4M
    1.43 +'Convert to depth-4 image plus mask'
    1.44 +
    1.45 +#colorMap8
    1.46 +'Convert to depth-8 image'
    1.47 +
    1.48 +#colorMap8M
    1.49 +'Convert to depth-8 image plus mask'
    1.50 +
    1.51 +#colorMapTable
    1.52 +'Shows a list of used colors of the image'
    1.53 +
    1.54 +#compressColormap
    1.55 +'Remove unneeded entries from the colorMap'
    1.56 +
    1.57 +#cropAll
    1.58 +'Find and remove all borders'
    1.59 +
    1.60 +#cropBottom
    1.61 +'Find and remove bottom border'
    1.62 +
    1.63 +#cropLeft
    1.64 +'Find and remove left border'
    1.65 +
    1.66 +#cropManual
    1.67 +'Specify border(s) to remove.'
    1.68 +
    1.69 +#cropRight
    1.70 +'Find and remove right border'
    1.71 +
    1.72 +#cropTop
    1.73 +'Find and remove top border'
    1.74 +
    1.75 +#drawModeBox
    1.76 +'Rectangle Drawing Mode'
    1.77 +
    1.78 +#drawModeCircle
    1.79 +'Circle Drawing Mode'
    1.80 +
    1.81 +#drawModeCopy
    1.82 +'Area Copy Mode'
    1.83 +
    1.84 +#drawModeFill
    1.85 +'Flood Fill Mode'
    1.86 +
    1.87 +#drawModeFilledBox
    1.88 +'Filled Rectangle Drawing Mode'
    1.89 +
    1.90 +#drawModePaste
    1.91 +'Paste Mode'
    1.92 +
    1.93 +#drawModePasteUnder
    1.94 +'Paste-Under Mode'
    1.95 +
    1.96 +#drawModePasteWithMask
    1.97 +'Paste-with-Mask Mode'
    1.98 +
    1.99 +#drawModePoint
   1.100 +'Point Drawing Mode'
   1.101 +
   1.102 +#drawModeSpecial
   1.103 +'Special operations (select rectangle, then choose operation)'
   1.104 +
   1.105 +#drawModeSpray
   1.106 +'Spray Drawing Mode'
   1.107 +
   1.108 +#edit3DProjection
   1.109 +''
   1.110 +
   1.111 +#editFlipHorizontal
   1.112 +'Flip the image horizontally'
   1.113 +
   1.114 +#editFlipVertical
   1.115 +'Flip the image vertically'
   1.116 +
   1.117 +#editMagnifyImage
   1.118 +'Magnify the image'
   1.119 +
   1.120 +#editNegate
   1.121 +'Invert the images colors'
   1.122 +
   1.123 +#editResize
   1.124 +'Resize the image (preserving the old image)'
   1.125 +
   1.126 +#editRotate
   1.127 +'Rotate the image'
   1.128 +
   1.129 +#fileEditMask
   1.130 +''
   1.131 +
   1.132 +#fileGrabImageFromScreen
   1.133 +'Pick an image from the screen (specify area)'
   1.134 +
   1.135 +#fileGrabImageFromWindow
   1.136 +'Pick an image from a window on the screen (click on window)'
   1.137 +
   1.138 +#fileLoadFromClass
   1.139 +'Select and load an image from a resource method'
   1.140 +
   1.141 +#fileLoadFromFile
   1.142 +'Select and load an image from a file'
   1.143 +
   1.144 +#fileLoadFromURL
   1.145 +'Load an image from the net, given its URL'
   1.146 +
   1.147 +#fileNewImage
   1.148 +'Create a new image'
   1.149 +
   1.150 +#fileNewImageFromClipboard
   1.151 +'Create a new image and initialize it from the clipboard'
   1.152 +
   1.153 +#fileNewMaskFromClipboard
   1.154 +'Paste the image in the clipboard as a mask. Must be a depth-1 image'
   1.155 +
   1.156 +#filePrint
   1.157 +'Print the image on a postscript printer'
   1.158 +
   1.159 +#fileSave
   1.160 +'Save the image'
   1.161 +
   1.162 +#fileSaveAs
   1.163 +'Save the image to a file'
   1.164 +
   1.165 +#fileSaveButtonImageAs
   1.166 +'Save an image of a button with the image to a file (for html use)'
   1.167 +
   1.168 +#fileSaveMaskAs
   1.169 +'Save the mask of the image to a file'
   1.170 +
   1.171 +#fileSaveMethod
   1.172 +'Save the image as resource method in the current class and selector'
   1.173 +
   1.174 +#fileSaveMethodAs
   1.175 +'Save the image as resource method in a class'
   1.176 +
   1.177 +#magnificationNumber
   1.178 +'Shows the current magnification'
   1.179 +
   1.180 +#magnifyImageDown
   1.181 +'Decrease magnification'
   1.182 +
   1.183 +#magnifyImageUp
   1.184 +'Increase magnification'
   1.185 +
   1.186 +#mouseKeyColorMode
   1.187 +'Toggle between left and right mouse button color'
   1.188 +
   1.189 +#nextImageInSequence
   1.190 +'Go to the next image in the animated gif image sequence.'
   1.191 +
   1.192 +#previewView
   1.193 +'Shows a preview of the image'
   1.194 +
   1.195 +#previousImageInSequence
   1.196 +'Go to the previous image in the animated gif image sequence.'
   1.197 +
   1.198 +#settingsGridMagnification
   1.199 +'Change the grid magnification of the edit view'
   1.200 +
   1.201 +#xdrawModeBox
   1.202 +'Rectangle'
   1.203 +
   1.204 +#xdrawModeCopy
   1.205 +'Copy'
   1.206 +
   1.207 +#xdrawModeFill
   1.208 +'Flood-fill'
   1.209 +
   1.210 +#xdrawModeFilledBox
   1.211 +'Filled rectangle'
   1.212 +
   1.213 +#xdrawModePaste
   1.214 +'Paste'
   1.215 +
   1.216 +#xdrawModePasteUnder
   1.217 +'Paste under'
   1.218 +
   1.219 +#xdrawModePasteWithMask
   1.220 +'Paste with Mask'
   1.221 +
   1.222 +#xdrawModePoint
   1.223 +'Point'
   1.224 +
   1.225 +#xfileGrabImage
   1.226 +'Pick from screen'
   1.227 +
   1.228 +#xfileLoadFromClass
   1.229 +'Load from method...'
   1.230 +
   1.231 +#xfileLoadFromFile
   1.232 +'Load from file...'
   1.233 +
   1.234 +#xfileNewImage
   1.235 +'New image'
   1.236 +
   1.237 +#xfileSaveAs
   1.238 +'Save to file...'
   1.239 +
   1.240 +#xfileSaveMaskAs
   1.241 +'Save mask to file...'
   1.242 +
   1.243 +#xfileSaveMethod
   1.244 +'Save as method'
   1.245 +
   1.246 +#xfileSaveMethodAs
   1.247 +'Save as Method...'
   1.248 +
   1.249 +)
   1.250  !
   1.251  
   1.252  localHelpTexts
   1.253 @@ -2202,6 +2433,7 @@
   1.254              label: 'Mode'
   1.255              translateLabel: true
   1.256              submenuChannel: modeMenu
   1.257 +            isVisible: modeMenuVisible
   1.258            )
   1.259           (MenuItem
   1.260              label: 'Colors'
   1.261 @@ -2843,6 +3075,7 @@
   1.262              activeHelpKey: fileLoadFromClass
   1.263              label: 'Load...'
   1.264              itemValue: doLoadFromClass
   1.265 +            isVisible: methodSaveAndLoadMenuItemsVisible
   1.266            )
   1.267           (MenuItem
   1.268              activeHelpKey: fileLoadFromFile
   1.269 @@ -2891,12 +3124,14 @@
   1.270              enabled: imageIsLoadedAndClassDefined
   1.271              label: 'Save'
   1.272              itemValue: doSaveMethod
   1.273 +            isVisible: methodSaveAndLoadMenuItemsVisible
   1.274            )
   1.275           (MenuItem
   1.276              activeHelpKey: fileSaveMethodAs
   1.277              enabled: imageIsLoadedHolder
   1.278              label: 'Save As...'
   1.279              itemValue: doSaveMethodAs
   1.280 +            isVisible: methodSaveAndLoadMenuItemsVisible
   1.281            )
   1.282           (MenuItem
   1.283              activeHelpKey: fileSaveAs
   1.284 @@ -3130,7 +3365,6 @@
   1.285              activeHelpKey: fileNewImage
   1.286              label: 'newImage'
   1.287              itemValue: doNewImage
   1.288 -            translateLabel: true
   1.289              isButton: true
   1.290              labelImage: (ResourceRetriever ToolbarIconLibrary newImageIcon)
   1.291            )
   1.292 @@ -3138,7 +3372,6 @@
   1.293              activeHelpKey: fileGrabImageFromScreen
   1.294              label: 'grabScreenImage'
   1.295              itemValue: grabScreenImage
   1.296 -            translateLabel: true
   1.297              isButton: true
   1.298              labelImage: (ResourceRetriever ToolbarIconLibrary snapshot24x24Icon)
   1.299            )
   1.300 @@ -3149,9 +3382,8 @@
   1.301              activeHelpKey: fileLoadFromClass
   1.302              label: 'loadFromClass'
   1.303              itemValue: doLoadFromClass
   1.304 -            translateLabel: true
   1.305              isButton: true
   1.306 -            isVisible: isStandAlone
   1.307 +            isVisible: isStandAloneAndMethodSaveAndLoadMenuItemsVisible
   1.308              submenuChannel: menuHistory
   1.309              labelImage: (ResourceRetriever XPToolbarIconLibrary loadImageFromMethodIcon)
   1.310              keepLinkedMenu: true
   1.311 @@ -3161,9 +3393,8 @@
   1.312              enabled: imageIsLoadedHolder
   1.313              label: 'fileSaveMethodAs'
   1.314              itemValue: doSaveMethodAs
   1.315 -            translateLabel: true
   1.316              isButton: true
   1.317 -            isVisible: isStandAlone
   1.318 +            isVisible: isStandAloneAndMethodSaveAndLoadMenuItemsVisible
   1.319              labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageAsMethodAsIcon)
   1.320            )
   1.321           (MenuItem
   1.322 @@ -3171,19 +3402,18 @@
   1.323              enabled: imageIsLoadedHolder
   1.324              label: 'saveAsMethod'
   1.325              itemValue: doSaveMethod
   1.326 -            translateLabel: true
   1.327              isButton: true
   1.328 -            isVisible: isNotStandAlone
   1.329 +            isVisible: isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
   1.330              labelImage: (ResourceRetriever ToolbarIconLibrary saveImageAsMethodIcon)
   1.331            )
   1.332           (MenuItem
   1.333              label: '-'
   1.334 +            isVisible: methodSaveAndLoadMenuItemsVisible
   1.335            )
   1.336           (MenuItem
   1.337              activeHelpKey: fileLoadFromFile
   1.338              label: 'loadFromFile'
   1.339              itemValue: doLoadFromFile
   1.340 -            translateLabel: true
   1.341              isButton: true
   1.342              labelImage: (ResourceRetriever ToolbarIconLibrary loadImageFromFileIcon)
   1.343            )
   1.344 @@ -3192,7 +3422,6 @@
   1.345              enabled: imageIsLoadedHolder
   1.346              label: 'saveAsFile'
   1.347              itemValue: doSaveImageFileAs
   1.348 -            translateLabel: true
   1.349              isButton: true
   1.350              labelImage: (ResourceRetriever ToolbarIconLibrary saveImageToFileAsIcon)
   1.351            )
   1.352 @@ -3204,7 +3433,6 @@
   1.353              enabled: canUndoHolder
   1.354              label: 'Undo'
   1.355              itemValue: doUndo
   1.356 -            translateLabel: true
   1.357              isButton: true
   1.358              labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
   1.359            )
   1.360 @@ -3217,7 +3445,6 @@
   1.361              enabled: imageHasPreviousImageHolder
   1.362              label: 'Previous Image'
   1.363              itemValue: previousImageInSequence
   1.364 -            translateLabel: true
   1.365              isVisible: imageHasImageSequenceHolder
   1.366              labelImage: (ResourceRetriever ToolbarIconLibrary leftArrow24x24Icon)
   1.367            )
   1.368 @@ -3226,7 +3453,6 @@
   1.369              enabled: imageHasNextImageHolder
   1.370              label: 'Next Image'
   1.371              itemValue: nextImageInSequence
   1.372 -            translateLabel: true
   1.373              isVisible: imageHasImageSequenceHolder
   1.374              labelImage: (ResourceRetriever ToolbarIconLibrary rightArrow24x24Icon)
   1.375            )
   1.376 @@ -4624,6 +4850,24 @@
   1.377      "Modified: / 16.3.1999 / 21:45:07 / cg"
   1.378  ! !
   1.379  
   1.380 +!ImageEditor methodsFor:'menu item visibility'!
   1.381 +
   1.382 +isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
   1.383 +    ^ self isNotStandAlone and:[ self methodSaveAndLoadMenuItemsVisible ]
   1.384 +!
   1.385 +
   1.386 +isStandAloneAndMethodSaveAndLoadMenuItemsVisible
   1.387 +    ^ self isStandAlone and:[ self methodSaveAndLoadMenuItemsVisible ]
   1.388 +!
   1.389 +
   1.390 +methodSaveAndLoadMenuItemsVisible
   1.391 +    ^ true
   1.392 +!
   1.393 +
   1.394 +modeMenuVisible
   1.395 +    ^ true
   1.396 +! !
   1.397 +
   1.398  !ImageEditor methodsFor:'menu modes'!
   1.399  
   1.400  colorMapMode