From e9555c20204d03978ac0bc4f1990b5dd6d5b0e55 Mon Sep 17 00:00:00 2001 From: arif Date: Thu, 3 Dec 2009 19:16:04 +0000 Subject: [PATCH] smyrna bug fixes warning fixes --- cmd/smyrna/arcball.c | 1 + cmd/smyrna/btree.c | 3 +- cmd/smyrna/draw.c | 12 ++-- cmd/smyrna/glexpose.c | 2 +- cmd/smyrna/gltemplate.c | 4 +- cmd/smyrna/gui/beacon.c | 4 +- cmd/smyrna/gui/frmobjectui.c | 2 + cmd/smyrna/gui/glcompui.c | 10 ++- cmd/smyrna/gui/topviewsettings.c | 5 ++ cmd/smyrna/gui/topviewsettings.h | 2 +- cmd/smyrna/gvprpipe.c | 5 +- cmd/smyrna/main.c | 3 + cmd/smyrna/selection.c | 57 +++++++++++++++++ cmd/smyrna/smyrna.vcproj | 2 +- cmd/smyrna/smyrnadefs.h | 1 + cmd/smyrna/topview.c | 83 ++++++++++++++++++------- cmd/smyrna/tvnodes.c | 1 - cmd/smyrna/viewport.c | 5 +- lib/glcomp/glcompdefs.h | 4 +- lib/glcomp/glcompfont.c | 6 +- lib/glcomp/glcomplabel.c | 51 ++++++++++++---- lib/glcomp/glcomplabel.h | 4 ++ lib/glcomp/glcomptexture.c | 9 +-- lib/glcomp/glutils.c | 25 ++++++++ lib/glcomp/glutils.h | 1 + share/gui/smyrna.glade | 101 ++++++++++++++++--------------- 26 files changed, 293 insertions(+), 110 deletions(-) diff --git a/cmd/smyrna/arcball.c b/cmd/smyrna/arcball.c index 891de959c..43f46808e 100644 --- a/cmd/smyrna/arcball.c +++ b/cmd/smyrna/arcball.c @@ -161,6 +161,7 @@ void arcmouseClick(ViewInfo * v) view->arcball->isDragging = 1; // Prepare For Dragging view->arcball->LastRot = view->arcball->ThisRot; // Set Last Static Rotation To Last Dynamic One click(view->arcball, &view->arcball->MousePt); +// printf ("arcmouse click \n"); } diff --git a/cmd/smyrna/btree.c b/cmd/smyrna/btree.c index eb2cee88b..4bb597847 100644 --- a/cmd/smyrna/btree.c +++ b/cmd/smyrna/btree.c @@ -126,7 +126,8 @@ int print_children(btree_node * n) else printf("%*s %c(%i)\n", n->rank * 5 + 1, "", n->op, n->rank); prev_rank = n->rank; - for (i = 0; i < n->child_count; i++) { + for (i = 0; i < n->child_count; i++) + { print_children(n->childs[i]); } return 1; diff --git a/cmd/smyrna/draw.c b/cmd/smyrna/draw.c index 29f8f230e..5fb6fa2ee 100755 --- a/cmd/smyrna/draw.c +++ b/cmd/smyrna/draw.c @@ -245,7 +245,7 @@ void DrawBeziers(sdot_op* o, int param) } -//Draws a ellpise made out of points. +//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) { @@ -592,11 +592,11 @@ void drawBorders(ViewInfo * view) view->borderColor.G, view->borderColor.A); glLineWidth(2); glBegin(GL_LINE_STRIP); - glVertex3d(view->bdxLeft, view->bdyBottom,0); - glVertex3d(view->bdxRight, view->bdyBottom,0); - glVertex3d(view->bdxRight, view->bdyTop,0); - glVertex3d(view->bdxLeft, view->bdyTop,0); - glVertex3d(view->bdxLeft, view->bdyBottom,0); + glVertex3d(view->bdxLeft, view->bdyBottom,-0.001); + glVertex3d(view->bdxRight, view->bdyBottom,-0.001); + glVertex3d(view->bdxRight, view->bdyTop,-0.001); + glVertex3d(view->bdxLeft, view->bdyTop,-0.001); + glVertex3d(view->bdxLeft, view->bdyBottom,-0.001); glEnd(); glLineWidth(1); } diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index 55be9fde3..26ee1916f 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -175,8 +175,8 @@ int glexpose_main(ViewInfo * view) glexpose_grid(view); draw_fisheye_magnifier(view); draw_magnifier(view); - glexpose_drawgraph(view); drawBorders(view); + glexpose_drawgraph(view); // drawRotatingTools(); // draw_cube(); drawRotatingAxis(); diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index 8757fd71d..5d01213b1 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -172,7 +172,6 @@ static void realize(GtkWidget * widget, gpointer data) // glEnable (GL_LIGHT0); // glEnable (GL_AUTO_NORMAL); // glEnable (GL_NORMALIZE); - glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthFunc(GL_LESS); @@ -276,6 +275,8 @@ gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, static gboolean button_press_event(GtkWidget * widget, GdkEventButton * event, gpointer data) { + Agraph_t* g=view->g[view->activeGraph]; + begin_x = (float) event->x; begin_y = (float) event->y; view->widgets->common.functions.mousedown((glCompObj*)view->widgets,(GLfloat) event->x,(GLfloat) event->y,getGlCompMouseType(event->button)); @@ -288,6 +289,7 @@ static gboolean button_press_event(GtkWidget * widget, appmouse_middle_click_down(view,(int) event->x,(int) event->y); expose_event(view->drawing_area, NULL, NULL); + return FALSE; } diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index d73da6810..69a2db40c 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -94,8 +94,8 @@ void pick_node_from_coords(float x, float y, float z) for (ind = 0;( (selnodes)&&(ind < view->Topview->Nodecount)); ind++) { n = &view->Topview->Nodes[ind]; - if (!select_node) - break; +/* if (!select_node(n)) + break;*/ a = ABS(n->distorted_x - view->mouse.GLpos.x); diff --git a/cmd/smyrna/gui/frmobjectui.c b/cmd/smyrna/gui/frmobjectui.c index 5cc1c2fdf..7daacd734 100644 --- a/cmd/smyrna/gui/frmobjectui.c +++ b/cmd/smyrna/gui/frmobjectui.c @@ -28,6 +28,8 @@ #include "frmobjectui.h" #include #include "sfstr.h" +#include "gvprpipe.h" + #ifdef WIN32 diff --git a/cmd/smyrna/gui/glcompui.c b/cmd/smyrna/gui/glcompui.c index e5b84da0f..6dfda0a10 100644 --- a/cmd/smyrna/gui/glcompui.c +++ b/cmd/smyrna/gui/glcompui.c @@ -195,10 +195,11 @@ glCompSet *glcreate_gl_topview_menu(void) glCompButton *b = NULL; /* glCompLabel *l=NULL; */ glCompImage *i = NULL; + glCompLabel* l; glCompColor c; s->common.callbacks.click = CBglCompMouseRightClick; - p = glCompPanelNew((glCompObj *) s, 25, 25, 51, 47); + p = glCompPanelNew((glCompObj *) s, 25, 25, 45, 47); p->common.align = glAlignLeft; p->common.data = 0; @@ -240,7 +241,7 @@ glCompSet *glcreate_gl_topview_menu(void) - p = glCompPanelNew((glCompObj *) p, 1, 325, 80, 180); + p = glCompPanelNew((glCompObj *) p, 1, 325, 45, 180); p->common.align = glAlignTop; p->common.data = 0; p->common.borderWidth = 1; @@ -330,7 +331,12 @@ glCompSet *glcreate_gl_topview_menu(void) glCompImageLoadPng(i, smyrnaPath("mod_3D.png")); img3D = i; i->common.visible = 0; + l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName); + glCompLabelSetFontSize(l,24); return s; + + + } int getIconsDirectory(char *bf) diff --git a/cmd/smyrna/gui/topviewsettings.c b/cmd/smyrna/gui/topviewsettings.c index b4efef8d8..c28799f52 100644 --- a/cmd/smyrna/gui/topviewsettings.c +++ b/cmd/smyrna/gui/topviewsettings.c @@ -45,6 +45,11 @@ void on_settingsApplyBtn_clicked(GtkWidget * widget, gpointer user_data) /* settvcolorinfo(view->g[view->activeGraph],view->Topview); init_node_size(view->g[view->activeGraph])*/ } +void on_dlgSettings_close (GtkWidget * widget, gpointer user_data) +{ + printf ("setting window is being closed\n"); +} + void on_settingsCancelBtn_clicked(GtkWidget * widget, gpointer user_data) diff --git a/cmd/smyrna/gui/topviewsettings.h b/cmd/smyrna/gui/topviewsettings.h index bc4abcd9b..14cac2a31 100644 --- a/cmd/smyrna/gui/topviewsettings.h +++ b/cmd/smyrna/gui/topviewsettings.h @@ -30,7 +30,7 @@ extern "C" { gpointer user_data); _BB void color_change_request(GtkWidget * widget, gpointer user_data); _BB void size_change_request(GtkWidget * widget, gpointer user_data); - + _BB void on_dlgSettings_close (GtkWidget * widget, gpointer user_data); extern int load_settings_from_graph(Agraph_t * g); extern int update_graph_from_settings(Agraph_t * g); extern int show_settings_form(void); diff --git a/cmd/smyrna/gvprpipe.c b/cmd/smyrna/gvprpipe.c index a79e5735a..c55ef0e75 100644 --- a/cmd/smyrna/gvprpipe.c +++ b/cmd/smyrna/gvprpipe.c @@ -24,7 +24,8 @@ #include #include "draw.h" #include "gui.h" - +#include "topviewsettings.h" +#include "topview.h" #include //#include @@ -52,7 +53,7 @@ extern GladeXML *xml; //global libglade vars gvprscript* scr_from_string(char* str,void* obj) { - + return NULL; } diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 9b0d949be..baa19a40b 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -213,6 +213,9 @@ int main(int argc, char *argv[]) gladewidget = glade_xml_get_widget(xml, "hbox11"); gtk_widget_hide(glade_xml_get_widget(xml, "vbox13")); + gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "dlgSettings"),0); + gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "dlgTVFilter"),0); + gtk_window_set_deletable ((GtkWindow*)glade_xml_get_widget(xml, "frmTVNodes"),0); create_window(glconfig, gladewidget); diff --git a/cmd/smyrna/selection.c b/cmd/smyrna/selection.c index a3da38d80..99c03c33b 100755 --- a/cmd/smyrna/selection.c +++ b/cmd/smyrna/selection.c @@ -680,6 +680,63 @@ void rectangle_select(ViewInfo* v) if(seledges) edge_rectangle_select(v); } +int linesegmentsintersects(float X1, float X2, float Y1, float Y2) +{ + //line segment + //X1,Y1 point 1 + //X2,Y3 point 2 + //rectangle + //RX,RY lower left corner of rectangle + //RW width of rectangle + //RH height of ractangle + //returns 1 if line segment is completely in the rect + //0 if they intersect + //-1 if completely out + float x, y, m, iter; + float RX, RY, RW, RH; + int intersects, in; + RX = view->Selection.X; + RY = view->Selection.Y; + RH=view->Selection.H; + RW=view->Selection.W; + if ((is_point_in_rectangle(X1, Y1, RX, RY, RW, RH)) + && (is_point_in_rectangle(X2, Y2, RX, RY, RW, RH))) + return 1; + if ((is_point_in_rectangle(X1, Y1, RX, RY, RW, RH)) + || (is_point_in_rectangle(X2, Y2, RX, RY, RW, RH))) + return 0; + //to be absolute or not to be one + if (X1 > X2) { + x = X2; + y = Y2; + X2 = X1; + Y2 = Y1; + X1 = x; + Y1 = y; + } + x = X1; + //iter + iter = RW / (float) SELECTION_SEGMENT_DIVIDER; + m = (Y2 - Y1) / (X2 - X1); + + in = 1; + intersects = 0; + while (x <= X2) { + x = x + iter; + y = Y1 + m * (x - X1); + if (!is_point_in_rectangle(x, y, RX, RY, RW, RH)) + in = 0; + else + intersects = 1; + + } + if (in == 1) + return 1; + if (intersects == 1) + return 0; + return -1; +} + diff --git a/cmd/smyrna/smyrna.vcproj b/cmd/smyrna/smyrna.vcproj index c5b18683a..c4c019507 100644 --- a/cmd/smyrna/smyrna.vcproj +++ b/cmd/smyrna/smyrna.vcproj @@ -365,7 +365,7 @@ > diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index 3cd4bdc35..a790263f3 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -658,6 +658,7 @@ typedef struct mouse_action_t* mouse_actions; /*customizable moouse interraction list*/ int mouse_action_count; refresh_filter refresh; + int edgerendertype; } ViewInfo; /*rotation steps*/ diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 5609c6d7f..714b17a9e 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -385,12 +385,6 @@ static void reset_refresh(ViewInfo* v) } void update_topview(Agraph_t * g, topview * t, int init) { - char *info_file; - char *str; - char buf[512]; - /* int BUFSIZE = 512; */ - unsigned char xbuffer[BUFSIZ]; - FILE *f; if (init) preparetopview(g, t); @@ -731,6 +725,56 @@ static int drawtopviewnodes(Agraph_t * g) endtopviewnodes(g); return 1; +} +static int edgevisible(topview_edge* e) +{ + static float x1,y1,x2,y2; + static glCompPoint a; + static glCompPoint b; + static glCompPoint c; + static glCompPoint d; + + x1=e->x1/ view->zoom * -1; + x2=e->y1/ view->zoom * -1; + y1=e->y1/ view->zoom * -1; + y2=e->y2/ view->zoom * -1; + + if ( + ((x1> view->clipX1) && (x1 < view->clipX2) && (y1 > view->clipY1) && (y1 < view->clipY2)) + || + ((x2 > view->clipX1)&& (x2< view->clipX2)&& (y2 > view->clipY1) && (y2 < view->clipY2)) + || + (view->active_camera >= 0) + + ) + return 1; + if(view->edgerendertype == 0) + { + a.x=x1;a.y=y1;a.z=0; + b.x=x2;b.y=y2;b.z=0; + c.x=view->clipX1;c.y=view->clipY1;c.z=0; + c.x=view->clipX1;c.y=view->clipY2;c.z=0; + if(lines_intersect (&a, &b, &c,&d)) + return 1; + c.x=view->clipX2;c.y=view->clipY1;c.z=0; + c.x=view->clipX2;c.y=view->clipY2;c.z=0; + if(lines_intersect (&a, &b, &c,&d)) + return 1; + c.x=view->clipX1;c.y=view->clipY1;c.z=0; + c.x=view->clipX2;c.y=view->clipY1;c.z=0; + if(lines_intersect (&a, &b, &c,&d)) + return 1; + c.x=view->clipX1;c.y=view->clipY2;c.z=0; + c.x=view->clipX2;c.y=view->clipY2;c.z=0; + if(lines_intersect (&a, &b, &c,&d)) + return 1; + return 0; + + } + return 0; + + + } static void drawtopviewedges(Agraph_t * g) @@ -743,21 +787,13 @@ static void drawtopviewedges(Agraph_t * g) return; glBegin(GL_LINES); set_topview_options(); - for (ind = 0; ind < view->Topview->Edgecount; ind++) { + for (ind = 0; ind < view->Topview->Edgecount; ind++) + { e = view->Topview->Edges + ind; - if (((e->x1 / view->zoom * -1 > view->clipX1) - && (e->x1 / view->zoom * -1 < view->clipX2) - && (e->y1 / view->zoom * -1 > view->clipY1) - && (e->y1 / view->zoom * -1 < view->clipY2)) - || ((e->x2 / view->zoom * -1 > view->clipX1) - && (e->x2 / view->zoom * -1 < view->clipX2) - && (e->y2 / view->zoom * -1 > view->clipY1) - && (e->y2 / view->zoom * -1 < view->clipY2)) - || (view->active_camera >= 0)) { - + if(edgevisible(e)) + { if (!get_color_from_edge(e)) continue; - //select_topview_edge(e); if (e->Node1->data.Selected == 1) { //tail is selected ddx = dx; @@ -868,9 +904,11 @@ static int drawtopviewedgelabels(Agraph_t * g) void drawTopViewGraph(Agraph_t * g) { - glEnable (GL_BLEND); +/* glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_DEPTH_TEST); + glDisable(GL_DEPTH_TEST);*/ + +// glDisable(GL_DEPTH_TEST); drawtopviewnodes(g); drawtopviewlabels(g); drawtopviewedges(g); @@ -878,6 +916,9 @@ void drawTopViewGraph(Agraph_t * g) enddrawcycle(g); draw_tv_xdot(view->Topview); draw_node_hint_boxes(); +// glEnable(GL_DEPTH_TEST); + + if ((view->Selection.Active > 0) && (!view->SignalBlock)) { view->Selection.Active = 0; drawTopViewGraph(g); @@ -885,6 +926,7 @@ void drawTopViewGraph(Agraph_t * g) glexpose(); view->SignalBlock = 0; } + } @@ -1081,7 +1123,6 @@ static void set_boundaries(topview * t) static int get_color_from_edge(topview_edge * e) { - GdkColor color; int return_value = 1; float Alpha = 0; GtkHScale *AlphaScale = diff --git a/cmd/smyrna/tvnodes.c b/cmd/smyrna/tvnodes.c index ba5ab525e..2e9ec4f1a 100755 --- a/cmd/smyrna/tvnodes.c +++ b/cmd/smyrna/tvnodes.c @@ -132,7 +132,6 @@ int validate_node(tv_node * TV_Node) static btree_node *n = 0; char *data_attr1; char *data_attr2; - char *buf; // n=tree_from_filter_string("([IP=\"^10.*\",min=\"0\",max=\"0\"])"); // get attributes from graph data_attr1 = agget(view->g[view->activeGraph], "DataAttribute1"); diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 344df235b..f8bd576da 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -316,6 +316,7 @@ void set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g) view->colschms = create_color_theme(atoi (get_attribute_value("colortheme", view, g))); + view->edgerendertype=atoi(get_attribute_value("edgerender", view, g)); if (view->graphCount > 0) @@ -351,7 +352,6 @@ void init_viewport(ViewInfo * view) FILE *input_file2 = NULL; static char* path; get_data_dir(); - input_file = fopen(view->template_file, "rb"); if (!input_file) { fprintf(stderr, @@ -370,7 +370,7 @@ void init_viewport(ViewInfo * view) } if (!path) path = smyrnaPath("attr_widgets.dot"); - printf ("%s\n", path); +// printf ("%s\n", path); input_file2 = fopen(path, "rb"); if (!input_file2) { fprintf(stderr, "default attributes template graph file \"%s\" not found\n",smyrnaPath("attr_widgets.dot")); @@ -509,6 +509,7 @@ void init_viewport(ViewInfo * view) view->refresh.selection=1; view->refresh.visibility=1; view->refresh.nodesize=1; + view->edgerendertype=0; /*add default camera */ //create fontset } diff --git a/lib/glcomp/glcompdefs.h b/lib/glcomp/glcompdefs.h index 86f6145b0..a4efdd2af 100644 --- a/lib/glcomp/glcompdefs.h +++ b/lib/glcomp/glcompdefs.h @@ -56,7 +56,7 @@ extern "C" { #define GLCOMPSET_BUTTON_COLOR_ALPHA (GLfloat)0.6 #define GLCOMPSET_BUTTON_THICKNESS (GLfloat)3 #define GLCOMPSET_BUTTON_BEVEL_BRIGHTNESS (GLfloat)1.7 -#define GLCOMPSET_FONT_SIZE (GLfloat)56 +#define GLCOMPSET_FONT_SIZE (GLfloat)14 #define GLCOMPSET_BUTTON_FONT_COLOR_R (GLfloat)0 #define GLCOMPSET_BUTTON_FONT_COLOR_G (GLfloat)0 @@ -203,6 +203,7 @@ extern "C" { float height; glCompTexType type; int userCount; + int fontSize; unsigned char *data; /*data */ } glCompTex; @@ -291,6 +292,7 @@ extern "C" { glCompCommon common; int autosize; /*if 1 label sized is calculated from font */ char *text; + int transparent; } glCompLabel; /*buttons*/ diff --git a/lib/glcomp/glcompfont.c b/lib/glcomp/glcompfont.c index 573515378..ef3c5f46f 100644 --- a/lib/glcomp/glcompfont.c +++ b/lib/glcomp/glcompfont.c @@ -205,13 +205,15 @@ glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,glCompFontType t font->color.A = c->A; font->justify.VJustify = GL_FONTVJUSTIFY; font->justify.HJustify = GL_FONTHJUSTIFY; + font->type=type; + font->is2D=is2D; if (font->type == gluttext) font->glutfont = DEFAULT_GLUT_FONT; else font->glutfont = (void *) 0; - font->fontdesc = fontdesc; + font->fontdesc = strdup(fontdesc); font->size = fs; font->transparent = 1; font->optimize = GL_FONTOPTIMIZE; @@ -240,7 +242,7 @@ glCompFont *new_font_from_parent(glCompObj * o, char *text) font->type = parent->font->type; font->glutfont = parent->font->glutfont; - font->fontdesc = parent->font->fontdesc; + font->fontdesc = strdup(parent->font->fontdesc); font->size = parent->font->size; font->transparent = parent->font->transparent; font->justify.VJustify = parent->font->justify.VJustify; diff --git a/lib/glcomp/glcomplabel.c b/lib/glcomp/glcomplabel.c index dcfb480b6..baa52f42b 100644 --- a/lib/glcomp/glcomplabel.c +++ b/lib/glcomp/glcomplabel.c @@ -28,10 +28,11 @@ glCompLabel *glCompLabelNew(glCompObj * par, GLfloat x, GLfloat y, p = NEW(glCompLabel); glCompInitCommon((glCompObj *) p, par, x, y); p->objType = glLabelObj; + p->transparent=1; //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType; p->text = strdup(text); - p->common.font = new_font_from_parent(par, text); + p->common.font = new_font_from_parent((glCompObj*)p, text); p->common.functions.draw = glCompLabelDraw; return p; @@ -44,23 +45,49 @@ int glCompLabelDraw(glCompLabel * p) 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(); + if(!p->transparent) + { + 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) +static void update_font(glCompLabel * p,char* text,char* desc,int fs) { - free(p->text); + + glCompFont* temp=p->common.font; + p->common.font=new_font(p->common.compset,text,&p->common.color,temp->type,desc,fs,temp->is2D); + if(temp) + delete_font(temp); + if(p->text) + free(p->text); p->text = strdup(text); - return 1; + + +} + +void glCompLabelSetText(glCompLabel * p, char *text) +{ + glCompFont* temp=p->common.font; + update_font(p,text,temp->fontdesc,temp->size); +} +void glCompLabelSetFontSize(glCompLabel * p, int size) +{ + glCompFont* temp=p->common.font; + update_font(p,p->text,temp->fontdesc,size); +} +void glCompLabelSetFontName(glCompLabel * p, char* fontName) +{ + glCompFont* temp=p->common.font; + update_font(p,p->text,fontName,temp->size); } diff --git a/lib/glcomp/glcomplabel.h b/lib/glcomp/glcomplabel.h index 836e7f643..afa2bfb28 100644 --- a/lib/glcomp/glcomplabel.h +++ b/lib/glcomp/glcomplabel.h @@ -42,6 +42,10 @@ extern "C" { extern void glCompLabelMouseUp(glCompObj * obj, GLfloat x, GLfloat y, glMouseButtonType t); + extern void glCompLabelSetText(glCompLabel * p, char *text); + extern void glCompLabelSetFontSize(glCompLabel * p, int size); + extern void glCompLabelSetFontName(glCompLabel * p, char* fontName); + #ifdef __cplusplus } #endif diff --git a/lib/glcomp/glcomptexture.c b/lib/glcomp/glcomptexture.c index a4a25cbb8..fc24a06a4 100644 --- a/lib/glcomp/glcomptexture.c +++ b/lib/glcomp/glcomptexture.c @@ -26,7 +26,7 @@ void glCompSetRemoveTexLabel(glCompSet * s, glCompFont * t) static glCompTex *glCompSetAddNewTexture(glCompSet * s, int width, int height, unsigned char *data, - int is2D) + int is2D,int fs) { int Er, offset, ind; glCompTex *t; @@ -94,7 +94,7 @@ glCompTex *glCompSetAddNewTexImage(glCompSet * s, int width, int height, glCompTex *t; if (!data) return NULL; - t = glCompSetAddNewTexture(s, width, height, data, is2D); + t = glCompSetAddNewTexture(s, width, height, data, is2D,-1); if (!t) return NULL; t->type = glTexImage; @@ -124,7 +124,8 @@ glCompTex *glCompSetAddNewTexLabel(glCompSet * s, char *def, int fs, 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)) { + && (strcmp(text, s->textures[ind]->text) == 0) + && (s->textures[ind]->fontSize==fs)) { s->textures[ind]->userCount++; return s->textures[ind]; } @@ -135,7 +136,7 @@ glCompTex *glCompSetAddNewTexLabel(glCompSet * s, char *def, int fs, data = create_pango_texture(def, fs, text, surface, &width, &height); if (!data) /*pango error , */ Er = 1; - t = glCompSetAddNewTexture(s, width, height, data, is2D); + t = glCompSetAddNewTexture(s, width, height, data, is2D,fs); if (!t) Er = 1; cairo_surface_destroy(surface); diff --git a/lib/glcomp/glutils.c b/lib/glcomp/glutils.c index 9e1e5faec..7c84bbe05 100644 --- a/lib/glcomp/glutils.c +++ b/lib/glcomp/glutils.c @@ -161,6 +161,7 @@ float GetOGLDistance(int l) void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z) { + int const WIDTH = 20; GLint viewport[4]; @@ -171,6 +172,7 @@ void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z) GLdouble posX, posY, posZ; int idx; static float comp; + glGetDoublev(GL_MODELVIEW_MATRIX, modelview); glGetDoublev(GL_PROJECTION_MATRIX, projection); glGetIntegerv(GL_VIEWPORT, viewport); @@ -681,6 +683,29 @@ void copy_glcomp_color(glCompColor * source, glCompColor * target) } +double area2(glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) +{ + double d; + + d = ((p1p->y - p2p->y) * (p3p->x - p2p->x)) - + ((p3p->y - p2p->y) * (p1p->x - p2p->x)); + return d; +} + + +enum {ISCCW, ISON, ISCW}; /* counterclockwise; collinear; clockwise */ +int sideOf (glCompPoint * p1p, glCompPoint * p2p, glCompPoint * p3p) { + double d = area2 (p1p,p2p,p3p); + if (d < 0) return ISCCW; + else if (d > 0) return ISCW; + else return ISON; +} + +int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint* d) +{ + return ((sideOf(a,b,c) != sideOf(a,b,d)) && (sideOf(c,d,a) != sideOf(c,d,b))); +} + diff --git a/lib/glcomp/glutils.h b/lib/glcomp/glutils.h index 7278ca11e..8c93d3603 100644 --- a/lib/glcomp/glutils.h +++ b/lib/glcomp/glutils.h @@ -63,6 +63,7 @@ extern "C" { extern void glCompSetColor(glCompColor * c); void glCompSelectionBox(glCompSet * s); + extern int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint* d); #ifdef __cplusplus } diff --git a/share/gui/smyrna.glade b/share/gui/smyrna.glade index a71eb2de5..98095751b 100755 --- a/share/gui/smyrna.glade +++ b/share/gui/smyrna.glade @@ -1638,6 +1638,7 @@ True False False + @@ -1716,7 +1717,7 @@ 443 408 True - 13 + 14 3 False 0 @@ -2350,6 +2351,54 @@ Rain Forest + + + + True + Show Edges + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 5 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 13 + 14 + fill + + + + + + + True + Always +When head or tail is within viewport + + False + True + True + + + 1 + 2 + 13 + 14 + fill + fill + + 10 @@ -2959,7 +3008,7 @@ GLUT_BITMAP_HELVETICA_18 - 397 + 423 308 True 7 @@ -3020,32 +3069,6 @@ GLUT_BITMAP_HELVETICA_18 - - - True - Node Size with Degree - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 5 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - - - True @@ -3200,28 +3223,6 @@ Custom - - - True - True - - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 2 - 3 - fill - - - - True -- 2.40.0