--- a/ImageEditor.st Fri Feb 03 13:15:36 2017 +0100
+++ b/ImageEditor.st Fri Feb 03 22:08:53 2017 +0100
@@ -1607,7 +1607,7 @@
label: 'Crop Border(s)'
name: 'Crop Border(s)'
min: (Point 10 10)
- bounds: (Rectangle 0 0 290 199)
+ bounds: (Rectangle 0 0 332 224)
)
component:
(SpecCollection
@@ -1633,7 +1633,7 @@
(ActionButtonSpec
label: 'Now'
name: 'GropLeftNowButton'
- layout: (LayoutFrame 148 0 21 0 221 0 50 0)
+ layout: (LayoutFrame 148 0 21 0 200 0 50 0)
activeHelpKey: gropLeft
translateLabel: true
resizeForLabel: true
@@ -1663,7 +1663,7 @@
(ActionButtonSpec
label: 'Now'
name: 'GropRightButton'
- layout: (LayoutFrame 148 0 51 0 221 0 80 0)
+ layout: (LayoutFrame 148 0 51 0 200 0 80 0)
activeHelpKey: gropRight
translateLabel: true
resizeForLabel: true
@@ -1693,7 +1693,7 @@
(ActionButtonSpec
label: 'Now'
name: 'GropTopButton'
- layout: (LayoutFrame 148 0 81 0 221 0 110 0)
+ layout: (LayoutFrame 148 0 81 0 200 0 110 0)
activeHelpKey: gropTop
translateLabel: true
resizeForLabel: true
@@ -1723,7 +1723,7 @@
(ActionButtonSpec
label: 'Now'
name: 'GropBottomButton'
- layout: (LayoutFrame 148 0 111 0 221 0 140 0)
+ layout: (LayoutFrame 148 0 111 0 200 0 140 0)
activeHelpKey: gropBottom
translateLabel: true
resizeForLabel: true
@@ -1734,7 +1734,7 @@
)
(HorizontalPanelViewSpec
name: 'HorizontalPanel1'
- layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
+ layout: (LayoutFrame 0 0.0 -30 1 -16 1.0 0 1)
horizontalLayout: fitSpace
verticalLayout: center
horizontalSpace: 3
@@ -1746,11 +1746,12 @@
(ActionButtonSpec
label: 'Cancel'
name: 'Button1'
+ visibilityChannel: cropBoxIsDialog
translateLabel: true
resizeForLabel: true
tabable: true
model: cancel
- extent: (Point 91 22)
+ extent: (Point 100 28)
)
(ActionButtonSpec
label: 'Apply'
@@ -1759,16 +1760,17 @@
resizeForLabel: true
tabable: true
model: applyAction
- extent: (Point 91 22)
+ extent: (Point 100 28)
)
(ActionButtonSpec
label: 'OK'
name: 'Button2'
+ visibilityChannel: cropBoxIsDialog
translateLabel: true
resizeForLabel: true
tabable: true
model: accept
- extent: (Point 92 22)
+ extent: (Point 100 28)
)
)
@@ -2177,7 +2179,7 @@
(SpecCollection
collection: (
(ViewSpec
- name: 'View1'
+ name: 'ColorBox'
component:
(SpecCollection
collection: (
@@ -2185,6 +2187,7 @@
name: 'MouseButtonColorToolBar'
layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0)
level: 0
+ visibilityChannel: colorBoxVisibleHolder
menu: menuMouseButtonColors
)
(DataSetSpec
@@ -2192,6 +2195,7 @@
layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0)
activeHelpKey: colorMapTable
style: (FontDescription helvetica medium roman 10)
+ visibilityChannel: colorBoxVisibleHolder
model: selectedColors
menu: colorMapMenu
hasHorizontalScrollBar: true
@@ -2206,6 +2210,22 @@
verticalSpacing: 1
columnAdaptor: colorColumnAdaptor
)
+ (ViewSpec
+ name: 'CropBox'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ visibilityChannel: cropBoxVisibleHolder
+ component:
+ (SpecCollection
+ collection: (
+ (UISubSpecification
+ name: 'SubSpecification1'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ minorKey: cropDialogSpec
+ )
+ )
+
+ )
+ )
)
)
@@ -4017,12 +4037,40 @@
^ self imageIsLoadedAndNotReadonlyHolder
!
+colorBoxVisibleHolder
+ |holder|
+
+ (holder := builder bindingAt:#colorBoxVisibleHolder) isNil ifTrue:[
+ builder aspectAt:#colorBoxVisibleHolder put:(holder := true asValue).
+ ].
+ ^ holder
+
+ "Created: / 03-02-2017 / 11:20:21 / cg"
+!
+
colorColumnAdaptor
^ self
"Created: / 26.7.1998 / 12:17:03 / cg"
!
+cropBoxIsDialog
+ ^ true
+
+ "Created: / 03-02-2017 / 11:23:50 / cg"
+!
+
+cropBoxVisibleHolder
+ |holder|
+
+ (holder := builder bindingAt:#cropBoxVisibleHolder) isNil ifTrue:[
+ builder aspectAt:#cropBoxVisibleHolder put:(holder := false asValue).
+ ].
+ ^ holder
+
+ "Created: / 03-02-2017 / 11:20:13 / cg"
+!
+
hasClassAndSelectorDefinedHolder
^ [
|cls|
@@ -4391,7 +4439,7 @@
!
update:something with:aParameter from:changedObject
- |clrIndex img imagePreView clr changedColor|
+ |clrIndex img imagePreView clr changedColor cMap|
img := self image.
imagePreView := self imagePreView.
@@ -4423,13 +4471,13 @@
clrIndex := clrIndex - 1.
].
changedColor := changedObject at:aParameter.
- img colorMap notNil ifTrue:[
+ drawingColormap notNil ifTrue:[
+ drawingColormap at:clrIndex put:changedColor.
+ ].
+ cMap := img colorMap.
+ (cMap notNil and:[cMap isMappedPalette not and:[cMap isFixedPalette not]]) ifTrue:[
img colorMap at:clrIndex put:changedColor.
self colorMapChanged.
- ] ifFalse:[
- drawingColormap notNil ifTrue:[
- drawingColormap at:clrIndex put:changedColor.
- ].
].
^ self
].
@@ -4493,7 +4541,7 @@
super update:something with:aParameter from:changedObject
- "Modified: / 21-10-2010 / 14:34:31 / cg"
+ "Modified: / 03-02-2017 / 21:52:33 / cg"
!
updateAfterImageChange
@@ -5150,6 +5198,7 @@
selectedColorIndex := anIndex.
anIndex isNil ifTrue:[^ self].
+
clr := self listOfColors at:anIndex ifAbsent:nil.
clr isNil ifTrue:[^ self].
@@ -5163,6 +5212,8 @@
].
imageEditView selectedColorIndex:pixel.
imageEditView selectedColor:clr.
+
+ "Modified (format): / 03-02-2017 / 21:49:32 / cg"
! !
!ImageEditor methodsFor:'startup & release'!
@@ -5251,7 +5302,7 @@
depth := img depth.
cMap := img colorMap.
- cMap isNil ifTrue:[
+ (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[
drawingColormap isNil ifTrue:[
self information:(resources stringWithCRs:'Image has no colormap.\The shown colorMap is for drawing only.').
drawingColormap := OrderedCollection new.
@@ -5312,8 +5363,8 @@
self updateLabelsAndHistory.
]
- "Created: / 12.3.1999 / 00:20:28 / cg"
- "Modified: / 16.3.1999 / 21:57:26 / cg"
+ "Created: / 12-03-1999 / 00:20:28 / cg"
+ "Modified: / 03-02-2017 / 21:42:18 / cg"
!
changeHLS
@@ -6312,7 +6363,7 @@
!
pasteColorIntoColormap
- |copyBufferColor|
+ |copyBufferColor cmap|
copyBufferColor := imageEditView getClipboardObject.
copyBufferColor isColor ifFalse:[
@@ -6322,9 +6373,21 @@
^ self
].
+ cmap := self image colorMap.
+ (cmap isNil or:[cmap isMappedPalette or:[cmap isFixedPalette]]) ifTrue:[
+ drawingColormap isNil ifTrue:[
+ drawingColormap := #()
+ ].
+ drawingColormap := drawingColormap copyWith:copyBufferColor.
+ self selectedColors value:drawingColormap size.
+ ^ self.
+ ].
+
self processSelectedColorWith:[:clr |
copyBufferColor
]
+
+ "Modified: / 03-02-2017 / 21:45:45 / cg"
!
pickAndAddColorToColormap
@@ -6358,17 +6421,17 @@
selectedColorIndices isEmptyOrNil ifTrue:[^ self].
img := self image.
- cMap := img colorMap.
- cMap isNil ifTrue:[
- self warn:(resources stringWithCRs:'Image has no colormap.\Please change the colorMap mode first.').
- ^ self
- ].
self hasMask ifTrue:[
maskOffset := 1.
] ifFalse:[
maskOffset := 0.
].
- oldColors := selectedColorIndices collect:[:idx | cMap at:idx-maskOffset].
+ cMap := img colorMap.
+ (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[
+ oldColors := drawingColormap
+ ] ifFalse:[
+ oldColors := selectedColorIndices collect:[:idx | cMap at:idx-maskOffset].
+ ].
imageEditView makeUndo.
modifiedColormap := cMap asNewArray.
@@ -6384,7 +6447,11 @@
depth:img depth
fromArray:img bits.
- newImage colorMap:modifiedColormap.
+ (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[
+ "/ only a dummy...
+ ] ifFalse:[
+ newImage colorMap:modifiedColormap.
+ ].
newImage fileName:img fileName.
newImage mask:(img mask copy).
@@ -6392,6 +6459,8 @@
self fetchImageData.
].
self selectedColors value:selectedColorIndices.
+
+ "Modified: / 03-02-2017 / 22:05:33 / cg"
!
reduceNumberOfColors