1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +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

@@ -136,7 +136,7 @@ typedef struct _TexturePanel {
/************/ /************/
static void updateGradButtons(TexturePanel * panel) static void updateGradButtons(TexturePanel *panel)
{ {
RImage *image; RImage *image;
WMPixmap *pixmap; WMPixmap *pixmap;
@@ -180,7 +180,7 @@ static void updateGradButtons(TexturePanel * panel)
} }
} }
static void updateTGradImage(TexturePanel * panel) static void updateTGradImage(TexturePanel *panel)
{ {
RImage *image, *gradient; RImage *image, *gradient;
WMPixmap *pixmap; WMPixmap *pixmap;
@@ -201,19 +201,17 @@ static void updateTGradImage(TexturePanel * panel)
to.green = WMGreenComponentOfColor(color) >> 8; to.green = WMGreenComponentOfColor(color) >> 8;
to.blue = WMBlueComponentOfColor(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); image = RMakeTiledImage(panel->image, 141, 91);
} else { else
image = RCloneImage(panel->image); image = RCloneImage(panel->image);
}
if (WMGetButtonSelected(panel->dirhB)) { if (WMGetButtonSelected(panel->dirhB))
gradient = RRenderGradient(image->width, image->height, &from, &to, RHorizontalGradient); 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); gradient = RRenderGradient(image->width, image->height, &from, &to, RVerticalGradient);
} else { else
gradient = RRenderGradient(image->width, image->height, &from, &to, RDiagonalGradient); gradient = RRenderGradient(image->width, image->height, &from, &to, RDiagonalGradient);
}
RCombineImagesWithOpaqueness(image, gradient, WMGetSliderValue(panel->topaS)); RCombineImagesWithOpaqueness(image, gradient, WMGetSliderValue(panel->topaS));
RReleaseImage(gradient); RReleaseImage(gradient);
@@ -225,7 +223,7 @@ static void updateTGradImage(TexturePanel * panel)
RReleaseImage(image); RReleaseImage(image);
} }
static void updateSGradButtons(TexturePanel * panel) static void updateSGradButtons(TexturePanel *panel)
{ {
RImage *image; RImage *image;
WMPixmap *pixmap; WMPixmap *pixmap;
@@ -264,7 +262,7 @@ static void updateSGradButtons(TexturePanel * panel)
/*********** Gradient ************/ /*********** Gradient ************/
static void updateSVSlider(WMSlider * sPtr, Bool saturation, WMFont * font, RHSVColor * hsv) static void updateSVSlider(WMSlider *sPtr, Bool saturation, WMFont *font, RHSVColor *hsv)
{ {
RImage *image; RImage *image;
WMPixmap *pixmap; WMPixmap *pixmap;
@@ -312,7 +310,7 @@ static void updateSVSlider(WMSlider * sPtr, Bool saturation, WMFont * font, RHSV
WMReleasePixmap(pixmap); WMReleasePixmap(pixmap);
} }
static void updateHueSlider(WMSlider * sPtr, WMFont * font, RHSVColor * hsv) static void updateHueSlider(WMSlider *sPtr, WMFont *font, RHSVColor *hsv)
{ {
RColor *colors[8]; RColor *colors[8];
RImage *image; RImage *image;
@@ -353,7 +351,7 @@ static void updateHueSlider(WMSlider * sPtr, WMFont * font, RHSVColor * hsv)
wfree(colors[i]); wfree(colors[i]);
} }
static void sliderChangeCallback(WMWidget * w, void *data) static void sliderChangeCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
RHSVColor hsv; RHSVColor hsv;
@@ -417,9 +415,8 @@ static void sliderChangeCallback(WMWidget * w, void *data)
} }
colors[i] = NULL; colors[i] = NULL;
if (panel->gimage != None) { if (panel->gimage != None)
XFreePixmap(WMScreenDisplay(scr), panel->gimage); XFreePixmap(WMScreenDisplay(scr), panel->gimage);
}
image = RRenderMultiGradient(30, i * WMGetListItemHeight(panel->gcolL), colors, RVerticalGradient); image = RRenderMultiGradient(30, i * WMGetListItemHeight(panel->gcolL), colors, RVerticalGradient);
RConvertImage(WMScreenRContext(scr), image, &panel->gimage); RConvertImage(WMScreenRContext(scr), image, &panel->gimage);
@@ -432,7 +429,7 @@ static void sliderChangeCallback(WMWidget * w, void *data)
updateGradButtons(panel); updateGradButtons(panel);
} }
static void paintGradListItem(WMList * lPtr, int index, Drawable d, char *text, int state, WMRect * rect) static void paintGradListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect)
{ {
TexturePanel *panel = (TexturePanel *) WMGetHangedData(lPtr); TexturePanel *panel = (TexturePanel *) WMGetHangedData(lPtr);
WMScreen *scr = WMWidgetScreen(lPtr); WMScreen *scr = WMWidgetScreen(lPtr);
@@ -465,7 +462,7 @@ static void paintGradListItem(WMList * lPtr, int index, Drawable d, char *text,
WMReleaseColor(gray); WMReleaseColor(gray);
} }
static void gradAddCallback(WMWidget * w, void *data) static void gradAddCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
WMListItem *item; WMListItem *item;
@@ -489,7 +486,7 @@ static void gradAddCallback(WMWidget * w, void *data)
WMSetButtonEnabled(panel->okB, WMGetListNumberOfRows(panel->gcolL) > 1); WMSetButtonEnabled(panel->okB, WMGetListNumberOfRows(panel->gcolL) > 1);
} }
static void gradClickCallback(WMWidget * w, void *data) static void gradClickCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
WMListItem *item; WMListItem *item;
@@ -511,7 +508,7 @@ static void gradClickCallback(WMWidget * w, void *data)
sliderChangeCallback(panel->gsatS, panel); sliderChangeCallback(panel->gsatS, panel);
} }
static void gradDeleteCallback(WMWidget * w, void *data) static void gradDeleteCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
WMListItem *item; WMListItem *item;
@@ -545,7 +542,7 @@ static void gradDeleteCallback(WMWidget * w, void *data)
/*************** Simple Gradient ***************/ /*************** Simple Gradient ***************/
static void colorWellObserver(void *self, WMNotification * n) static void colorWellObserver(void *self, WMNotification *n)
{ {
/* Parameter not used, but tell the compiler that it is ok */ /* Parameter not used, but tell the compiler that it is ok */
(void) n; (void) n;
@@ -553,7 +550,7 @@ static void colorWellObserver(void *self, WMNotification * n)
updateSGradButtons(self); updateSGradButtons(self);
} }
static void opaqChangeCallback(WMWidget * w, void *data) static void opaqChangeCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
@@ -565,7 +562,7 @@ static void opaqChangeCallback(WMWidget * w, void *data)
/****************** Image ******************/ /****************** Image ******************/
static void updateImage(TexturePanel * panel, const char *path) static void updateImage(TexturePanel *panel, const char *path)
{ {
WMScreen *scr = WMWidgetScreen(panel->win); WMScreen *scr = WMWidgetScreen(panel->win);
RImage *image; RImage *image;
@@ -613,12 +610,12 @@ static void updateImage(TexturePanel * panel, const char *path)
} }
} }
static void browseImageCallback(WMWidget * w, void *data) static void browseImageCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
WMOpenPanel *opanel; WMOpenPanel *opanel;
WMScreen *scr = WMWidgetScreen(w); WMScreen *scr = WMWidgetScreen(w);
static char *ipath = NULL; static char *ipath;
opanel = WMGetOpenPanel(scr); opanel = WMGetOpenPanel(scr);
WMSetFilePanelCanChooseDirectories(opanel, False); WMSetFilePanelCanChooseDirectories(opanel, False);
@@ -670,18 +667,17 @@ static void browseImageCallback(WMWidget * w, void *data)
} }
} }
static void buttonCallback(WMWidget * w, void *data) static void buttonCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
if (w == panel->okB) { if (w == panel->okB)
(*panel->okAction) (panel->okData); (*panel->okAction) (panel->okData);
} else { else
(*panel->cancelAction) (panel->cancelData); (*panel->cancelAction) (panel->cancelData);
}
} }
static void changeTypeCallback(WMWidget * w, void *data) static void changeTypeCallback(WMWidget *w, void *data)
{ {
TexturePanel *panel = (TexturePanel *) data; TexturePanel *panel = (TexturePanel *) data;
int newType; int newType;
@@ -731,7 +727,7 @@ static void changeTypeCallback(WMWidget * w, void *data)
* Public functions * Public functions
*-------------------------------------------------------------------------- *--------------------------------------------------------------------------
*/ */
void ShowTexturePanel(TexturePanel * panel) void ShowTexturePanel(TexturePanel *panel)
{ {
Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->win)); Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->win));
Screen *scr = DefaultScreenOfDisplay(dpy); Screen *scr = DefaultScreenOfDisplay(dpy);
@@ -742,24 +738,24 @@ void ShowTexturePanel(TexturePanel * panel)
WMMapWidget(panel->win); WMMapWidget(panel->win);
} }
void HideTexturePanel(TexturePanel * panel) void HideTexturePanel(TexturePanel *panel)
{ {
WMUnmapWidget(panel->win); WMUnmapWidget(panel->win);
} }
void SetTexturePanelOkAction(TexturePanel * panel, WMCallback * action, void *clientData) void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action, void *clientData)
{ {
panel->okAction = action; panel->okAction = action;
panel->okData = clientData; panel->okData = clientData;
} }
void SetTexturePanelCancelAction(TexturePanel * panel, WMCallback * action, void *clientData) void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clientData)
{ {
panel->cancelAction = action; panel->cancelAction = action;
panel->cancelData = clientData; panel->cancelData = clientData;
} }
void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList * texture) void SetTexturePanelTexture(TexturePanel *panel, const char *name, WMPropList *texture)
{ {
WMScreen *scr = WMWidgetScreen(panel->win); WMScreen *scr = WMWidgetScreen(panel->win);
char *str, *type; char *str, *type;
@@ -775,9 +771,8 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
return; return;
p = WMGetFromPLArray(texture, 0); p = WMGetFromPLArray(texture, 0);
if (!p) { if (!p)
goto bad_texture; goto bad_texture;
}
type = WMGetFromPLString(p); type = WMGetFromPLString(p);
/*............................................... */ /*............................................... */
@@ -786,11 +781,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID); WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
p = WMGetFromPLArray(texture, 1); p = WMGetFromPLArray(texture, 1);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->defcW, color); WMSetColorWellColor(panel->defcW, color);
@@ -803,11 +797,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT); WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
p = WMGetFromPLArray(texture, 1); p = WMGetFromPLArray(texture, 1);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol1W, color); WMSetColorWellColor(panel->tcol1W, color);
@@ -815,11 +808,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMReleaseColor(color); WMReleaseColor(color);
p = WMGetFromPLArray(texture, 2); p = WMGetFromPLArray(texture, 2);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol2W, color); WMSetColorWellColor(panel->tcol2W, color);
@@ -846,11 +838,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetSliderValue(panel->topaS, i); WMSetSliderValue(panel->topaS, i);
p = WMGetFromPLArray(texture, 3); p = WMGetFromPLArray(texture, 3);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol1W, color); WMSetColorWellColor(panel->tcol1W, color);
@@ -858,11 +849,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMReleaseColor(color); WMReleaseColor(color);
p = WMGetFromPLArray(texture, 4); p = WMGetFromPLArray(texture, 4);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->tcol2W, color); WMSetColorWellColor(panel->tcol2W, color);
@@ -873,9 +863,9 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
if (panel->imageFile) if (panel->imageFile)
wfree(panel->imageFile); wfree(panel->imageFile);
if ((panel->imageFile = wfindfileinarray(panel->pathList, panel->imageFile = wfindfileinarray(panel->pathList,
WMGetFromPLString(WMGetFromPLArray(texture, 1)))) != WMGetFromPLString(WMGetFromPLArray(texture, 1)));
NULL) { if (panel->imageFile != NULL) {
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0); panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
updateTGradImage(panel); updateTGradImage(panel);
@@ -899,11 +889,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT); WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
p = WMGetFromPLArray(texture, 1); p = WMGetFromPLArray(texture, 1);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False); color = WMCreateNamedColor(scr, str, False);
WMSetColorWellColor(panel->defcW, color); WMSetColorWellColor(panel->defcW, color);
@@ -915,11 +904,10 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
XColor xcolor; XColor xcolor;
p = WMGetFromPLArray(texture, i); p = WMGetFromPLArray(texture, i);
if (!p) { if (!p)
str = "black"; str = "black";
} else { else
str = WMGetFromPLString(p); str = WMGetFromPLString(p);
}
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap, str, &xcolor); XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap, str, &xcolor);
@@ -1001,13 +989,13 @@ void SetTexturePanelTexture(TexturePanel * panel, const char *name, WMPropList *
} }
char *GetTexturePanelTextureName(TexturePanel * panel) char *GetTexturePanelTextureName(TexturePanel *panel)
{ {
return WMGetTextFieldText(panel->nameT); return WMGetTextFieldText(panel->nameT);
} }
WMPropList *GetTexturePanelTexture(TexturePanel * panel) WMPropList *GetTexturePanelTexture(TexturePanel *panel)
{ {
WMPropList *prop = NULL; WMPropList *prop = NULL;
WMColor *color; WMColor *color;
@@ -1104,13 +1092,12 @@ WMPropList *GetTexturePanelTexture(TexturePanel * panel)
color = WMGetColorWellColor(panel->defcW); color = WMGetColorWellColor(panel->defcW);
str = WMGetColorRGBDescription(color); str = WMGetColorRGBDescription(color);
if (WMGetButtonSelected(panel->dirdB)) { if (WMGetButtonSelected(panel->dirdB))
prop = WMCreatePLArray(WMCreatePLString("mdgradient"), WMCreatePLString(str), NULL); prop = WMCreatePLArray(WMCreatePLString("mdgradient"), WMCreatePLString(str), NULL);
} else if (WMGetButtonSelected(panel->dirvB)) { else if (WMGetButtonSelected(panel->dirvB))
prop = WMCreatePLArray(WMCreatePLString("mvgradient"), WMCreatePLString(str), NULL); prop = WMCreatePLArray(WMCreatePLString("mvgradient"), WMCreatePLString(str), NULL);
} else { else
prop = WMCreatePLArray(WMCreatePLString("mhgradient"), WMCreatePLString(str), NULL); prop = WMCreatePLArray(WMCreatePLString("mhgradient"), WMCreatePLString(str), NULL);
}
wfree(str); wfree(str);
for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) { for (i = 0; i < WMGetListNumberOfRows(panel->gcolL); i++) {
@@ -1131,12 +1118,12 @@ WMPropList *GetTexturePanelTexture(TexturePanel * panel)
return prop; return prop;
} }
void SetTexturePanelPixmapPath(TexturePanel * panel, WMPropList * array) void SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array)
{ {
panel->pathList = array; panel->pathList = array;
} }
TexturePanel *CreateTexturePanel(WMWindow * keyWindow) TexturePanel *CreateTexturePanel(WMWindow *keyWindow)
/*CreateTexturePanel(WMScreen *scr)*/ /*CreateTexturePanel(WMScreen *scr)*/
{ {
TexturePanel *panel; TexturePanel *panel;
@@ -1475,7 +1462,7 @@ TexturePanel *CreateTexturePanel(WMWindow * keyWindow)
char *ProgName = "test"; char *ProgName = "test";
void testOKButton(WMWidget * self, void *data) void testOKButton(WMWidget *self, void *data)
{ {
char *test; char *test;
Display *dpy; Display *dpy;
@@ -1504,13 +1491,13 @@ void testOKButton(WMWidget * self, void *data)
} }
void testCancelButton(WMWidget * self, void *data) void testCancelButton(WMWidget *self, void *data)
{ {
wwarning("Exiting test...."); wwarning("Exiting test....");
exit(0); exit(0);
} }
void wAbort() void wAbort(void)
{ {
exit(1); exit(1);
} }