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:
committed by
Carlos R. Mafra
parent
963b4b2b78
commit
39181154ab
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user