behavior of dataset changed if a write operation is invoked by a column adaptor
authorca
Mon, 30 Sep 2002 15:42:48 +0200
changeset 1611 2f23751929d6
parent 1610 cb3e093aa6d5
child 1612 15d05e73f258
behavior of dataset changed if a write operation is invoked by a column adaptor do not return the new color to exchange the row.
ImageEditor.st
--- a/ImageEditor.st	Sat Sep 28 07:15:33 2002 +0200
+++ b/ImageEditor.st	Mon Sep 30 15:42:48 2002 +0200
@@ -2202,17 +2202,33 @@
 
 !ImageEditor methodsFor:'data access'!
 
+atColor:aOldColor put:aNewColor
+    "a color changed to a new color
+    "
+    |index list|
+
+    list  := self listOfColors.
+    index := list identityIndexOf:aOldColor.
+
+    index ~~ 0 ifTrue:[
+        list at:index put:aNewColor
+    ] ifFalse:[
+        self halt:'should not happen'.
+        list add:aNewColor
+    ].
+!
+
 blueAtColor:aColor put:newBlue
     "helper used to return a new row element, when blue is changed"
 
     |byte|
 
-    aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
+    aColor isNil ifTrue:[^ self].       "/ mask cannot be changed
     byte := newBlue clampBetween:0 and:255.
-    byte = aColor blueByte ifTrue:[^ aColor].
-    ^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte
-
-    "Modified: / 18.8.1998 / 17:00:12 / cg"
+    byte = aColor blueByte ifTrue:[^ self ].
+
+    self atColor:aColor
+             put:(Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte).
 !
 
 blueFromColor:aColor
@@ -2251,12 +2267,12 @@
 
     |byte|
 
-    aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
+    aColor isNil ifTrue:[^ self].       "/ mask cannot be changed
     byte := newGreen clampBetween:0 and:255.
-    byte = aColor greenByte ifTrue:[^ aColor].
-    ^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)
-
-    "Modified: / 18.8.1998 / 17:00:38 / cg"
+    byte = aColor greenByte ifTrue:[^ self].
+
+    self atColor:aColor
+             put:(Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)).
 !
 
 greenFromColor:aColor
@@ -2274,12 +2290,12 @@
 
     |byte|
 
-    aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
+    aColor isNil ifTrue:[^ self].       "/ mask cannot be changed
     byte := newRed clampBetween:0 and:255.
-    byte = aColor redByte ifTrue:[^ aColor].
-    ^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)
-
-    "Modified: / 18.8.1998 / 17:00:49 / cg"
+    byte = aColor redByte ifTrue:[^ self].
+
+    self atColor:aColor
+             put:(Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)).
 !
 
 redFromColor:aColor