]> granicus.if.org Git - graphviz/commitdiff
Clean up smyrna files:
authorerg <devnull@localhost>
Wed, 19 Mar 2008 21:43:58 +0000 (21:43 +0000)
committererg <devnull@localhost>
Wed, 19 Mar 2008 21:43:58 +0000 (21:43 +0000)
  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

lib/glcomp/glcompset.h
lib/glcomp/glcomptexture.c
lib/glcomp/glcomptexture.h

index bbc9b76745e71cabf9fb781bcc1f248dadc0fac3..a1f543d10cd43d5dc5a654b74e17b8ecb19fe5d6 100644 (file)
@@ -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
 */
 #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
index d44a80f010063a632d9c65ae75fbc64a95b280ef..cbd147a080f516c2532ab6483138b57b9f835b78 100644 (file)
@@ -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;
 }
index eacfd33b52daf1a68603374099a3b32971127cfa..25bbd3d6aa7b8050816302c109cee2c771ac7823 100644 (file)
@@ -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
 */
 #endif
 #include <stdio.h>
 #include <GL/gl.h>
-#include <GL/glu.h>                                                    
+#include <GL/glu.h>
 
 #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
-