--- a/ImageEditor.st Mon Dec 20 13:52:35 2004 +0100
+++ b/ImageEditor.st Wed Feb 02 11:29:49 2005 +0100
@@ -1408,51 +1408,51 @@
dataList: listOfColors
has3Dsepartors: true
has3Dseparators: true
- columnHolder: tableColumns
+ columnHolder: colorTableColumns
verticalSpacing: 1
- columns:
- (OrderedCollection
-
- (DataSetColumnSpec
- labelButtonType: Button
- rendererType: rowSelector
- backgroundSelector: theColorItSelf:
- )
- (DataSetColumnSpec
- label: 'R'
- labelAlignment: left
- labelButtonType: Button
- columnAlignment: right
- editorType: InputField
- type: number
- model: redFromColor:
- writeSelector: redAtColor:put:
- selectSelector: canSelectRedInColor:
- )
-
- (DataSetColumnSpec
- label: 'G'
- labelAlignment: left
- labelButtonType: Button
- columnAlignment: right
- editorType: InputField
- type: number
- model: greenFromColor:
- writeSelector: greenAtColor:put:
- selectSelector: canSelectGreenInColor:
- )
- (DataSetColumnSpec
- label: 'B'
- labelAlignment: left
- labelButtonType: Button
- columnAlignment: right
- editorType: InputField
- type: number
- model: blueFromColor:
- writeSelector: blueAtColor:put:
- selectSelector: canSelectBlueInColor:
- )
- )
+"/ columns:
+"/ (OrderedCollection
+"/
+"/ (DataSetColumnSpec
+"/ labelButtonType: Button
+"/ rendererType: rowSelector
+"/ backgroundSelector: theColorItSelf:
+"/ )
+"/ (DataSetColumnSpec
+"/ label: 'R'
+"/ labelAlignment: left
+"/ labelButtonType: Button
+"/ columnAlignment: right
+"/ editorType: InputField
+"/ type: number
+"/ model: redFromColor:
+"/ writeSelector: redAtColor:put:
+"/ selectSelector: canSelectRedInColor:
+"/ )
+"/
+"/ (DataSetColumnSpec
+"/ label: 'G'
+"/ labelAlignment: left
+"/ labelButtonType: Button
+"/ columnAlignment: right
+"/ editorType: InputField
+"/ type: number
+"/ model: greenFromColor:
+"/ writeSelector: greenAtColor:put:
+"/ selectSelector: canSelectGreenInColor:
+"/ )
+"/ (DataSetColumnSpec
+"/ label: 'B'
+"/ labelAlignment: left
+"/ labelButtonType: Button
+"/ columnAlignment: right
+"/ editorType: InputField
+"/ type: number
+"/ model: blueFromColor:
+"/ writeSelector: blueAtColor:put:
+"/ selectSelector: canSelectBlueInColor:
+"/ )
+"/ )
columnAdaptor: colorColumnAdaptor
)
)
@@ -2637,7 +2637,7 @@
!ImageEditor class methodsFor:'tableColumns specs'!
-tableColumns
+colorTableColumns
"This resource specification was automatically generated
by the DataSetBuilder of ST/X."
@@ -2692,7 +2692,6 @@
selectSelector: canSelectBlueInColor:
)
)
-
! !
!ImageEditor methodsFor:'accessing'!
@@ -2916,7 +2915,7 @@
with: (listOfColors at:1)
with: (listOfColors at:2 ifAbsent:[listOfColors at:1])).
- self hasMask "image mask" notNil ifTrue: [
+ self hasMask ifTrue: [
(listOfColors contains: [:clr| clr = (Color colorId:0)])
ifFalse:[
listOfColors addFirst:(Color colorId:0).
@@ -3027,6 +3026,17 @@
"Modified: / 10.2.2000 / 23:36:49 / cg"
!
+updateColorsFromImage:image
+ |colors|
+
+ image colorMap notNil ifTrue:[
+ colors := image colorMap asOrderedCollection.
+ ] ifFalse:[
+ colors := image usedColors asSet asOrderedCollection.
+ ].
+ self listOfColors contents:colors.
+!
+
updateForNoImage
"updates channels and view, if image is loaded"
@@ -3224,11 +3234,7 @@
self withCursor:Cursor wait do:[
(imageEditView loadFromFile: aFileName) notNil ifTrue:[
(img := self image) notNil ifTrue:[
- img colorMap notNil ifTrue:[
- self listOfColors contents:(img usedColors asSet asOrderedCollection).
- ] ifFalse:[
- self listOfColors removeAll.
- ].
+ self updateColorsFromImage:img.
self findColorMapMode.
self updateLabelsAndHistory.
img := img onDevice:device.
@@ -3255,11 +3261,7 @@
imageEditView clearModified.
img notNil ifTrue:[
- img colorMap notNil ifTrue:[
- self listOfColors contents:(img usedColors asSet asOrderedCollection).
- ] ifFalse:[
- self listOfColors removeAll.
- ].
+ self updateColorsFromImage:img.
self findColorMapMode.
self updateLabelsAndHistory.
] ifFalse:[
@@ -3277,12 +3279,8 @@
(imageEditView loadFromMessage: aMessage) notNil ifTrue:[
(img := self image) notNil ifTrue:[
img := img onDevice:device.
- img colorMap isNil ifTrue:[
- self listOfColors contents:(img usedColors asSet asOrderedCollection).
- ].
-"/ self findColorMapMode.
+ self updateColorsFromImage:img.
self updateLabelsAndHistory.
- "/ imageEditView image:img.
] ifFalse:[
self updateForNoImage
]
@@ -3296,9 +3294,8 @@
if no image could extract from aMessage; do set the class and the selector from
the aMessage for a saving at the end of editing"
- (imageEditView loadFromMessage: aMessage) notNil
- ifTrue: [
- self listOfColors contents: self image usedColors asSet asOrderedCollection.
+ (imageEditView loadFromMessage: aMessage) notNil ifTrue: [
+ self updateColorsFromImage:self image.
self findColorMapMode.
] ifFalse: [
imageEditView resourceMessage: aMessage.
@@ -3880,9 +3877,6 @@
(imageEditView image: image) notNil ifTrue:[
self fetchImageData.
-"/ self listOfColors contents: image colorMap.
-"/ self findColorMapMode.
-"/ self updateLabelsAndHistory.
]
]
@@ -3982,9 +3976,6 @@
(imageEditView image:newImage) notNil ifTrue:
[
self fetchImageData.
-"/ self listOfColors contents: newImage colorMap.
-"/ self findColorMapMode.
-"/ self updateLabelsAndHistory.
]
]
@@ -4207,9 +4198,6 @@
imageEditView image:img.
self fetchImageData.
-"/ self listOfColors contents:(img colorMap).
-"/ self findColorMapMode.
-"/ self updateLabelsAndHistory.
usedColors := img usedColorsMax:10000.
usedColors size == 10000 ifTrue:[
Dialog information:('>= ' , usedColors size printString , ' colors used.')
@@ -4240,13 +4228,13 @@
|cmapIndex img cMap|
cmapIndex := self selectedColorIndexOrNil.
- cmapIndex isNil ifTrue:[^ self].
+ cmapIndex isNil ifTrue:[^ nil].
img := self image.
cMap := img colorMap.
cMap isNil ifTrue:[
self warn:('Image has no colormap.\Please change the colorMap mode first.' withCRs).
- ^ self
+ ^ nil
].
^ cMap at:cmapIndex.
!
@@ -4333,9 +4321,6 @@
(imageEditView image:newImage) notNil ifTrue:[
self fetchImageData.
-"/ self listOfColors contents: newImage colorMap.
-"/ self findColorMapMode.
-"/ self updateLabelsAndHistory.
]
]
@@ -4731,7 +4716,7 @@
(imageEditView loadFromClass) notNil ifTrue:[
imageSeqNr := nil.
(img := self image) notNil ifTrue: [
- self listOfColors contents: img usedColors asSet asOrderedCollection.
+ self updateColorsFromImage:img.
self findColorMapMode.
self updateLabelsAndHistory.
] ifFalse: [
@@ -4823,7 +4808,7 @@
(imageEditView image:image) notNil
ifTrue:[
- self listOfColors contents:(image colorMap).
+ self updateColorsFromImage:image.
self findColorMapMode.
self updateLabelsAndHistory.
]