From: ellson Date: Fri, 9 Oct 2009 01:56:08 +0000 (+0000) Subject: Janitor: various cleanups to reduce compiler noise X-Git-Tag: LAST_LIBGRAPH~32^2~1666 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7089eb2fa6e9fbd5c4005b40e4741abe828f63e6;p=graphviz Janitor: various cleanups to reduce compiler noise --- diff --git a/lib/glcomp/glcompbutton.c b/lib/glcomp/glcompbutton.c index 76e4d344b..d9cd5b120 100644 --- a/lib/glcomp/glcompbutton.c +++ b/lib/glcomp/glcompbutton.c @@ -27,7 +27,7 @@ glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption) { glCompButton *p; - glCompCommon* parent=&par->common; +// glCompCommon* parent=&par->common; p = malloc(sizeof(glCompButton)); glCompInitCommon((glCompObj*)p,par,x,y); p->objType=glButtonObj; @@ -137,8 +137,8 @@ void glCompButtonDraw(glCompButton * p) glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),!p->status); if (p->label) p->label->common.functions.draw(p->label); - if(p->image) - p->image->common.functions.draw((glCompObj*)p->image); + if (p->image) + p->image->common.functions.draw(p->image); if (p->common.callbacks.draw) p->common.callbacks.draw(p); /*user defined drawing routines are called here.*/ } @@ -174,7 +174,7 @@ void glCompButtonClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t) else p->status = 0; } if (p->common.callbacks.click) - p->common.callbacks.click(p,x,y,t); + p->common.callbacks.click((glCompObj*)p,x,y,t); } void glCompButtonDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t) diff --git a/lib/glcomp/glcompdefs.h b/lib/glcomp/glcompdefs.h index 19ae95cdd..bb5122f20 100644 --- a/lib/glcomp/glcompdefs.h +++ b/lib/glcomp/glcompdefs.h @@ -114,19 +114,19 @@ typedef enum {glMouseLeftButton,glMouseRightButton,glMouseMiddleButton} glMouseB typedef enum {glTexImage,glTexLabel} glCompTexType; typedef enum {glPanelObj,glButtonObj,glLabelObj,glImageObj}glObjType; +typedef struct _glCompButton glCompButton; +typedef struct _glCompObj glCompObj; /*call backs for widgets*/ -typedef void (*glcompdrawfunc_t) (void* obj); -typedef void (*glcompclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t); -typedef void (*glcompdoubleclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t); -typedef void (*glcompmouseoverfunc_t) (void* obj,GLfloat x,GLfloat y); -typedef void (*glcompmouseinfunc_t) (void* obj,GLfloat x,GLfloat y); -typedef void (*glcompmouseoutfunc_t) (void* obj,GLfloat x,GLfloat y); -typedef void (*glcompmousedownfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t); -typedef void (*glcompmouseupfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t); -typedef void (*glcompmousedragfunct_t) (void* obj,GLfloat dx,GLfloat dy,glMouseButtonType t); - - +typedef void (*glcompdrawfunc_t) (glCompButton* obj); +typedef void (*glcompclickfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t); +typedef void (*glcompdoubleclickfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t); +typedef void (*glcompmouseoverfunc_t) (glCompObj* obj,GLfloat x,GLfloat y); +typedef void (*glcompmouseinfunc_t) (glCompObj* obj,GLfloat x,GLfloat y); +typedef void (*glcompmouseoutfunc_t) (glCompObj* obj,GLfloat x,GLfloat y); +typedef void (*glcompmousedownfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t); +typedef void (*glcompmouseupfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t); +typedef void (*glcompmousedragfunct_t) (glCompObj* obj,GLfloat dx,GLfloat dy,glMouseButtonType t); @@ -189,7 +189,7 @@ typedef struct _glCompRect typedef struct _glCompTex { - int id; + GLuint id; char* def; char* text; float width; @@ -292,7 +292,8 @@ typedef struct _glCompLabel } glCompLabel; /*buttons*/ -typedef struct _glCompButton { +struct _glCompButton +{ glObjType objType; /*always keep this here for each drawable object*/ glCompCommon common; GLfloat width, height; @@ -304,7 +305,7 @@ typedef struct _glCompButton { void *customptr; //general purpose void pointer to pass to call back int data; -} glCompButton; +}; /*texture based image*/ @@ -343,10 +344,11 @@ typedef struct }fontset_t; /*object prototype*/ -typedef struct { +struct _glCompObj +{ glObjType objType; glCompCommon common; -}glCompObj; +}; typedef struct _glCompMouse { diff --git a/lib/glcomp/glcompfont.c b/lib/glcomp/glcompfont.c index 2515036ee..00fd06c66 100644 --- a/lib/glcomp/glcompfont.c +++ b/lib/glcomp/glcompfont.c @@ -98,9 +98,9 @@ glPrintf(glCompFont * font, GLfloat xpos, GLfloat ypos, GLfloat zpos, GLfloat width, char *bf, int usez) { - GLfloat size = font->size; - GLfloat x = xpos; - GLfloat y = ypos; +// GLfloat size = font->size; +// GLfloat x = xpos; +// GLfloat y = ypos; //set the color glColor4f(font->color.R, font->color.G, font->color.B, font->color.A); @@ -372,6 +372,8 @@ void glCompRenderText(glCompFont* f,glCompObj* parentObj) GLfloat x,y,z,w,h; if (!f->tex) return ; + x=0; + y=0; w=f->tex->width; h=f->tex->height; ref=parentObj->common; diff --git a/lib/glcomp/glcompimage.c b/lib/glcomp/glcompimage.c index ac5f347d0..ba3a488f5 100644 --- a/lib/glcomp/glcompimage.c +++ b/lib/glcomp/glcompimage.c @@ -48,7 +48,8 @@ int glCompImageLoad(glCompImage* i,unsigned char* data,int width,int height) if(data != NULL) /*valid image data*/ { glCompDeleteTexture(i->texture); - if(i->texture=glCompSetAddNewTexImage(i->common.compset,width,height,data,1)) + i->texture=glCompSetAddNewTexImage(i->common.compset,width,height,data,1); + if(i->texture) { i->common.width=width; i->common.height=height; @@ -80,7 +81,7 @@ void glCompImageDraw(void* obj) { glCompImage* p; static glCompCommon ref; - static GLfloat w,h,d; +// static GLfloat w,h,d; p=(glCompImage*)obj; ref=p->common; glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref); diff --git a/lib/glcomp/glcomplabel.c b/lib/glcomp/glcomplabel.c index ebe62c4c1..6c19ae4ea 100644 --- a/lib/glcomp/glcomplabel.c +++ b/lib/glcomp/glcomplabel.c @@ -21,7 +21,7 @@ glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text) { glCompLabel *p; - glCompCommon* parent=&par->common; +// glCompCommon* parent=&par->common; p = malloc(sizeof(glCompLabel)); glCompInitCommon((glCompObj*)p,par,x,y); p->objType=glLabelObj; diff --git a/lib/glcomp/glcomppanel.c b/lib/glcomp/glcomppanel.c index 62f07d3c4..5b95d9a29 100644 --- a/lib/glcomp/glcomppanel.c +++ b/lib/glcomp/glcomppanel.c @@ -23,7 +23,7 @@ glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h) { glCompPanel *p; - glCompCommon* parent=&parentObj->common; +// glCompCommon* parent=&parentObj->common; p = malloc(sizeof(glCompPanel)); glCompInitCommon((glCompObj*)p,parentObj,(GLfloat)x ,(GLfloat)y); diff --git a/lib/glcomp/glcompset.c b/lib/glcomp/glcompset.c index 406d74faf..fc20b0a79 100644 --- a/lib/glcomp/glcompset.c +++ b/lib/glcomp/glcompset.c @@ -50,17 +50,19 @@ void glCompGetObjectType(glCompObj* p) } } + static int glCompPointInObject(glCompObj* p, float x, float y) { return ((x > p->common.refPos.x) && (x < p->common.refPos.x + p->common.width) && (y > p->common.refPos.y) && (y < p->common.refPos.y + p->common.height)); } + glCompObj* glCompGetObjByMouse(glCompSet* s ,glCompMouse* m,int onlyClickable) { - int ind=0; + int ind; glCompObj* rv=NULL; if (!s || !m) return NULL; - for (ind ; ind < s->objcnt ; ind ++) + for (ind=0 ; ind < s->objcnt ; ind ++) { if ((s->obj[ind]->common.visible)&&(glCompPointInObject(s->obj[ind],m->pos.x,m->pos.y))) { @@ -252,6 +254,10 @@ void glCompSetAddObj(glCompSet* s ,glCompObj* obj) s->obj[s->objcnt - 1] = obj; obj->common.compset=s; } + +#if 0 +// compiler reports this function is not used. + //converts screen location to opengl coordinates static void glCompSetGetPos(int x, int y, float *X, float *Y, float *Z) { @@ -284,6 +290,7 @@ static void glCompSetGetPos(int x, int y, float *X, float *Y, float *Z) *Y = (float) posY; *Z = (float) posZ; } +#endif void glCompDrawBegin(void) //pushes a gl stack { diff --git a/lib/glcomp/glcomptexture.c b/lib/glcomp/glcomptexture.c index 6d7ced115..cd999a299 100644 --- a/lib/glcomp/glcomptexture.c +++ b/lib/glcomp/glcomptexture.c @@ -105,7 +105,7 @@ glCompTex* glCompSetAddNewTexImage(glCompSet* s,int width,int height,unsigned ch glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D) { int ind,Er,width,height; - int ind2=0; +// int ind2=0; glCompTex* t; cairo_surface_t *surface=NULL; unsigned char* data; diff --git a/lib/glcomp/glpangofont.c b/lib/glcomp/glpangofont.c index 320d2d183..106867566 100644 --- a/lib/glcomp/glpangofont.c +++ b/lib/glcomp/glpangofont.c @@ -159,11 +159,11 @@ int create_font_file(char *fontdescription,int fs, char *fontfile, float gw,floa unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h) { - char buf[] = " "; - int ncolumns = 16; - int counter = 0; - int X = 0; - int Y = 0; +// char buf[] = " "; +// int ncolumns = 16; +// int counter = 0; +// int X = 0; +// int Y = 0; cairo_t *cr; PangoLayout *layout; double width, height; diff --git a/lib/glcomp/glutils.c b/lib/glcomp/glutils.c index 0eafbc52d..63e522f4c 100644 --- a/lib/glcomp/glutils.c +++ b/lib/glcomp/glutils.c @@ -542,6 +542,9 @@ void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref ref->width=parent->width-2*borderWidth;; ref->height=parent->height-2*borderWidth; break; + case glAlignCenter: + case glAlignNone: + break; } if(child->align == glAlignNone) // No alignment , chekc anchors { @@ -563,10 +566,16 @@ void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref child->width=ref->width; child->height=ref->height; } + +#if 0 +// compiler reports this function is not used + static void glCompVertex(glCompPoint* p) { glVertex3f(p->x,p->y,p->z); } +#endif + static void glCompQuadVertex(glCompPoint* p0,glCompPoint* p1,glCompPoint* p2,glCompPoint* p3) { glVertex3f(p0->x,p0->y,p0->z);