--- a/ImageEditor.st Wed Feb 28 16:32:25 2018 +0100
+++ b/ImageEditor.st Mon Mar 12 15:39:58 2018 +0100
@@ -2394,10 +2394,12 @@
^
#(FullSpec
name: windowSpec
+ uuid: 'ea3a8340-1e4a-11b2-83b1-485b39758412'
window:
(WindowSpec
label: 'Image Editor'
name: 'Image Editor'
+ uuid: 'ea3a8bec-1e4a-11b2-83b1-485b39758412'
min: (Point 800 400)
bounds: (Rectangle 0 0 800 446)
menu: menu
@@ -2409,13 +2411,15 @@
(MenuPanelSpec
name: 'menuToolbarView'
layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
- style: (FontDescription helvetica medium roman 10)
+ style: (FontDescription helvetica medium roman 10 #'iso10646-1' nil nil)
+ uuid: 'ea3a98c6-1e4a-11b2-83b1-485b39758412'
menu: menuToolbar
showSeparatingLines: true
)
(VariableHorizontalPanelSpec
name: 'mainPanel'
layout: (LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
+ uuid: 'ea3a9eca-1e4a-11b2-83b1-485b39758412'
snapMode: both
barLevel: 0
component:
@@ -2423,6 +2427,7 @@
collection: (
(ViewSpec
name: 'leftView'
+ uuid: 'ea3aa3d4-1e4a-11b2-83b1-485b39758412'
level: 1
component:
(SpecCollection
@@ -2430,6 +2435,7 @@
(VariableVerticalPanelSpec
name: 'verticalPanel'
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ uuid: 'ea3aa672-1e4a-11b2-83b1-485b39758412'
level: 0
snapMode: both
component:
@@ -2437,12 +2443,14 @@
collection: (
(ViewSpec
name: 'ColorAnCropBox'
+ uuid: 'ea3aa992-1e4a-11b2-83b1-485b39758412'
component:
(SpecCollection
collection: (
(TabViewSpec
name: 'TabHeader1'
layout: (LayoutFrame 0 0 0 0 0 1 36 0)
+ uuid: 'ea3aab9a-1e4a-11b2-83b1-485b39758412'
model: colorCropTabSelectionIndexHolder
menu: colorCropTabLabelList
useIndex: true
@@ -2451,6 +2459,7 @@
(ViewSpec
name: 'ColorBox'
layout: (LayoutFrame 0 0 36 0 0 1 0 1)
+ uuid: 'ea3ab0ae-1e4a-11b2-83b1-485b39758412'
visibilityChannel: colorBoxVisibleHolder
component:
(SpecCollection
@@ -2458,6 +2467,7 @@
(MenuPanelSpec
name: 'MouseButtonColorToolBar'
layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0)
+ uuid: 'ea3ab2d4-1e4a-11b2-83b1-485b39758412'
level: 0
menu: menuMouseButtonColors
)
@@ -2465,29 +2475,32 @@
label: 'Label'
name: 'Label1'
layout: (LayoutFrame -160 1 0 0 -104 1 22 0)
+ activeHelpKey: drawingAlpha
+ uuid: 'ea3ab590-1e4a-11b2-83b1-485b39758412'
+ visibilityChannel: alphaVisibleHolder
translateLabel: true
labelChannel: alphaText
- visibilityChannel: alphaVisibleHolder
- activeHelpKey: drawingAlpha
)
(InputFieldSpec
name: 'EntryField1'
layout: (LayoutFrame -106 1 2 0 -56 1 22 0)
+ activeHelpKey: drawingAlpha
+ uuid: 'ea3aba90-1e4a-11b2-83b1-485b39758412'
+ visibilityChannel: alphaVisibleHolder
+ model: alphaHolder
+ type: numberInRange
acceptOnReturn: true
acceptOnTab: true
+ numChars: 3
+ minValue: 0
+ maxValue: 100
acceptOnPointerLeave: true
- visibilityChannel: alphaVisibleHolder
- activeHelpKey: drawingAlpha
- model: alphaHolder
- type: numberInRange
- numChars: 3
- minValue: 0
- maxValue: 100
)
(ViewSpec
name: 'Box1'
layout: (LayoutFrame -40 1.0 4 0 -26 1.0 18 0)
activeHelpKey: drawingColor1
+ uuid: 'ea3ac1c0-1e4a-11b2-83b1-485b39758412'
level: -1
backgroundChannel: drawingColor1Holder
)
@@ -2495,6 +2508,7 @@
name: 'Box2'
layout: (LayoutFrame -25 1.0 4 0 -11 1.0 18 0)
activeHelpKey: drawingColor2
+ uuid: 'ea3ac418-1e4a-11b2-83b1-485b39758412'
level: -1
backgroundChannel: drawingColor2Holder
)
@@ -2502,7 +2516,8 @@
name: 'colorDataSetView'
layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0)
activeHelpKey: colorMapTable
- style: (FontDescription helvetica medium roman 10)
+ style: (FontDescription helvetica medium roman 10 #'iso10646-1' nil nil)
+ uuid: 'ea3ac652-1e4a-11b2-83b1-485b39758412'
model: selectedColors
menu: colorMapMenuHolder
hasHorizontalScrollBar: true
@@ -2524,6 +2539,7 @@
(ViewSpec
name: 'FloodFillBox'
layout: (LayoutFrame 0 0 36 0 0 1 0 1)
+ uuid: 'ea3acfda-1e4a-11b2-83b1-485b39758412'
visibilityChannel: floodFillBoxVisibleHolder
component:
(SpecCollection
@@ -2531,6 +2547,7 @@
(UISubSpecification
name: 'SubSpecification2'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ uuid: 'ea3ad21e-1e4a-11b2-83b1-485b39758412'
minorKey: floodFillToleranceSpec
)
)
@@ -2540,6 +2557,7 @@
(ViewSpec
name: 'CropBox'
layout: (LayoutFrame 0 0 36 0 0 1 0 1)
+ uuid: 'ea3ad552-1e4a-11b2-83b1-485b39758412'
visibilityChannel: cropBoxVisibleHolder
component:
(SpecCollection
@@ -2547,6 +2565,7 @@
(UISubSpecification
name: 'SubSpecification1'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ uuid: 'ea3ad76e-1e4a-11b2-83b1-485b39758412'
minorKey: cropSpec
)
)
@@ -2560,6 +2579,7 @@
(ArbitraryComponentSpec
name: 'imagePreView'
activeHelpKey: previewView
+ uuid: 'ea3ad9a8-1e4a-11b2-83b1-485b39758412'
menu: previewMenu
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
@@ -2579,12 +2599,14 @@
)
(ViewSpec
name: 'rightView'
+ uuid: 'ea3ade8a-1e4a-11b2-83b1-485b39758412'
component:
(SpecCollection
collection: (
(MenuPanelSpec
name: 'ToolBar1'
layout: (LayoutFrame 0 0 0 0.0 28 0 0 1.0)
+ uuid: 'ea3ae0b0-1e4a-11b2-83b1-485b39758412'
level: 1
menu: toolsMenuToolbar
verticalLayout: true
@@ -2594,6 +2616,7 @@
(ViewSpec
name: 'editingView'
layout: (LayoutFrame 28 0.0 0 0.0 0 1.0 0 1.0)
+ uuid: 'ea3ae3bc-1e4a-11b2-83b1-485b39758412'
level: 1
component:
(SpecCollection
@@ -2601,6 +2624,7 @@
(ArbitraryComponentSpec
name: 'imageEditView'
layout: (LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0)
+ uuid: 'ea3ae5ec-1e4a-11b2-83b1-485b39758412'
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
hasBorder: false
@@ -2609,6 +2633,7 @@
(LabelSpec
name: 'coordLabel'
layout: (LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0)
+ uuid: 'ea3ae8da-1e4a-11b2-83b1-485b39758412'
level: -1
translateLabel: true
labelChannel: imageInfoHolder
@@ -2619,6 +2644,7 @@
name: 'magnifyDownButton'
layout: (LayoutFrame -80 1 -22 1 -58 1 0 1)
activeHelpKey: magnifyImageDown
+ uuid: 'ea3aebd2-1e4a-11b2-83b1-485b39758412'
translateLabel: true
model: doMagnifyDown
enableChannel: imageIsLoadedHolder
@@ -2630,6 +2656,7 @@
name: 'magnifyUpButton'
layout: (LayoutFrame -24 1 -22 1 -2 1 0 1)
activeHelpKey: magnifyImageUp
+ uuid: 'ea3af26c-1e4a-11b2-83b1-485b39758412'
translateLabel: true
model: doMagnifyUp
enableChannel: imageIsLoadedHolder
@@ -2641,6 +2668,7 @@
name: 'magnificationInputField'
layout: (LayoutFrame -57 1 -22 1 -26 1 0 1)
activeHelpKey: magnificationNumber
+ uuid: 'ea3af62c-1e4a-11b2-83b1-485b39758412'
enableChannel: imageIsLoadedHolder
model: magnificationHolder
type: numberInRange
@@ -2667,6 +2695,7 @@
(UISubSpecification
name: 'infoBarSubSpec'
layout: (LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
+ uuid: 'ea3afaf0-1e4a-11b2-83b1-485b39758412'
majorKey: ToolApplicationModel
minorKey: windowSpecForInfoBar
)
@@ -2674,8 +2703,6 @@
)
)
-
- "Modified: / 05-09-2017 / 10:46:56 / cg"
! !
!ImageEditor class methodsFor:'menu specs'!
@@ -5230,31 +5257,34 @@
imagePreView := self imagePreView.
changedObject == self tileModeHolder ifTrue:[
- imagePreView
+ image isNil ifTrue:[
+ ^ self
+ ].
+ imagePreView
tileMode:(changedObject value) tileOffset:(image extent);
- clear;
+ clear;
invalidate.
^ self
].
-
+
changedObject == self previewBackgroundColorHolder ifTrue:[
- clr := changedObject value isNil
+ clr := changedObject value isNil
ifTrue:[imageEditView viewBackground]
ifFalse:[Color perform:changedObject value].
- imagePreView
+ imagePreView
viewBackground:clr;
clear;
invalidate.
^ self
].
changedObject == self previewMagnificationHolder ifTrue:[
- imagePreView
+ imagePreView
magnificationFactor:(self previewMagnificationHolder value);
- clear;
+ clear;
invalidate.
- ^ self.
- ].
-
+ ^ self
+ ].
+
changedObject == self listOfColors ifTrue:[
something == #at: ifTrue:[
"/ colormap entry changed at aParameter
@@ -5272,14 +5302,14 @@
drawingColormap notNil ifTrue:[
drawingColormap size < clrIndex ifTrue:[
|newDrawingColormap|
-
+
newDrawingColormap := drawingColormap species new:clrIndex.
newDrawingColormap replaceFrom:1 with:drawingColormap.
drawingColormap := newDrawingColormap.
- ].
+ ].
drawingColormap at:clrIndex put:changedColor.
].
- ].
+ ].
^ self
].
^ self
@@ -5287,13 +5317,13 @@
changedObject == imageEditView undoImages ifTrue:[
self canUndoHolder value:(changedObject notEmpty).
- ^ self.
+ ^ self
].
changedObject == imageEditView ifTrue:[
something == #imageColors ifTrue:[
self updateListOfColorsAndColormapMode.
- ^ self.
+ ^ self
].
something == #image ifTrue:[
self updateAfterImageChange.
@@ -5303,7 +5333,7 @@
imagePreView tileMode:true tileOffset:(image extent).
].
self updateInfoLabel.
- ^ self.
+ ^ self
].
something == #subImageIn ifTrue:[
imagePreView image ~~ image ifTrue:[
@@ -5314,7 +5344,7 @@
] ifFalse:[
imagePreView invalidate:aParameter.
].
- ^ self.
+ ^ self
].
something == #selectedColor ifTrue:[
(aParameter isNil or:[aParameter = (Color colorId:0)]) ifTrue:[
@@ -5325,9 +5355,9 @@
clrIndex := self listOfColors indexOf:aParameter.
].
self selectedColors value:{clrIndex}. "/ selectionOfColor value:clrIndex.
- ^ self.
+ ^ self
].
- ^ self.
+ ^ self
].
changedObject == imageEditView modifiedHolder ifTrue:[
@@ -5338,7 +5368,7 @@
changedObject == imageEditView image ifTrue:[
"/ self halt:'to be implemented'.
self updateAfterImageChange.
- ^ self.
+ ^ self
].
super update:something with:aParameter from:changedObject
@@ -7445,11 +7475,11 @@
!
processSelectedColorsWith:aBlock
- "undoable color processing:
- the selected colors will be replaced by the value of aBlock
+ "undoable color processing:
+ the selected colors will be replaced by the value of aBlock
(which gets a color vector and must return a color vector)"
- |img cMap modifiedColormap oldColors newImage selectedColorIndices newColors maskOffset|
+ |img cMap modifiedColormap oldColors newImage selectedColorIndices newColors maskOffset processingSubset|
selectedColorIndices := self selectedColors value.
selectedColorIndices isEmptyOrNil ifTrue:[^ self].
@@ -7462,28 +7492,37 @@
].
cMap := img colorMap.
(cMap isNil) ifTrue:[
- oldColors := drawingColormap
- ] ifFalse:[
+ oldColors := drawingColormap.
+ processingSubset := false.
+ ] ifFalse:[
(cMap isMappedPalette or:[cMap isFixedPalette]) ifTrue:[
- oldColors := cMap asArray
- ] ifFalse:[
+ oldColors := cMap asArray.
+ processingSubset := false.
+ ] ifFalse:[
oldColors := selectedColorIndices collect:[:idx | cMap at:idx-maskOffset].
+ processingSubset := true.
].
].
imageEditView makeUndo.
modifiedColormap := cMap asNewArray.
- selectedColorIndices max > modifiedColormap size ifTrue:[
+ (selectedColorIndices max - maskOffset) > modifiedColormap size ifTrue:[
|t|
- t := Array new:selectedColorIndices max.
+ t := Array new:(selectedColorIndices max - maskOffset).
t replaceFrom:1 with:modifiedColormap.
modifiedColormap := t.
].
-
+
newColors := oldColors collect:aBlock.
- selectedColorIndices do:[:idx |
- modifiedColormap at:idx-maskOffset put:(newColors at:idx-maskOffset ifAbsent:[Color black])
- ].
+ processingSubset ifTrue:[
+ selectedColorIndices with:newColors do:[:idx :newColor |
+ modifiedColormap at:idx-maskOffset put:newColor.
+ ].
+ ] ifFalse:[
+ selectedColorIndices do:[:idx |
+ modifiedColormap at:idx-maskOffset put:(newColors at:idx-maskOffset ifAbsent:[self halt.Color black])
+ ].
+ ].
newImage := img species new
width:img width
@@ -7493,9 +7532,9 @@
(cMap isNil) ifTrue:[
"/ only a dummy...
- ] ifFalse:[
- newImage colorMap:modifiedColormap.
- newImage photometric:#palette.
+ ] ifFalse:[
+ newImage colorMap:modifiedColormap.
+ newImage photometric:#palette.
].
newImage fileName:img fileName.
newImage mask:(img mask copy).