#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Tue, 03 Dec 2019 14:13:09 +0100
changeset 3822 8f40c5d2a468
parent 3821 798167a7637b
child 3823 fefcdd086a7d
#BUGFIX by cg class: ColorEditDialog changed: #colorChanged #colorNameChanged
ColorEditDialog.st
--- a/ColorEditDialog.st	Fri Nov 15 00:42:20 2019 +0100
+++ b/ColorEditDialog.st	Tue Dec 03 14:13:09 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by eXept Software AG
               All Rights Reserved
@@ -965,26 +967,28 @@
 !ColorEditDialog methodsFor:'actions'!
 
 colorChanged
-    |clr nm|
+    |clr nm def|
 
-    clr := self colorNameOrColor.
-    clr isColor ifTrue:[
-        "not a symbol"
-        self setPreview:clr.
-        self htmlColorNameHolder value:(clr htmlPrintString) withoutNotifying:self.
+    "/ clr := self color.
+    clr := Color redByte:(red value) greenByte:(green value) blueByte:(blue value).
+
+    self setPreview:clr.
+    self htmlColorNameHolder value:(clr htmlPrintString) withoutNotifying:self.
 
-        nm := #(white black
-                gray lightGray darkGray
-                red green blue 
-                yellow magenta cyan
-                orange brown) detect:[:nm | clr = (Color perform:nm)] ifNone:nil.
+    "/ clr := self colorNameOrColor.
+    "/ clr isColor ifTrue:[
+        "not a symbol"
+
+        nm := Color constantNames detect:[:nm | clr = (Color perform:nm)] ifNone:nil.
         nm notNil ifTrue:[
-            self colorDefinitionStringHolder value:('Color ',nm).
+            self colorNameHolder value:nm withoutNotifying:self.
+            def := 'Color ',nm.
         ] ifFalse:[
-            self colorDefinitionStringHolder value:('Color rgbValue:16r',(clr rgbValue hexPrintString leftPaddedTo:6 with:$0)).
+            def := 'Color rgbValue:16r%06x' printfWith:clr rgbValue.
         ].
-        self brightnessStringHolder value:((clr brightness asFixedPoint:3) printString).
-    ].
+        self colorDefinitionStringHolder value:def withoutNotifying:self.
+        self brightnessStringHolder value:((clr brightness asFixedPoint:3) printString) withoutNotifying:self.
+    "/ ].
 
     "Modified: / 27-01-2011 / 12:54:04 / cg"
     "Modified: / 30-04-2019 / 15:09:48 / Claus Gittinger"
@@ -1018,6 +1022,7 @@
 
     clr := Color name:(self colorName) ifIllegal:nil.
     clr isNil ifTrue:[
+        Transcript showCR:'no such color'.
         ^ self
     ].
     self colorChangedTo:clr.