From 0cb50e20f2d4aa72e567dccfe35393416450855e Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 26 Jul 2004 12:07:01 +0000 Subject: [PATCH] accept SVG color names in the hex entry. Not very intuitive but probably a 2004-07-26 Sven Neumann * libgimpwidgets/gimpcolorscales.c (gimp_color_scales_hex_events): accept SVG color names in the hex entry. Not very intuitive but probably a nice experts feature and it can be improved later. --- ChangeLog | 6 ++++++ libgimpwidgets/gimpcolorscales.c | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b22082e7b..8e258403f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-26 Sven Neumann + + * libgimpwidgets/gimpcolorscales.c (gimp_color_scales_hex_events): + accept SVG color names in the hex entry. Not very intuitive but + probably a nice experts feature and it can be improved later. + 2004-07-26 Michael Natterer * app/main.c (main): use #ifdef GIMP_UNSTABLE instead of looking diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c index 4b8d19c458..553bc7ddbc 100644 --- a/libgimpwidgets/gimpcolorscales.c +++ b/libgimpwidgets/gimpcolorscales.c @@ -491,10 +491,11 @@ gimp_color_scales_hex_events (GtkWidget *widget, gimp_rgb_get_uchar (&selector->rgb, &r, &g, &b); g_snprintf (buffer, sizeof (buffer), "%.2x%.2x%.2x", r, g, b); - if ((strlen (hex_color) == 6) && - (g_ascii_strcasecmp (buffer, hex_color) != 0)) + if (g_ascii_strcasecmp (buffer, hex_color) != 0) { - if (gimp_rgb_parse_hex (&selector->rgb, hex_color, 6)) + if ((strlen (hex_color) == 6 && + gimp_rgb_parse_hex (&selector->rgb, hex_color, 6)) || + (gimp_rgb_parse_name (&selector->rgb, hex_color, -1))) { gimp_rgb_to_hsv (&selector->rgb, &selector->hsv); @@ -504,9 +505,9 @@ gimp_color_scales_hex_events (GtkWidget *widget, return FALSE; } - } - gtk_entry_set_text (GTK_ENTRY (widget), buffer); + gtk_entry_set_text (GTK_ENTRY (widget), buffer); + } break; default: