mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +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:
committed by
Carlos R. Mafra
parent
74dc2d2cc0
commit
fc35dfd277
@@ -3391,6 +3391,7 @@ static void grayInit(W_ColorPanel * panel)
|
|||||||
static void rgbInit(W_ColorPanel * panel)
|
static void rgbInit(W_ColorPanel * panel)
|
||||||
{
|
{
|
||||||
char tmp[4];
|
char tmp[4];
|
||||||
|
const char *format;
|
||||||
|
|
||||||
if (panel->color.set != cpRGB)
|
if (panel->color.set != cpRGB)
|
||||||
convertCPColor(&panel->color);
|
convertCPColor(&panel->color);
|
||||||
@@ -3399,11 +3400,20 @@ static void rgbInit(W_ColorPanel * panel)
|
|||||||
WMSetSliderValue(panel->rgbGreenS, panel->color.rgb.green);
|
WMSetSliderValue(panel->rgbGreenS, panel->color.rgb.green);
|
||||||
WMSetSliderValue(panel->rgbBlueS, panel->color.rgb.blue);
|
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);
|
WMSetTextFieldText(panel->rgbRedT, tmp);
|
||||||
sprintf(tmp, "%d", panel->color.rgb.green);
|
sprintf(tmp, format, panel->color.rgb.green);
|
||||||
WMSetTextFieldText(panel->rgbGreenT, tmp);
|
WMSetTextFieldText(panel->rgbGreenT, tmp);
|
||||||
sprintf(tmp, "%d", panel->color.rgb.blue);
|
sprintf(tmp, format, panel->color.rgb.blue);
|
||||||
WMSetTextFieldText(panel->rgbBlueT, tmp);
|
WMSetTextFieldText(panel->rgbBlueT, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user