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

WPrefs: Code formatting in TexturePanel.c; minimizes checkpatch.pl warnings.

This commit is contained in:
Doug Torrance
2016-01-24 01:32:28 -05:00
committed by Carlos R. Mafra
parent bf6f81434b
commit 9f7e51e66d

View File

@@ -201,19 +201,17 @@ static void updateTGradImage(TexturePanel * panel)
to.green = WMGreenComponentOfColor(color) >> 8;
to.blue = WMBlueComponentOfColor(color) >> 8;
if (panel->image->width < 141 || panel->image->height < 91) {
if (panel->image->width < 141 || panel->image->height < 91)
image = RMakeTiledImage(panel->image, 141, 91);
} else {
else
image = RCloneImage(panel->image);
}
if (WMGetButtonSelected(panel->dirhB)) {
if (WMGetButtonSelected(panel->dirhB))
gradient = RRenderGradient(image->width, image->height, &from, &to, RHorizontalGradient);
} else if (WMGetButtonSelected(panel->dirvB)) {
else if (WMGetButtonSelected(panel->dirvB))
gradient = RRenderGradient(image->width, image->height, &from, &to, RVerticalGradient);
} else {
else
gradient = RRenderGradient(image->width, image->height, &from, &to, RDiagonalGradient);
}
RCombineImagesWithOpaqueness(image, gradient, WMGetSliderValue(panel->topaS));
RReleaseImage(gradient);
@@ -417,9 +415,8 @@ static void sliderChangeCallback(WMWidget * w, void *data)
}
colors[i] = NULL;
if (panel->gimage != None) {
if (panel->gimage != None)
XFreePixmap(WMScreenDisplay(scr), panel->gimage);
}
image = RRenderMultiGradient(30, i * WMGetListItemHeight(panel->gcolL), colors, RVerticalGradient);
RConvertImage(WMScreenRContext(scr), image, &panel->gimage);
@@ -618,7 +615,7 @@ static void browseImageCallback(WMWidget * w, void *data)
TexturePanel *panel = (TexturePanel *) data;
WMOpenPanel *opanel;
WMScreen *scr = WMWidgetScreen(w);
static char *ipath = NULL;
static char *ipath;
opanel = WMGetOpenPanel(scr);
WMSetFilePanelCanChooseDirectories(opanel, False);
@@ -674,12 +671,11 @@ static void buttonCallback(WMWidget * w, void *data)
{
TexturePanel *panel = (TexturePanel *) data;
if (w == panel->okB) {
if (w == panel->okB)
(*panel->okAction) (panel->okData);
} else {
else
(*panel->cancelAction) (panel->cancelData);
}
}
static void changeTypeCallback(WMWidget *w, void *data)
{
@@ -775,9 +771,8 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
return;
p = WMGetFromPLArray(texture, 0);
if (!p) {
if (!p)
goto bad_texture;
}
type = WMGetFromPLString(p);
/*............................................... */
@@ -786,11 +781,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
p = WMGetFromPLArray(texture, 1);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->defcW, color);
@@ -803,11 +797,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
p = WMGetFromPLArray(texture, 1);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol1W, color);
@@ -815,11 +808,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMReleaseColor(color);
p = WMGetFromPLArray(texture, 2);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol2W, color);
@@ -846,11 +838,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetSliderValue(panel->topaS, i);
p = WMGetFromPLArray(texture, 3);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol1W, color);
@@ -858,11 +849,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMReleaseColor(color);
p = WMGetFromPLArray(texture, 4);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol2W, color);
@@ -873,9 +863,9 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
if (panel->imageFile)
wfree(panel->imageFile);
if ((panel->imageFile = wfindfileinarray(panel->pathList,
WMGetFromPLString(WMGetFromPLArray(texture, 1)))) !=
NULL) {
panel->imageFile = wfindfileinarray(panel->pathList,
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
if (panel->imageFile != NULL) {
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
updateTGradImage(panel);
@@ -899,11 +889,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
p = WMGetFromPLArray(texture, 1);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->defcW, color);
@@ -915,11 +904,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
XColor xcolor;
p = WMGetFromPLArray(texture, i);
if (!p) {
if (!p)
str = "black";
} else {
else
str = WMGetFromPLString(p);
}
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap, str, &xcolor);
@@ -1104,13 +1092,12 @@ WMPropList *GetTexturePanelTexture(TexturePanel * panel)
color = WMGetColorWellColor(panel->defcW);
str = WMGetColorRGBDescription(color);
if (WMGetButtonSelected(panel->dirdB)) {
if (WMGetButtonSelected(panel->dirdB))
prop = WMCreatePLArray(WMCreatePLString("mdgradient"), WMCreatePLString(str), NULL);
} else if (WMGetButtonSelected(panel->dirvB)) {
else if (WMGetButtonSelected(panel->dirvB))
prop = WMCreatePLArray(WMCreatePLString("mvgradient"), WMCreatePLString(str), NULL);
} else {
else
prop = WMCreatePLArray(WMCreatePLString("mhgradient"), WMCreatePLString(str), NULL);
}
wfree(str);
for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) {
@@ -1510,7 +1497,7 @@ void testCancelButton(WMWidget * self, void *data)
exit(0);
}
void wAbort()
void wAbort(void)
{
exit(1);
}