In particular, the values were only being converted when the RGB slider was used
to pick the color. If another tool was used, e.g., the magnifying glass, th e
value was assumed to be decimal, even if hexadecimal was selected.
---
WINGs/wcolorpanel.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c
index b2c3e77..0b3fc15 100644
--- a/WINGs/wcolorpanel.c
+++ b/WINGs/wcolorpanel.c
@@ -3391,6 +3391,7 @@ static void grayInit(W_ColorPanel * panel)
static void rgbInit(W_ColorPanel * panel)
{
char tmp[4];
+ const char *format;
if (panel->color.set != cpRGB)
convertCPColor(&panel->color);
@@ -3399,11 +3400,20 @@ static void rgbInit(W_ColorPanel * panel)
WMSetSliderValue(panel->rgbGreenS, panel->color.rgb.green);
WMSetSliderValue(panel->rgbBlueS, panel->color.rgb.blue);
- sprintf(tmp, "%d", panel->color.rgb.red);
+ switch (panel->rgbState) {
+ case RGBdec:
+ format = "%d";
+ break;
+ case RGBhex:
+ format = "%0X";
+ break;
+ }
+
+ sprintf(tmp, format, panel->color.rgb.red);
WMSetTextFieldText(panel->rgbRedT, tmp);
- sprintf(tmp, "%d", panel->color.rgb.green);
+ sprintf(tmp, format, panel->color.rgb.green);
WMSetTextFieldText(panel->rgbGreenT, tmp);
- sprintf(tmp, "%d", panel->color.rgb.blue);
+ sprintf(tmp, format, panel->color.rgb.blue);
WMSetTextFieldText(panel->rgbBlueT, tmp);
}
--
1.9.1
--
To unsubscribe, send mail to [email protected].