From: erg Date: Fri, 16 Jul 2010 18:18:26 +0000 (+0000) Subject: Fix image code to use xdot specs; adapt to changes in glcomp lib; X-Git-Tag: LAST_LIBGRAPH~32^2~1268 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3966d2a2539a11fca5c49c5df12505d5462c53bb;p=graphviz Fix image code to use xdot specs; adapt to changes in glcomp lib; general clean-up --- diff --git a/cmd/smyrna/draw.c b/cmd/smyrna/draw.c index 41549b4c8..b2bc0b945 100755 --- a/cmd/smyrna/draw.c +++ b/cmd/smyrna/draw.c @@ -45,7 +45,7 @@ GLubyte rasters[24] = { 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0 }; -void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, +static void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param) { /*copied from NEHE */ @@ -205,7 +205,7 @@ static void relocate_spline(sdot_op * sop, int param) }*/ } -void DrawBeziers(sdot_op* o, int param) +static void DrawBeziers(sdot_op* o, int param) { //SEND ALL CONTROL POINTS IN 3D ARRAYS @@ -215,9 +215,8 @@ void DrawBeziers(sdot_op* o, int param) int temp = 0; int filled; int i = 0; - static xdot_op * op; - op=&o->op; - view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; + xdot_op * op=&o->op; + view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; // SelectBeziers((sdot_op *) op); relocate_spline((sdot_op *) op, param); @@ -250,15 +249,14 @@ void DrawBeziers(sdot_op* o, int param) //Draws an ellpise made out of points. //void DrawEllipse(xdot_point* xpoint,GLfloat xradius, GLfloat yradius,int filled) -void DrawEllipse(sdot_op* o, int param) +static void DrawEllipse(sdot_op* o, int param) { //to draw a circle set xradius and yradius same values GLfloat x, y, xradius, yradius; int i = 0; int filled; - static xdot_op * op; - op=&o->op; - view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; + xdot_op * op=&o->op; + view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; set_options((sdot_op *) op, param); x = op->u.ellipse.x - dx; y = op->u.ellipse.y - dy; @@ -300,13 +298,12 @@ void DrawEllipse(sdot_op* o, int param) glEnd(); } -extern void DrawPolygon(sdot_op * o, int param) +static void DrawPolygon(sdot_op * o, int param) //void DrawPolygon(xdot_point* xpoint,int count, int filled) { int filled; - static xdot_op * op; - op=&o->op; - view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; + xdot_op * op=&o->op; + view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; //SelectPolygon((sdot_op *) op); set_options((sdot_op *) op, param); @@ -349,23 +346,18 @@ extern void DrawPolygon(sdot_op * o, int param) } -extern void DrawPolygon2(sdot_op * o, int param) - +#if 0 +static void DrawPolygon2(sdot_op * o, int param) { drawTessPolygon(o); } +#endif - - - - - -void DrawPolyline(sdot_op* o, int param) +static void DrawPolyline(sdot_op* o, int param) { int i = 0; - static xdot_op * op; - op=&o->op; - view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; + xdot_op * op=&o->op; + view->Topview->global_z=view->Topview->global_z+o->layer*LAYER_DIFF; if (param == 0) glColor4f(view->penColor.R, view->penColor.G, view->penColor.B, @@ -385,22 +377,37 @@ void DrawPolyline(sdot_op* o, int param) glEnd(); } -void SetFillColor(sdot_op* o, int param) +static glCompColor GetglCompColor(char *color) { - glCompColor c; - static xdot_op * op; - op=&o->op; - c = GetglCompColor(op->u.color); + gvcolor_t cl; + glCompColor c; + if (color != '\0') { + colorxlate(color, &cl, RGBA_DOUBLE); + c.R = (float) cl.u.RGBA[0]; + c.G = (float) cl.u.RGBA[1]; + c.B = (float) cl.u.RGBA[2]; + c.A = (float) cl.u.RGBA[3]; + } else { + c.R = view->penColor.R; + c.G = view->penColor.G; + c.B = view->penColor.B; + c.A = view->penColor.A; + } + return c; +} +static void SetFillColor(sdot_op* o, int param) +{ + xdot_op * op=&o->op; + glCompColor c = GetglCompColor(op->u.color); view->fillColor.R = c.R; view->fillColor.G = c.G; view->fillColor.B = c.B; view->fillColor.A = c.A; } -void SetPenColor(sdot_op* o, int param) +static void SetPenColor(sdot_op* o, int param) { glCompColor c; - static xdot_op * op; - op=&o->op; + xdot_op * op=&o->op; c = GetglCompColor(op->u.color); view->penColor.R = c.R; view->penColor.G = c.G; @@ -408,42 +415,42 @@ void SetPenColor(sdot_op* o, int param) view->penColor.A = c.A; } -void SetStyle(sdot_op* o, int param) +static void SetStyle(sdot_op* o, int param) { - static xdot_op * op; - op=&o->op; - - + /* xdot_op * op=&o->op; */ } static sdot_op * font_op; -void SetFont(sdot_op * o, int param) +static void SetFont(sdot_op * o, int param) { font_op=o; } /*for now we only support png files in 2d space, no image rotation*/ -void InsertImage(sdot_op * o, int param) +static void InsertImage(sdot_op * o, int param) { - float w,h,x,y,X,Y,Z; + float x,y; glCompImage *i; if(!o->obj) return; - if(!o->iData.data) - { - o->iData.data = load_png(o->op.u.image.name, &o->iData.w, &o->iData.h); - x=o->op.u.image.pos.x; - y=o->op.u.image.pos.y; - i = glCompImageNew(NULL, x, y); - glCompImageLoadPng(i, o->op.u.image.name,0); + if(!o->img) { + x = o->op.u.image.pos.x; + y = o->op.u.image.pos.y; + i = o->img = glCompImageNewFile (NULL, x, y, o->op.u.image.name, 0); + if (!o->img) { + fprintf (stderr, "Could not open file \"%s\" to read image.\n", o->op.u.image.name); + return; + } + i->width = o->op.u.image.pos.w; + i->height = o->op.u.image.pos.h; i->common.functions.draw(i); } } -void EmbedText(sdot_op* o, int param) +static void EmbedText(sdot_op* o, int param) { GLfloat x,y; glColor4f(view->penColor.R,view->penColor.G,view->penColor.B,view->penColor.A); @@ -464,18 +471,19 @@ void EmbedText(sdot_op* o, int param) y=o->op.u.text.y; if (!o->font) { - o->font=new_font( + o->font=glNewFont( view->widgets, o->op.u.text.text, &view->penColor, pangotext, font_op->op.u.font.name,font_op->op.u.font.size,0); - //new_font(glCompSet * s, char *text, glCompColor * c, glCompFontType type, char *fontdesc, int fs)*/ + //glNewFont(glCompSet * s, char *text, glCompColor * c, glCompFontType type, char *fontdesc, int fs)*/ } glCompDrawText3D(o->font,x,y,view->Topview->global_z,o->op.u.text.width,font_op->op.u.font.size); } +#if 0 void draw_selection_box(ViewInfo * view) { /* if (((view->mouse.mouse_mode == 4) || (view->mouse.mouse_mode == 5)) @@ -505,6 +513,7 @@ void draw_selection_box(ViewInfo * view) }*/ } +#endif void draw_magnifier(ViewInfo * view) { @@ -554,7 +563,7 @@ void draw_magnifier(ViewInfo * view) } -void draw_circle(float originX, float originY, float radius) +static void draw_circle(float originX, float originY, float radius) { /* draw a circle from a bunch of short lines */ float vectorX1, vectorY1, vectorX, vectorY, angle; @@ -680,8 +689,8 @@ static void drawXdotwithattrs(void *e, int param) #endif - -/*void drawGraph(Agraph_t * g) +#if 0 +void drawGraph(Agraph_t * g) { Agnode_t *v; Agedge_t *e; @@ -725,8 +734,10 @@ static void drawXdotwithattrs(void *e, int param) view->SignalBlock = 0; } -}*/ +} +#endif +#if 0 /* this function is used to cache fonts in view->fontset @@ -748,7 +759,6 @@ static void scanXdot(xdot * xDot, void *p) } - static void scanXdotwithattr(void *p, char *attr) { xdot *xDot; @@ -774,8 +784,7 @@ static void scanXdotwithattrs(void *e) iterate in nodes and edges to cache fonts, run this once or whenever a new font is added to the graph */ - -void scanGraph(Agraph_t * g) +static void scanGraph(Agraph_t * g) { Agnode_t *v; Agedge_t *e; @@ -804,6 +813,7 @@ int randomize_color(glCompColor * c, int brightness) c->B = B; return 1; } +#endif void drawCircle(float x, float y, float radius, float zdepth) @@ -835,24 +845,6 @@ drawfunc_t OpFns[] = { (drawfunc_t)InsertImage, }; -glCompColor GetglCompColor(char *color) -{ - gvcolor_t cl; - glCompColor c; - if (color != '\0') { - colorxlate(color, &cl, RGBA_DOUBLE); - c.R = (float) cl.u.RGBA[0]; - c.G = (float) cl.u.RGBA[1]; - c.B = (float) cl.u.RGBA[2]; - c.A = (float) cl.u.RGBA[3]; - } else { - c.R = view->penColor.R; - c.G = view->penColor.G; - c.B = view->penColor.B; - c.A = view->penColor.A; - } - return c; -} void drawEllipse(float xradius, float yradius, int angle1, int angle2) { int i; @@ -867,6 +859,8 @@ void drawEllipse(float xradius, float yradius, int angle1, int angle2) glEnd(); } + +#if 0 int draw_node_hintbox_gl_polygon(GLfloat x, GLfloat y, GLfloat z, GLfloat fs, char *text) { @@ -951,7 +945,9 @@ int draw_node_hintbox(GLfloat x, GLfloat y, GLfloat z, GLfloat fs, return 1; } +#endif +#if 0 static GLUquadric *sphere; void draw_sphere(float x, float y, float z, float r) { @@ -962,6 +958,7 @@ void draw_sphere(float x, float y, float z, float r) gluSphere(fisheyesphere, r, SPHERE_SLICE_COUNT, SPHERE_SLICE_COUNT); glTranslatef(-x, -y, -z); } +#endif void draw_selpoly(glCompPoly* selPoly) { diff --git a/cmd/smyrna/draw.h b/cmd/smyrna/draw.h index 6357521f6..d98ca3516 100755 --- a/cmd/smyrna/draw.h +++ b/cmd/smyrna/draw.h @@ -31,50 +31,47 @@ extern "C" { * these are opengl based xdot drawing functions * topview drawings are not here */ - extern drawfunc_t OpFns[]; - extern void drawGraph(Agraph_t * g); - void scanGraph(Agraph_t * g); - void draw_selection_box(ViewInfo * view); - void draw_magnifier(ViewInfo * view); - void draw_fisheye_magnifier(ViewInfo * view); - extern int randomize_color(glCompColor * c, int brightness); - extern void drawCircle(float x, float y, float radius, float zdepth); - extern glCompColor GetglCompColor(char *color); - extern void drawBorders(ViewInfo * view); - void drawEllipse(float xradius, float yradius, int angle1, int angle2); - int draw_node_hintbox(GLfloat x, GLfloat y, GLfloat z, GLfloat fs, - char *text); - void draw_sphere(float x, float y, float z, float r); +extern drawfunc_t OpFns[]; +extern void drawGraph(Agraph_t * g); +#if 0 +extern void scanGraph(Agraph_t * g); +extern int randomize_color(glCompColor * c, int brightness); +extern void draw_sphere(float x, float y, float z, float r); +extern int draw_node_hintbox(GLfloat x, GLfloat y, GLfloat z, GLfloat fs, char *text); +extern glCompColor GetglCompColor(char *color); +#endif +extern void draw_selection_box(ViewInfo * view); +extern void draw_magnifier(ViewInfo * view); +extern void draw_fisheye_magnifier(ViewInfo * view); +extern void drawCircle(float x, float y, float radius, float zdepth); +extern void drawBorders(ViewInfo * view); +extern void drawEllipse(float xradius, float yradius, int angle1, int angle2); +extern void draw_selpoly(glCompPoly* selPoly); - void draw_selpoly(glCompPoly* selPoly); +#if 0 /*xdot drawing functions*/ - extern void DrawBeziers(sdot_op* o, int param); - extern void DrawEllipse(sdot_op * op, int param); - extern void DrawPolygon(sdot_op * op, int param); - extern void DrawPolyline(sdot_op * op, int param); - extern void SetFillColor(sdot_op* o, int param); - extern void SetPenColor(sdot_op* o, int param); - extern void SetStyle(sdot_op* o, int param); - extern void SetFont(sdot_op * o, int param); - extern void InsertImage(sdot_op * o, int param); - extern void EmbedText(sdot_op * o, int param); - - typedef struct - { - glCompColor color; - float width; - }xdotstyle; - - - - typedef struct - { - glCompColor penColor; - glCompColor fillColor; - xdotstyle style; - } xdotstate; +extern void DrawBeziers(sdot_op* o, int param); +extern void DrawEllipse(sdot_op * op, int param); +extern void DrawPolygon(sdot_op * op, int param); +extern void DrawPolyline(sdot_op * op, int param); +extern void SetFillColor(sdot_op* o, int param); +extern void SetPenColor(sdot_op* o, int param); +extern void SetStyle(sdot_op* o, int param); +extern void SetFont(sdot_op * o, int param); +extern void InsertImage(sdot_op * o, int param); +extern void EmbedText(sdot_op * o, int param); +#endif +typedef struct { + glCompColor color; + float width; +} xdotstyle; +typedef struct { + glCompColor penColor; + glCompColor fillColor; + xdotstyle style; +} xdotstate; #ifdef __cplusplus diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index 83bd991e1..73bd0a0e6 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -24,8 +24,8 @@ #include "hotkeymap.h" #include "polytess.h" -void drawRotatingAxis(void); -void draw_cube() +#if 0 +static void draw_cube() { glBegin(GL_QUADS); // Draw The Cube Using quads @@ -61,13 +61,12 @@ void draw_cube() glVertex3f(100.0f, -100.0f, -100.0f); // Bottom Right Of The Quad (Right) glEnd(); } +#endif - - -void drawRotatingAxis(void) +static void drawRotatingAxis(void) { - static GLUquadricObj *quadratic = (GLUquadricObj *) 0; - float AL = 45; + static GLUquadricObj *quadratic; + float AL = 45; if (get_mode(view) != MM_ROTATE) return; @@ -114,7 +113,7 @@ void drawRotatingAxis(void) params:ViewInfo , global view variable defined in viewport.c return value:always 1 */ -int glupdatecamera(ViewInfo * view) +static int glupdatecamera(ViewInfo * view) { if (view->active_camera == -1) glTranslatef(-view->panx, -view->pany, view->panz); @@ -150,63 +149,8 @@ int glupdatecamera(ViewInfo * view) return 1; } -/* - main gl expose ,any time sreen needs to be redrawn, this function is called by gltemplate - ,all drawings are initialized in this function - params:ViewInfo , global view variable defined in viewport.c - return value:0 if something goes wrong with GL 1 , otherwise -*/ -int glexpose_main(ViewInfo * view) -{ - static int doonce = 0; - if (!glupdatecamera(view)) - return 0; - - if (view->activeGraph >= 0) { - if (!doonce) { - doonce = 1; - btnToolZoomFit_clicked(NULL, NULL); - btnToolZoomFit_clicked(NULL, NULL); - } - } - else - return 0; - - glexpose_grid(view); - draw_fisheye_magnifier(view); - draw_magnifier(view); - drawBorders(view); - glexpose_drawgraph(view); -// drawRotatingTools(); -// draw_cube(); - drawRotatingAxis(); - draw_selpoly(&view->Topview->sel.selPoly); -// draw_stuff(); -// test_color_pallete(); -// drawtestpoly(); - /*DEBUG*/ -/* if (view->mouse.mouse_mode == MM_PAN) - { - glBegin(GL_LINE_STRIP); - glColor4f((GLfloat) 1, (GLfloat) 0.0, (GLfloat) 0.0, - (GLfloat) 1); - glVertex3f((GLfloat) view->GLx, (GLfloat) view->GLy, - (GLfloat) 0.001); - glVertex3f((GLfloat) view->GLx2, (GLfloat) view->GLy2, - (GLfloat) 0.001); - - - glEnd(); - }*/ - /*DEBUG*/ return 1; -} - -/* - draws grid (little dots , with no use) - params:ViewInfo , global view variable defined in viewport.c - return value:none -*/ -void drawtestpoly(void) +#if 0 +static void drawtestpoly(void) { glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -229,8 +173,14 @@ void drawtestpoly(void) glDisable(GL_TEXTURE_2D); } +#endif -void glexpose_grid(ViewInfo * view) +/* + draws grid (little dots , with no use) + params:ViewInfo , global view variable defined in viewport.c + return value:none +*/ +static void glexpose_grid(ViewInfo * view) { //drawing grids float x, y; @@ -255,7 +205,7 @@ void glexpose_grid(ViewInfo * view) params:ViewInfo , global view variable defined in viewport.c return value:1 if there is a graph to draw else 0 */ -int glexpose_drawgraph(ViewInfo * view) +static int glexpose_drawgraph(ViewInfo * view) { if (view->activeGraph > -1) { @@ -277,6 +227,79 @@ int glexpose_drawgraph(ViewInfo * view) return 0; } +#if 0 +static void test_color_pallete(void) +{ + int ind = 0; + float xGAP = 5; + float yGAP = 80; + float x = 50; + float y = 50; + glCompColor c; + for (ind = 0; ind < 350; ind++) { + getcolorfromschema(view->colschms, ind, 350, &c); + x = ind * xGAP; + glBegin(GL_POLYGON); + glColor3f(c.R, c.G, c.B); + glVertex3f(x, y, 0.0); + glVertex3f(x + xGAP, y, 0.0); + glVertex3f(x + xGAP, y + yGAP, 0.0); + glVertex3f(x, y + yGAP, 0.0); + glEnd(); + } +} +#endif +/* + main gl expose ,any time sreen needs to be redrawn, this function is called by gltemplate + ,all drawings are initialized in this function + params:ViewInfo , global view variable defined in viewport.c + return value:0 if something goes wrong with GL 1 , otherwise +*/ +int glexpose_main(ViewInfo * view) +{ + static int doonce = 0; + if (!glupdatecamera(view)) + return 0; + + if (view->activeGraph >= 0) { + if (!doonce) { + doonce = 1; + btnToolZoomFit_clicked(NULL, NULL); + btnToolZoomFit_clicked(NULL, NULL); + } + } + else + return 0; + + glexpose_grid(view); + draw_fisheye_magnifier(view); + draw_magnifier(view); + drawBorders(view); + glexpose_drawgraph(view); +// drawRotatingTools(); +// draw_cube(); + drawRotatingAxis(); + draw_selpoly(&view->Topview->sel.selPoly); +// draw_stuff(); +// test_color_pallete(); +// drawtestpoly(); + /*DEBUG*/ +/* if (view->mouse.mouse_mode == MM_PAN) + { + glBegin(GL_LINE_STRIP); + glColor4f((GLfloat) 1, (GLfloat) 0.0, (GLfloat) 0.0, + (GLfloat) 1); + glVertex3f((GLfloat) view->GLx, (GLfloat) view->GLy, + (GLfloat) 0.001); + glVertex3f((GLfloat) view->GLx2, (GLfloat) view->GLy2, + (GLfloat) 0.001); + + + glEnd(); + }*/ + /*DEBUG*/ return 1; +} + /* void drawRotatingTools(void) { diff --git a/cmd/smyrna/glexpose.h b/cmd/smyrna/glexpose.h index 594fe1d87..2ffefa2a6 100644 --- a/cmd/smyrna/glexpose.h +++ b/cmd/smyrna/glexpose.h @@ -23,13 +23,13 @@ extern "C" { #endif - int glupdatecamera(ViewInfo * v); + /* int glupdatecamera(ViewInfo * v); */ int glexpose_main(ViewInfo * v); - void glexpose_grid(ViewInfo * v); - int glexpose_drawgraph(ViewInfo * view); + /* void glexpose_grid(ViewInfo * v); */ + /* int glexpose_drawgraph(ViewInfo * view); */ void drawRotatingTools(void); - void drawtestpoly(void); - void draw_cube(void); + /* void drawtestpoly(void); */ + /* void draw_cube(void); */ #ifdef __cplusplus } /* end extern "C" */ diff --git a/cmd/smyrna/glmotion.c b/cmd/smyrna/glmotion.c index 84457ab38..37622476f 100644 --- a/cmd/smyrna/glmotion.c +++ b/cmd/smyrna/glmotion.c @@ -26,7 +26,7 @@ gboolean redraw = FALSE; - +#if 0 void glmotion_main(ViewInfo * v, GdkEventMotion * event, GtkWidget * widget) { @@ -61,22 +61,9 @@ void glmotion_main(ViewInfo * v, GdkEventMotion * event, FALSE); } -void glmotion_zoom_inc(int zoomin) -{ - float inc_value; - inc_value = - (float) (view->Topview->fitin_zoom * MAX_ZOOM * -1 - - view->Topview->fitin_zoom * MIN_ZOOM * -1) / ZOOM_STEPS; - if (zoomin) /*zooming in , zoom value should be decreased */ - graph_zoom(view->zoom - view->zoom * 0.25); - else - graph_zoom(view->zoom + view->zoom * 0.25); /*zoom out */ - glexpose(); - -} - +#endif /*real zoom in out is done here, all other functions send this one what they desire, it is not guranteed,*/ -void graph_zoom(float real_zoom) +static void graph_zoom(float real_zoom) { float old_zoom; @@ -108,6 +95,20 @@ void graph_zoom(float real_zoom) glCompLabelSetText((glCompLabel *) v->Topview->customptr, buf);*/ } +void glmotion_zoom_inc(int zoomin) +{ + float inc_value; + inc_value = + (float) (view->Topview->fitin_zoom * MAX_ZOOM * -1 - + view->Topview->fitin_zoom * MIN_ZOOM * -1) / ZOOM_STEPS; + if (zoomin) /*zooming in , zoom value should be decreased */ + graph_zoom(view->zoom - view->zoom * 0.25); + else + graph_zoom(view->zoom + view->zoom * 0.25); /*zoom out */ + glexpose(); + +} + void glmotion_zoom(ViewInfo * v) { float real_zoom; @@ -149,6 +150,7 @@ void glmotion_pan(ViewInfo * v) redraw = TRUE; } +#if 0 void glmotion_adjust_pan(ViewInfo * v, float panx, float pany) { float gldx, gldy; @@ -171,6 +173,7 @@ void glmotion_adjust_pan(ViewInfo * v, float panx, float pany) redraw = TRUE; } +#endif #ifdef UNUSED static float mod_angle(float angle) @@ -179,6 +182,7 @@ static float mod_angle(float angle) } #endif +#if 0 void glmotion_rotate(ViewInfo * v) { /* if(v->mouse.rotate_axis==MOUSE_ROTATE_XY) @@ -202,3 +206,4 @@ void glmotion_rotate(ViewInfo * v) v->cameras[v->active_camera]->anglez-=v->mouse.dy/7; }*/ } +#endif diff --git a/cmd/smyrna/glmotion.h b/cmd/smyrna/glmotion.h index e8ea1fa07..2ec1ef01d 100644 --- a/cmd/smyrna/glmotion.h +++ b/cmd/smyrna/glmotion.h @@ -23,13 +23,16 @@ extern "C" { #endif +#if 0 void glmotion_main(ViewInfo * v, GdkEventMotion * event, GtkWidget * widget); - void glmotion_zoom(ViewInfo * v); - void glmotion_pan(ViewInfo * v); void glmotion_rotate(ViewInfo * v); void glmotion_adjust_pan(ViewInfo * v, float panx, float pany); void graph_zoom(float real_zoom); +#endif + + void glmotion_zoom(ViewInfo * v); + void glmotion_pan(ViewInfo * v); void glmotion_zoom_inc(int zoomin); #ifdef __cplusplus diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index 49bab427d..14391745a 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -52,13 +52,34 @@ static glMouseButtonType getGlCompMouseType(int n) } +/* + test single opengl parameter, all visual , it doesnt return a value + params:gtk gl config class , attribute name and id,if boolean expected send is_boolean true + return value:none +*/ +void print_gl_config_attrib(GdkGLConfig * glconfig, + const gchar * attrib_str, + int attrib, gboolean is_boolean) +{ + int value; + + g_print("%s = ", attrib_str); + if (gdk_gl_config_get_attrib(glconfig, attrib, &value)) { + if (is_boolean) + g_print("%s\n", value == TRUE ? "TRUE" : "FALSE"); + else + g_print("%d\n", value); + } else + g_print("*** Cannot get %s attribute value\n", attrib_str); +} + /* test opengl parameters, configuration.Run this function to see machine's open gl capabilities params:gtk gl config class ,gtk takes care of all these tests return value:none */ -void examine_gl_config_attrib(GdkGLConfig * glconfig) +static void examine_gl_config_attrib(GdkGLConfig * glconfig) { g_print("\nOpenGL visual configurations :\n\n"); g_print("gdk_gl_config_is_rgba (glconfig) = %s\n", @@ -109,27 +130,6 @@ void examine_gl_config_attrib(GdkGLConfig * glconfig) g_print("\n"); } -/* - test single opengl parameter, all visual , it doesnt return a value - params:gtk gl config class , attribute name and id,if boolean expected send is_boolean true - return value:none -*/ -void print_gl_config_attrib(GdkGLConfig * glconfig, - const gchar * attrib_str, - int attrib, gboolean is_boolean) -{ - int value; - - g_print("%s = ", attrib_str); - if (gdk_gl_config_get_attrib(glconfig, attrib, &value)) { - if (is_boolean) - g_print("%s\n", value == TRUE ? "TRUE" : "FALSE"); - else - g_print("%d\n", value); - } else - g_print("*** Cannot get %s attribute value\n", attrib_str); -} - /* initialize the gl , run only once!! params:gtk opgn gl canvas and optional data pointer diff --git a/cmd/smyrna/gltemplate.h b/cmd/smyrna/gltemplate.h index c9ae2c596..27b3517f1 100755 --- a/cmd/smyrna/gltemplate.h +++ b/cmd/smyrna/gltemplate.h @@ -36,20 +36,23 @@ extern "C" { #endif +#if 0 void examine_gl_config_attrib(GdkGLConfig * glconfig); void print_gl_config_attrib(GdkGLConfig * glconfig, const gchar * attrib_str, int attrib, gboolean is_boolean); -/* static void realize (GtkWidget *widget,gpointer data); */ -/* static gboolean configure_event (GtkWidget *widget,GdkEventConfigure *event, gpointer data); */ +void realize (GtkWidget *widget,gpointer data); +gboolean configure_event (GtkWidget *widget,GdkEventConfigure *event, gpointer data); +gboolean button_press_event (GtkWidget *widget,GdkEventButton *event,gpointer data); +gboolean button_release_event (GtkWidget *widget,GdkEventButton *event,gpointer data); +gboolean motion_notify_event (GtkWidget *widget,GdkEventMotion *event,gpointer data); +gboolean key_press_event (GtkWidget *widget, GdkEventKey *event,gpointer data); +gboolean button_press_event_popup_menu (GtkWidget *widget,GdkEventButton *event,gpointer data); + void switch_Mouse(GtkMenuItem * menuitem, int mouse_mode); +#endif + gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer data); -/* static gboolean button_press_event (GtkWidget *widget,GdkEventButton *event,gpointer data); */ -/* static gboolean button_release_event (GtkWidget *widget,GdkEventButton *event,gpointer data); */ -/* static gboolean motion_notify_event (GtkWidget *widget,GdkEventMotion *event,gpointer data); */ -/* static gboolean key_press_event (GtkWidget *widget, GdkEventKey *event,gpointer data); */ - void switch_Mouse(GtkMenuItem * menuitem, int mouse_mode); -/* static gboolean button_press_event_popup_menu (GtkWidget *widget,GdkEventButton *event,gpointer data); */ extern GdkGLConfig *configure_gl(void); void create_window(GdkGLConfig * glconfig, GtkWidget * vbox); diff --git a/cmd/smyrna/gui/frmobjectui.c b/cmd/smyrna/gui/frmobjectui.c index d027e8b63..59e094caa 100644 --- a/cmd/smyrna/gui/frmobjectui.c +++ b/cmd/smyrna/gui/frmobjectui.c @@ -573,6 +573,10 @@ _BB void on_attrRB0_clicked(GtkWidget * widget, gpointer user_data) view->Topview); } + +/* This is the action attached to the publish button on the attributes + * window. What should happen? + */ _BB void on_attrProg_toggled(GtkWidget * widget, gpointer user_data) { /* FIX */ @@ -739,7 +743,7 @@ attr_list *load_attr_list(Agraph_t * g) { int nodeCnt = 0; int edgeCnt = 0; - static char buf[512]; + char buf[512]; Agedge_t* ep; Agnode_t* v; Agraph_t* g; diff --git a/cmd/smyrna/gui/glcompui.c b/cmd/smyrna/gui/glcompui.c index d46d7765b..4ca368b4a 100644 --- a/cmd/smyrna/gui/glcompui.c +++ b/cmd/smyrna/gui/glcompui.c @@ -198,16 +198,11 @@ void selectnodes(glCompObj *obj, GLfloat x, GLfloat y) view->Topview->sel.selectNodes=1; else view->Topview->sel.selectNodes=0; - - } - void testContainer(glCompSet *s) { - glCompPanel* p; - glCompLabel *l=NULL; p = glCompPanelNew((glCompObj *) s, 100, 100, 500, 500); p = glCompPanelNew((glCompObj *) p, 0, 0, 480, 480); @@ -221,13 +216,6 @@ void testContainer(glCompSet *s) p->common.anchor.bottom=50; p->common.anchor.top=10; p->common.anchor.right=10; - - - - - - - } @@ -288,17 +276,15 @@ glCompSet *glcreate_gl_topview_menu(void) y=y+off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "N"); - b->common.callbacks.click = selectnodes; + b->common.callbacks.click = (glcompclickfunc_t)selectnodes; b->groupid=-1; b->status=1; y=y+off; b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "E"); - b->common.callbacks.click = selectedges; + b->common.callbacks.click = (glcompclickfunc_t)selectedges; b->groupid=-1; - - p = glCompPanelNew((glCompObj *) p, 1, 325, 45, 180); p->common.align = glAlignTop; p->common.data = 0; diff --git a/cmd/smyrna/gvprpipe.c b/cmd/smyrna/gvprpipe.c index 70af10b20..5f98dd5bd 100644 --- a/cmd/smyrna/gvprpipe.c +++ b/cmd/smyrna/gvprpipe.c @@ -50,12 +50,13 @@ extern GladeXML *xml; //global libglade vars }*/ +#if 0 gvprscript* scr_from_string(char* str,void* obj) { return NULL; } - +#endif static ssize_t outfn(void *sp, const char *buf, size_t nbyte, void *dp) diff --git a/cmd/smyrna/hier.c b/cmd/smyrna/hier.c index 0cf3fdda9..66cb07809 100644 --- a/cmd/smyrna/hier.c +++ b/cmd/smyrna/hier.c @@ -212,6 +212,7 @@ focus_t *initFocus(int ncnt) return fs; } +#ifdef UNUSED void freeFocus(focus_t * fs) { free(fs->foci_nodes); @@ -219,3 +220,4 @@ void freeFocus(focus_t * fs) free(fs->y_foci); free(fs); } +#endif diff --git a/cmd/smyrna/polytess.c b/cmd/smyrna/polytess.c index 36497e205..92e8dbb19 100644 --- a/cmd/smyrna/polytess.c +++ b/cmd/smyrna/polytess.c @@ -95,7 +95,7 @@ GLdouble complex[25][3] = { 0.0f, 0.0f, 0.0f, #ifndef WIN32 #define CALLBACK #endif -void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut) +static void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut) { GLdouble *vertex; int i; @@ -115,7 +115,7 @@ void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLflo *dataOut = vertex; } -void CALLBACK vertexCallback(GLvoid *vertex) +static void CALLBACK vertexCallback(GLvoid *vertex) { GLdouble *ptr; ptr = (GLdouble *) vertex; @@ -123,8 +123,6 @@ void CALLBACK vertexCallback(GLvoid *vertex) } - - static GLUtesselator* Init() { // Create a new tessellation object @@ -183,20 +181,16 @@ static int Render_Contour2(GLUtesselator *tobj,sdot_op* p) #if UNUSED static int Render_Contour(GLUtesselator *tobj, GLdouble obj_data[][3],int cnt) { - - - // GLdouble d[1][3]; - static GLdouble**d; + static GLdouble** d; int x=0; /* int y=0; */ - if (!d) - { - d = (GLdouble**) malloc(sizeof(GLdouble)* cnt); + if (!d) { + d = N_NEW(cnt,GLdouble*); for (x=0;x < cnt; x++) { /* GLdouble temp; */ - d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3)); + d[x] = N_NEW3,GLdouble); d[x][0]=obj_data[x][0]; d[x][1]=obj_data[x][1]; d[x][2]=obj_data[x][2]; @@ -260,12 +254,15 @@ static int End_Contour(GLUtesselator *tobj) } +#if 0 static int freeTes(GLUtesselator *tobj) { gluDeleteTess(tobj); return(1); } +#endif + int drawTessPolygon(sdot_op* p) { if (!TP.tobj) diff --git a/cmd/smyrna/smyrna_utils.c b/cmd/smyrna/smyrna_utils.c index ab206d891..276108075 100644 --- a/cmd/smyrna/smyrna_utils.c +++ b/cmd/smyrna/smyrna_utils.c @@ -218,6 +218,7 @@ int point_within_sphere_with_coords(float x0, float y0, float z0, float r, return 1; return 0; } +#if 0 float distance_to_line(float ax, float ay, float bx, float by, float cx, float cy) { @@ -238,7 +239,8 @@ int _point_in_polygon(int npol, float *xp, float *yp, float x, float y) c = !c; } return c; - } +} +#endif int point_in_polygon(glCompPoly* selPoly,glCompPoint p) diff --git a/cmd/smyrna/smyrna_utils.h b/cmd/smyrna/smyrna_utils.h index d5dbe4385..2fb958946 100644 --- a/cmd/smyrna/smyrna_utils.h +++ b/cmd/smyrna/smyrna_utils.h @@ -29,7 +29,9 @@ extern char* getAttrStr(Agraph_t* g,void* obj,char* attr_name,char* def); extern void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A); extern void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c); extern glCompPoint getPointFromStr(char* str); +#if 0 extern float distance_to_line(float ax, float ay, float bx, float by, float cx,float cy); +#endif extern int point_in_polygon(glCompPoly* selPoly,glCompPoint p); extern int point_within_ellips_with_coords(float ex, float ey, float ea, float eb, diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index 645376da5..968061686 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -154,14 +154,15 @@ typedef struct int h; }image_data; typedef struct - { - xdot_op op; - void *obj; - glCompFont* font; - int size; - int layer; - int listId;/*opengl list id*/ - image_data iData; + { + xdot_op op; + void *obj; + glCompFont* font; + int size; + int layer; + int listId;/*opengl list id*/ + glCompImage* img; + /* image_data iData; */ } sdot_op; diff --git a/cmd/smyrna/support.c b/cmd/smyrna/support.c index dbcf858d7..f0891a6e9 100755 --- a/cmd/smyrna/support.c +++ b/cmd/smyrna/support.c @@ -18,6 +18,7 @@ #include "support.h" +#if 0 GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) { GtkWidget *parent, *found_widget; @@ -42,11 +43,13 @@ GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name) g_warning("Widget not found: %s", widget_name); return found_widget; } +#endif static GList *pixmaps_directories = NULL; +#if 0 /* Use this function to set the directory containing installed pixmaps. */ -void add_pixmap_directory(const gchar * directory) +static void add_pixmap_directory(const gchar * directory) { pixmaps_directories = g_list_prepend(pixmaps_directories, g_strdup(directory)); @@ -117,7 +120,9 @@ GdkPixbuf *create_pixbuf(const gchar * filename) g_free(pathname); return pixbuf; } +#endif +#if 0 /* This is used to set ATK action descriptions. */ void glade_set_atk_action_description(AtkAction * action, @@ -134,3 +139,4 @@ glade_set_atk_action_description(AtkAction * action, atk_action_set_description(action, i, description); } } +#endif diff --git a/cmd/smyrna/support.h b/cmd/smyrna/support.h index ba7105379..472c14b1c 100755 --- a/cmd/smyrna/support.h +++ b/cmd/smyrna/support.h @@ -47,7 +47,7 @@ GtkWidget *lookup_widget(GtkWidget * widget, const gchar * widget_name); /* Use this function to set the directory containing installed pixmaps. */ -void add_pixmap_directory(const gchar * directory); +/* void add_pixmap_directory(const gchar * directory); */ /* @@ -58,7 +58,7 @@ void add_pixmap_directory(const gchar * directory); GtkWidget *create_pixmap(GtkWidget * widget, const gchar * filename); /* This is used to create the pixbufs used in the interface. */ -GdkPixbuf *create_pixbuf(const gchar * filename); +/* GdkPixbuf *create_pixbuf(const gchar * filename); */ /* This is used to set ATK action descriptions. */ void glade_set_atk_action_description(AtkAction * action, diff --git a/cmd/smyrna/topfisheyeview.c b/cmd/smyrna/topfisheyeview.c index b5644cd65..fd77c568e 100644 --- a/cmd/smyrna/topfisheyeview.c +++ b/cmd/smyrna/topfisheyeview.c @@ -240,7 +240,7 @@ static v_data *makeGraph(Agraph_t* gg, int *nedges) - +#if 0 static v_data *makeGraph_old(topview * tv, int *nedges) { int i; @@ -288,7 +288,24 @@ static v_data *makeGraph_old(topview * tv, int *nedges) *nedges = ne; return graph; } +#endif +static void refresh_old_values(topview * t) +{ + int level, v; + Hierarchy *hp = t->fisheyeParams.h; + for (level = 0; level < hp->nlevels; level++) { + for (v = 0; v < hp->nvtxs[level]; v++) { + ex_vtx_data *gg = hp->geom_graphs[level]; + /* v_data *g = hp->graphs[level]; */ + /* double x0,y0; */ + gg[v].old_physical_x_coord = gg[v].physical_x_coord; + gg[v].old_physical_y_coord = gg[v].physical_y_coord; + gg[v].old_active_level = gg[v].active_level; + } + } + +} /* To use: * double* x_coords; // initial x coordinates @@ -387,6 +404,7 @@ void prepare_topological_fisheye(Agraph_t* g,topview * t) } +#if 0 /* draws all level 0 nodes and edges, during animation */ @@ -411,8 +429,9 @@ void printalllevels(topview * t) } glEnd(); } +#endif -void drawtopfishnodes(topview * t) +static void drawtopfishnodes(topview * t) { glCompColor srcColor; glCompColor tarColor; @@ -473,7 +492,8 @@ void drawtopfishnodes(topview * t) } -void drawtopfishnodelabels(topview * t) +#if 0 +static void drawtopfishnodelabels(topview * t) { int v, finenodes, focusnodes; char buf[512]; @@ -517,7 +537,8 @@ void drawtopfishnodelabels(topview * t) } } -void drawtopfishedges(topview * t) +#endif +static void drawtopfishedges(topview * t) { glCompColor srcColor; glCompColor tarColor; @@ -592,6 +613,29 @@ void drawtopfishedges(topview * t) } +static int get_active_frame(topview * t) +{ + gulong microseconds; + gdouble seconds; + int fr; + seconds = g_timer_elapsed(view->timer, µseconds); + fr = (int) (seconds / ((double) view->frame_length / (double) 1000)); + if (fr < view->total_frames) { + + if (fr == view->active_frame) + return 0; + else { + view->active_frame = fr; + return 1; + } + } else { + g_timer_stop(view->timer); + view->Topview->fisheyeParams.animate = 0; + return 0; + } + +} + void drawtopologicalfisheye(topview * t) { get_active_frame(t); @@ -602,6 +646,12 @@ void drawtopologicalfisheye(topview * t) } +static void get_interpolated_coords(double x0, double y0, double x1, double y1, + int fr, int total_fr, double *x, double *y) +{ + *x = x0 + (x1 - x0) / (double) total_fr *(double) (fr + 1); + *y = y0 + (y1 - y0) / (double) total_fr *(double) (fr + 1); +} int get_temp_coords(topview * t, int level, int v, double *coord_x, double *coord_y) @@ -677,6 +727,7 @@ int get_temp_coords(topview * t, int level, int v, double *coord_x, * positionAllItems(hierarchy, fs, parms) */ +#if 0 void infotopfisheye(topview * t, float *x, float *y, float *z) { @@ -690,7 +741,7 @@ void infotopfisheye(topview * t, float *x, float *y, float *z) /* hp->geom_graphs[0][closest_fine_node].x_coord; hp->geom_graphs[0][closest_fine_node].y_coord;*/ } - +#endif @@ -770,51 +821,7 @@ void changetopfishfocus(topview * t, float *x, float *y, } } -void refresh_old_values(topview * t) -{ - int level, v; - Hierarchy *hp = t->fisheyeParams.h; - for (level = 0; level < hp->nlevels; level++) { - for (v = 0; v < hp->nvtxs[level]; v++) { - ex_vtx_data *gg = hp->geom_graphs[level]; - /* v_data *g = hp->graphs[level]; */ - /* double x0,y0; */ - gg[v].old_physical_x_coord = gg[v].physical_x_coord; - gg[v].old_physical_y_coord = gg[v].physical_y_coord; - gg[v].old_active_level = gg[v].active_level; - } - } - -} -void get_interpolated_coords(double x0, double y0, double x1, double y1, - int fr, int total_fr, double *x, double *y) -{ - *x = x0 + (x1 - x0) / (double) total_fr *(double) (fr + 1); - *y = y0 + (y1 - y0) / (double) total_fr *(double) (fr + 1); -} - -int get_active_frame(topview * t) -{ - gulong microseconds; - gdouble seconds; - int fr; - seconds = g_timer_elapsed(view->timer, µseconds); - fr = (int) (seconds / ((double) view->frame_length / (double) 1000)); - if (fr < view->total_frames) { - - if (fr == view->active_frame) - return 0; - else { - view->active_frame = fr; - return 1; - } - } else { - g_timer_stop(view->timer); - view->Topview->fisheyeParams.animate = 0; - return 0; - } -} #ifdef UNUSED diff --git a/cmd/smyrna/topfisheyeview.h b/cmd/smyrna/topfisheyeview.h index 51d4e762c..b0f233669 100644 --- a/cmd/smyrna/topfisheyeview.h +++ b/cmd/smyrna/topfisheyeview.h @@ -27,14 +27,16 @@ extern "C" { void fisheye_spherical(double x_focus, double y_focus, double z_focus, topview * t); void drawtopologicalfisheye(topview * t); - void drawtopologicalfisheye2(topview * t); void changetopfishfocus(topview * t, float *x, float *y, float *z, int num_foci); - void refresh_old_values(topview * t); +#if 0 + void drawtopologicalfisheye2(topview * t); + int get_active_frame(topview * t); void get_interpolated_coords(double x0, double y0, double x1, double y1, int fr, int total_fr, double *x, double *y); - int get_active_frame(topview * t); + void refresh_old_values(topview * t); +#endif void prepare_topological_fisheye(Agraph_t* g,topview * t); #ifdef __cplusplus diff --git a/cmd/smyrna/topviewfuncs.c b/cmd/smyrna/topviewfuncs.c index c8d6b4940..86df003e8 100644 --- a/cmd/smyrna/topviewfuncs.c +++ b/cmd/smyrna/topviewfuncs.c @@ -160,7 +160,7 @@ static void glCompColorxlate(glCompColor* c,char* str) /* If the "visible" attribute is not set or "", return true * else evaluate as boolean */ -int visible(Agsym_t* attr, void* obj) +static int visible(Agsym_t* attr, void* obj) { char* s; @@ -171,7 +171,7 @@ int visible(Agsym_t* attr, void* obj) } else return 1; } -int object_color(void* obj,glCompColor* c) +static int object_color(void* obj,glCompColor* c) { gvcolor_t cl; Agraph_t* g=view->g[view->activeGraph]; @@ -265,7 +265,7 @@ static void draw_edge(glCompPoint* posT,glCompPoint* posH, GLfloat length,int de } } -void renderSelectedNodes(Agraph_t * g) +static void renderSelectedNodes(Agraph_t * g) { Agnode_t *v; Agsym_t* data_attr = GN_labelattribute(g); @@ -324,7 +324,7 @@ void renderSelectedNodes(Agraph_t * g) -void renderNodes(Agraph_t * g) +static void renderNodes(Agraph_t * g) { Agnode_t *v; glCompPoint pos; @@ -399,7 +399,7 @@ void renderNodes(Agraph_t * g) } -void renderSelectedEdges(Agraph_t * g) +static void renderSelectedEdges(Agraph_t * g) { Agedge_t *e; @@ -453,7 +453,7 @@ void renderSelectedEdges(Agraph_t * g) -void renderEdges(Agraph_t * g) +static void renderEdges(Agraph_t * g) { Agedge_t *e; Agnode_t *v; @@ -510,7 +510,7 @@ void renderEdges(Agraph_t * g) glEnd(); } -void renderNodeLabels(Agraph_t * g) +static void renderNodeLabels(Agraph_t * g) { Agnode_t *v; glCompPoint pos; @@ -538,7 +538,7 @@ void renderNodeLabels(Agraph_t * g) } } -void renderEdgeLabels(Agraph_t * g) +static void renderEdgeLabels(Agraph_t * g) { Agedge_t *e; Agnode_t *v; @@ -578,8 +578,7 @@ void renderEdgeLabels(Agraph_t * g) - -void cacheNodes(Agraph_t * g,topview* t) +static void cacheNodes(Agraph_t * g,topview* t) { if(t->cache.node_id!=-1) /*clean existing cache*/ glDeleteLists(t->cache.node_id,1); @@ -592,7 +591,7 @@ void cacheNodes(Agraph_t * g,topview* t) } -void cacheEdges(Agraph_t * g,topview* t) +static void cacheEdges(Agraph_t * g,topview* t) { if(t->cache.edge_id!=-1) /*clean existing cache*/ glDeleteLists(t->cache.edge_id,1); @@ -623,7 +622,7 @@ void cacheSelectedNodes(Agraph_t * g,topview* t) renderSelectedNodes(g); glEndList(); } -void cacheNodeLabels(Agraph_t * g,topview* t) +static void cacheNodeLabels(Agraph_t * g,topview* t) { if(t->cache.nodelabel_id!=-1) /*clean existing cache*/ glDeleteLists(t->cache.nodelabel_id,1); @@ -632,7 +631,7 @@ void cacheNodeLabels(Agraph_t * g,topview* t) renderNodeLabels(g); glEndList(); } -void cacheEdgeLabels(Agraph_t * g,topview* t) +static void cacheEdgeLabels(Agraph_t * g,topview* t) { if(t->cache.edgelabel_id!=-1) /*clean existing cache*/ glDeleteLists(t->cache.edgelabel_id,1); diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 68274e5d2..fa709ed21 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -38,13 +38,15 @@ #include "topviewfuncs.h" - /* Forward declarations */ #ifdef UNUSED static int init_object_custom_data(Agraph_t * graph, void *obj); static void refresh_borders(Agraph_t * g); #endif +static colorschemaset *create_color_theme(int themeid); +static md5_byte_t *get_md5_key(Agraph_t * graph); + #define countof( array ) ( sizeof( array )/sizeof( array[0] ) ) ViewInfo *view; @@ -76,7 +78,7 @@ static Dtdisc_t qDisc = { #endif -void clear_viewport(ViewInfo * view) +static void clear_viewport(ViewInfo * view) { /*free topview if there is one */ if (view->activeGraph >= 0) @@ -114,7 +116,7 @@ static void *get_glut_font(int ind) } } -void fill_key(md5_byte_t * b, md5_byte_t * data) +static void fill_key(md5_byte_t * b, md5_byte_t * data) { int ind = 0; for (ind = 0; ind < 16; ind++) { @@ -705,20 +707,20 @@ int add_new_graph_to_viewport(void) static md5_byte_t md5_digest[16]; static md5_state_t pms; -int append_to_md5(void *chan, const char *str) +static int append_to_md5(void *chan, const char *str) { md5_append(&pms, (unsigned char *) str, (int) strlen(str)); return 1; } -int flush_md5(void *chan) +static int flush_md5(void *chan) { md5_finish(&pms, md5_digest); return 1; } -md5_byte_t *get_md5_key(Agraph_t * graph) +static md5_byte_t *get_md5_key(Agraph_t * graph) { Agiodisc_t *xio; Agiodisc_t a; @@ -820,13 +822,10 @@ int save_as_graph(void) } -/* init_object_custom_data: - * creates a custom_object_data - */ - +#ifdef UNUSED /* move_node: */ -void movenode(void *obj, float dx, float dy) +static void movenode(void *obj, float dx, float dy) { char buf[512]; double x, y; @@ -839,7 +838,6 @@ void movenode(void *obj, float dx, float dy) } } -#ifdef UNUSED static char *move_xdot(void *obj, xdot * x, int dx, int dy, int dz) { int i = 0; @@ -1008,6 +1006,7 @@ void glexpose(void) expose_event(view->drawing_area, NULL, NULL); } +#if 0 /*following code does not do what i like it to do*/ /*I liked to have a please wait window on the screen all i got was the outer borders of the window GTK requires a custom widget expose function @@ -1024,6 +1023,7 @@ void please_dont_wait(void) { gtk_widget_hide(glade_xml_get_widget(xml, "frmWait")); } +#endif float interpol(float minv, float maxv, float minc, float maxc, float x) { @@ -1093,15 +1093,13 @@ typedef struct{ colorschema* s; }colorschemaset; */ -void clear_color_theme(colorschemaset * cs) +static void clear_color_theme(colorschemaset * cs) { free(cs->s); free(cs); } - - -colorschemaset *create_color_theme(int themeid) +static colorschemaset *create_color_theme(int themeid) { char **colors; colorschemaset *s = malloc(sizeof(colorschemaset)); @@ -1154,24 +1152,3 @@ colorschemaset *create_color_theme(int themeid) return s; } - -void test_color_pallete(void) -{ - int ind = 0; - float xGAP = 5; - float yGAP = 80; - float x = 50; - float y = 50; - glCompColor c; - for (ind = 0; ind < 350; ind++) { - getcolorfromschema(view->colschms, ind, 350, &c); - x = ind * xGAP; - glBegin(GL_POLYGON); - glColor3f(c.R, c.G, c.B); - glVertex3f(x, y, 0.0); - glVertex3f(x + xGAP, y, 0.0); - glVertex3f(x + xGAP, y + yGAP, 0.0); - glVertex3f(x, y + yGAP, 0.0); - glEnd(); - } -} diff --git a/cmd/smyrna/viewport.h b/cmd/smyrna/viewport.h index 4984992d6..262787546 100755 --- a/cmd/smyrna/viewport.h +++ b/cmd/smyrna/viewport.h @@ -29,7 +29,15 @@ extern "C" { void init_viewport(ViewInfo * view); void set_viewport_settings_from_template(ViewInfo * view, Agraph_t *); +#if 0 void clear_viewport(ViewInfo * view); + colorschemaset *create_color_theme(int themeid); + md5_byte_t *get_md5_key(Agraph_t * graph); + void fill_key(md5_byte_t * b, md5_byte_t * data); + void movenode(void *n, float dx, float dy); + void please_dont_wait(void); + void please_wait(void); +#endif void switch_graph(int); void refreshViewport(int doClear); int add_graph_to_viewport_from_file(char *fileName); @@ -41,14 +49,8 @@ extern "C" { int do_graph_layout(Agraph_t * graph, int Engine, int keeppos); - void movenode(void *n, float dx, float dy); void glexpose(void); void move_nodes(Agraph_t * g); - void please_wait(void); - void please_dont_wait(void); - extern md5_byte_t *get_md5_key(Agraph_t * graph); - void fill_key(md5_byte_t * b, md5_byte_t * data); - colorschemaset *create_color_theme(int themeid); extern void getcolorfromschema(colorschemaset * sc, float l, float maxl, glCompColor * c); diff --git a/cmd/smyrna/viewportcamera.c b/cmd/smyrna/viewportcamera.c index 2e4a94c2e..0bf91bb4f 100644 --- a/cmd/smyrna/viewportcamera.c +++ b/cmd/smyrna/viewportcamera.c @@ -36,7 +36,7 @@ static void viewport_update_camera_indexes(ViewInfo * view) } } -viewport_camera *add_camera_to_viewport(ViewInfo * view) +static viewport_camera *add_camera_to_viewport(ViewInfo * view) { view->camera_count++; view->cameras = @@ -47,7 +47,8 @@ viewport_camera *add_camera_to_viewport(ViewInfo * view) return view->cameras[view->camera_count - 1]; } -void set_camera_x_y(viewport_camera * c) +#if 0 +static void set_camera_x_y(viewport_camera * c) { /* c->x = c->r * cos((float) DEG2RAD * c->anglexy) * sin((float) DEG2RAD * @@ -58,7 +59,6 @@ void set_camera_x_y(viewport_camera * c) view->pany; c->z = c->r * cos(DEG2RAD * c->anglexyz);*/ } - int delete_camera_from_viewport(ViewInfo * view, viewport_camera * c) { int ind; @@ -80,6 +80,8 @@ int delete_camera_from_viewport(ViewInfo * view, viewport_camera * c) } return 0; } +#endif +#if 0 int activate_viewport_camera(ViewInfo * view, int cam_index) { if (cam_index < view->camera_count) { @@ -88,7 +90,6 @@ int activate_viewport_camera(ViewInfo * view, int cam_index) } else return 0; } - int refresh_viewport_camera(ViewInfo * view) { if (view->active_camera >= 0) { @@ -101,6 +102,7 @@ int refresh_viewport_camera(ViewInfo * view) } else return 0; } +#endif void menu_click_add_camera(void *p) { @@ -128,25 +130,84 @@ void menu_click_add_camera(void *p) // attach_camera_widget(view); } -int blocksignal = 0; -void menu_click_2d(void *p) +#ifdef UNUSED +static int blocksignal = 0; +static void menu_click_2d(void *p) { view->active_camera = -1; } -void menu_click_camera_select(void *p) +static void menu_click_camera_select(void *p) { view->active_camera = ((glCompButton *) p)->data; } +static int show_camera_settings(viewport_camera * c) +{ + + char buf[50]; + sprintf(buf, "Camera:%i", c->index); + gtk_label_set_text((GtkLabel *) + glade_xml_get_widget(xml, "dlgcameralabel1"), buf); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton1"), + c->x); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton2"), + c->y); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton3"), + c->z); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton4"), + c->targetx); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton5"), + c->targety); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton6"), + c->targetz); + + + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton7"), + c->camera_vectorx * 360.0); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton8"), + c->camera_vectory * 360.0); + gtk_spin_button_set_value((GtkSpinButton *) + glade_xml_get_widget(xml, + "dlgcameraspinbutton9"), + c->camera_vectorz * 360.0); + + + + + + gtk_widget_hide(glade_xml_get_widget(xml, "dlgCamera")); + gtk_widget_show(glade_xml_get_widget(xml, "dlgCamera")); + gtk_window_set_keep_above((GtkWindow *) + glade_xml_get_widget(xml, "dlgCamera"), 1); + view->selected_camera = c; + return 1; + + +} -void menu_click_camera_edit(void *p) +static void menu_click_camera_edit(void *p) { show_camera_settings(view->cameras[(int) ((glCompButton *) p)->data] ); } -#ifdef UNUSED void attach_camera_widget(ViewInfo * view) { @@ -262,66 +323,7 @@ void attach_camera_widget(ViewInfo * view) } } #endif -int show_camera_settings(viewport_camera * c) -{ - - char buf[50]; - sprintf(buf, "Camera:%i", c->index); - gtk_label_set_text((GtkLabel *) - glade_xml_get_widget(xml, "dlgcameralabel1"), buf); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton1"), - c->x); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton2"), - c->y); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton3"), - c->z); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton4"), - c->targetx); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton5"), - c->targety); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton6"), - c->targetz); - - - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton7"), - c->camera_vectorx * 360.0); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton8"), - c->camera_vectory * 360.0); - gtk_spin_button_set_value((GtkSpinButton *) - glade_xml_get_widget(xml, - "dlgcameraspinbutton9"), - c->camera_vectorz * 360.0); - - - - - - gtk_widget_hide(glade_xml_get_widget(xml, "dlgCamera")); - gtk_widget_show(glade_xml_get_widget(xml, "dlgCamera")); - gtk_window_set_keep_above((GtkWindow *) - glade_xml_get_widget(xml, "dlgCamera"), 1); - view->selected_camera = c; - return 1; - - -} - +#if 0 int save_camera_settings(viewport_camera * c) { c->x = (float) gtk_spin_button_get_value((GtkSpinButton *) @@ -377,3 +379,4 @@ void dlgcameracancelbutton_clicked_cb (GtkWidget * widget, gpointer user_data) { gtk_widget_hide(glade_xml_get_widget(xml, "dlgCamera")); } +#endif diff --git a/cmd/smyrna/viewportcamera.h b/cmd/smyrna/viewportcamera.h index 1b665411c..995c67b22 100644 --- a/cmd/smyrna/viewportcamera.h +++ b/cmd/smyrna/viewportcamera.h @@ -23,18 +23,20 @@ extern "C" { #endif - viewport_camera *add_camera_to_viewport(ViewInfo * view); +#if 0 void set_camera_x_y(viewport_camera * c); int delete_camera_from_viewport(ViewInfo * view, viewport_camera * c); + viewport_camera *add_camera_to_viewport(ViewInfo * view); int activate_viewport_camera(ViewInfo * view, int cam_index); - int refresh_viewport_camera(ViewInfo * view); - void attach_camera_widget(ViewInfo * view); - int show_camera_settings(viewport_camera * c); - int save_camera_settings(viewport_camera * c); - _BB void dlgcameraokbutton_clicked_cb(GtkWidget * widget, - gpointer user_data); _BB void dlgcameracancelbutton_clicked_cb(GtkWidget * widget, gpointer user_data); + _BB void dlgcameraokbutton_clicked_cb(GtkWidget * widget, + gpointer user_data); + int refresh_viewport_camera(ViewInfo * view); + int save_camera_settings(viewport_camera * c); + int show_camera_settings(viewport_camera * c); +#endif + extern void attach_camera_widget(ViewInfo * view); extern void menu_click_add_camera(void *p); #ifdef __cplusplus