1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WINGs: Fix decimal/hexadecimal conversion bug in color panel.

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.
This commit is contained in:
Doug Torrance
2014-10-28 18:31:10 -05:00
committed by Carlos R. Mafra
parent 74dc2d2cc0
commit fc35dfd277

View File

@@ -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);
}