1
0
forked from vitrine/wmaker

WINGs: changed use of 'if' on panel->rgbState into a switch

This allow compiler to raise a warning in case a new value would be added
to the enum; it also change order in the check so that WMGetButtonSelected
will be called only once, only for the case of interest.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-17 16:43:22 +02:00
committed by Carlos R. Mafra
parent 963b4b2b78
commit 39181154ab

View File

@@ -2480,19 +2480,26 @@ static void rgbDecToHex(WMWidget *w, void *data)
(void) w;
if (WMGetButtonSelected(panel->rgbDecB) && panel->rgbState == RGBhex) {
WMSetLabelText(panel->rgbMaxL, "255");
WMRedisplayWidget(panel->rgbMaxL);
value = rgbCharToInt(panel);
panel->rgbState = RGBdec;
rgbIntToChar(panel, value);
}
if (WMGetButtonSelected(panel->rgbHexB) && panel->rgbState == RGBdec) {
WMSetLabelText(panel->rgbMaxL, "FF");
WMRedisplayWidget(panel->rgbMaxL);
value = rgbCharToInt(panel);
panel->rgbState = RGBhex;
rgbIntToChar(panel, value);
switch (panel->rgbState) {
case RGBhex:
if (WMGetButtonSelected(panel->rgbDecB)) {
WMSetLabelText(panel->rgbMaxL, "255");
WMRedisplayWidget(panel->rgbMaxL);
value = rgbCharToInt(panel);
panel->rgbState = RGBdec;
rgbIntToChar(panel, value);
}
break;
case RGBdec:
if (WMGetButtonSelected(panel->rgbHexB)) {
WMSetLabelText(panel->rgbMaxL, "FF");
WMRedisplayWidget(panel->rgbMaxL);
value = rgbCharToInt(panel);
panel->rgbState = RGBhex;
rgbIntToChar(panel, value);
}
break;
}
}