+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
**********************************************************/
#include "glCompTrackBar.h"
#include "glcomptext.h"
-
-
+#include "memory.h"
glCompTrackBar *glCompTrackBarNew(GLfloat x, GLfloat y, GLfloat w,
GLfloat h, glCompOrientation orientation)
{
glCompTrackBar *p;
- p = malloc(sizeof(glCompTrackBar));
+ p = NEW(glCompTrackBar);
/*default color values for a panel */
p->color.R = GLCOMPSET_PANEL_COLOR_R;
p->color.G = GLCOMPSET_PANEL_COLOR_G;
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
-
-
-
#endif
-
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include "glcompfont.h"
#include "glutils.h"
#include "glcompset.h"
+#include "memory.h"
#include <string.h>
#include <GL/glut.h>
-glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption)
+glCompButton *glCompButtonNew(glCompObj * par, GLfloat x, GLfloat y,
+ GLfloat w, GLfloat h, char *caption)
{
glCompButton *p;
-// glCompCommon* parent=&par->common;
- p = malloc(sizeof(glCompButton));
- glCompInitCommon((glCompObj*)p,par,x,y);
- p->objType=glButtonObj;
- /*customize button color*/
- p->common.color.R = GLCOMPSET_BUTTON_COLOR_R;
+// glCompCommon* parent=&par->common;
+ p = NEW(glCompButton);
+ glCompInitCommon((glCompObj *) p, par, x, y);
+ p->objType = glButtonObj;
+ /*customize button color */
+ p->common.color.R = GLCOMPSET_BUTTON_COLOR_R;
p->common.color.G = GLCOMPSET_BUTTON_COLOR_G;
p->common.color.B = GLCOMPSET_BUTTON_COLOR_B;
p->common.color.A = GLCOMPSET_BUTTON_COLOR_ALPHA;
- p->common.borderType=glBorderSolid;
+ p->common.borderType = glBorderSolid;
- p->common.borderWidth= GLCOMPSET_BUTTON_BEVEL;
+ p->common.borderWidth = GLCOMPSET_BUTTON_BEVEL;
p->common.width = w;
p->common.height = h;
p->status = 0; //0 not pressed 1 pressed;
p->groupid = 0;
- p->common.callbacks.click = '\0';
+ p->common.callbacks.click = '\0';
p->customptr = '\0';
- /*set event functions*/
-
- p->common.functions.draw=glCompButtonDraw;
-
- p->common.functions.click=glCompButtonClick;
- p->common.functions.doubleclick=glCompButtonDoubleClick;
- p->common.functions.mousedown=glCompButtonMouseDown;
- p->common.functions.mousein=glCompButtonMouseIn;
- p->common.functions.mouseout=glCompButtonMouseOut;
- p->common.functions.mouseover=glCompButtonMouseOver;
- p->common.functions.mouseup=glCompButtonMouseUp;
-
- /*caption*/
- p->common.font =new_font_from_parent((glCompObj*)p,NULL);
- p->label=glCompLabelNew((glCompObj*)p,0,0,caption);
- p->label->common.font->justify.VJustify=glFontVJustifyCenter;
- p->label->common.font->justify.HJustify=glFontHJustifyCenter;
- p->label->common.align=glAlignParent;
- /*image*/
- p->image=(glCompImage*)0;
- p->glyphPos=glButtonGlyphLeft;
+ /*set event functions */
+
+ p->common.functions.draw = glCompButtonDraw;
+
+ p->common.functions.click = glCompButtonClick;
+ p->common.functions.doubleclick = glCompButtonDoubleClick;
+ p->common.functions.mousedown = glCompButtonMouseDown;
+ p->common.functions.mousein = glCompButtonMouseIn;
+ p->common.functions.mouseout = glCompButtonMouseOut;
+ p->common.functions.mouseover = glCompButtonMouseOver;
+ p->common.functions.mouseup = glCompButtonMouseUp;
+
+ /*caption */
+ p->common.font = new_font_from_parent((glCompObj *) p, NULL);
+ p->label = glCompLabelNew((glCompObj *) p, 0, 0, caption);
+ p->label->common.font->justify.VJustify = glFontVJustifyCenter;
+ p->label->common.font->justify.HJustify = glFontHJustifyCenter;
+ p->label->common.align = glAlignParent;
+ /*image */
+ p->image = (glCompImage *) 0;
+ p->glyphPos = glButtonGlyphLeft;
return p;
}
-int glCompButtonAddPngGlyph(glCompButton* b,char* fileName)
+int glCompButtonAddPngGlyph(glCompButton * b, char *fileName)
{
- int rv;
- /*delete if there is an existing image*/
- if (b->image)
- glCompImageDelete(b->image);
- /*image on left for now*/
- b->image=glCompImageNew((glCompObj*)b,0,0);
+ int rv;
+ /*delete if there is an existing image */
+ if (b->image)
+ glCompImageDelete(b->image);
+ /*image on left for now */
+ b->image = glCompImageNew((glCompObj *) b, 0, 0);
- rv= glCompImageLoadPng(b->image,fileName);
- if (rv)
- {
- b->image->common.anchor.leftAnchor=1;
- b->image->common.anchor.left=0;
+ rv = glCompImageLoadPng(b->image, fileName);
+ if (rv) {
+ b->image->common.anchor.leftAnchor = 1;
+ b->image->common.anchor.left = 0;
- b->image->common.anchor.topAnchor=1;
- b->image->common.anchor.top=0;
+ b->image->common.anchor.topAnchor = 1;
+ b->image->common.anchor.top = 0;
- b->image->common.anchor.bottomAnchor=1;
- b->image->common.anchor.bottom=0;
+ b->image->common.anchor.bottomAnchor = 1;
+ b->image->common.anchor.bottom = 0;
- b->label->common.anchor.leftAnchor=1;
- b->label->common.anchor.left=b->image->common.width;
- b->label->common.anchor.rightAnchor=1;
- b->label->common.anchor.right=0;
+ b->label->common.anchor.leftAnchor = 1;
+ b->label->common.anchor.left = b->image->common.width;
+ b->label->common.anchor.rightAnchor = 1;
+ b->label->common.anchor.right = 0;
- b->label->common.anchor.topAnchor=1;
- b->label->common.anchor.top=0;
+ b->label->common.anchor.topAnchor = 1;
+ b->label->common.anchor.top = 0;
- b->label->common.anchor.bottomAnchor=1;
- b->label->common.anchor.bottom=0;
+ b->label->common.anchor.bottomAnchor = 1;
+ b->label->common.anchor.bottom = 0;
- b->label->common.align=glAlignNone;
- }
- return rv;
+ b->label->common.align = glAlignNone;
+ }
+ return rv;
}
void glCompButtonHide(glCompButton * p)
-{
- p->common.visible=0;
- if (p->label)
- p->label->common.visible=0;
- if (p->image)
- p->image->common.visible=0;
+{
+ p->common.visible = 0;
+ if (p->label)
+ p->label->common.visible = 0;
+ if (p->image)
+ p->image->common.visible = 0;
}
+
void glCompButtonShow(glCompButton * p)
-{
- p->common.visible=1;
- if (p->label)
- p->label->common.visible=1;
- if (p->image)
- p->image->common.visible=1;
+{
+ p->common.visible = 1;
+ if (p->label)
+ p->label->common.visible = 1;
+ if (p->image)
+ p->image->common.visible = 1;
}
void glCompButtonDraw(glCompButton * p)
{
- glCompCommon ref;
- ref=p->common;
- glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
+ glCompCommon ref;
+ ref = p->common;
+ glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
if (!p->common.visible)
- return;
- /*draw panel*/
- glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),!p->status);
- if (p->label)
- p->label->common.functions.draw((void*)p->label);
- if (p->image)
- p->image->common.functions.draw((void*)p->image);
- if (p->common.callbacks.draw)
- p->common.callbacks.draw((void*)p); /*user defined drawing routines are called here.*/
+ return;
+ /*draw panel */
+ glCompDrawRectPrism(&(ref.pos), ref.width, ref.height,
+ p->common.borderWidth, 0.01, &(ref.color),
+ !p->status);
+ if (p->label)
+ p->label->common.functions.draw((void *) p->label);
+ if (p->image)
+ p->image->common.functions.draw((void *) p->image);
+ if (p->common.callbacks.draw)
+ p->common.callbacks.draw((void *) p); /*user defined drawing routines are called here. */
}
-void glCompButtonClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompButtonClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- glCompButton* p=(glCompButton*)o;
- glCompObj* obj;
- glCompSet* s=o->common.compset;
- int ind=0;
- if (p->groupid > 0)
- {
- for (;ind < s->objcnt;ind ++)
- {
- obj=s->obj[ind];
- if (obj->objType==glButtonObj)
- {
- if ( ((glCompButton*)obj)->groupid == p->groupid)
- ((glCompButton*)obj)->status=0;
- }
- }
+ glCompButton *p = (glCompButton *) o;
+ glCompObj *obj;
+ glCompSet *s = o->common.compset;
+ int ind = 0;
+ if (p->groupid > 0) {
+ for (; ind < s->objcnt; ind++) {
+ obj = s->obj[ind];
+ if (obj->objType == glButtonObj) {
+ if (((glCompButton *) obj)->groupid == p->groupid)
+ ((glCompButton *) obj)->status = 0;
+ }
+ }
+ p->status = 1;
+ } else {
+ if (p->groupid == -1) {
+ if (p->status == 0)
p->status = 1;
- }
- else
- {
- if (p->groupid == -1)
- {
- if (p->status == 0)
- p->status = 1;
- else
- p->status = 0;
- }
- else p->status = 0;
+ else
+ p->status = 0;
+ } else
+ p->status = 0;
}
- if (p->common.callbacks.click)
- p->common.callbacks.click((glCompObj*)p,x,y,t);
+ if (p->common.callbacks.click)
+ p->common.callbacks.click((glCompObj *) p, x, y, t);
}
-void glCompButtonDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompButtonDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompButton*)obj)->common.callbacks.doubleclick)
- ((glCompButton*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompButton *) obj)->common.callbacks.doubleclick)
+ ((glCompButton *) obj)->common.callbacks.doubleclick(obj, x, y, t);
}
-void glCompButtonMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompButtonMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
+ /*Put your internal code here */
- ((glCompButton*)obj)->status=1;
- if (((glCompButton*)obj)->common.callbacks.mousedown)
- ((glCompButton*)obj)->common.callbacks.mousedown(obj,x,y,t);
+ ((glCompButton *) obj)->status = 1;
+ if (((glCompButton *) obj)->common.callbacks.mousedown)
+ ((glCompButton *) obj)->common.callbacks.mousedown(obj, x, y, t);
}
-void glCompButtonMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+void glCompButtonMouseIn(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompButton*)obj)->common.callbacks.mousein)
- ((glCompButton*)obj)->common.callbacks.mousein(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompButton *) obj)->common.callbacks.mousein)
+ ((glCompButton *) obj)->common.callbacks.mousein(obj, x, y);
}
-void glCompButtonMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompButtonMouseOut(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompButton*)obj)->common.callbacks.mouseout)
- ((glCompButton*)obj)->common.callbacks.mouseout(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompButton *) obj)->common.callbacks.mouseout)
+ ((glCompButton *) obj)->common.callbacks.mouseout(obj, x, y);
}
-void glCompButtonMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompButtonMouseOver(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompButton*)obj)->common.callbacks.mouseover)
- ((glCompButton*)obj)->common.callbacks.mouseover(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompButton *) obj)->common.callbacks.mouseover)
+ ((glCompButton *) obj)->common.callbacks.mouseover(obj, x, y);
}
-void glCompButtonMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+
+void glCompButtonMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompButton*)obj)->common.callbacks.mouseup)
- ((glCompButton*)obj)->common.callbacks.mouseup(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompButton *) obj)->common.callbacks.mouseup)
+ ((glCompButton *) obj)->common.callbacks.mouseup(obj, x, y, t);
}
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
-glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption);
-extern int glCompSetRemoveButton(glCompSet * s, glCompButton * p);
-extern void glCompButtonDraw(glCompButton * p);
-extern void glCompButtonSetText(glCompButton * p,char* str);
-extern int glCompButtonAddPngGlyph(glCompButton* b,char* fileName);
-extern void glCompButtonClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompButtonDoubleClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompButtonMouseDown(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompButtonMouseIn(glCompObj * o,GLfloat x,GLfloat y);
-extern void glCompButtonMouseOut(glCompObj * o,GLfloat x,GLfloat y);
-extern void glCompButtonMouseOver(glCompObj * o,GLfloat x,GLfloat y);
-extern void glCompButtonMouseUp(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompButtonHide(glCompButton * p);
-extern void glCompButtonShow(glCompButton * p);
-
-
+ extern glCompButton *glCompButtonNew(glCompObj * par, GLfloat x,
+ GLfloat y, GLfloat w, GLfloat h,
+ char *caption);
+ extern int glCompSetRemoveButton(glCompSet * s, glCompButton * p);
+ extern void glCompButtonDraw(glCompButton * p);
+ extern void glCompButtonSetText(glCompButton * p, char *str);
+ extern int glCompButtonAddPngGlyph(glCompButton * b, char *fileName);
+ extern void glCompButtonClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompButtonDoubleClick(glCompObj * o, GLfloat x,
+ GLfloat y, glMouseButtonType t);
+ extern void glCompButtonMouseDown(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompButtonMouseIn(glCompObj * o, GLfloat x, GLfloat y);
+ extern void glCompButtonMouseOut(glCompObj * o, GLfloat x, GLfloat y);
+ extern void glCompButtonMouseOver(glCompObj * o, GLfloat x, GLfloat y);
+ extern void glCompButtonMouseUp(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompButtonHide(glCompButton * p);
+ extern void glCompButtonShow(glCompButton * p);
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#define strdup _strdup
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define GLCOMPSET_PANEL_COLOR_R (GLfloat)0.16
#define GLCOMPSET_PANEL_COLOR_G (GLfloat)0.44
-#define FONT_MAX_LEN 1024 /* maximum chars to draw to the screen, used for buffers also */
-#define FONT_TAB_SPACE 4 /* spaces to draw for a tab, make option? */
+#define FONT_MAX_LEN 1024 /* maximum chars to draw to the screen, used for buffers also */
+#define FONT_TAB_SPACE 4 /* spaces to draw for a tab, make option? */
#define C_DPI 16
#define R_DPI 16
+ typedef enum { inverted_y, scientific_y } glCompOrientation;
+ typedef enum { gluttext, pangotext } glCompFontType;
+ typedef enum { glAlignNone, glAlignLeft, glAlignTop, glAlignBottom,
+ glAlignRight, glAlignParent, glAlignCenter } glCompAlignment;
+ typedef enum { glFontVJustifyNone, glFontVJustifyTop,
+ glFontVJustifyBottom, glFontVJustifyCenter } glCompVJustify;
+ typedef enum { glFontHJustifyNone, glFontHJustifyLeft,
+ glFontHJustifyRight, glFontHJustifyCenter } glCompHJustify;
+ typedef enum { glButtonGlyphLeft, glButtonGlyphRight, glButtonGlyphTop,
+ glButtonGlyphBottom } glCompButtonGlyph;
+ typedef enum { glBorderNone, glBorderSolid, glBorderBevel,
+ glBorderCustom } glCompBorderType;
+ typedef enum { glMouseDown, glMouseUp } glCompMouseStatus;
+ typedef enum { glMouseLeftButton, glMouseRightButton,
+ glMouseMiddleButton } glMouseButtonType;
+ typedef enum { glTexImage, glTexLabel } glCompTexType;
+ typedef enum { glPanelObj, glButtonObj, glLabelObj,
+ glImageObj } glObjType;
-
-
-typedef enum { inverted_y,scientific_y} glCompOrientation;
-typedef enum {gluttext,pangotext} glCompFontType;
-typedef enum {glAlignNone,glAlignLeft,glAlignTop,glAlignBottom,glAlignRight,glAlignParent,glAlignCenter} glCompAlignment;
-
-typedef enum {glFontVJustifyNone,glFontVJustifyTop,glFontVJustifyBottom,glFontVJustifyCenter} glCompVJustify;
-typedef enum {glFontHJustifyNone,glFontHJustifyLeft,glFontHJustifyRight,glFontHJustifyCenter} glCompHJustify;
-typedef enum {glButtonGlyphLeft,glButtonGlyphRight,glButtonGlyphTop,glButtonGlyphBottom} glCompButtonGlyph;
-typedef enum {glBorderNone,glBorderSolid,glBorderBevel,glBorderCustom} glCompBorderType;
-
-typedef enum {glMouseDown,glMouseUp}glCompMouseStatus;
-typedef enum {glMouseLeftButton,glMouseRightButton,glMouseMiddleButton} glMouseButtonType;
-
-typedef enum {glTexImage,glTexLabel} glCompTexType;
-typedef enum {glPanelObj,glButtonObj,glLabelObj,glImageObj}glObjType;
-
-typedef struct _glCompButton glCompButton;
-typedef struct _glCompObj glCompObj;
+ typedef struct _glCompButton glCompButton;
+ typedef struct _glCompObj glCompObj;
/*call backs for widgets*/
-typedef void (*glcompdrawfunc_t) (void* 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);
-
-
-
-typedef struct _glCompAnchor {
-
- int topAnchor; /*anchor booleans*/
+ typedef void (*glcompdrawfunc_t) (void *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);
+
+
+
+ typedef struct _glCompAnchor {
+
+ int topAnchor; /*anchor booleans */
int leftAnchor;
int rightAnchor;
int bottomAnchor;
- GLfloat top; /*anchor values*/
+ GLfloat top; /*anchor values */
GLfloat left;
GLfloat right;
GLfloat bottom;
-} glCompAnchor;
+ } glCompAnchor;
-typedef struct _glCompJustify
-{
+ typedef struct _glCompJustify {
glCompVJustify VJustify;
glCompHJustify HJustify;
-}glCompJustify;
-
+ } glCompJustify;
-typedef struct _glCompPoint
-{
- GLfloat x, y,z;
-} glCompPoint;
-typedef struct _glCompPointI
-{
- int x, y;
-} glCompPointI;
+ typedef struct _glCompPoint {
+ GLfloat x, y, z;
+ } glCompPoint;
+ typedef struct _glCompPointI {
+ int x, y;
+ } glCompPointI;
+ typedef struct {
+ GLfloat R;
+ GLfloat G;
+ GLfloat B;
+ GLfloat A; //Alpha
+ } glCompColor;
-
-
-
-typedef struct
-{
- GLfloat R;
- GLfloat G;
- GLfloat B;
- GLfloat A; //Alpha
-} glCompColor;
-
-
-typedef struct _glCompRect
-{
+ typedef struct _glCompRect {
glCompPoint pos;
GLfloat w;
GLfloat h;
-}glCompRect;
+ } glCompRect;
-typedef struct _glCompTex
-{
+ typedef struct _glCompTex {
GLuint id;
- char* def;
- char* text;
+ char *def;
+ char *text;
float width;
float height;
glCompTexType type;
int userCount;
- unsigned char* data; /*data*/
-}glCompTex;
+ unsigned char *data; /*data */
+ } glCompTex;
/*opengl font*/
-typedef struct
-{
- char* fontdesc; //font description , only used with pango fonts
+ typedef struct {
+ char *fontdesc; //font description , only used with pango fonts
glCompColor color;
glCompFontType type;
- void* glutfont; /*glut font pointer if used*/
+ void *glutfont; /*glut font pointer if used */
int transparent;
- glCompTex* tex;/* texture, if type is pangotext*/
+ glCompTex *tex; /* texture, if type is pangotext */
int size;
- int reference; /*if font has references to parent*/
+ int reference; /*if font has references to parent */
glCompJustify justify;
int optimize;
-} glCompFont;
+ } glCompFont;
-typedef struct _glCompCallBacks
-{
+ typedef struct _glCompCallBacks {
glcompdrawfunc_t draw;
glcompclickfunc_t click;
glcompdoubleclickfunc_t doubleclick;
glcompmouseupfunc_t mouseup;
glcompmousedragfunct_t mousedrag;
-}glCompCallBacks;
+ } glCompCallBacks;
/*
common widget properties
also each widget has pointer to its parents common
*/
-typedef struct _glCompCommon
-{
- glCompPoint pos;
- glCompPoint refPos;/*calculated pos after anchors and aligns*/
- GLfloat width, height;
+ typedef struct _glCompCommon {
+ glCompPoint pos;
+ glCompPoint refPos; /*calculated pos after anchors and aligns */
+ GLfloat width, height;
GLfloat borderWidth;
glCompBorderType borderType;
- glCompColor color;
- int enabled;
- int visible;
- void *compset; // compset
- void* parent; /*parent widget*/
- int data;
- glCompFont* font; //pointer to font to use
+ glCompColor color;
+ int enabled;
+ int visible;
+ void *compset; // compset
+ void *parent; /*parent widget */
+ int data;
+ glCompFont *font; //pointer to font to use
glCompAlignment align;
glCompAnchor anchor;
- int layer; /*keep track of object order, what to draw on top*/
+ int layer; /*keep track of object order, what to draw on top */
glCompCallBacks callbacks;
glCompCallBacks functions;
glCompJustify justify;
-}glCompCommon;
+ } glCompCommon;
/*generic image*/
-typedef struct _glCompImage
-{
- glObjType objType; /*always keep this here for each drawable object*/
+ typedef struct _glCompImage {
+ glObjType objType; /*always keep this here for each drawable object */
glCompCommon common;
- glCompTex* texture;
- char* pngFile;
+ glCompTex *texture;
+ char *pngFile;
int stretch;
-}glCompImage;
+ } glCompImage;
/*generic panel*/
-typedef struct _glCompPanel
-{
- glObjType objType; /*always keep this here for each drawable object*/
+ typedef struct _glCompPanel {
+ glObjType objType; /*always keep this here for each drawable object */
glCompCommon common;
GLfloat shadowwidth;
- glCompColor shadowcolor;
- char* text;
- glCompImage* image;
-}glCompPanel;
+ glCompColor shadowcolor;
+ char *text;
+ glCompImage *image;
+ } glCompPanel;
/*label*/
-typedef struct _glCompLabel
-{
- glObjType objType; /*always keep this here for each drawable object*/
+ typedef struct _glCompLabel {
+ glObjType objType; /*always keep this here for each drawable object */
glCompCommon common;
- int autosize; /*if 1 label sized is calculated from font*/
- char *text;
-} glCompLabel;
+ int autosize; /*if 1 label sized is calculated from font */
+ char *text;
+ } glCompLabel;
/*buttons*/
-struct _glCompButton
-{
- glObjType objType; /*always keep this here for each drawable object*/
+ struct _glCompButton {
+ glObjType objType; /*always keep this here for each drawable object */
glCompCommon common;
- GLfloat width, height;
- glCompLabel* label;
- int status; //0 not pressed 1 pressed;
- int groupid;
- glCompImage* image;/*glyph*/
+ GLfloat width, height;
+ glCompLabel *label;
+ int status; //0 not pressed 1 pressed;
+ int groupid;
+ glCompImage *image; /*glyph */
glCompButtonGlyph glyphPos;
- void *customptr; //general purpose void pointer to pass to call back
- int data;
+ void *customptr; //general purpose void pointer to pass to call back
+ int data;
-};
+ };
/*texture based image*/
/*track bar*/
-typedef struct _glCompTrackBar {
- glObjType objType; /*always keep this here for each drawable object*/
- GLfloat width,height;
- glCompPanel* outerpanel;
- glCompPanel* trackline;
- glCompPanel* indicator;
-
- GLfloat bevel;
- glCompColor color;
- glCompColor shadowcolor;
+ typedef struct _glCompTrackBar {
+ glObjType objType; /*always keep this here for each drawable object */
+ GLfloat width, height;
+ glCompPanel *outerpanel;
+ glCompPanel *trackline;
+ glCompPanel *indicator;
+
+ GLfloat bevel;
+ glCompColor color;
+ glCompColor shadowcolor;
float value;
float maxvalue;
float minvalue;
int enabled;
- int visible;
- void *parentset; //parent compset
- int data;
- glCompFont* font; //pointer to font to use
+ int visible;
+ void *parentset; //parent compset
+ int data;
+ glCompFont *font; //pointer to font to use
glCompOrientation orientation;
-}glCompTrackBar;
+ } glCompTrackBar;
/*glCompFont container class*/
-typedef struct
-{
- glCompFont** fonts;
+ typedef struct {
+ glCompFont **fonts;
int count;
int activefont;
- char* font_directory; //location where the glfont files are stored
-}fontset_t;
+ char *font_directory; //location where the glfont files are stored
+ } fontset_t;
/*object prototype*/
-struct _glCompObj
-{
+ struct _glCompObj {
glObjType objType;
glCompCommon common;
-};
+ };
-typedef struct _glCompMouse
-{
+ typedef struct _glCompMouse {
glCompMouseStatus status;
glMouseButtonType t;
glCompPoint pos;
- GLfloat dragX,dragY;
- glCompObj* clickedObj;
+ GLfloat dragX, dragY;
+ glCompObj *clickedObj;
glCompCallBacks callbacks;
glCompCallBacks functions;
int down;
-}glCompMouse;
+ } glCompMouse;
/*main widget set manager*/
-typedef struct {
- glObjType objType; /*always keep this here for each drawable object*/
+ typedef struct {
+ glObjType objType; /*always keep this here for each drawable object */
glCompCommon common;
- glCompObj** obj;
+ glCompObj **obj;
int objcnt;
glCompPanel **panels;
- glCompButton **buttons;
- glCompLabel **labels;
- int groupCount ; /*group id counter*/
- int active; //0 dont draw, 1 draw
- int enabled; //0 disabled 1 enabled(allow mouse interaction)
- GLfloat clickedX, clickedY;
+ glCompButton **buttons;
+ glCompLabel **labels;
+ int groupCount; /*group id counter */
+ int active; //0 dont draw, 1 draw
+ int enabled; //0 disabled 1 enabled(allow mouse interaction)
+ GLfloat clickedX, clickedY;
int textureCount;
- glCompTex** textures;
+ glCompTex **textures;
glCompMouse mouse;
-} glCompSet;
-
-
-
+ } glCompSet;
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcompfont.h"
#include "glcompset.h"
#include "glpangofont.h"
GLfloat width, char *bf, int usez)
{
-// GLfloat size = font->size;
+// GLfloat size = font->size;
// GLfloat x = xpos;
// GLfloat y = ypos;
glColor4f(font->color.R, font->color.G, font->color.B, font->color.A);
if (!font)
return;
- if (font->type == gluttext)
- {
- glprintfglut(font->glutfont, xpos, ypos, zpos, bf);
- return;
+ if (font->type == gluttext) {
+ glprintfglut(font->glutfont, xpos, ypos, zpos, bf);
+ return;
}
}
return font;
}
-void delete_font (glCompFont* f)
+void delete_font(glCompFont * f)
{
- if(f->fontdesc)
- free (f->fontdesc);
- if(f->tex)
- glCompDeleteTexture(f->tex);
- free (f);
+ if (f->fontdesc)
+ free(f->fontdesc);
+ if (f->tex)
+ glCompDeleteTexture(f->tex);
+ free(f);
}
-glCompFont *new_font(glCompSet* s,char* text,glCompColor* c,glCompFontType type,char* fontdesc,int fs)
+glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,
+ glCompFontType type, char *fontdesc, int fs)
{
- glCompFont *font = NEW(glCompFont);
- font->reference=0;
- font->color.R=c->R;
- font->color.G=c->G;
- font->color.B=c->B;
- font->color.A=c->A;
- font->justify.VJustify=GL_FONTVJUSTIFY;
- font->justify.HJustify=GL_FONTHJUSTIFY;
-
- if(font->type==gluttext)
- font->glutfont=DEFAULT_GLUT_FONT;
- else
- font->glutfont=(void*)0;
-
- font->fontdesc=fontdesc;
- font->size=fs;
- font->transparent=1;
- font->optimize=GL_FONTOPTIMIZE;
- if (text)
- font->tex=glCompSetAddNewTexLabel(s, font->fontdesc,font->size,text,1);
+ glCompFont *font = NEW(glCompFont);
+ font->reference = 0;
+ font->color.R = c->R;
+ font->color.G = c->G;
+ font->color.B = c->B;
+ font->color.A = c->A;
+ font->justify.VJustify = GL_FONTVJUSTIFY;
+ font->justify.HJustify = GL_FONTHJUSTIFY;
+
+ if (font->type == gluttext)
+ font->glutfont = DEFAULT_GLUT_FONT;
+ else
+ font->glutfont = (void *) 0;
+
+ font->fontdesc = fontdesc;
+ font->size = fs;
+ font->transparent = 1;
+ font->optimize = GL_FONTOPTIMIZE;
+ if (text)
+ font->tex =
+ glCompSetAddNewTexLabel(s, font->fontdesc, font->size, text,
+ 1);
return font;
}
-glCompFont *new_font_from_parent(glCompObj* o,char* text)
+glCompFont *new_font_from_parent(glCompObj * o, char *text)
{
- glCompCommon* parent;
+ glCompCommon *parent;
glCompFont *font = NEW(glCompFont);
- parent=o->common.parent;
- if (parent)
- {
- parent=o->common.parent;
- font->reference=1;
- font->color.R=parent->font->color.R;
- font->color.G=parent->font->color.G;
- font->color.B=parent->font->color.B;
- font->color.A=parent->font->color.A;
-
- font->type=parent->font->type;
- font->glutfont=parent->font->glutfont;
- font->fontdesc=parent->font->fontdesc;
- font->size=parent->font->size;
- font->transparent=parent->font->transparent;
- font->justify.VJustify=parent->font->justify.VJustify;
- font->justify.HJustify=parent->font->justify.HJustify;
- font->optimize=parent->font->optimize;
- if (text)
- {
- if (strlen(text))
- font->tex=glCompSetAddNewTexLabel(parent->compset, font->fontdesc,font->size,text,1);
- }
- }
- else/*no parent*/
- {
- glCompColor c;
- c.R=GLCOMPSET_FONT_COLOR_R;c.G=GLCOMPSET_FONT_COLOR_G;c.B=GLCOMPSET_FONT_COLOR_B;c.A=GLCOMPSET_FONT_COLOR_ALPHA;
- font=new_font(o->common.compset,text,&c,pangotext,GLCOMPSET_FONT_DESC,GLCOMPSET_FONT_SIZE);
+ parent = o->common.parent;
+ if (parent) {
+ parent = o->common.parent;
+ font->reference = 1;
+ font->color.R = parent->font->color.R;
+ font->color.G = parent->font->color.G;
+ font->color.B = parent->font->color.B;
+ font->color.A = parent->font->color.A;
+
+ font->type = parent->font->type;
+ font->glutfont = parent->font->glutfont;
+ font->fontdesc = parent->font->fontdesc;
+ font->size = parent->font->size;
+ font->transparent = parent->font->transparent;
+ font->justify.VJustify = parent->font->justify.VJustify;
+ font->justify.HJustify = parent->font->justify.HJustify;
+ font->optimize = parent->font->optimize;
+ if (text) {
+ if (strlen(text))
+ font->tex =
+ glCompSetAddNewTexLabel(parent->compset,
+ font->fontdesc, font->size,
+ text, 1);
}
- return font;
+ } else { /*no parent */
+
+ glCompColor c;
+ c.R = GLCOMPSET_FONT_COLOR_R;
+ c.G = GLCOMPSET_FONT_COLOR_G;
+ c.B = GLCOMPSET_FONT_COLOR_B;
+ c.A = GLCOMPSET_FONT_COLOR_ALPHA;
+ font =
+ new_font(o->common.compset, text, &c, pangotext,
+ GLCOMPSET_FONT_DESC, GLCOMPSET_FONT_SIZE);
+ }
+ return font;
}
fontset->fonts =
ALLOC(fontset->count + 1, fontset->fonts, glCompFont *);
fontset->fonts[fontset->count] = glut_font_init();
- fontset->fonts[fontset->count]->type=gluttext;
+ fontset->fonts[fontset->count]->type = gluttext;
fontset->fonts[fontset->count]->glutfont = glutfont;
fontset->count++;
return fontset->fonts[fontset->count - 1];
}
-glCompFont *add_font(fontset_t * fontset, char *fontdesc,int fs)
+glCompFont *add_font(fontset_t * fontset, char *fontdesc, int fs)
{
int id;
size_t sz;
return NULL;
} else
return fontset->fonts[id];*/
- }
+ }
- return NULL;
+ return NULL;
}
void free_font_set(fontset_t * fontset)
font->color.B = b;
font->color.A = a;
}
-void glCompRenderText(glCompFont* f,glCompObj* parentObj)
+
+void glCompRenderText(glCompFont * f, glCompObj * parentObj)
{
- static glCompCommon ref;
- 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;
- z=ref.pos.z;
- switch (f->justify.HJustify)
- {
- case glFontHJustifyNone:
- case glFontHJustifyLeft:
- x=ref.refPos.x;
- break;
- case glFontHJustifyRight:
- x=ref.refPos.x + (ref.width-f->tex->width);
- break;
- case glFontHJustifyCenter:
- x=ref.refPos.x + (ref.width-f->tex->width)/(GLfloat)2.0;
- break;
- }
- switch (f->justify.VJustify)
- {
- case glFontVJustifyNone:
- case glFontVJustifyBottom:
- y=ref.pos.y;
- break;
- case glFontVJustifyTop:
- x=ref.refPos.y + (ref.height-f->tex->height);
- break;
- case glFontVJustifyCenter:
- y=ref.refPos.y + (ref.height-f->tex->height)/(GLfloat)2.0;
- break;
- }
+ static glCompCommon ref;
+ 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;
+ z = ref.pos.z;
+ switch (f->justify.HJustify) {
+ case glFontHJustifyNone:
+ case glFontHJustifyLeft:
+ x = ref.refPos.x;
+ break;
+ case glFontHJustifyRight:
+ x = ref.refPos.x + (ref.width - f->tex->width);
+ break;
+ case glFontHJustifyCenter:
+ x = ref.refPos.x + (ref.width - f->tex->width) / (GLfloat) 2.0;
+ break;
+ }
+ switch (f->justify.VJustify) {
+ case glFontVJustifyNone:
+ case glFontVJustifyBottom:
+ y = ref.pos.y;
+ break;
+ case glFontVJustifyTop:
+ x = ref.refPos.y + (ref.height - f->tex->height);
+ break;
+ case glFontVJustifyCenter:
+ y = ref.refPos.y + (ref.height - f->tex->height) / (GLfloat) 2.0;
+ break;
+ }
- glCompSetColor(&f->color);
- glRasterPos2f(x,y);
- glDrawPixels(f->tex->width,f->tex->height,GL_RGBA,GL_UNSIGNED_BYTE,f->tex->data);
+ glCompSetColor(&f->color);
+ glRasterPos2f(x, y);
+ glDrawPixels(f->tex->width, f->tex->height, GL_RGBA, GL_UNSIGNED_BYTE,
+ f->tex->data);
/* glEnable(GL_BLEND); // Turn Blending On
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
}
-
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
-#include "glpangofont.h"
+#include "glpangofont.h"
typedef float GLfloat;
#else
#include <unistd.h>
-#include <GL/gl.h>
+#include <GL/gl.h>
#endif
#include "glcompdefs.h"
#include <GL/glut.h>
#ifdef __cplusplus
extern "C" {
#endif
-extern fontset_t* fontset_init(void);
-extern void free_font_set(fontset_t* fontset);
-extern void copy_font(glCompFont* targetfont,const glCompFont* sourcefont);
-extern glCompFont *add_font(fontset_t * fontset, char *fontdesc,int fs);
-extern glCompFont* add_glut_font(fontset_t* fontset,void* glutfont);
-extern void glprintf (glCompFont*, GLfloat , GLfloat , GLfloat ,GLfloat, char*);
-extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
-extern glCompFont* font_init(void);
-extern void fontColor (glCompFont* font,float r, float g, float b,float a);
-extern int glCompLoadFontPNG (char *name, int id);
-extern glCompFont *new_font(glCompSet* s,char* text,glCompColor* c,glCompFontType type,char* fontdesc,int fs);
-extern glCompFont *new_font_from_parent(glCompObj* o,char* text);
-extern void delete_font (glCompFont* f);
-extern void glCompRenderText(glCompFont* f,glCompObj* parentObj);
+ extern fontset_t *fontset_init(void);
+ extern void free_font_set(fontset_t * fontset);
+ extern void copy_font(glCompFont * targetfont,
+ const glCompFont * sourcefont);
+ extern glCompFont *add_font(fontset_t * fontset, char *fontdesc,
+ int fs);
+ extern glCompFont *add_glut_font(fontset_t * fontset, void *glutfont);
+ extern void glprintf(glCompFont *, GLfloat, GLfloat, GLfloat, GLfloat,
+ char *);
+ extern void glprintfglut(void *font, GLfloat xpos, GLfloat ypos,
+ GLfloat zpos, char *bf);
+ extern glCompFont *font_init(void);
+ extern void fontColor(glCompFont * font, float r, float g, float b,
+ float a);
+ extern int glCompLoadFontPNG(char *name, int id);
+ extern glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,
+ glCompFontType type, char *fontdesc,
+ int fs);
+ extern glCompFont *new_font_from_parent(glCompObj * o, char *text);
+ extern void delete_font(glCompFont * f);
+ extern void glCompRenderText(glCompFont * f, glCompObj * parentObj);
#ifdef __cplusplus
}
#endif
-
#endif
-
-
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcompimage.h"
#include "glcompfont.h"
#include "glcompset.h"
#include "glutils.h"
#include "glcomptexture.h"
+#include "memory.h"
-glCompImage *glCompImageNew(glCompObj* par,GLfloat x, GLfloat y)
+glCompImage *glCompImageNew(glCompObj * par, GLfloat x, GLfloat y)
{
glCompImage *p;
- p = malloc(sizeof(glCompImage));
- glCompInitCommon((glCompObj*)p,par,x,y);
- p->objType=glImageObj;
- //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
-
- p->objType=glImageObj;
- p->stretch=0;
- p->pngFile=(char*)0;
- p->texture=NULL;
- p->common.functions.draw=glCompImageDraw;
+ p = NEW(glCompImage);
+ glCompInitCommon((glCompObj *) p, par, x, y);
+ p->objType = glImageObj;
+ //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+
+ p->objType = glImageObj;
+ p->stretch = 0;
+ p->pngFile = (char *) 0;
+ p->texture = NULL;
+ p->common.functions.draw = glCompImageDraw;
return p;
}
-void glCompImageDelete (glCompImage* p)
+
+void glCompImageDelete(glCompImage * p)
{
- glCompEmptyCommon(&p->common);
- if(p->pngFile)
- free (p->pngFile);
- if(p->texture)
- glCompDeleteTexture(p->texture);
- free(p);
+ glCompEmptyCommon(&p->common);
+ if (p->pngFile)
+ free(p->pngFile);
+ if (p->texture)
+ glCompDeleteTexture(p->texture);
+ free(p);
}
-extern unsigned char *load_png(char *file_name, int *imageWidth,int *imageHeight);
-int glCompImageLoad(glCompImage* i,unsigned char* data,int width,int height)
+extern unsigned char *load_png(char *file_name, int *imageWidth,
+ int *imageHeight);
+int glCompImageLoad(glCompImage * i, unsigned char *data, int width,
+ int height)
{
- if(data != NULL) /*valid image data*/
- {
- glCompDeleteTexture(i->texture);
- i->texture=glCompSetAddNewTexImage(i->common.compset,width,height,data,1);
- if(i->texture)
- {
- i->common.width=width;
- i->common.height=height;
- return 1;
- }
-
+ if (data != NULL) { /*valid image data */
+ glCompDeleteTexture(i->texture);
+ i->texture =
+ glCompSetAddNewTexImage(i->common.compset, width, height, data,
+ 1);
+ if (i->texture) {
+ i->common.width = width;
+ i->common.height = height;
+ return 1;
}
- return 0;
+
+ }
+ return 0;
}
-int glCompImageLoadPng(glCompImage* i,char* pngFile)
+int glCompImageLoadPng(glCompImage * i, char *pngFile)
{
- int imageWidth,imageHeight;
- unsigned char* data;
- data=load_png(pngFile, &imageWidth, &imageHeight);
- return glCompImageLoad(i,data,imageWidth,imageHeight);
+ int imageWidth, imageHeight;
+ unsigned char *data;
+ data = load_png(pngFile, &imageWidth, &imageHeight);
+ return glCompImageLoad(i, data, imageWidth, imageHeight);
}
-int glCompImageLoadRaw(glCompSet * s,glCompImage* i,char* rawFile)
+int glCompImageLoadRaw(glCompSet * s, glCompImage * i, char *rawFile)
{
- int imageWidth,imageHeight;
- unsigned char* data;
- data=load_png(rawFile, &imageWidth, &imageHeight);
- return glCompImageLoad(i,data,imageWidth,imageHeight);
+ int imageWidth, imageHeight;
+ unsigned char *data;
+ data = load_png(rawFile, &imageWidth, &imageHeight);
+ return glCompImageLoad(i, data, imageWidth, imageHeight);
}
-void glCompImageDraw(void* obj)
+void glCompImageDraw(void *obj)
{
- glCompImage* p;
- static glCompCommon ref;
-// static GLfloat w,h,d;
- p=(glCompImage*)obj;
- ref=p->common;
- glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
+ glCompImage *p;
+ static glCompCommon ref;
+// static GLfloat w,h,d;
+ p = (glCompImage *) obj;
+ ref = p->common;
+ glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
if (!p->common.visible)
- return ;
- if (!p->texture)
- return;
- glRasterPos2f(ref.pos.x,ref.pos.y);
- glDrawPixels(p->texture->width,p->texture->height,GL_RGBA,GL_UNSIGNED_BYTE,p->texture->data);
+ return;
+ if (!p->texture)
+ return;
+ glRasterPos2f(ref.pos.x, ref.pos.y);
+ glDrawPixels(p->texture->width, p->texture->height, GL_RGBA,
+ GL_UNSIGNED_BYTE, p->texture->data);
/* w=ref.width;
h=ref.height;
}
-void glCompImageClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompImageClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- if (o->common.callbacks.click)
- o->common.callbacks.click(o,x,y,t);
+ if (o->common.callbacks.click)
+ o->common.callbacks.click(o, x, y, t);
}
-void glCompImageDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompImageDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.doubleclick)
- ((glCompImage*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.doubleclick)
+ ((glCompImage *) obj)->common.callbacks.doubleclick(obj, x, y, t);
}
-void glCompImageMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompImageMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.mousedown)
- ((glCompImage*)obj)->common.callbacks.mousedown(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.mousedown)
+ ((glCompImage *) obj)->common.callbacks.mousedown(obj, x, y, t);
}
-void glCompImageMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+void glCompImageMouseIn(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.mousein)
- ((glCompImage*)obj)->common.callbacks.mousein(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.mousein)
+ ((glCompImage *) obj)->common.callbacks.mousein(obj, x, y);
}
-void glCompImageMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompImageMouseOut(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.mouseout)
- ((glCompImage*)obj)->common.callbacks.mouseout(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.mouseout)
+ ((glCompImage *) obj)->common.callbacks.mouseout(obj, x, y);
}
-void glCompImageMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompImageMouseOver(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.mouseover)
- ((glCompImage*)obj)->common.callbacks.mouseover(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.mouseover)
+ ((glCompImage *) obj)->common.callbacks.mouseover(obj, x, y);
}
-void glCompImageMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+
+void glCompImageMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompImage*)obj)->common.callbacks.mouseup)
- ((glCompImage*)obj)->common.callbacks.mouseup(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompImage *) obj)->common.callbacks.mouseup)
+ ((glCompImage *) obj)->common.callbacks.mouseup(obj, x, y, t);
}
-
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
-extern glCompImage *glCompImageNew(glCompObj* par,GLfloat x, GLfloat y);
-extern void glCompImageDelete (glCompImage* p);
-extern int glCompImageLoad(glCompImage* i,unsigned char* data,int width,int height);
-extern int glCompImageLoadPng(glCompImage* i,char* pngFile);
-extern void glCompImageDraw(void* obj);
-extern void glCompImageClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompImageDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompImageMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompImageMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompImageMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompImageMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompImageMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-
-
-
-
-
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern glCompImage *glCompImageNew(glCompObj * par, GLfloat x,
+ GLfloat y);
+ extern void glCompImageDelete(glCompImage * p);
+ extern int glCompImageLoad(glCompImage * i, unsigned char *data,
+ int width, int height);
+ extern int glCompImageLoadPng(glCompImage * i, char *pngFile);
+ extern void glCompImageDraw(void *obj);
+ extern void glCompImageClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompImageDoubleClick(glCompObj * obj, GLfloat x,
+ GLfloat y, glMouseButtonType t);
+ extern void glCompImageMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompImageMouseIn(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompImageMouseOut(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompImageMouseOver(glCompObj * obj, GLfloat x,
+ GLfloat y);
+ extern void glCompImageMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcomplabel.h"
#include "glcompfont.h"
#include "glcompset.h"
#include "glutils.h"
+#include "memory.h"
-
-glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text)
+glCompLabel *glCompLabelNew(glCompObj * par, GLfloat x, GLfloat y,
+ char *text)
{
glCompLabel *p;
-// glCompCommon* parent=&par->common;
- p = malloc(sizeof(glCompLabel));
- glCompInitCommon((glCompObj*)p,par,x,y);
- p->objType=glLabelObj;
- //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+// glCompCommon* parent=&par->common;
+ p = NEW(glCompLabel);
+ glCompInitCommon((glCompObj *) p, par, x, y);
+ p->objType = glLabelObj;
+ //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
p->text = strdup(text);
- p->common.font =new_font_from_parent(par,text);
- p->common.functions.draw=glCompLabelDraw;
+ p->common.font = new_font_from_parent(par, text);
+ p->common.functions.draw = glCompLabelDraw;
- return p;
+ return p;
}
int glCompLabelDraw(glCompLabel * p)
{
- glCompCommon ref;
- ref=p->common;
- glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
- /*draw background*/
- glCompSetColor(&p->common.color);
- glBegin(GL_QUADS);
- glVertex3d(ref.refPos.x,ref.refPos.y,ref.refPos.z);
- glVertex3d(ref.refPos.x+ref.width,ref.refPos.y,ref.refPos.z);
- glVertex3d(ref.refPos.x+ref.width,ref.refPos.y+ref.height,ref.refPos.z);
- glVertex3d(ref.refPos.x,ref.refPos.y+ref.height,ref.refPos.z);
- glEnd();
- glCompRenderText(p->common.font,(glCompObj*)p);
- return 1;
+ glCompCommon ref;
+ ref = p->common;
+ glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
+ /*draw background */
+ glCompSetColor(&p->common.color);
+ glBegin(GL_QUADS);
+ glVertex3d(ref.refPos.x, ref.refPos.y, ref.refPos.z);
+ glVertex3d(ref.refPos.x + ref.width, ref.refPos.y, ref.refPos.z);
+ glVertex3d(ref.refPos.x + ref.width, ref.refPos.y + ref.height,
+ ref.refPos.z);
+ glVertex3d(ref.refPos.x, ref.refPos.y + ref.height, ref.refPos.z);
+ glEnd();
+ glCompRenderText(p->common.font, (glCompObj *) p);
+ return 1;
}
int glCompLabelSetText(glCompLabel * p, char *text)
}
-void glCompLabelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompLabelClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- if (o->common.callbacks.click)
- o->common.callbacks.click(o,x,y,t);
+ if (o->common.callbacks.click)
+ o->common.callbacks.click(o, x, y, t);
}
-void glCompLabelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompLabelDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.doubleclick)
- ((glCompLabel*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.doubleclick)
+ ((glCompLabel *) obj)->common.callbacks.doubleclick(obj, x, y, t);
}
-void glCompLabelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompLabelMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.mousedown)
- ((glCompLabel*)obj)->common.callbacks.mousedown(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.mousedown)
+ ((glCompLabel *) obj)->common.callbacks.mousedown(obj, x, y, t);
}
-void glCompLabelMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+void glCompLabelMouseIn(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.mousein)
- ((glCompLabel*)obj)->common.callbacks.mousein(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.mousein)
+ ((glCompLabel *) obj)->common.callbacks.mousein(obj, x, y);
}
-void glCompLabelMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompLabelMouseOut(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.mouseout)
- ((glCompLabel*)obj)->common.callbacks.mouseout(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.mouseout)
+ ((glCompLabel *) obj)->common.callbacks.mouseout(obj, x, y);
}
-void glCompLabelMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompLabelMouseOver(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.mouseover)
- ((glCompLabel*)obj)->common.callbacks.mouseover(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.mouseover)
+ ((glCompLabel *) obj)->common.callbacks.mouseover(obj, x, y);
}
-void glCompLabelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+
+void glCompLabelMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompLabel*)obj)->common.callbacks.mouseup)
- ((glCompLabel*)obj)->common.callbacks.mouseup(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompLabel *) obj)->common.callbacks.mouseup)
+ ((glCompLabel *) obj)->common.callbacks.mouseup(obj, x, y, t);
}
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
-glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text);
-extern int glCompSetAddLabel(glCompSet * s, glCompLabel * p);
-extern int glCompSetRemoveLabel(glCompSet * s, glCompLabel * p);
-
+ extern glCompLabel *glCompLabelNew(glCompObj * par, GLfloat x,
+ GLfloat y, char *text);
+ extern int glCompSetAddLabel(glCompSet * s, glCompLabel * p);
+ extern int glCompSetRemoveLabel(glCompSet * s, glCompLabel * p);
/*events*/
-extern int glCompLabelDraw(glCompLabel * p);
-extern void glCompLabelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompLabelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompLabelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompLabelMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompLabelMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompLabelMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompLabelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-
-
-
-
-
+ extern int glCompLabelDraw(glCompLabel * p);
+ extern void glCompLabelClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompLabelDoubleClick(glCompObj * obj, GLfloat x,
+ GLfloat y, glMouseButtonType t);
+ extern void glCompLabelMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompLabelMouseIn(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompLabelMouseOut(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompLabelMouseOver(glCompObj * obj, GLfloat x,
+ GLfloat y);
+ extern void glCompLabelMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcompmouse.h"
#include "glcompfont.h"
#include "glcompset.h"
#include "glutils.h"
-
-
void glCompMouseInit(glCompMouse * m)
{
- m->functions.click=glCompClick;
- m->functions.doubleclick=glCompDoubleClick;
- m->functions.draw=NULL;
- m->functions.mousedown=glCompMouseDown;
- m->functions.mousedrag=glCompMouseDrag;
- m->functions.mousein=glCompMouseIn;
- m->functions.mouseout=glCompMouseOut;
- m->functions.mouseover=glCompMouseOver;
- m->functions.mouseup=glCompMouseUp;
-
- m->callbacks.click=NULL;
- m->callbacks.doubleclick=NULL;
- m->callbacks.draw=NULL;
- m->callbacks.mousedown=NULL;
- m->callbacks.mousedrag=NULL;
- m->callbacks.mousein=NULL;
- m->callbacks.mouseout=NULL;
- m->callbacks.mouseover=NULL;
- m->callbacks.mouseup=NULL;
- m->dragX=0;
- m->dragY=0;
- m->down=0;
+ m->functions.click = glCompClick;
+ m->functions.doubleclick = glCompDoubleClick;
+ m->functions.draw = NULL;
+ m->functions.mousedown = glCompMouseDown;
+ m->functions.mousedrag = glCompMouseDrag;
+ m->functions.mousein = glCompMouseIn;
+ m->functions.mouseout = glCompMouseOut;
+ m->functions.mouseover = glCompMouseOver;
+ m->functions.mouseup = glCompMouseUp;
+
+ m->callbacks.click = NULL;
+ m->callbacks.doubleclick = NULL;
+ m->callbacks.draw = NULL;
+ m->callbacks.mousedown = NULL;
+ m->callbacks.mousedrag = NULL;
+ m->callbacks.mousein = NULL;
+ m->callbacks.mouseout = NULL;
+ m->callbacks.mouseover = NULL;
+ m->callbacks.mouseup = NULL;
+ m->dragX = 0;
+ m->dragY = 0;
+ m->down = 0;
}
-extern void glCompClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+extern void glCompClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
}
-extern void glCompDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+extern void glCompDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
}
-extern void glCompMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+extern void glCompMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
}
-extern void glCompMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+extern void glCompMouseIn(glCompObj * obj, GLfloat x, GLfloat y)
{
}
-extern void glCompMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+extern void glCompMouseOut(glCompObj * obj, GLfloat x, GLfloat y)
{
}
-extern void glCompMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+extern void glCompMouseOver(glCompObj * obj, GLfloat x, GLfloat y)
{
}
-extern void glCompMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+extern void glCompMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
}
-extern void glCompMouseDrag(glCompObj * obj,GLfloat dx,GLfloat dy,glMouseButtonType t)
+extern void glCompMouseDrag(glCompObj * obj, GLfloat dx, GLfloat dy,
+ glMouseButtonType t)
{
}
-
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
-
+#ifdef __cplusplus
+extern "C" {
+#endif
/*events*/
-extern void glCompMouseInit(glCompMouse * m);
-extern void glCompClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompMouseDrag(glCompObj * obj,GLfloat dx,GLfloat dy,glMouseButtonType t);
+ extern void glCompMouseInit(glCompMouse * m);
+ extern void glCompClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompMouseIn(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompMouseOut(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompMouseOver(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompMouseDrag(glCompObj * obj, GLfloat dx, GLfloat dy,
+ glMouseButtonType t);
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcomppanel.h"
#include "glcompfont.h"
#include "glcompset.h"
#include "glcomptexture.h"
#include "glutils.h"
+#include "memory.h"
-
-glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h)
+glCompPanel *glCompPanelNew(glCompObj * parentObj, GLfloat x, GLfloat y,
+ GLfloat w, GLfloat h)
{
glCompPanel *p;
-// glCompCommon* parent=&parentObj->common;
- p = malloc(sizeof(glCompPanel));
- glCompInitCommon((glCompObj*)p,parentObj,(GLfloat)x ,(GLfloat)y);
+// glCompCommon* parent=&parentObj->common;
+ p = NEW(glCompPanel);
+ glCompInitCommon((glCompObj *) p, parentObj, (GLfloat) x, (GLfloat) y);
- p->shadowcolor.R = GLCOMPSET_PANEL_SHADOW_COLOR_R;
+ p->shadowcolor.R = GLCOMPSET_PANEL_SHADOW_COLOR_R;
p->shadowcolor.G = GLCOMPSET_PANEL_SHADOW_COLOR_G;
p->shadowcolor.B = GLCOMPSET_PANEL_SHADOW_COLOR_B;
p->shadowcolor.A = GLCOMPSET_PANEL_SHADOW_COLOR_A;
p->shadowwidth = GLCOMPSET_PANEL_SHADOW_WIDTH;
- p->common.borderWidth=GLCOMPSET_PANEL_BORDERWIDTH;
+ p->common.borderWidth = GLCOMPSET_PANEL_BORDERWIDTH;
- p->common.width = w;
+ p->common.width = w;
p->common.height = h;
- p->common.font=new_font_from_parent((glCompObj*)p,NULL);
- p->text=(char*)0;
- p->common.functions.draw=glCompPanelDraw;
- p->image=(glCompImage*)0;
+ p->common.font = new_font_from_parent((glCompObj *) p, NULL);
+ p->text = (char *) 0;
+ p->common.functions.draw = glCompPanelDraw;
+ p->image = (glCompImage *) 0;
return p;
}
void glCompSetPanelText(glCompPanel * p, char *t)
{
- replacestr(t,&p->text);
- glCompDeleteTexture(p->common.font->tex);
- p->common.font->tex=glCompSetAddNewTexLabel(p->common.compset, p->common.font->fontdesc,p->common.font->size,p->text,1);
+ replacestr(t, &p->text);
+ glCompDeleteTexture(p->common.font->tex);
+ p->common.font->tex =
+ glCompSetAddNewTexLabel(p->common.compset,
+ p->common.font->fontdesc,
+ p->common.font->size, p->text, 1);
}
int glCompPanelDraw(glCompObj * o)
{
- glCompPanel * p;
- glCompCommon ref;
- glCompRect r;
- p=(glCompPanel*)o;
- ref=p->common;
- glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
- p->objType=glPanelObj;
- //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+ glCompPanel *p;
+ glCompCommon ref;
+ glCompRect r;
+ p = (glCompPanel *) o;
+ ref = p->common;
+ glCompCalcWidget((glCompCommon *) p->common.parent, &p->common, &ref);
+ p->objType = glPanelObj;
+ //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
if (!p->common.visible)
- return 0;
- /*draw shadow*/
- glColor4f((GLfloat) p->shadowcolor.R, (GLfloat) p->shadowcolor.G,(GLfloat) p->shadowcolor.B, (GLfloat) p->shadowcolor.A);
- r.h=p->shadowwidth; r.w=ref.width; r.pos.x=ref.pos.x+p->shadowwidth; r.pos.y=ref.pos.y-p->shadowwidth; r.pos.z=-0.001;
- glCompDrawRectangle (&r);
- r.h=ref.height; r.w=p->shadowwidth; r.pos.x=ref.pos.x+ref.width; r.pos.y=ref.pos.y-p->shadowwidth; r.pos.z=-0.001;
- glCompDrawRectangle (&r);
- /*draw panel*/
- glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),1);
- /*draw image if there is*/
- if (p->image)
- {
- p->image->common.callbacks.draw((void*)p->image);
- }
+ return 0;
+ /*draw shadow */
+ glColor4f((GLfloat) p->shadowcolor.R, (GLfloat) p->shadowcolor.G,
+ (GLfloat) p->shadowcolor.B, (GLfloat) p->shadowcolor.A);
+ r.h = p->shadowwidth;
+ r.w = ref.width;
+ r.pos.x = ref.pos.x + p->shadowwidth;
+ r.pos.y = ref.pos.y - p->shadowwidth;
+ r.pos.z = -0.001;
+ glCompDrawRectangle(&r);
+ r.h = ref.height;
+ r.w = p->shadowwidth;
+ r.pos.x = ref.pos.x + ref.width;
+ r.pos.y = ref.pos.y - p->shadowwidth;
+ r.pos.z = -0.001;
+ glCompDrawRectangle(&r);
+ /*draw panel */
+ glCompDrawRectPrism(&(ref.pos), ref.width, ref.height,
+ p->common.borderWidth, 0.01, &(ref.color), 1);
+ /*draw image if there is */
+ if (p->image) {
+ p->image->common.callbacks.draw((void *) p->image);
+ }
if (p->text) {
}
-void glCompPanelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompPanelClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- if (o->common.callbacks.click)
- o->common.callbacks.click(o,x,y,t);
+ if (o->common.callbacks.click)
+ o->common.callbacks.click(o, x, y, t);
}
-void glCompPanelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompPanelDoubleClick(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.doubleclick)
- ((glCompPanel*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.doubleclick)
+ ((glCompPanel *) obj)->common.callbacks.doubleclick(obj, x, y, t);
}
-void glCompPanelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+void glCompPanelMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.mousedown)
- ((glCompPanel*)obj)->common.callbacks.mousedown(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.mousedown)
+ ((glCompPanel *) obj)->common.callbacks.mousedown(obj, x, y, t);
}
-void glCompPanelMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+void glCompPanelMouseIn(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.mousein)
- ((glCompPanel*)obj)->common.callbacks.mousein(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.mousein)
+ ((glCompPanel *) obj)->common.callbacks.mousein(obj, x, y);
}
-void glCompPanelMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompPanelMouseOut(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.mouseout)
- ((glCompPanel*)obj)->common.callbacks.mouseout(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.mouseout)
+ ((glCompPanel *) obj)->common.callbacks.mouseout(obj, x, y);
}
-void glCompPanelMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+
+void glCompPanelMouseOver(glCompObj * obj, GLfloat x, GLfloat y)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.mouseover)
- ((glCompPanel*)obj)->common.callbacks.mouseover(obj,x,y);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.mouseover)
+ ((glCompPanel *) obj)->common.callbacks.mouseover(obj, x, y);
}
-void glCompPanelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+
+void glCompPanelMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- /*Put your internal code here*/
- if (((glCompPanel*)obj)->common.callbacks.mouseup)
- ((glCompPanel*)obj)->common.callbacks.mouseup(obj,x,y,t);
+ /*Put your internal code here */
+ if (((glCompPanel *) obj)->common.callbacks.mouseup)
+ ((glCompPanel *) obj)->common.callbacks.mouseup(obj, x, y, t);
}
{
// replacestr(str, &p->text);
}
-
-
-
-
-
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include "glcompdefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
-glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-extern int glCompSetAddPanel(glCompSet * s, glCompPanel * p);
-extern int glCompSetRemovePanel(glCompSet * s, glCompPanel * p);
-extern int glCompPanelShow(glCompPanel * p);
-extern int glCompPanelHide(glCompPanel * p);
-extern void glCompSetPanelText(glCompPanel * p,char* t);
+ extern glCompPanel *glCompPanelNew(glCompObj * parentObj, GLfloat x,
+ GLfloat y, GLfloat w, GLfloat h);
+ extern int glCompSetAddPanel(glCompSet * s, glCompPanel * p);
+ extern int glCompSetRemovePanel(glCompSet * s, glCompPanel * p);
+ extern int glCompPanelShow(glCompPanel * p);
+ extern int glCompPanelHide(glCompPanel * p);
+ extern void glCompSetPanelText(glCompPanel * p, char *t);
/*events*/
-extern int glCompPanelDraw(glCompObj * o);
-extern void glCompPanelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompPanelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompPanelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-extern void glCompPanelMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompPanelMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompPanelMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
-extern void glCompPanelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
-
-
-
-
+ extern int glCompPanelDraw(glCompObj * o);
+ extern void glCompPanelClick(glCompObj * o, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompPanelDoubleClick(glCompObj * obj, GLfloat x,
+ GLfloat y, glMouseButtonType t);
+ extern void glCompPanelMouseDown(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+ extern void glCompPanelMouseIn(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompPanelMouseOut(glCompObj * obj, GLfloat x, GLfloat y);
+ extern void glCompPanelMouseOver(glCompObj * obj, GLfloat x,
+ GLfloat y);
+ extern void glCompPanelMouseUp(glCompObj * obj, GLfloat x, GLfloat y,
+ glMouseButtonType t);
+
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include "glutils.h"
//typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
-static GLfloat startX,startY;
+static GLfloat startX, startY;
-void glCompGetObjectType(glCompObj* p)
+void glCompGetObjectType(glCompObj * p)
{
- switch (p->objType)
- {
- case glPanelObj:
- printf ("Panel\n");
- break;
- case glButtonObj:
- printf ("Button\n");
- break;
- case glImageObj:
- printf ("Image\n");
- break;
- case glLabelObj:
- printf ("Label\n");
- break;
- default:
- printf ("undefined object\n");
- break;
+ switch (p->objType) {
+ case glPanelObj:
+ printf("Panel\n");
+ break;
+ case glButtonObj:
+ printf("Button\n");
+ break;
+ case glImageObj:
+ printf("Image\n");
+ break;
+ case glLabelObj:
+ printf("Label\n");
+ break;
+ default:
+ printf("undefined object\n");
+ break;
- }
+ }
}
-static int glCompPointInObject(glCompObj* p, float x, float y)
+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));
+ 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)
+glCompObj *glCompGetObjByMouse(glCompSet * s, glCompMouse * m,
+ int onlyClickable)
{
- int ind;
- glCompObj* rv=NULL;
- if (!s || !m)
- return NULL;
- for (ind=0 ; ind < s->objcnt ; ind ++)
- {
- if ((s->obj[ind]->common.visible)&&(glCompPointInObject(s->obj[ind],m->pos.x,m->pos.y)))
- {
- if ((!rv) ||(s->obj[ind]->common.layer >= rv->common.layer))
- {
- if (((onlyClickable) && (s->obj[ind]->common.functions.click)) || (!onlyClickable))
- rv=s->obj[ind];
- }
- }
+ int ind;
+ glCompObj *rv = NULL;
+ if (!s || !m)
+ return NULL;
+ for (ind = 0; ind < s->objcnt; ind++) {
+ if ((s->obj[ind]->common.visible)
+ && (glCompPointInObject(s->obj[ind], m->pos.x, m->pos.y))) {
+ if ((!rv) || (s->obj[ind]->common.layer >= rv->common.layer)) {
+ if (((onlyClickable)
+ && (s->obj[ind]->common.functions.click))
+ || (!onlyClickable))
+ rv = s->obj[ind];
+ }
}
+ }
- return rv;
+ return rv;
}
-static void glCompMouseMove (void* obj,GLfloat x,GLfloat y)
+static void glCompMouseMove(void *obj, GLfloat x, GLfloat y)
{
- ((glCompSet*)obj)->mouse.pos.x=x;
- ((glCompSet*)obj)->mouse.pos.y=((glCompObj*)obj)->common.height - y;
- ((glCompSet*)obj)->mouse.pos.z=0;
- ((glCompSet*)obj)->mouse.dragY=((glCompSet*)obj)->mouse.pos.y - startY;
- ((glCompSet*)obj)->mouse.dragX=((glCompSet*)obj)->mouse.pos.x - startX;
- if (((glCompSet*)obj)->common.callbacks.mouseover)
- ((glCompSet*)obj)->common.callbacks.mouseover(obj,x,y);
+ ((glCompSet *) obj)->mouse.pos.x = x;
+ ((glCompSet *) obj)->mouse.pos.y =
+ ((glCompObj *) obj)->common.height - y;
+ ((glCompSet *) obj)->mouse.pos.z = 0;
+ ((glCompSet *) obj)->mouse.dragY =
+ ((glCompSet *) obj)->mouse.pos.y - startY;
+ ((glCompSet *) obj)->mouse.dragX =
+ ((glCompSet *) obj)->mouse.pos.x - startX;
+ if (((glCompSet *) obj)->common.callbacks.mouseover)
+ ((glCompSet *) obj)->common.callbacks.mouseover(obj, x, y);
/* if (((glCompSet*)obj)->mouse.down)
printf ("%f %f \n",((glCompSet*)obj)->mouse.dragX,((glCompSet*)obj)->mouse.dragX);*/
}
-static void glCompSetMouseClick (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
+static void glCompSetMouseClick(void *obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- if (((glCompSet*)obj)->common.callbacks.click)
- ((glCompSet*)obj)->common.callbacks.click(obj,x,y,t);
+ if (((glCompSet *) obj)->common.callbacks.click)
+ ((glCompSet *) obj)->common.callbacks.click(obj, x, y, t);
}
-static void glCompSetMouseDown (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
+static void glCompSetMouseDown(void *obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- ((glCompSet*)obj)->mouse.t=t;
- if (t==glMouseLeftButton)
- {
- ((glCompSet*)obj)->mouse.pos.x=x;
- ((glCompSet*)obj)->mouse.pos.y=((glCompObj*)obj)->common.height - y;
- ((glCompSet*)obj)->mouse.pos.z=0;
- ((glCompSet*)obj)->mouse.clickedObj=glCompGetObjByMouse(((glCompObj*)obj)->common.compset,&((glCompSet*)(((glCompObj*)obj)->common.compset))->mouse,1);
- if(((glCompSet*)obj)->mouse.clickedObj)
- if(((glCompSet*)obj)->mouse.clickedObj->common.functions.mousedown)
- ((glCompSet*)obj)->mouse.clickedObj->common.functions.mousedown(((glCompSet*)obj)->mouse.clickedObj,x,y,t);
- }
- ((glCompSet*)obj)->mouse.down=1;
- startX=x;
- startY=((glCompObj*)obj)->common.height - y;
- if (((glCompSet*)obj)->common.callbacks.mousedown)
- ((glCompSet*)obj)->common.callbacks.mousedown(obj,x,y,t);
+ ((glCompSet *) obj)->mouse.t = t;
+ if (t == glMouseLeftButton) {
+ ((glCompSet *) obj)->mouse.pos.x = x;
+ ((glCompSet *) obj)->mouse.pos.y =
+ ((glCompObj *) obj)->common.height - y;
+ ((glCompSet *) obj)->mouse.pos.z = 0;
+ ((glCompSet *) obj)->mouse.clickedObj =
+ glCompGetObjByMouse(((glCompObj *) obj)->common.compset,
+ &((glCompSet *) (((glCompObj *) obj)->
+ common.compset))->mouse,
+ 1);
+ if (((glCompSet *) obj)->mouse.clickedObj)
+ if (((glCompSet *) obj)->mouse.clickedObj->common.functions.
+ mousedown)
+ ((glCompSet *) obj)->mouse.clickedObj->common.functions.
+ mousedown(((glCompSet *) obj)->mouse.clickedObj, x, y,
+ t);
+ }
+ ((glCompSet *) obj)->mouse.down = 1;
+ startX = x;
+ startY = ((glCompObj *) obj)->common.height - y;
+ if (((glCompSet *) obj)->common.callbacks.mousedown)
+ ((glCompSet *) obj)->common.callbacks.mousedown(obj, x, y, t);
}
-static void glCompSetMouseUp (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
+static void glCompSetMouseUp(void *obj, GLfloat x, GLfloat y,
+ glMouseButtonType t)
{
- static GLfloat tempX,tempY;
- tempX=x;
- tempY=((glCompObj*)obj)->common.height - y;
-
- ((glCompSet*)obj)->mouse.down=0;
- if (t==glMouseLeftButton)
- {
- glCompObj* o=NULL;
- glCompObj* o_clicked=((glCompSet*)obj)->mouse.clickedObj;
- ((glCompSet*)obj)->mouse.pos.x=tempX;
- ((glCompSet*)obj)->mouse.pos.y=tempY;
- ((glCompSet*)obj)->mouse.pos.z=0;
- if (o_clicked)
- o=glCompGetObjByMouse((glCompSet*)obj,&((glCompSet*)obj)->mouse,1);
- if(!o)
- return;
- if(o == o_clicked)
- o->common.functions.click(o,x,y,t);
- }
- if (((glCompSet*)obj)->common.callbacks.mouseup)
- ((glCompSet*)obj)->common.callbacks.mouseup(obj,x,y,t);
- /*check if mouse is clicked or dragged*/
- if ((startX == (int)tempX) && (startY == tempY))
- glCompSetMouseClick(obj,x,y,t);
+ static GLfloat tempX, tempY;
+ tempX = x;
+ tempY = ((glCompObj *) obj)->common.height - y;
+
+ ((glCompSet *) obj)->mouse.down = 0;
+ if (t == glMouseLeftButton) {
+ glCompObj *o = NULL;
+ glCompObj *o_clicked = ((glCompSet *) obj)->mouse.clickedObj;
+ ((glCompSet *) obj)->mouse.pos.x = tempX;
+ ((glCompSet *) obj)->mouse.pos.y = tempY;
+ ((glCompSet *) obj)->mouse.pos.z = 0;
+ if (o_clicked)
+ o = glCompGetObjByMouse((glCompSet *) obj,
+ &((glCompSet *) obj)->mouse, 1);
+ if (!o)
+ return;
+ if (o == o_clicked)
+ o->common.functions.click(o, x, y, t);
+ }
+ if (((glCompSet *) obj)->common.callbacks.mouseup)
+ ((glCompSet *) obj)->common.callbacks.mouseup(obj, x, y, t);
+ /*check if mouse is clicked or dragged */
+ if ((startX == (int) tempX) && (startY == tempY))
+ glCompSetMouseClick(obj, x, y, t);
-extern void glCompInitCommon(glCompObj* childObj,glCompObj* parentObj,GLfloat x ,GLfloat y)
+extern void glCompInitCommon(glCompObj * childObj, glCompObj * parentObj,
+ GLfloat x, GLfloat y)
{
- glCompCommon* c;
- glCompCommon* parent;
- c=&childObj->common;
- c->align=glAlignNone;
- c->anchor.bottom=0;
- c->anchor.left=0;
- c->anchor.top=0;
- c->anchor.right=0;
- c->anchor.leftAnchor=0;
- c->anchor.rightAnchor=0;
- c->anchor.topAnchor=0;
- c->anchor.bottomAnchor=0;
- c->data=0;
- c->enabled=1;
- c->height=GLCOMP_DEFAULT_HEIGHT;;
- c->width=GLCOMP_DEFAULT_WIDTH;
- c->visible=1;
- c->pos.x=x;
- c->pos.y=y;
- c->borderType=glBorderSolid;
- c->borderWidth=GLCOMPSET_BORDERWIDTH;
-
- /*NULL function pointers*/
- childObj->common.callbacks.click=NULL;
- childObj->common.callbacks.doubleclick=NULL;
- childObj->common.callbacks.draw=NULL;
- childObj->common.callbacks.mousedown=NULL;
- childObj->common.callbacks.mousein=NULL;
- childObj->common.callbacks.mouseout=NULL;
- childObj->common.callbacks.mouseover=NULL;
- childObj->common.callbacks.mouseup=NULL;
-
- childObj->common.functions.click=NULL;
- childObj->common.functions.doubleclick=NULL;
- childObj->common.functions.draw=NULL;
- childObj->common.functions.mousedown=NULL;
- childObj->common.functions.mousein=NULL;
- childObj->common.functions.mouseout=NULL;
- childObj->common.functions.mouseover=NULL;
- childObj->common.functions.mouseup=NULL;
-
-
-
- if (parentObj)
- {
- c->parent=&parentObj->common;
- parent=&parentObj->common;
- copy_glcomp_color(&parent->color,&c->color);
- c->layer=parent->layer + 1;
- c->pos.z=parent->pos.z;
- glCompSetAddObj((glCompSet*)parent->compset ,childObj);
- }
- else
- {
- c->parent=NULL;
- c->color.R=GLCOMPSET_PANEL_COLOR_R; c->color.G=GLCOMPSET_PANEL_COLOR_G; c->color.B=GLCOMPSET_PANEL_COLOR_B; c->color.A=GLCOMPSET_PANEL_COLOR_ALPHA;
- c->layer=0;
- c->pos.z=0;
- }
- c->font =new_font_from_parent(childObj,NULL);
+ glCompCommon *c;
+ glCompCommon *parent;
+ c = &childObj->common;
+ c->align = glAlignNone;
+ c->anchor.bottom = 0;
+ c->anchor.left = 0;
+ c->anchor.top = 0;
+ c->anchor.right = 0;
+ c->anchor.leftAnchor = 0;
+ c->anchor.rightAnchor = 0;
+ c->anchor.topAnchor = 0;
+ c->anchor.bottomAnchor = 0;
+ c->data = 0;
+ c->enabled = 1;
+ c->height = GLCOMP_DEFAULT_HEIGHT;;
+ c->width = GLCOMP_DEFAULT_WIDTH;
+ c->visible = 1;
+ c->pos.x = x;
+ c->pos.y = y;
+ c->borderType = glBorderSolid;
+ c->borderWidth = GLCOMPSET_BORDERWIDTH;
+
+ /*NULL function pointers */
+ childObj->common.callbacks.click = NULL;
+ childObj->common.callbacks.doubleclick = NULL;
+ childObj->common.callbacks.draw = NULL;
+ childObj->common.callbacks.mousedown = NULL;
+ childObj->common.callbacks.mousein = NULL;
+ childObj->common.callbacks.mouseout = NULL;
+ childObj->common.callbacks.mouseover = NULL;
+ childObj->common.callbacks.mouseup = NULL;
+
+ childObj->common.functions.click = NULL;
+ childObj->common.functions.doubleclick = NULL;
+ childObj->common.functions.draw = NULL;
+ childObj->common.functions.mousedown = NULL;
+ childObj->common.functions.mousein = NULL;
+ childObj->common.functions.mouseout = NULL;
+ childObj->common.functions.mouseover = NULL;
+ childObj->common.functions.mouseup = NULL;
+
+
+
+ if (parentObj) {
+ c->parent = &parentObj->common;
+ parent = &parentObj->common;
+ copy_glcomp_color(&parent->color, &c->color);
+ c->layer = parent->layer + 1;
+ c->pos.z = parent->pos.z;
+ glCompSetAddObj((glCompSet *) parent->compset, childObj);
+ } else {
+ c->parent = NULL;
+ c->color.R = GLCOMPSET_PANEL_COLOR_R;
+ c->color.G = GLCOMPSET_PANEL_COLOR_G;
+ c->color.B = GLCOMPSET_PANEL_COLOR_B;
+ c->color.A = GLCOMPSET_PANEL_COLOR_ALPHA;
+ c->layer = 0;
+ c->pos.z = 0;
+ }
+ c->font = new_font_from_parent(childObj, NULL);
}
-void glCompEmptyCommon(glCompCommon* c)
+
+void glCompEmptyCommon(glCompCommon * c)
{
- delete_font (c->font);
+ delete_font(c->font);
}
glCompSet *glCompSetNew(int w, int h)
{
glCompSet *s = NEW(glCompSet);
- glCompInitCommon((glCompObj*)s,NULL,(GLfloat)0 ,(GLfloat)0);
- s->common.width = (GLfloat) w;
- s->common.height = (GLfloat) h;
+ glCompInitCommon((glCompObj *) s, NULL, (GLfloat) 0, (GLfloat) 0);
+ s->common.width = (GLfloat) w;
+ s->common.height = (GLfloat) h;
s->groupCount = 0;
- s->objcnt=0;
- s->obj=(glCompObj**)0;
- s->textureCount=0;
- s->textures=(glCompTex**)0;
- s->common.font=new_font_from_parent((glCompObj*)s,NULL);
- s->common.compset=(glCompSet*)s;
- s->common.functions.mouseover=glCompMouseMove;
- s->common.functions.mousedown=glCompSetMouseDown;
- s->common.functions.mouseup=glCompSetMouseUp;
- glCompMouseInit(&s->mouse);
+ s->objcnt = 0;
+ s->obj = (glCompObj **) 0;
+ s->textureCount = 0;
+ s->textures = (glCompTex **) 0;
+ s->common.font = new_font_from_parent((glCompObj *) s, NULL);
+ s->common.compset = (glCompSet *) s;
+ s->common.functions.mouseover = glCompMouseMove;
+ s->common.functions.mousedown = glCompSetMouseDown;
+ s->common.functions.mouseup = glCompSetMouseUp;
+ glCompMouseInit(&s->mouse);
return s;
}
-void glCompSetAddObj(glCompSet* s ,glCompObj* obj)
+void glCompSetAddObj(glCompSet * s, glCompObj * obj)
{
- s->objcnt++;
- s->obj=realloc(s->obj, sizeof(glCompObj*) * s->objcnt);
+ s->objcnt++;
+ s->obj = realloc(s->obj, sizeof(glCompObj *) * s->objcnt);
s->obj[s->objcnt - 1] = obj;
- obj->common.compset=s;
+ obj->common.compset = s;
}
-#if 0
+#if 0
// compiler reports this function is not used.
//converts screen location to opengl coordinates
glPushMatrix();
glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
+ glDisable(GL_DEPTH_TEST);
}
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- glEnable(GL_DEPTH_TEST);
+ glEnable(GL_DEPTH_TEST);
}
int glCompSetDraw(glCompSet * s)
{
- int ind=0;
- glCompDrawBegin();
- for (;ind < s->objcnt;ind ++)
- {
- s->obj[ind]->common.functions.draw((void*)s->obj[ind]);
- }
+ int ind = 0;
+ glCompDrawBegin();
+ for (; ind < s->objcnt; ind++) {
+ s->obj[ind]->common.functions.draw((void *) s->obj[ind]);
+ }
glCompDrawEnd();
return 1;
}
void glcompsetUpdateBorder(glCompSet * s, int w, int h)
{
if (w > 0 && h > 0) {
- s->common.width = (GLfloat) w;
+ s->common.width = (GLfloat) w;
s->common.height = (GLfloat) h;
}
}
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include "glcompfont.h"
#include "glcomptextpng.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
-extern void glCompInitCommon(glCompObj* childObj,glCompObj* parentObj,GLfloat x ,GLfloat y);
-void glCompEmptyCommon(glCompCommon* c);
-extern glCompSet* glCompSetNew( int w, int h);
-extern void glCompSetClear(glCompSet * s);
-extern int glCompSetDraw(glCompSet * s);
-extern int glCompSetHide(glCompSet * s);
-extern int glCompSetShow(glCompSet * s);
-extern int glCompSetClick(glCompSet * s, int x, int y);
-extern int glCompSetRelease(glCompSet * s, int x, int y);
-extern void glcompsetUpdateBorder(glCompSet * s, int w, int h);
-extern int glcompsetNextGroupId(glCompSet *s);
-extern int glcompsetGetGroupId(glCompSet *s);
-extern void glCompDrawBegin(void);
-extern void glCompDrawEnd(void);
-extern void glCompDeleteTexture(glCompTex* t);
-extern void glCompSetAddObj(glCompSet* s ,glCompObj* obj);
-glCompObj* glCompGetObjByMouse(glCompSet* s ,glCompMouse* m,int onlyClickable);
-extern void glCompGetObjectType(glCompObj* p);
+ extern void glCompInitCommon(glCompObj * childObj,
+ glCompObj * parentObj, GLfloat x,
+ GLfloat y);
+ void glCompEmptyCommon(glCompCommon * c);
+ extern glCompSet *glCompSetNew(int w, int h);
+ extern void glCompSetClear(glCompSet * s);
+ extern int glCompSetDraw(glCompSet * s);
+ extern int glCompSetHide(glCompSet * s);
+ extern int glCompSetShow(glCompSet * s);
+ extern int glCompSetClick(glCompSet * s, int x, int y);
+ extern int glCompSetRelease(glCompSet * s, int x, int y);
+ extern void glcompsetUpdateBorder(glCompSet * s, int w, int h);
+ extern int glcompsetNextGroupId(glCompSet * s);
+ extern int glcompsetGetGroupId(glCompSet * s);
+ extern void glCompDrawBegin(void);
+ extern void glCompDrawEnd(void);
+ extern void glCompDeleteTexture(glCompTex * t);
+ extern void glCompSetAddObj(glCompSet * s, glCompObj * obj);
+ glCompObj *glCompGetObjByMouse(glCompSet * s, glCompMouse * m,
+ int onlyClickable);
+ extern void glCompGetObjectType(glCompObj * p);
/*
change all components's fonts in s
to sourcefont
*/
/* void change_fonts(glCompSet * s,const texFont_t* sourcefont); */
-
-
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcomptext.h"
#include "glpangofont.h"
#include "glutils.h"
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
-#include "glpangofont.h"
+#include "glpangofont.h"
typedef float GLfloat;
#else
#include <unistd.h>
-#include <GL/gl.h>
+#include <GL/gl.h>
#endif
#include "glcompdefs.h"
#include <GL/glut.h>
#ifdef __cplusplus
extern "C" {
#endif
-extern fontset_t* fontset_init(void);
-extern void free_font_set(fontset_t* fontset);
+ extern fontset_t *fontset_init(void);
+ extern void free_font_set(fontset_t * fontset);
//extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat ,GLfloat, char*);
-//extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
+//extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
#ifdef __cplusplus
}
#endif
-
#endif
-
-
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
+
#include "glcompfont.h"
+#include "memory.h"
#include <gtk/gtk.h>
#include <png.h>
unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight)
{
- cairo_surface_t* surface;
- cairo_format_t format;
- int w,h;
- unsigned char* d;
- surface=NULL;
+ cairo_surface_t *surface;
+ cairo_format_t format;
+ int w, h;
+ unsigned char *d;
+ surface = NULL;
/* d=create_pango_texture("Arial",14,"hello world \ n hello mars",surface,&w,&h);
*imageWidth=w;
*imageHeight=h;*/
- surface = cairo_image_surface_create_from_png(filename);
- w=cairo_image_surface_get_width(surface);
- h=cairo_image_surface_get_height(surface);
- *imageWidth=w;
- *imageHeight=h;
- format=cairo_image_surface_get_format(surface);
- d=cairo_image_surface_get_data (surface);
- return d;
+ surface = cairo_image_surface_create_from_png(filename);
+ w = cairo_image_surface_get_width(surface);
+ h = cairo_image_surface_get_height(surface);
+ *imageWidth = w;
+ *imageHeight = h;
+ format = cairo_image_surface_get_format(surface);
+ d = cairo_image_surface_get_data(surface);
+ return d;
unsigned char *load_raw(char *filename, int width, int height)
{
unsigned char *data;
- FILE* file;
+ FILE *file;
// allocate buffer
- data = malloc(width * height * 3);
+ data = N_NEW(width * height * 3, unsigned char);
// open and read texture data
file = fopen(filename, "rb");
fread(data, width * height * 3, 1, file);
-unsigned char *load_png2(char *file_name, int *imageWidth,int *imageHeight)
+unsigned char *load_png2(char *file_name, int *imageWidth,
+ int *imageHeight)
{
unsigned char *imageData = NULL;
unsigned char header[8];
row_pointers = png_get_rows(png_ptr, info_ptr);
*imageWidth = info_ptr->width;
*imageHeight = info_ptr->height;
- imageData = malloc(info_ptr->height * info_ptr->width);
+ imageData = N_NEW(info_ptr->height * info_ptr->width, unsigned char);
c = 0;
//decide what pixel offset to use, ro
pixeloffset = png_get_rowbytes(png_ptr, info_ptr) / info_ptr->width;
b2 = -1;
b3 = -1;
- for (i = 0; i < (int) info_ptr->height; i++)
- {
- for (ii = 0; ii < (int) png_get_rowbytes(png_ptr, info_ptr); ii = ii + pixeloffset)
- {
- imageData[c] = row_pointers[info_ptr->height - i - 1][ii];
- if ((b0 != row_pointers[info_ptr->height - i - 1][ii])|| (b1 != row_pointers[info_ptr->height - i - 1][ii + 1])|| (b2 != row_pointers[info_ptr->height - i - 1][ii + 2])|| (b3 != row_pointers[info_ptr->height - i - 1][ii + 3]))
- {
- b0 = row_pointers[info_ptr->height - i - 1][ii];
- b1 = row_pointers[info_ptr->height - i - 1][ii + 1];
- b2 = row_pointers[info_ptr->height - i - 1][ii + 2];
- b3 = row_pointers[info_ptr->height - i - 1][ii + 3];
- }
- c++;
- }
+ for (i = 0; i < (int) info_ptr->height; i++) {
+ for (ii = 0; ii < (int) png_get_rowbytes(png_ptr, info_ptr);
+ ii = ii + pixeloffset) {
+ imageData[c] = row_pointers[info_ptr->height - i - 1][ii];
+ if ((b0 != row_pointers[info_ptr->height - i - 1][ii])
+ || (b1 != row_pointers[info_ptr->height - i - 1][ii + 1])
+ || (b2 != row_pointers[info_ptr->height - i - 1][ii + 2])
+ || (b3 !=
+ row_pointers[info_ptr->height - i - 1][ii + 3])) {
+ b0 = row_pointers[info_ptr->height - i - 1][ii];
+ b1 = row_pointers[info_ptr->height - i - 1][ii + 1];
+ b2 = row_pointers[info_ptr->height - i - 1][ii + 2];
+ b3 = row_pointers[info_ptr->height - i - 1][ii + 3];
+ }
+ c++;
+ }
}
//cleaning libpng mess
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
-
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include "memory.h"
-void glCompSetRemoveTexLabel(glCompSet* s,glCompFont* t)
+void glCompSetRemoveTexLabel(glCompSet * s, glCompFont * t)
{
}
-static glCompTex* glCompSetAddNewTexture(glCompSet* s,int width,int height,unsigned char* data,int is2D)
+static glCompTex *glCompSetAddNewTexture(glCompSet * s, int width,
+ int height, unsigned char *data,
+ int is2D)
{
- int Er,offset,ind;
- glCompTex* t;
- unsigned char* tarData;
- unsigned char* srcData;
-
- if (!data)
- return NULL;
-
- Er=0;
- t=NEW(glCompTex);
- if (!is2D) /*use opengl texture*/
- {
- glEnable(GL_TEXTURE_2D);
- glShadeModel(GL_FLAT);
- glEnable(GL_DEPTH_TEST);
- glPixelStorei(GL_UNPACK_ALIGNMENT,1);
- glGenTextures(1, &t->id); //get next id
- if (t->id < 0 ) /*for some opengl based error , texture couldnt be created*/
- Er=1;
- else
- {
- glBindTexture(GL_TEXTURE_2D, t->id);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,width, height,0,GL_RGBA, GL_UNSIGNED_BYTE, data );
- glDisable(GL_TEXTURE_2D);
- }
+ int Er, offset, ind;
+ glCompTex *t;
+ unsigned char *tarData;
+ unsigned char *srcData;
+
+ if (!data)
+ return NULL;
+
+ Er = 0;
+ t = NEW(glCompTex);
+ if (!is2D) { /*use opengl texture */
+ glEnable(GL_TEXTURE_2D);
+ glShadeModel(GL_FLAT);
+ glEnable(GL_DEPTH_TEST);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glGenTextures(1, &t->id); //get next id
+ if (t->id < 0) /*for some opengl based error , texture couldnt be created */
+ Er = 1;
+ else {
+ glBindTexture(GL_TEXTURE_2D, t->id);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
+ GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glDisable(GL_TEXTURE_2D);
}
- if(is2D && !Er)
- {
- t->data=malloc (4 * width * height);
- offset =4 ;//RGBA mod,TO DO implement other modes
- /*data upside down because of pango gl coord system*/
- for (ind=0;ind < height; ind ++)
- {
- srcData = data + (height - 1 -ind) * offset * width;
- tarData = t->data+ind * offset * width;
- memcpy(tarData,srcData,4*width);
- }
+ }
+ if (is2D && !Er) {
+ t->data = N_NEW(4 * width * height, char);
+ offset = 4; //RGBA mod,TO DO implement other modes
+ /*data upside down because of pango gl coord system */
+ for (ind = 0; ind < height; ind++) {
+ srcData = data + (height - 1 - ind) * offset * width;
+ tarData = t->data + ind * offset * width;
+ memcpy(tarData, srcData, 4 * width);
}
-
- if(Er)
- {
- free (data);
- free (t);
- return NULL;
- }
- t->userCount=1;
- t->width=(GLfloat)width;
- t->height=(GLfloat)height;
- s->textureCount ++ ;
- s->textures=realloc(s->textures,s->textureCount * sizeof(glCompTex*));
- s->textures[s->textureCount-1]=t;
- return t;
+ }
+
+ if (Er) {
+ free(data);
+ free(t);
+ return NULL;
+ }
+ t->userCount = 1;
+ t->width = (GLfloat) width;
+ t->height = (GLfloat) height;
+ s->textureCount++;
+ s->textures =
+ realloc(s->textures, s->textureCount * sizeof(glCompTex *));
+ s->textures[s->textureCount - 1] = t;
+ return t;
}
-glCompTex* glCompSetAddNewTexImage(glCompSet* s,int width,int height,unsigned char* data,int is2D)
+glCompTex *glCompSetAddNewTexImage(glCompSet * s, int width, int height,
+ unsigned char *data, int is2D)
{
- glCompTex* t;
- if (!data)
- return NULL;
- t=glCompSetAddNewTexture(s,width,height,data,is2D);
- if (!t)
- return NULL;
- t->type=glTexImage;
- return t;
+ glCompTex *t;
+ if (!data)
+ return NULL;
+ t = glCompSetAddNewTexture(s, width, height, data, is2D);
+ if (!t)
+ return NULL;
+ t->type = glTexImage;
+ return t;
}
-glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D)
+glCompTex *glCompSetAddNewTexLabel(glCompSet * s, char *def, int fs,
+ char *text, int is2D)
{
- int ind,Er,width,height;
-// int ind2=0;
- glCompTex* t;
- cairo_surface_t *surface=NULL;
- unsigned char* data;
- data=(unsigned char*)0;
- Er=0;
- if (!def)
- return NULL;
- /*first check if the same label with same font def created before
- if it was , return its id
- */
- for (ind =0 ; ind < s->textureCount ; ind ++)
- {
- if(s->textures[ind]->type==glTexLabel)
- {
- if ((strcmp(def,s->textures[ind]->def)==0)&&(s->textures[ind]->type == glTexLabel)&&(strcmp(text,s->textures[ind]->text)==0) )
- {
- s->textures[ind]->userCount ++;
- return s->textures[ind];
- }
- }
+ int ind, Er, width, height;
+// int ind2=0;
+ glCompTex *t;
+ cairo_surface_t *surface = NULL;
+ unsigned char *data;
+ data = (unsigned char *) 0;
+ Er = 0;
+ if (!def)
+ return NULL;
+ /*first check if the same label with same font def created before
+ if it was , return its id
+ */
+ for (ind = 0; ind < s->textureCount; ind++) {
+ if (s->textures[ind]->type == glTexLabel) {
+ if ((strcmp(def, s->textures[ind]->def) == 0)
+ && (s->textures[ind]->type == glTexLabel)
+ && (strcmp(text, s->textures[ind]->text) == 0)) {
+ s->textures[ind]->userCount++;
+ return s->textures[ind];
+ }
}
+ }
- data= create_pango_texture(def,fs,text,surface,&width,&height);
- if (!data) /*pango error , */
- Er=1;
- t=glCompSetAddNewTexture(s,width,height,data,is2D);
- if (!t) Er=1;
+ data = create_pango_texture(def, fs, text, surface, &width, &height);
+ if (!data) /*pango error , */
+ Er = 1;
+ t = glCompSetAddNewTexture(s, width, height, data, is2D);
+ if (!t)
+ Er = 1;
cairo_surface_destroy(surface);
- if(Er)
- {
- free (data);
- free (t);
- return NULL;
- }
+ if (Er) {
+ free(data);
+ free(t);
+ return NULL;
+ }
- t->def=strdup(def);
- t->text=strdup(text);
- t->type=glTexLabel;
- return t;
+ t->def = strdup(def);
+ t->text = strdup(text);
+ t->type = glTexLabel;
+ return t;
}
-void glCompDeleteTexture(glCompTex* t)
+void glCompDeleteTexture(glCompTex * t)
{
- if (!t)
- return;
- t->userCount --;
- if (!t->userCount)
- {
- if (t->data)
- free (t->data);
- if (t->def)
- free (t->def);
- if (t->text)
- free (t->text);
- free(t);
- }
+ if (!t)
+ return;
+ t->userCount--;
+ if (!t->userCount) {
+ if (t->data)
+ free(t->data);
+ if (t->def)
+ free(t->def);
+ if (t->text)
+ free(t->text);
+ free(t);
+ }
}
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include <GL/gl.h>
#include <GL/glu.h>
#include "glcompdefs.h"
-extern glCompTex* glCompSetAddNewTexImage(glCompSet* s,int width,int height,unsigned char* data,int is2D);
-extern glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ extern glCompTex *glCompSetAddNewTexImage(glCompSet * s, int width,
+ int height,
+ unsigned char *data,
+ int is2D);
+ extern glCompTex *glCompSetAddNewTexLabel(glCompSet * s, char *def,
+ int fs, char *text,
+ int is2D);
+
+#ifdef __cplusplus
+}
+#endif
#endif
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
return 0;
}
-static PangoLayout *get_pango_layout( char *markup_text,
- char *fontdescription,int fontsize,
+static PangoLayout *get_pango_layout(char *markup_text,
+ char *fontdescription, int fontsize,
double *width, double *height)
{
PangoFontDescription *desc;
pango_cairo_font_map_create_context(PANGO_CAIRO_FONT_MAP(fontmap));
options = cairo_font_options_create();
- cairo_font_options_set_antialias(options,CAIRO_ANTIALIAS_GRAY);
+ cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_FULL);
cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_ON);
desc = pango_font_description_from_string(fontdescription);
// pango_font_description_set_family(desc, "CENTAUR.TTF");
- pango_font_description_set_size(desc,
- (gint) (fontsize * PANGO_SCALE));
+ pango_font_description_set_size(desc, (gint) (fontsize * PANGO_SCALE));
// pango_font_description_set_style (desc,PANGO_STYLE_ITALIC);
return CAIRO_STATUS_WRITE_ERROR;
}
-int create_font_file(char *fontdescription,int fs, char *fontfile, float gw,float gh)
+int create_font_file(char *fontdescription, int fs, char *fontfile,
+ float gw, float gh)
{
char buf[] = " ";
int return_value = -1;
if (file_exists(fontfile)) //checking if font file has already been created
- return 0;
+ return 0;
//create the right size canvas for character set
- surface =cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int) ((float) ncolumns * gw),(int) (gh * (float) ncolumns));
+ surface =
+ cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
+ (int) ((float) ncolumns * gw),
+ (int) (gh * (float) ncolumns));
cr = cairo_create(surface);
//draw a rectangle with same size of canvas
- cairo_rectangle(cr, 0, 0, (float) ncolumns * gw, gh * (float) ncolumns);
+ cairo_rectangle(cr, 0, 0, (float) ncolumns * gw,
+ gh * (float) ncolumns);
//fill rectangle with black
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_fill(cr);
//set pen color to white
cairo_set_source_rgb(cr, 1, 1, 1);
- for (c = 0; c < 256; c++)
- {
- counter++;
- if ((c != 38) && (c != 60) && (c != 128) && (c < 129))
- buf[0] = c;
- else
- buf[0] = ' ';
- cairo_move_to(cr, X, Y);
- layout =
- get_pango_layout(buf, fontdescription,fs, &width, &height);
- pango_cairo_show_layout(cr, layout);
- X = X + (int) gw;
- if (counter == ncolumns)
- {
- X = 0;
- Y = Y + (int) gh;
- counter = 0;
- }
+ for (c = 0; c < 256; c++) {
+ counter++;
+ if ((c != 38) && (c != 60) && (c != 128) && (c < 129))
+ buf[0] = c;
+ else
+ buf[0] = ' ';
+ cairo_move_to(cr, X, Y);
+ layout =
+ get_pango_layout(buf, fontdescription, fs, &width, &height);
+ pango_cairo_show_layout(cr, layout);
+ X = X + (int) gw;
+ if (counter == ncolumns) {
+ X = 0;
+ Y = Y + (int) gh;
+ counter = 0;
+ }
}
output_file = fopen(fontfile, "wb+");
- if (output_file)
- {
- cairo_surface_write_to_png_stream(surface, writer, output_file);
- return_value = 0;
+ if (output_file) {
+ cairo_surface_write_to_png_stream(surface, writer, output_file);
+ return_value = 0;
}
fclose(output_file);
g_object_unref(layout);
}
-unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h)
+unsigned char *create_pango_texture(char *fontdescription, int fontsize,
+ char *txt, cairo_surface_t * surface,
+ int *w, int *h)
{
// char buf[] = " ";
cairo_t *cr;
PangoLayout *layout;
double width, height;
- FILE* output_file;
+ FILE *output_file;
- layout =get_pango_layout(txt, fontdescription, fontsize,&width, &height);
- //create the right size canvas for character set
- surface =cairo_image_surface_create(CAIRO_FORMAT_ARGB32,(int)width,(int)height);
-// surface =cairo_image_surface_create(CAIRO_FORMAT_A8,(int)width,(int)height);
+ layout =
+ get_pango_layout(txt, fontdescription, fontsize, &width, &height);
+ //create the right size canvas for character set
+ surface =
+ cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int) width,
+ (int) height);
+// surface =cairo_image_surface_create(CAIRO_FORMAT_A8,(int)width,(int)height);
cr = cairo_create(surface);
//draw a rectangle with same size of canvas
// cairo_set_source_rgba(cr, 0.5, 0.5, 0.5,0.3);
// cairo_fill(cr);
//set pen color to white
- cairo_set_source_rgba(cr, 1, 1, 1,1);
- //draw the text
- pango_cairo_show_layout(cr, layout);
+ cairo_set_source_rgba(cr, 1, 1, 1, 1);
+ //draw the text
+ pango_cairo_show_layout(cr, layout);
- output_file = fopen("c:/graphviz-ms/test_folder/test.png", "wb+");
- if (output_file)
- {
- cairo_surface_write_to_png_stream(surface, writer, output_file);
+ output_file = fopen("c:/graphviz-ms/test_folder/test.png", "wb+");
+ if (output_file) {
+ cairo_surface_write_to_png_stream(surface, writer, output_file);
- }
+ }
- *w=(int)width;
- *h=(int)height;
+ *w = (int) width;
+ *h = (int) height;
g_object_unref(layout);
cairo_destroy(cr);
fclose(output_file);
- return cairo_image_surface_get_data (surface);
+ return cairo_image_surface_get_data(surface);
}
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
#include <pango/pangocairo.h>
#include <png.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
//creates a font file with given name and font description
//returns non-zero if fails
-unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h);
-int create_font_file(char *fontdescription,int fs, char *fontfile, float gw,float gh);
-
+ unsigned char *create_pango_texture(char *fontdescription,
+ int fontsize, char *txt,
+ cairo_surface_t * surface, int *w,
+ int *h);
+ int create_font_file(char *fontdescription, int fs, char *fontfile,
+ float gw, float gh);
+#ifdef __cplusplus
+}
+#endif
#endif
-
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
glReadPixels(x - WIDTH / 2, (int) winY - WIDTH / 2, WIDTH, WIDTH,
GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
comp = -9999999;
- for (idx = 0; idx < WIDTH * WIDTH; idx++)
- {
-// printf ("Z value:%f ",winZ[idx]);
- if ((winZ[idx] > comp) && (winZ[idx] < 1))
- comp = winZ[idx];
+ for (idx = 0; idx < WIDTH * WIDTH; idx++) {
+// printf ("Z value:%f ",winZ[idx]);
+ if ((winZ[idx] > comp) && (winZ[idx] < 1))
+ comp = winZ[idx];
}
-// printf ("\n");
+// printf ("\n");
- gluUnProject(winX, winY, comp, modelview, projection, viewport, &posX,
+ gluUnProject(winX, winY, comp, modelview, projection, viewport, &posX,
&posY, &posZ);
*X = (GLfloat) posX;
static point3f scale(double d, point3f p)
{
- p.x *= (float)d;
- p.y *= (float)d;
- p.z *= (float)d;
+ p.x *= (float) d;
+ p.y *= (float) d;
+ p.z *= (float) d;
return p;
}
point3f ba = sub(b, a);
point3f pa = sub(p, a);
- U = (float)(dot(pa, ba) / dot(ba, ba));
+ U = (float) (dot(pa, ba) / dot(ba, ba));
if (U > 1)
q = b;
{
if (tet > 0) {
tet = 5;
- tet = (float)DEG2RAD * tet;
+ tet = (float) DEG2RAD *tet;
P2->x =
(float) (J.N.x * J.N.x +
- (float)cos(tet) * (1 - J.N.x * J.N.x)) * P.x +
- (J.N.x * J.N.y * (1 - (float)cos(tet)) - J.N.z * (float)sin(tet))
- + (J.N.z * J.N.x * (1 - (float)cos(tet)) + J.N.y * (float)sin(tet)) * P.z;
+ (float) cos(tet) * (1 - J.N.x * J.N.x)) * P.x +
+ (J.N.x * J.N.y * (1 - (float) cos(tet)) -
+ J.N.z * (float) sin(tet))
+ + (J.N.z * J.N.x * (1 - (float) cos(tet)) +
+ J.N.y * (float) sin(tet)) * P.z;
P2->y =
- (float) (J.N.x * J.N.y * (1 - (float)cos(tet)) +
- J.N.z * (float)sin(tet)) * P.x + (J.N.y * J.N.y +
- (float)cos(tet) * (1 -
- J.N.y *
- J.N.y)) * P.y +
- (J.N.y * J.N.z * (1 - (float)cos(tet)) - J.N.x * (float)sin(tet)) * P.z;
+ (float) (J.N.x * J.N.y * (1 - (float) cos(tet)) +
+ J.N.z * (float) sin(tet)) * P.x + (J.N.y * J.N.y +
+ (float) cos(tet) *
+ (1 -
+ J.N.y * J.N.y)) *
+ P.y + (J.N.y * J.N.z * (1 - (float) cos(tet)) -
+ J.N.x * (float) sin(tet)) * P.z;
P2->z =
- (float) (J.N.z * J.N.x * (1 - (float)cos(tet)) -
- J.N.y * (float)sin(tet)) * P.x + (J.N.y * J.N.z * (1 -
- (float)cos(tet))
- + J.N.x * (float)sin(tet)) * P.y +
- (J.N.z * J.N.z + (float)cos(tet) * (1 - J.N.z * J.N.z)) * P.z;
+ (float) (J.N.z * J.N.x * (1 - (float) cos(tet)) -
+ J.N.y * (float) sin(tet)) * P.x +
+ (J.N.y * J.N.z * (1 - (float) cos(tet))
+ + J.N.x * (float) sin(tet)) * P.y + (J.N.z * J.N.z +
+ (float) cos(tet) * (1 -
+ J.N.
+ z *
+ J.N.
+ z)) *
+ P.z;
return 1;
} else
return 0;
}
-void glCompSelectionBox(glCompSet* s)
+void glCompSelectionBox(glCompSet * s)
{
- static GLfloat x,y,w,h;
+ static GLfloat x, y, w, h;
/* if (( h < 0) || (w < 0))
{
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 15);
}*/
- x=s->mouse.pos.x;
- y=s->mouse.pos.y;
- w=s->mouse.dragX;
- h=s->mouse.dragY;
- printf ("%f %f %f %f \n",x,y,w,h);
- glColor4f(1,1,1,1);
+ x = s->mouse.pos.x;
+ y = s->mouse.pos.y;
+ w = s->mouse.dragX;
+ h = s->mouse.dragY;
+ printf("%f %f %f %f \n", x, y, w, h);
+ glColor4f(1, 1, 1, 1);
/* glBegin(GL_POLYGON);
glVertex2f(x,y);
glVertex2f(x, y+h);
glEnd();*/
- glBegin(GL_POLYGON);
- glVertex2f(0,0);
- glVertex2f(250, 0);
- glVertex2f(250, 250);
- glVertex2f(0, 250);
- glVertex2f(0,0);
+ glBegin(GL_POLYGON);
+ glVertex2f(0, 0);
+ glVertex2f(250, 0);
+ glVertex2f(250, 250);
+ glVertex2f(0, 250);
+ glVertex2f(0, 0);
- glEnd();
+ glEnd();
glDisable(GL_LINE_STIPPLE);
-void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref)
+void glCompCalcWidget(glCompCommon * parent, glCompCommon * child,
+ glCompCommon * ref)
{
- /*check alignments first , alignments overrides anchors*/
- GLfloat borderWidth;
- ref->height=child->height;
- ref->width=child->width;
- if (parent->borderType == glBorderNone)
- borderWidth=0;
- else
- borderWidth=parent->borderWidth;
- if(child->align != glAlignNone) //if alignment, make sure width and height is no greater than parent
- {
- if (child->width > parent->width)
- ref->width=parent->width-(float)2.0 * borderWidth ;
- if (child->height > parent->height)
- ref->height=parent->height-(float)2.0 * borderWidth ;;
-
- }
+ /*check alignments first , alignments overrides anchors */
+ GLfloat borderWidth;
+ ref->height = child->height;
+ ref->width = child->width;
+ if (parent->borderType == glBorderNone)
+ borderWidth = 0;
+ else
+ borderWidth = parent->borderWidth;
+ if (child->align != glAlignNone) //if alignment, make sure width and height is no greater than parent
+ {
+ if (child->width > parent->width)
+ ref->width = parent->width - (float) 2.0 *borderWidth;
+ if (child->height > parent->height)
+ ref->height = parent->height - (float) 2.0 *borderWidth;;
- ref->pos.x=parent->refPos.x+ref->pos.x+borderWidth;
- ref->pos.y=parent->refPos.y+ref->pos.y+borderWidth;
-
+ }
- switch (child->align)
- {
- case glAlignLeft:
- ref->pos.x=parent->refPos.x+borderWidth;
- ref->pos.y=parent->refPos.y+borderWidth;
- ref->height=parent->height-2*borderWidth;
- break;
- case glAlignRight:
- ref->pos.x=parent->refPos.x+parent->width-child->width-borderWidth;
- ref->pos.y=parent->refPos.y+borderWidth;
- ref->height=parent->height-2*borderWidth;
- break;
-
- case glAlignTop:
- ref->pos.y=parent->refPos.y+parent->height-child->height-borderWidth;
- ref->pos.x=parent->refPos.x;
- ref->width=parent->width-2*borderWidth;
- break;
-
- case glAlignBottom:
- ref->pos.y=parent->refPos.y+borderWidth;
- ref->pos.x=parent->refPos.x+borderWidth;
- ref->width=parent->width-2*borderWidth;
- break;
- case glAlignParent:
- ref->pos.y=parent->refPos.y+borderWidth;
- ref->pos.x=parent->refPos.x+borderWidth;;
- 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
- {
- ref->pos.x=parent->refPos.x+child->pos.x+borderWidth;
- ref->pos.y=parent->refPos.y+child->pos.y+borderWidth;
-
- if (child->anchor.leftAnchor)
- ref->pos.x=parent->refPos.x+child->anchor.left+borderWidth;
- if (child->anchor.bottomAnchor )
- ref->pos.y=parent->refPos.y+child->anchor.bottom+borderWidth;
-
- if (child->anchor.topAnchor)
- ref->height =parent->refPos.y+parent->height-ref->pos.y-child->anchor.top-borderWidth;
- if (child->anchor.rightAnchor)
- ref->width = parent->refPos.x+parent->width - ref->pos.x - child->anchor.right-borderWidth;
- }
- child->refPos.x=ref->pos.x;
- child->refPos.y=ref->pos.y;
- child->width=ref->width;
- child->height=ref->height;
+ ref->pos.x = parent->refPos.x + ref->pos.x + borderWidth;
+ ref->pos.y = parent->refPos.y + ref->pos.y + borderWidth;
+
+
+ switch (child->align) {
+ case glAlignLeft:
+ ref->pos.x = parent->refPos.x + borderWidth;
+ ref->pos.y = parent->refPos.y + borderWidth;
+ ref->height = parent->height - 2 * borderWidth;
+ break;
+ case glAlignRight:
+ ref->pos.x =
+ parent->refPos.x + parent->width - child->width - borderWidth;
+ ref->pos.y = parent->refPos.y + borderWidth;
+ ref->height = parent->height - 2 * borderWidth;
+ break;
+
+ case glAlignTop:
+ ref->pos.y =
+ parent->refPos.y + parent->height - child->height -
+ borderWidth;
+ ref->pos.x = parent->refPos.x;
+ ref->width = parent->width - 2 * borderWidth;
+ break;
+
+ case glAlignBottom:
+ ref->pos.y = parent->refPos.y + borderWidth;
+ ref->pos.x = parent->refPos.x + borderWidth;
+ ref->width = parent->width - 2 * borderWidth;
+ break;
+ case glAlignParent:
+ ref->pos.y = parent->refPos.y + borderWidth;
+ ref->pos.x = parent->refPos.x + borderWidth;;
+ 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
+ {
+ ref->pos.x = parent->refPos.x + child->pos.x + borderWidth;
+ ref->pos.y = parent->refPos.y + child->pos.y + borderWidth;
+
+ if (child->anchor.leftAnchor)
+ ref->pos.x =
+ parent->refPos.x + child->anchor.left + borderWidth;
+ if (child->anchor.bottomAnchor)
+ ref->pos.y =
+ parent->refPos.y + child->anchor.bottom + borderWidth;
+
+ if (child->anchor.topAnchor)
+ ref->height =
+ parent->refPos.y + parent->height - ref->pos.y -
+ child->anchor.top - borderWidth;
+ if (child->anchor.rightAnchor)
+ ref->width =
+ parent->refPos.x + parent->width - ref->pos.x -
+ child->anchor.right - borderWidth;
+ }
+ child->refPos.x = ref->pos.x;
+ child->refPos.y = ref->pos.y;
+ child->width = ref->width;
+ child->height = ref->height;
}
#if 0
// compiler reports this function is not used
-static void glCompVertex(glCompPoint* p)
+static void glCompVertex(glCompPoint * p)
{
- glVertex3f(p->x,p->y,p->z);
+ glVertex3f(p->x, p->y, p->z);
}
#endif
-static void glCompQuadVertex(glCompPoint* p0,glCompPoint* p1,glCompPoint* p2,glCompPoint* p3)
+static void glCompQuadVertex(glCompPoint * p0, glCompPoint * p1,
+ glCompPoint * p2, glCompPoint * p3)
{
- glVertex3f(p0->x,p0->y,p0->z);
- glVertex3f(p1->x,p1->y,p1->z);
- glVertex3f(p2->x,p2->y,p2->z);
- glVertex3f(p3->x,p3->y,p3->z);
+ glVertex3f(p0->x, p0->y, p0->z);
+ glVertex3f(p1->x, p1->y, p1->z);
+ glVertex3f(p2->x, p2->y, p2->z);
+ glVertex3f(p3->x, p3->y, p3->z);
}
-void glCompSetColor(glCompColor* c)
+
+void glCompSetColor(glCompColor * c)
{
- glColor4f(c->R,c->G,c->B,c->A);
+ glColor4f(c->R, c->G, c->B, c->A);
}
-void glCompDrawRectangle (glCompRect* r)
+void glCompDrawRectangle(glCompRect * r)
{
- glBegin(GL_QUADS);
- glVertex3f(r->pos.x,r->pos.y,r->pos.z);
- glVertex3f(r->pos.x+r->w,r->pos.y,r->pos.z);
- glVertex3f(r->pos.x+r->w,r->pos.y+r->h,r->pos.z);
- glVertex3f(r->pos.x,r->pos.y+r->h,r->pos.z);
- glEnd();
+ glBegin(GL_QUADS);
+ glVertex3f(r->pos.x, r->pos.y, r->pos.z);
+ glVertex3f(r->pos.x + r->w, r->pos.y, r->pos.z);
+ glVertex3f(r->pos.x + r->w, r->pos.y + r->h, r->pos.z);
+ glVertex3f(r->pos.x, r->pos.y + r->h, r->pos.z);
+ glEnd();
}
-void glCompDrawRectPrism (glCompPoint* p,GLfloat w,GLfloat h,GLfloat b,GLfloat d,glCompColor* c,int bumped)
+void glCompDrawRectPrism(glCompPoint * p, GLfloat w, GLfloat h, GLfloat b,
+ GLfloat d, glCompColor * c, int bumped)
{
- static GLfloat color_fac;
- static glCompPoint A,B,C,D,E,F,G,H;
- GLfloat dim=1.00;
- if (!bumped)
- {
- color_fac=(GLfloat)1.3;
- b=b-2;
- dim=0.5;
- }
- else
- color_fac=(GLfloat)1/(GLfloat)1.3;
-
-
- A.x=p->x;A.y=p->y;A.z=p->z;
- B.x=p->x+w; B.y=p->y; B.z=p->z;
- C.x=p->x+w; C.y=p->y+h; C.z=p->z;
- D.x=p->x; D.y=p->y+h; D.z=p->z;
- G.x=p->x+b; G.y=p->y+b; G.z=p->z+d;
- H.x=p->x+w-b; H.y=p->y+b; H.z=p->z+d;
- E.x=p->x+b; E.y=p->y+h-b; E.z=p->z+d;
- F.x=p->x+w-b; F.y=p->y+h-b; F.z=p->z+d;
- glBegin (GL_QUADS);
- glColor4f(c->R*dim,c->G*dim,c->B*dim,c->A);
- glCompQuadVertex(&G,&H,&F,&E);
-
- glColor4f(c->R*color_fac*dim,c->G*color_fac*dim,c->B*color_fac*dim,c->A);
- glCompQuadVertex(&A,&B,&H,&G);
- glCompQuadVertex(&B,&H,&F,&C);
-
- glColor4f(c->R/color_fac*dim,c->G/color_fac*dim,c->B/color_fac*dim,c->A);
- glCompQuadVertex(&A,&G,&E,&D);
- glCompQuadVertex(&E,&F,&C,&D);
- glEnd();
+ static GLfloat color_fac;
+ static glCompPoint A, B, C, D, E, F, G, H;
+ GLfloat dim = 1.00;
+ if (!bumped) {
+ color_fac = (GLfloat) 1.3;
+ b = b - 2;
+ dim = 0.5;
+ } else
+ color_fac = (GLfloat) 1 / (GLfloat) 1.3;
+
+
+ A.x = p->x;
+ A.y = p->y;
+ A.z = p->z;
+ B.x = p->x + w;
+ B.y = p->y;
+ B.z = p->z;
+ C.x = p->x + w;
+ C.y = p->y + h;
+ C.z = p->z;
+ D.x = p->x;
+ D.y = p->y + h;
+ D.z = p->z;
+ G.x = p->x + b;
+ G.y = p->y + b;
+ G.z = p->z + d;
+ H.x = p->x + w - b;
+ H.y = p->y + b;
+ H.z = p->z + d;
+ E.x = p->x + b;
+ E.y = p->y + h - b;
+ E.z = p->z + d;
+ F.x = p->x + w - b;
+ F.y = p->y + h - b;
+ F.z = p->z + d;
+ glBegin(GL_QUADS);
+ glColor4f(c->R * dim, c->G * dim, c->B * dim, c->A);
+ glCompQuadVertex(&G, &H, &F, &E);
+
+ glColor4f(c->R * color_fac * dim, c->G * color_fac * dim,
+ c->B * color_fac * dim, c->A);
+ glCompQuadVertex(&A, &B, &H, &G);
+ glCompQuadVertex(&B, &H, &F, &C);
+
+ glColor4f(c->R / color_fac * dim, c->G / color_fac * dim,
+ c->B / color_fac * dim, c->A);
+ glCompQuadVertex(&A, &G, &E, &D);
+ glCompQuadVertex(&E, &F, &C, &D);
+ glEnd();
}
-void copy_glcomp_color(glCompColor* source,glCompColor* target)
+
+void copy_glcomp_color(glCompColor * source, glCompColor * target)
{
- target->R=source->R;
- target->G=source->G;
- target->B=source->B;
- target->A=source->A;
+ target->R = source->R;
+ target->G = source->G;
+ target->B = source->B;
+ target->A = source->A;
}
+/* $Id$Revision: */
/* vim:set shiftwidth=4 ts=8: */
+
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
#include <GL/glu.h>
#include "glcompdefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct {
+ float x, y, z;
+ } point3f;
+ typedef struct {
+ point3f u, v;
+ } line;
+ typedef struct {
+ point3f N; /* normal */
+ double d; /* offset */
+ } plane;
+
-typedef struct {
- float x, y, z;
-} point3f;
-typedef struct {
- point3f u, v;
-} line;
-typedef struct {
- point3f N; /* normal */
- double d; /* offset */
-} plane;
-
-
-int GetFixedOGLPos(int, int, float, GLfloat*, GLfloat*, GLfloat * Z);
-int GetOGLPosRef(int x, int y, float *X, float *Y, float *Z);
-float GetOGLDistance(int l);
-int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z);
-void to3D(int x, int y, GLfloat * X, GLfloat * Y,GLfloat * Z);
-void linear_interplotate (float,float,float,float,float,float*);
-double point_to_line_dist(point3f p, point3f u, point3f v);
-double point_to_lineseg_dist (point3f p, point3f a, point3f b);
-int rot_spherex(plane J,float tet,point3f P,point3f* P2);
-void make_plane(point3f a,point3f b,point3f c,plane* P);
-void replacestr(char *source,char **target);
-extern void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref);
-extern void glCompDrawRectangle (glCompRect* r);
-extern void glCompDrawRectPrism (glCompPoint* p,GLfloat w,GLfloat h,GLfloat b,GLfloat d,glCompColor* c,int bumped);
-extern void copy_glcomp_color(glCompColor* source,glCompColor* target);
-extern void glCompSetColor(glCompColor* c);
-
-void glCompSelectionBox(glCompSet* s);
+ int GetFixedOGLPos(int, int, float, GLfloat *, GLfloat *, GLfloat * Z);
+ int GetOGLPosRef(int x, int y, float *X, float *Y, float *Z);
+ float GetOGLDistance(int l);
+ int GetFixedOGLPoslocal(int x, int y, GLfloat * X, GLfloat * Y,
+ GLfloat * Z);
+ void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z);
+ void linear_interplotate(float, float, float, float, float, float *);
+ double point_to_line_dist(point3f p, point3f u, point3f v);
+ double point_to_lineseg_dist(point3f p, point3f a, point3f b);
+ int rot_spherex(plane J, float tet, point3f P, point3f * P2);
+ void make_plane(point3f a, point3f b, point3f c, plane * P);
+ void replacestr(char *source, char **target);
+ extern void glCompCalcWidget(glCompCommon * parent,
+ glCompCommon * child, glCompCommon * ref);
+ extern void glCompDrawRectangle(glCompRect * r);
+ extern void glCompDrawRectPrism(glCompPoint * p, GLfloat w, GLfloat h,
+ GLfloat b, GLfloat d, glCompColor * c,
+ int bumped);
+ extern void copy_glcomp_color(glCompColor * source,
+ glCompColor * target);
+ extern void glCompSetColor(glCompColor * c);
+
+ void glCompSelectionBox(glCompSet * s);
+
+#ifdef __cplusplus
+}
+#endif
#endif