From: erg Date: Wed, 19 Mar 2008 21:43:58 +0000 (+0000) Subject: Clean up smyrna files: X-Git-Tag: LAST_LIBGRAPH~32^2~4470 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6b179610496c3c734d98c98eb45e1423aa08819;p=graphviz Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings --- diff --git a/lib/glcomp/glcompset.h b/lib/glcomp/glcompset.h index bbc9b7674..a1f543d10 100644 --- a/lib/glcomp/glcompset.h +++ b/lib/glcomp/glcompset.h @@ -1,3 +1,18 @@ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2007 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + /*Open GL basic component set includes glPanel,glCompButton,glCompCustomButton,clCompLabel,glCompStyle */ @@ -41,118 +56,117 @@ #define GLCOMPSET_PANEL_BEVEL (GLfloat)0.1 #define GLCOMPSET_BEVEL_DIFF (GLfloat)0.001 -typedef void (*callbackfunc_t)(void* component); - -typedef struct _glCompPoint -{ - GLfloat x,y; -}glCompPoint; -typedef struct{ - GLfloat R; - GLfloat G; - GLfloat B; - GLfloat A; //Alpha +typedef void (*callbackfunc_t) (void *component); + +typedef struct _glCompPoint { + GLfloat x, y; +} glCompPoint; +typedef struct { + GLfloat R; + GLfloat G; + GLfloat B; + GLfloat A; //Alpha } glCompColor; -typedef struct _glCompPanel -{ - glCompPoint pos; - GLfloat width,height; - GLfloat shadowwidth; - GLfloat bevel; - glCompColor color; - glCompColor shadowcolor; - int enabled; - int visible; - void* parentset; //parent compset - int data; - - -}glCompPanel; -typedef struct _glCompLabel -{ - glCompPoint pos; - GLfloat size; - GLfloat bevel; - glCompColor color; - int visible; - char* text; - GLfloat fontsizefactor; - glCompPanel* panel; //container panel -}glCompLabel; - - -typedef struct _glCompButton{ - glCompPoint pos; - GLfloat width,height; - GLfloat bevel; - GLfloat thickness; - glCompColor color; - glCompColor fontcolor; - char* caption; - int enabled; - int visible; - int status; //0 not pressed 1 pressed; - int groupid; - void* parentset; //parent compset - GLfloat fontsize; - int hasglyph; - glCompTexture* glyph; - int glyphwidth,glyphheight; - glCompPanel* panel; //container panel - callbackfunc_t callbackfunc; //call back for button click - void* customptr; //general purpose void pointer to pass to call back - int data; -}glCompButton; - - - -typedef struct -{ - glCompPanel** panels; - glCompButton** buttons; - glCompLabel** labels; - - int panelcount; - int buttoncount; - int labelcount; - int active; //0 dont draw, 1 draw - int enabled; //0 disabled 1 enabled(allow mouse interaction) - GLfloat clickedX,clickedY; -}glCompSet; - -glCompPanel* glCompPanelNew(GLfloat x,GLfloat y,GLfloat w,GLfloat h); -void glCompSetClear(glCompSet* s); -int glCompSetAddPanel(glCompSet* s,glCompPanel* p); -int glCompSetRemovePanel(glCompSet* s,glCompPanel* p); -int glCompSetDraw(glCompSet* s); - -glCompButton* glCompButtonNew(GLfloat x,GLfloat y,GLfloat w,GLfloat h,char* caption,char* glyphfile,int glyphwidth,int glyphheight); -int glCompSetAddButton(glCompSet* s,glCompButton* p); -int glCompSetRemoveButton(glCompSet* s,glCompButton* p); -int glCompDrawButton(glCompButton* p); - - -int glCompSetDraw(glCompSet* s); -int glCompSetHide(glCompSet* s); -int glCompSetShow(glCompSet* s); -void glCompDrawBegin(); //pushes a gl stack -void glCompDrawEnd(); //pops the gl stack -int glCompDrawPanel(glCompPanel* p); -int glCompSetClick(glCompSet* s,int x,int y); -int glCompSetRelease(glCompSet* s, int x, int y); -void glCompSetGetPos(int x, int y,float* X,float* Y,float* Z); -int glCompPointInButton(glCompButton* p,float x,float y); -void glCompButtonClick(glCompButton* p); - -glCompLabel* glCompLabelNew(GLfloat x,GLfloat y,GLfloat size,char* text); -int glCompSetAddLabel(glCompSet* s,glCompLabel* p); -int glCompSetRemoveLabel(glCompSet* s,glCompLabel* p); -int glCompDrawLabel(glCompLabel* p); -int glCompLabelSetText(glCompLabel* p,char* text); -int glCompPanelHide(glCompPanel* p); -int glCompPanelShow(glCompPanel* p); -int glCompSetDrawPanels(glCompSet* s); +typedef struct _glCompPanel { + glCompPoint pos; + GLfloat width, height; + GLfloat shadowwidth; + GLfloat bevel; + glCompColor color; + glCompColor shadowcolor; + int enabled; + int visible; + void *parentset; //parent compset + int data; + + +} glCompPanel; +typedef struct _glCompLabel { + glCompPoint pos; + GLfloat size; + GLfloat bevel; + glCompColor color; + int visible; + char *text; + GLfloat fontsizefactor; + glCompPanel *panel; //container panel +} glCompLabel; + + +typedef struct _glCompButton { + glCompPoint pos; + GLfloat width, height; + GLfloat bevel; + GLfloat thickness; + glCompColor color; + glCompColor fontcolor; + char *caption; + int enabled; + int visible; + int status; //0 not pressed 1 pressed; + int groupid; + void *parentset; //parent compset + GLfloat fontsize; + int hasglyph; + glCompTexture *glyph; + int glyphwidth, glyphheight; + glCompPanel *panel; //container panel + callbackfunc_t callbackfunc; //call back for button click + void *customptr; //general purpose void pointer to pass to call back + int data; +} glCompButton; + + + +typedef struct { + glCompPanel **panels; + glCompButton **buttons; + glCompLabel **labels; + + int panelcount; + int buttoncount; + int labelcount; + int active; //0 dont draw, 1 draw + int enabled; //0 disabled 1 enabled(allow mouse interaction) + GLfloat clickedX, clickedY; +} glCompSet; + +glCompPanel *glCompPanelNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h); +void glCompSetClear(glCompSet * s); +int glCompSetAddPanel(glCompSet * s, glCompPanel * p); +int glCompSetRemovePanel(glCompSet * s, glCompPanel * p); +int glCompSetDraw(glCompSet * s); + +glCompButton *glCompButtonNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h, + char *caption, char *glyphfile, + int glyphwidth, int glyphheight); +int glCompSetAddButton(glCompSet * s, glCompButton * p); +int glCompSetRemoveButton(glCompSet * s, glCompButton * p); +int glCompDrawButton(glCompButton * p); + + +int glCompSetDraw(glCompSet * s); +int glCompSetHide(glCompSet * s); +int glCompSetShow(glCompSet * s); +void glCompDrawBegin(); //pushes a gl stack +void glCompDrawEnd(); //pops the gl stack +int glCompDrawPanel(glCompPanel * p); +int glCompSetClick(glCompSet * s, int x, int y); +int glCompSetRelease(glCompSet * s, int x, int y); +void glCompSetGetPos(int x, int y, float *X, float *Y, float *Z); +int glCompPointInButton(glCompButton * p, float x, float y); +void glCompButtonClick(glCompButton * p); + +glCompLabel *glCompLabelNew(GLfloat x, GLfloat y, GLfloat size, + char *text); +int glCompSetAddLabel(glCompSet * s, glCompLabel * p); +int glCompSetRemoveLabel(glCompSet * s, glCompLabel * p); +int glCompDrawLabel(glCompLabel * p); +int glCompLabelSetText(glCompLabel * p, char *text); +int glCompPanelHide(glCompPanel * p); +int glCompPanelShow(glCompPanel * p); +int glCompSetDrawPanels(glCompSet * s); #endif diff --git a/lib/glcomp/glcomptexture.c b/lib/glcomp/glcomptexture.c index d44a80f01..cbd147a08 100644 --- a/lib/glcomp/glcomptexture.c +++ b/lib/glcomp/glcomptexture.c @@ -1,43 +1,59 @@ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2007 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + #include "glcomptexture.h" -glCompTexture* glCompCreateTextureFromRaw(char* filename,int width,int height,int wrap) +glCompTexture *glCompCreateTextureFromRaw(char *filename, int width, + int height, int wrap) { - glCompTexture* t; + glCompTexture *t; #ifdef _WIN32 - BYTE * data; + BYTE *data; #else - unsigned char *data; + unsigned char *data; #endif - FILE * file; - t=malloc(sizeof(glCompTexture)); - glGenTextures( 1, &t->id ); + FILE *file; + t = malloc(sizeof(glCompTexture)); + glGenTextures(1, &t->id); - // allocate buffer - data = malloc( width * height * 3 ); - // open and read texture data - file = fopen( filename, "rb" ); - fread( data, width * height * 3, 1, file ); - fclose( file ); + // allocate buffer + data = malloc(width * height * 3); + // open and read texture data + file = fopen(filename, "rb"); + fread(data, width * height * 3, 1, file); + fclose(file); // select our current texture - glBindTexture( GL_TEXTURE_2D, t->id); + glBindTexture(GL_TEXTURE_2D, t->id); // select modulate to mix texture with color for shading - glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // when texture area is small, bilinear filter the closest mipmap - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_NEAREST ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); // when texture area is large, bilinear filter the first mipmap - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // if wrap is true, the texture wraps over at the edges (repeat) // ... false, the texture ends at the edges (clamp) - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - (GLfloat)wrap ? (GLfloat)GL_REPEAT : GL_CLAMP ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - (GLfloat)wrap ? (GLfloat)GL_REPEAT : GL_CLAMP ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + (GLfloat) wrap ? (GLfloat) GL_REPEAT : GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + (GLfloat) wrap ? (GLfloat) GL_REPEAT : GL_CLAMP); /* glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT ); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); @@ -49,16 +65,17 @@ glCompTexture* glCompCreateTextureFromRaw(char* filename,int width,int height,in // build our texture mipmaps glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE,data);*/ - gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB, width, height, - GL_RGB, GL_UNSIGNED_BYTE, data ); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, width, height, + GL_RGB, GL_UNSIGNED_BYTE, data); // free buffer - free( data ); - t->w=(float)width; - t->h=(float)height; - return t; + free(data); + t->w = (float) width; + t->h = (float) height; + return t; } -int glCompDeleteTexture(glCompTexture* t) + +int glCompDeleteTexture(glCompTexture * t) { - return 0; + return 0; } diff --git a/lib/glcomp/glcomptexture.h b/lib/glcomp/glcomptexture.h index eacfd33b5..25bbd3d6a 100644 --- a/lib/glcomp/glcomptexture.h +++ b/lib/glcomp/glcomptexture.h @@ -1,3 +1,18 @@ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2007 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + /*Open GL texture handling and storing mechanism includes glPanel,glCompButton,glCompCustomButton,clCompLabel,glCompStyle */ @@ -6,16 +21,16 @@ #endif #include #include -#include +#include #ifndef GLCOMPTEXTURE_H #define GLCOMPTEXTURE_H -typedef struct{ - int id; - float w,h; +typedef struct { + int id; + float w, h; } glCompTexture; -glCompTexture* glCompCreateTextureFromRaw(char* filename,int width,int height,int wrap); -int glCompDeleteTexture(glCompTexture* t); +glCompTexture *glCompCreateTextureFromRaw(char *filename, int width, + int height, int wrap); +int glCompDeleteTexture(glCompTexture * t); #endif -