From: arif Date: Fri, 13 Nov 2009 21:05:54 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: LAST_LIBGRAPH~32^2~1567 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00976577c6e6c12ec5bbe93b32d7f3b8b1194602;p=graphviz *** empty log message *** --- diff --git a/cmd/smyrna/gui/datalistcallbacks.c b/cmd/smyrna/gui/datalistcallbacks.c index 18cbc48ba..5439c9b03 100755 --- a/cmd/smyrna/gui/datalistcallbacks.c +++ b/cmd/smyrna/gui/datalistcallbacks.c @@ -151,16 +151,6 @@ void btnTVUnselectAll_clicked_cb(GtkWidget * widget, gpointer user_data) tv_unselect_all(); } -void btnTVHighlightAll_clicked_cb(GtkWidget * widget, gpointer user_data) -{ - tv_highligh_all(); -} - -void btnTVUnhighlightAll_clicked_cb(GtkWidget * widget, gpointer user_data) -{ - tv_unhighligh_all(); -} - void btnTVShowAll_clicked_cb(GtkWidget * widget, gpointer user_data) { diff --git a/cmd/smyrna/gui/topviewsettings.c b/cmd/smyrna/gui/topviewsettings.c index 60390bef7..a981199a6 100644 --- a/cmd/smyrna/gui/topviewsettings.c +++ b/cmd/smyrna/gui/topviewsettings.c @@ -50,9 +50,10 @@ static int set_color_button_widget(char *attribute, char *widget_name) gvcolor_t cl; char *buf; + attribute=attribute +13; buf = agget(view->g[view->activeGraph], attribute); if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { colorxlate(buf, &cl, RGBA_DOUBLE); color.red = (int) (cl.u.RGBA[0] * 65535.0); @@ -72,6 +73,8 @@ static int get_color_button_widget_to_attribute(char *attribute, { GdkColor color; char *buf = N_GNEW(256, char); + attribute=attribute +13; + gtk_color_button_get_color((GtkColorButton *) glade_xml_get_widget(xml, widget_name), &color); @@ -86,6 +89,8 @@ static int get_color_button_widget_to_attribute(char *attribute, static int get_text_widget_to_attribute(char *attribute, char *widget_name, Agraph_t * g) { + attribute=attribute +9; + if (strlen(attribute) > 512) return 0; agattr(g, AGRAPH, attribute, @@ -96,9 +101,11 @@ static int get_text_widget_to_attribute(char *attribute, char *widget_name, static int set_text_widget(char *attribute, char *widget_name) { char *buf; + attribute=attribute +9; + buf = agget(view->g[view->activeGraph], attribute); if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { gtk_entry_set_text((GtkEntry *) glade_xml_get_widget(xml, widget_name), buf); @@ -111,9 +118,11 @@ static int set_checkbox_widget(char *attribute, char *widget_name) { char *buf; int value; + attribute=attribute +10; + buf = agget(view->g[view->activeGraph], attribute); if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { value = atoi(buf); gtk_toggle_button_set_active((GtkToggleButton *) @@ -133,6 +142,8 @@ static int get_checkbox_widget_to_attribute(char *attribute, { int value; char buf[100]; + attribute=attribute +10; + value = (int) gtk_toggle_button_get_active((GtkToggleButton *) glade_xml_get_widget(xml, widget_name)); @@ -145,9 +156,11 @@ static int set_spinbtn_widget(char *attribute, char *widget_name) { char *buf; float value; + attribute=attribute +12; + buf = agget(view->g[view->activeGraph], attribute); if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { value = (float) atof(buf); gtk_spin_button_set_value((GtkSpinButton *) @@ -162,6 +175,8 @@ static int get_spinbtn_widget_to_attribute(char *attribute, { float value; char buf[25]; + attribute=attribute +12; + value = (float) gtk_spin_button_get_value((GtkSpinButton *) glade_xml_get_widget(xml, widget_name)); @@ -176,6 +191,8 @@ static int get_scalebtn_widget_to_attribute(char *attribute, { float value; char buf[25]; + attribute=attribute +13; + value = (float) gtk_range_get_value((GtkRange *) glade_xml_get_widget(xml, widget_name)); @@ -190,9 +207,11 @@ static int set_scalebtn_widget_to_attribute(char *attribute, { char *buf; float value; + attribute=attribute +13; buf = agget(view->g[view->activeGraph], attribute); + if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { value = (float) atof(buf); gtk_range_set_value((GtkRange *) @@ -206,10 +225,10 @@ static int set_combobox_widget(char *attribute, char *widget_name) { char *buf; int value; + attribute=attribute +9; buf = agget(view->g[view->activeGraph], attribute); - if ((!buf) || (strcmp(buf, "") == 0)) - buf = agget(view->default_attributes, attribute); + buf = agget(view->systemGraphs.def_attrs, attribute); if (buf) { value = (int) atof(buf); gtk_combo_box_set_active((GtkComboBox *) @@ -228,6 +247,8 @@ static int get_combobox_widget_to_attribute(char *attribute, { char buf[25]; float value; + attribute=attribute +9; + value = (float) gtk_combo_box_get_active((GtkComboBox *) @@ -239,279 +260,49 @@ static int get_combobox_widget_to_attribute(char *attribute, } - - - -/* -Q-What are these set and get functions ? -A-These are functions to set and get data from GTK widgets based on what object they are -User click on setting windows, all window parameters are updated from current graph, -default values are stored in a template graph "" - -*/ - - - - - int load_settings_from_graph(Agraph_t * g) { - char *buf; /*local buffer */ - set_color_button_widget("bgcolor", "settingsColorBtn1"); - set_color_button_widget("bordercolor", "settingsColorBtn2"); - set_color_button_widget("gridcolor", "settingsColorBtn3"); - set_color_button_widget("highlightednodecolor", "settingsColorBtn6"); - set_color_button_widget("highlightededgecolor", "settingsColorBtn7"); - set_color_button_widget("selectednodecolor", "settingsColorBtn8"); - set_color_button_widget("selectededgecolor", "settingsColorBtn9"); - set_color_button_widget("defaultnodecolor", "DefaultNodeCbtn"); - set_color_button_widget("defaultedgecolor", "DefaultEdgeCbtn"); - - set_color_button_widget("topologicaltopviewfinestcolor", - "settingsColorBtn9"); - set_color_button_widget("topologicaltopviewcoarsestcolor", - "settingsColorBtn9"); - - set_color_button_widget("topologicalfisheyefinestcolor", - "settingsColorBtn10"); - set_color_button_widget("topologicalfisheyecoarsestcolor", - "settingsColorBtn11"); - set_text_widget("topologicalfisheyelabelattribute", - "finenodelabelattribute"); - - - set_checkbox_widget("bordervisible", "settingsChkBox2"); - set_checkbox_widget("gridvisible", "settingsChkBox3"); - - set_checkbox_widget("drawnodes", "settingsChkBox5-1"); - set_checkbox_widget("drawedges", "settingsChkBox5-2"); - - - /*page 2 label settings */ - set_combobox_widget("labelglutfont", "labelfont"); - - set_color_button_widget("nodelabelcolor", "nodelabelcolor"); - set_color_button_widget("edgelabelcolor", "edgelabelcolor"); - set_text_widget("nodelabelattribute", "labelnodeattribute"); - set_text_widget("edgecolorattribute", "edgecolortxt"); - - - set_text_widget("edgelabelattribute", "labeledgeattribute"); - set_checkbox_widget("labelwithdegree", "labelwithdegree"); - set_spinbtn_widget("labelnumberofnodes", "labelzoomfactor"); - set_checkbox_widget("shownodelabels", "labelshownodes"); - set_checkbox_widget("showedgelabels", "labelshowedges"); - - - - set_checkbox_widget("usermode", "settingsChkBox10"); - set_checkbox_widget("nodesizewithdegree", "settingsChkBox11"); - set_checkbox_widget("antialiasing", "settingsChkBox12"); - - set_checkbox_widget("topologicalfisheyedist2limit", - "settingsChkBox13"); - set_checkbox_widget("topologicalfisheyeanimate", "settingsChkBox14"); - set_checkbox_widget("topologicalfisheyelabelfinenodes", - "settingsChkBox15"); - set_checkbox_widget("topologicalfisheyecolornodes", - "settingsChkBox16"); - set_checkbox_widget("topologicalfisheyecoloredges", - "settingsChkBox17"); - set_checkbox_widget("topologicalfisheyelabelfocus", - "settingsChkBox18"); - - set_checkbox_widget("defaultnodeshapegl", "settingsChkBox10_1"); - set_checkbox_widget("defaultnodeshapespherical", "settingsChkBox10_2"); - set_checkbox_widget("defaultnodeshaperectangular", - "settingsChkBox10_3"); - - - - set_spinbtn_widget("defaultmagnifierwidth", "settingsspinbutton1"); - set_spinbtn_widget("defaultmagnifierheight", "settingsspinbutton2"); - set_spinbtn_widget("defaultmagnifierkts", "settingsspinbutton3"); - set_spinbtn_widget("defaultfisheyemagnifierradius", - "settingsspinbutton4"); - set_spinbtn_widget("defaultfisheyemagnifierdistort", - "settingsspinbutton5"); - set_spinbtn_widget("topologicalfisheyefinenodes", - "settingsspinbutton6"); - set_spinbtn_widget("topologicalfisheyecoarseningfactor", - "settingsspinbutton7"); - set_spinbtn_widget("topologicalfisheyedistortionfactor", - "settingsspinbutton8"); - - /*alpha values,1 for nodes 1 for edges */ - - - set_scalebtn_widget_to_attribute("defaultnodealpha", "settingsscale1"); /*node alpha */ - set_scalebtn_widget_to_attribute("defaultedgealpha", "settingsscale2"); /*edge alpha */ - set_scalebtn_widget_to_attribute("nodesize", "nodesizescale"); /*edge alpha */ - - /*Node Shape Combo, 0:opengl dots, 1:circle ,2:box */ - buf = agget(view->g[view->activeGraph], "defaultnodeshape"); - if (!buf) - buf = agget(view->default_attributes, "defaultnodeshape"); - if (buf) { - /*select the right item in combo box */ - gtk_combo_box_set_active((GtkComboBox *) - glade_xml_get_widget(xml, - "settingscombobox1"), - atoi(buf)); - - } - /*Color theme */ - buf = agget(view->g[view->activeGraph], "colortheme"); - if (!buf) - buf = agget(view->default_attributes, "colortheme"); - if (buf) { - /*select the right item in combo box */ - gtk_combo_box_set_active((GtkComboBox *) - glade_xml_get_widget(xml, - "colorthemecb"), - atoi(buf)); + Agsym_t* sym=NULL; + while ((sym = agnxtattr(view->systemGraphs.attrs_widgets,AGRAPH, sym))) + { + if(strncmp (sym->name,"color_button",strlen("color_button"))==0) + set_color_button_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); + if(strncmp (sym->name,"check_box",strlen("check_box"))==0) + set_checkbox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); + if(strncmp (sym->name,"text_box",strlen("text_box"))==0) + set_text_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); + if(strncmp (sym->name,"combobox",strlen("combobox"))==0) + set_combobox_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); + if(strncmp (sym->name,"spin_button",strlen("spin_button"))==0) + set_spinbtn_widget(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); + if(strncmp (sym->name,"scale_button",strlen("scale_button"))==0) + set_scalebtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name)); } - - - - /*Node Shape Combo, 0:opengl dots, 1:circle ,2:box */ - return 1; } int update_graph_from_settings(Agraph_t * g) { -#ifdef UNUSED - gchar *buf; - int value; - char buf2[10]; + Agsym_t* sym=NULL; + while ((sym = agnxtattr(view->systemGraphs.attrs_widgets,AGRAPH, sym))) + { + if(strncmp (sym->name,"color_button",strlen("color_button"))==0) + get_color_button_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); + if(strncmp (sym->name,"check_box",strlen("check_box"))==0) + get_checkbox_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); + if(strncmp (sym->name,"text_box",strlen("text_box"))==0) + get_text_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); + if(strncmp (sym->name,"combobox",strlen("combobox"))==0) + get_combobox_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); + if(strncmp (sym->name,"spin_button",strlen("spin_button"))==0) + get_spinbtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); + if(strncmp (sym->name,"scale_button",strlen("scale_button"))==0) + get_scalebtn_widget_to_attribute(sym->name, agget(view->systemGraphs.attrs_widgets,sym->name),g); - buf = - gtk_font_selection_get_font_name((GtkFontSelection *) - glade_xml_get_widget(xml, - "settingsFontSelection")); - agset(g, "defaultfontname", buf); -#endif - get_color_button_widget_to_attribute("bgcolor", "settingsColorBtn1", - g); - get_color_button_widget_to_attribute("bordercolor", - "settingsColorBtn2", g); - get_color_button_widget_to_attribute("gridcolor", "settingsColorBtn3", - g); - get_color_button_widget_to_attribute("highlightednodecolor", - "settingsColorBtn6", g); - get_color_button_widget_to_attribute("highlightededgecolor", - "settingsColorBtn7", g); - get_color_button_widget_to_attribute("selectednodecolor", - "settingsColorBtn8", g); - get_color_button_widget_to_attribute("selectededgecolor", - "settingsColorBtn9", g); - - - get_color_button_widget_to_attribute("defaultnodecolor", - "DefaultNodeCbtn", g); - get_color_button_widget_to_attribute("defaultedgecolor", - "DefaultEdgeCbtn", g); - - - - get_color_button_widget_to_attribute("topologicalfisheyefinestcolor", - "settingsColorBtn10", g); - get_color_button_widget_to_attribute("topologicalfisheyecoarsestcolor", - "settingsColorBtn11", g); - get_text_widget_to_attribute("topologicalfisheyelabelattribute", - "finenodelabelattribute", g); - - - get_checkbox_widget_to_attribute("bordervisible", "settingsChkBox2", - g); - get_checkbox_widget_to_attribute("gridvisible", "settingsChkBox3", g); - - get_checkbox_widget_to_attribute("drawnodes", "settingsChkBox5-1", g); - get_checkbox_widget_to_attribute("drawedges", "settingsChkBox5-2", g); - - /*page 2 label settings */ - get_combobox_widget_to_attribute("labelglutfont", "labelfont", g); - - get_color_button_widget_to_attribute("nodelabelcolor", - "nodelabelcolor", g); - get_color_button_widget_to_attribute("edgelabelcolor", - "edgelabelcolor", g); - - get_text_widget_to_attribute("nodelabelattribute", - "labelnodeattribute", g); - get_text_widget_to_attribute("edgelabelattribute", - "labeledgeattribute", g); - - get_text_widget_to_attribute("edgecolorattribute", "edgecolortxt", g); - - get_checkbox_widget_to_attribute("labelwithdegree", "labelwithdegree", - g); - get_spinbtn_widget_to_attribute("labelnumberofnodes", - "labelzoomfactor", g); - get_checkbox_widget_to_attribute("shownodelabels", "labelshownodes", - g); - get_checkbox_widget_to_attribute("showedgelabels", "labelshowedges", - g); - - - - - - - - - - get_checkbox_widget_to_attribute("usermode", "settingsChkBox10", g); - - - - get_checkbox_widget_to_attribute("nodesizewithdegree", - "settingsChkBox11", g); - get_checkbox_widget_to_attribute("antialiasing", "settingsChkBox12", - g); - - get_checkbox_widget_to_attribute("topologicalfisheyedist2limit", - "settingsChkBox13", g); - get_checkbox_widget_to_attribute("topologicalfisheyeanimate", - "settingsChkBox14", g); - get_checkbox_widget_to_attribute("topologicalfisheyelabelfinenodes", - "settingsChkBox15", g); - get_checkbox_widget_to_attribute("topologicalfisheyecolornodes", - "settingsChkBox16", g); - get_checkbox_widget_to_attribute("topologicalfisheyecoloredges", - "settingsChkBox17", g); - get_checkbox_widget_to_attribute("topologicalfisheyelabelfocus", - "settingsChkBox18", g); - - get_spinbtn_widget_to_attribute("defaultmagnifierwidth", - "settingsspinbutton1", g); - get_spinbtn_widget_to_attribute("defaultmagnifierheight", - "settingsspinbutton2", g); - get_spinbtn_widget_to_attribute("defaultmagnifierkts", - "settingsspinbutton3", g); - get_spinbtn_widget_to_attribute("defaultfisheyemagnifierradius", - "settingsspinbutton4", g); - get_spinbtn_widget_to_attribute("defaultfisheyemagnifierdistort", - "settingsspinbutton5", g); - get_spinbtn_widget_to_attribute("topologicalfisheyefinenodes", - "settingsspinbutton6", g); - get_spinbtn_widget_to_attribute("topologicalfisheyecoarseningfactor", - "settingsspinbutton7", g); - get_spinbtn_widget_to_attribute("topologicalfisheyedistortionfactor", - "settingsspinbutton8", g); - /*added later */ - get_scalebtn_widget_to_attribute("defaultnodealpha", - "settingsscale1", g); - get_scalebtn_widget_to_attribute("defaultedgealpha", - "settingsscale2", g); - get_scalebtn_widget_to_attribute("nodesize", "nodesizescale", g); - get_combobox_widget_to_attribute("defaultnodeshape", - "settingscombobox1", g); - get_combobox_widget_to_attribute("colortheme", "colorthemecb", g); + } return 1; } diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index dcc10e688..0bdde1c0d 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -266,15 +266,11 @@ typedef struct int ObjType; int Layer; int Visible; - int Locked; - int Highlighted; int Selected; - int Preselected; int NumDataCount; float *NumData; int StrDataCount; char **StrData; - int selectionflag; int param; //generic purpose param int TVRef; //Topview reference int edgeid; /*for only edges, > 0 multiedges */ @@ -353,8 +349,6 @@ typedef struct float zoom_factor; int in_fish_eye; //boolean value if to apply fisheye glCompColor Color; - glCompColor GroupColor; - int GroupIndex; //default -1; char *Label; char *Label2; int degree; @@ -501,10 +495,14 @@ typedef struct int active; int fisheye_distortion_fac; } fisheye_magnifier; - + typedef struct{ + Agraph_t *def_attrs; + Agraph_t *attrs_widgets; + }systemgraphs; typedef struct _ViewInfo { + systemgraphs systemGraphs; /*view variables */ float panx; float pany; @@ -616,7 +614,6 @@ typedef struct /*Topview data structure, refer topview.h for more info */ topview *Topview; - Agraph_t *default_attributes; /*timer for animations */ GTimer *timer; /*this timer is session timer and always active */ @@ -651,8 +648,9 @@ typedef struct char *initFileName; //file name from command line int initFile; colorschemaset *colschms; - char *template_file; char *glade_file; + char* temp; + char *template_file; char *attr_file; int flush; line interpol; diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 7ef9d4a06..f3d5d9f83 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -65,17 +65,13 @@ void cleartopview(topview * t) static void init_element_data(element_data * d) { - d->Highlighted = 0; d->Layer = 0; d->Visible = 1; - d->Highlighted = 0; d->Selected = 0; - d->Preselected = 0; d->NumDataCount = 0; d->NumData = (float *) 0; d->StrDataCount = 0; d->StrData = (char **) 0; - d->selectionflag = 0; d->param = 0; d->TVRef = -1; } @@ -92,6 +88,7 @@ static void setpositioninfo(float *x, float *y, float *z, char *buf) static void setglCompColor(glCompColor * c, char *colorstr) { gvcolor_t cl; + float A=1; /*if node has color attribute */ if ((colorstr != '\0') && (strlen(colorstr) > 0)) { colorxlate(colorstr, &cl, RGBA_DOUBLE); @@ -99,13 +96,15 @@ static void setglCompColor(glCompColor * c, char *colorstr) } else { colorxlate(agget(view->g[view->activeGraph], "defaultnodecolor"), &cl, RGBA_DOUBLE); + c->tag = 0; + A= view->defaultnodealpha; } 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]; - + c->A = (float) cl.u.RGBA[3]*A; + } #undef DIST2 @@ -233,7 +232,6 @@ void settvcolorinfo(Agraph_t * g, topview * t) /*while in the loop why dont we set some smyrna settings from graph? selected , highlighted , visible */ np->data.Selected = boolAttr(np->Node, sel, 0); - np->data.Highlighted = boolAttr(np->Node, hilite, 0); np->data.Visible = visible(np->Node, vis, sty); tempStr=agget(t->Nodes[ind].Node, "size"); if(tempStr) @@ -268,33 +266,12 @@ void settvcolorinfo(Agraph_t * g, topview * t) ep->data.edgeid = boolAttr(ep->Edge, edgeid, 0); ep->Color = color; ep->data.Selected = boolAttr(ep->Edge, sel, 0); - ep->data.Highlighted = boolAttr(ep->Edge, hilite, 0); ep->data.Visible = visible(ep->Edge, vis, sty); } } -#if UNUSED -static xdot *parseXdotwithattr(void *p, char *attr) -{ - int ind; - xdot *xDot; - xdot_op* x_op; - sdot_op* s_op; - xDot = parseXDotF(agget(p, attr), OpFns, sizeof(sdot_op)); - if (!xDot) - return NULL; - for (ind = 0 ; ind < xDot->cnt; ind ++) - { - x_op=&(xDot->ops[ind]); - s_op=(sdot_op*)x_op; - s_op->font=NULL; - s_op->layer=ind; - } - return xDot; -} -#endif static xdot* parseXdotwithattrs(void *e) { @@ -398,7 +375,7 @@ void preparetopview(Agraph_t * g, topview * t) Agnode_t *v; Agedge_t *e; Agsym_t *sym; - int ind, ind2, data_type_count; //number of columns for custom view->Topview data ,IP ,HOST, etc + int ind, ind2, data_type_count; float maxedgelen, minedgelen, edgelength; @@ -429,7 +406,6 @@ void preparetopview(Agraph_t * g, topview * t) //bind temp record; agbindrec(v, "temp_node_record", sizeof(temp_node_record), TRUE); //graph custom data /*initialize group index, -1 means no group */ - t->Nodes[ind].GroupIndex = -1; t->Nodes[ind].Node = v; t->Nodes[ind].data.TVRef = ind; ((temp_node_record *) AGDATA(v))->TVref = ind; @@ -656,7 +632,7 @@ static int drawtopviewnodes(Agraph_t * g) view->selectedNodeColor.A); } else { //get the color from node glColor4f(v->Color.R, v->Color.G, v->Color.B, - v->node_alpha * view->defaultnodealpha); + v->node_alpha); ddx = 0; ddy = 0; ddz = 0; @@ -1057,35 +1033,6 @@ static int get_color_from_edge(topview_edge * e) view->selectedEdgeColor.B, view->selectedEdgeColor.A); return return_value; } - /*edge maybe in a group and group may be selected, then use groups's color example:ATT hosts */ - if ((e->Node1->GroupIndex >= 0) || (e->Node2->GroupIndex >= 0)) { - if (view->Topview->TopviewData->hostactive[e->Node1->GroupIndex] == - 1) { - gtk_color_button_get_color(view->Topview->TopviewData-> - gtkhostcolor[e->Node1->GroupIndex], - &color); - glColor4f((GLfloat) color.red / (GLfloat) 65535.0, - (GLfloat) color.green / (GLfloat) 65535.0, - (GLfloat) color.blue / (GLfloat) 65535.0, - (GLfloat) 1); - return return_value; - } else { - if (view->Topview->TopviewData-> - hostactive[e->Node2->GroupIndex] == 1) { - gtk_color_button_get_color(view->Topview->TopviewData-> - gtkhostcolor[e->Node2-> - GroupIndex], - &color); - glColor4f((GLfloat) color.red / (GLfloat) 65535.0, - (GLfloat) color.green / (GLfloat) 65535.0, - (GLfloat) color.blue / (GLfloat) 65535.0, - (GLfloat) 1); - return return_value; - } - } - - } - /*get edge's color attribute */ if (e->Color.tag == 0) glColor4f(e->Color.R, e->Color.G, e->Color.B, Alpha * e->Color.A); diff --git a/cmd/smyrna/topviewdata.c b/cmd/smyrna/topviewdata.c index 3cc68f5dd..dff6793d8 100644 --- a/cmd/smyrna/topviewdata.c +++ b/cmd/smyrna/topviewdata.c @@ -32,159 +32,3 @@ static int validate_group_node(tv_node * TV_Node, char *regex_string) return valid; } -int prepare_nodes_for_groups(topview * t, topviewdata * td, int groupindex) -{ - GdkColor color; - int i; - int count = 0; - tv_node tvn; - gtk_color_button_get_color(td->gtkhostcolor[0], &color); - - for (i = 0; i < t->Nodecount; i++) { - tvn.index = i; - if (validate_group_node(&tvn, td->hostregex[groupindex])) { - count++; - gtk_color_button_get_color(td->gtkhostcolor[groupindex], - &color); - t->Nodes[i].GroupIndex = groupindex; - t->Nodes[i].GroupColor.R = (float) color.red / (float) 65535.0; - t->Nodes[i].GroupColor.G = - (float) color.green / (float) 65535.0; - t->Nodes[i].GroupColor.B = - (float) color.blue / (float) 65535.0; - } - } - return 1; -} - -/*int load_host_buttons(topview * t, Agraph_t * g, glCompSet * s) -{ - GtkLayout *layout; - int btncount = 0; - int i = 0; - char *str; - char hostbtncaption[50]; - char hostbtnregex[50]; - char hostbtncolorR[50]; - char hostbtncolorG[50]; - char hostbtncolorB[50]; - char hostbtncolorA[50]; - int X = 10; - int Y = 25; - GdkColor color; - glCompPanel *p; - glCompButton *b; - - layout = - (GtkLayout *) glade_xml_get_widget(xml, "frmHostSelectionFixed"); - str = '\0'; - str = agget(g, "hostbtncount"); - if (str) - btncount = atoi(str); - -// Graph [hostbtncaption1="AT&T",hostbtnregex1="*.ATT*",hostbtncolorR1="1",hostbtncolorG1="0",hostbtncolorB1="0",hostbtncolorA1="1"]; - - t->TopviewData->hostregex = N_GNEW(btncount, char *); - t->TopviewData->gtkhostbtn = N_GNEW(btncount, GtkButton *); - t->TopviewData->gtkhostcolor = N_GNEW(btncount, GtkColorButton *); - t->TopviewData->gtkhostbtncount = btncount; - if (btncount > 0) { - p = glCompPanelNew(25, 75, 165, 400,scientific_y); - p->data = 2; //data panel - p->color.R = (float) 0.80; - p->color.B = (float) 0.2; - glCompSetAddPanel(s, p); - } else - return 0; - - for (i = 0; i < btncount; i++) { - sprintf(hostbtncaption, "hostbtncaption%i", i); - sprintf(hostbtnregex, "hostbtnregex%i", i); - sprintf(hostbtncolorR, "hostbtncolorR%i", i); - sprintf(hostbtncolorG, "hostbtncolorG%i", i); - sprintf(hostbtncolorB, "hostbtncolorB%i", i); - sprintf(hostbtncolorA, "hostbtncolorA%i", i); - agget(g, hostbtncaption), - agget(g, hostbtnregex), - agget(g, hostbtncolorR), - agget(g, hostbtncolorG), - agget(g, hostbtncolorB), agget(g, hostbtncolorA); - t->TopviewData->hostregex[i] = agget(g, hostbtnregex); - - b = glCompButtonNew((GLfloat) 5, - (GLfloat) 7 + ((GLfloat) i + - (GLfloat) 1) * (GLfloat) 36, - (GLfloat) 150, (GLfloat) 35, agget(g, - hostbtncaption), - '\0', 0, 0,scientific_y); - b->color.R = (float) atof(agget(g, hostbtncolorR)); - b->color.G = (float) atof(agget(g, hostbtncolorG)); - b->color.B = (float) atof(agget(g, hostbtncolorB)); - b->color.A = (float) 1; - b->panel = p; - b->groupid = -1; - b->callbackfunc = glhost_button_clicked_Slot; - b->data = i; - glCompSetAddButton(s, b); - - t->TopviewData->gtkhostbtn[i] = (GtkButton *) - gtk_button_new_with_label(agget(g, hostbtncaption)); - g_signal_connect((gpointer) t->TopviewData->gtkhostbtn[i], - "clicked", G_CALLBACK(host_button_clicked_Slot), - (gpointer) i); - - color.blue = 65535 * atoi(agget(g, hostbtncolorB)); - color.red = 65535 * atoi(agget(g, hostbtncolorR)); - color.green = 65535 * atoi(agget(g, hostbtncolorG)); - - t->TopviewData->gtkhostcolor[i] = - (GtkColorButton *) gtk_color_button_new_with_color(&color); - - gtk_color_button_set_alpha((GtkColorButton *) t->TopviewData-> - gtkhostbtn[i], - 65535 * atoi(agget(g, hostbtncolorA))); - - - gtk_layout_put(layout, (GtkWidget *) t->TopviewData->gtkhostbtn[i], - X, Y); - gtk_widget_set_size_request((GtkWidget *) t->TopviewData-> - gtkhostbtn[i], 200, 35); - - gtk_layout_put(layout, - (GtkWidget *) t->TopviewData->gtkhostcolor[i], - X + 225, Y); - gtk_widget_set_size_request((GtkWidget *) t->TopviewData-> - gtkhostcolor[i], 40, 35); - - gtk_widget_show((GtkWidget *) t->TopviewData->gtkhostbtn[i]); - gtk_widget_show((GtkWidget *) t->TopviewData->gtkhostcolor[i]); - Y = Y + 40; - t->TopviewData->hostactive[i] = 0; - } - p->height = (GLfloat) 15 + (GLfloat) (btncount + 1) * (GLfloat) 36; - for (i = 0; i < btncount; i++) { - prepare_nodes_for_groups(t, t->TopviewData, i); - } - return 1; -}*/ -void glhost_button_clicked_Slot(void *p) -{ - //negative active - int user_data; - user_data = ((glCompButton *) p)->data; - if (view->Topview->TopviewData->hostactive[user_data] == 0) - view->Topview->TopviewData->hostactive[user_data] = 1; - else - view->Topview->TopviewData->hostactive[user_data] = 0; - glexpose(); -} - -/*void host_button_clicked_Slot(GtkWidget * widget, gpointer user_data) -{ - //negative active - if (view->Topview->TopviewData->hostactive[(int) user_data] == 0) - view->Topview->TopviewData->hostactive[(int) user_data] = 1; - else - view->Topview->TopviewData->hostactive[(int) user_data] = 0; - glexpose(); -}*/ diff --git a/cmd/smyrna/tvnodes.c b/cmd/smyrna/tvnodes.c index 5b42f40de..82694e200 100755 --- a/cmd/smyrna/tvnodes.c +++ b/cmd/smyrna/tvnodes.c @@ -185,11 +185,6 @@ int validate_node(tv_node * TV_Node) if (strlen(TV_Nodes.filter.filter_string) > 0) valid = evaluate_expresions(TV_Node, n); //if show only highlighted - if (TV_Nodes.filter.highlighted >= 0) { - if (view->Topview->Nodes[TV_Node->index].data.Highlighted != - TV_Nodes.filter.highlighted) - valid = 0; - } //if show only visibles if (TV_Nodes.filter.visible >= 0) { if (view->Topview->Nodes[TV_Node->index].data.Visible != @@ -260,10 +255,6 @@ static int update_node_gui_objects(tv_node * TV_Node) LOCATION_X_CHKHIGHLIGHTED, TV_Nodes.Y); } gtk_widget_show((GtkWidget *) TV_Node->chkHighlighted); - gtk_toggle_button_set_active((GtkToggleButton *) TV_Node-> - chkHighlighted, - view->Topview->Nodes[TV_Node->index].data. - Highlighted); //NAME @@ -593,15 +584,6 @@ int update_TV_data_from_gui(void) if (view->Topview->Nodes[index].data.Visible) view->Topview->Nodes[index].data.Visible = 0; } - // apply if Highlighted - if (gtk_toggle_button_get_active - ((GtkToggleButton *) TV_Nodes.TV_Node[i].chkHighlighted)) { - if (!view->Topview->Nodes[index].data.Highlighted) - view->Topview->Nodes[index].data.Highlighted = 1; - } else { - if (view->Topview->Nodes[index].data.Highlighted) - view->Topview->Nodes[index].data.Highlighted = 0; - } agset((void *) view->Topview->Nodes[index].Node, data_attr1, (char *) gtk_entry_get_text(TV_Nodes.TV_Node[i].Data1)); agset(view->Topview->Nodes[index].Node, data_attr2, @@ -714,37 +696,8 @@ int tv_unselect_all() } -int tv_highligh_all(void) -{ - tv_node tvn; - int i; - for (i = 0; i < view->Topview->Nodecount; i++) { - tvn.index = i; - if (cache_validate_node(&tvn)) { - view->Topview->Nodes[i].data.Highlighted = 1; - } - } - apply_filter_from_gui(); - return 1; -} - -int tv_unhighligh_all(void) -{ - tv_node tvn; - int i; - for (i = 0; i < view->Topview->Nodecount; i++) { - tvn.index = i; - if (cache_validate_node(&tvn)) { - view->Topview->Nodes[i].data.Highlighted = 0; - } - } - apply_filter_from_gui(); - return 1; - -} - int tv_show_all(void) { tv_node tvn; diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 2e1a1c6f0..4711d03a7 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -170,7 +170,7 @@ char *get_attribute_value(char *attr, ViewInfo * view, Agraph_t * g) char *buf; buf = agget(g, attr); if ((!buf) || (*buf == '\0')) - buf = agget(view->default_attributes, attr); + buf = agget(view->systemGraphs.def_attrs, attr); return buf; } @@ -348,6 +348,7 @@ static void get_data_dir(void) void init_viewport(ViewInfo * view) { FILE *input_file = NULL; + FILE *input_file2 = NULL; get_data_dir(); input_file = fopen(view->template_file, "rb"); @@ -356,12 +357,25 @@ void init_viewport(ViewInfo * view) "default attributes template graph file \"%s\" not found\n", view->template_file); exit(-1); - } else if (!(view->default_attributes = agread(input_file, 0))) { + } else if (!(view->systemGraphs.def_attrs = agread(input_file, 0))) { fprintf(stderr, "could not load default attributes template graph file \"%s\"\n", view->template_file); exit(-1); } + printf ("%s\n",smyrnaPath("attr_widgets.dot")); + input_file2 = fopen(smyrnaPath("attr_widgets.dot"), "rb"); + if (!input_file2) + { + fprintf(stderr, "default attributes template graph file \"%s\" not found\n",smyrnaPath("attr_widgets.dot")); + exit(-1); + + } + else if (!(view->systemGraphs.attrs_widgets = agread(input_file2, 0))) + { + fprintf(stderr,"could not load default attribute widgets graph file \"%s\"\n",smyrnaPath("attr_widgets.dot")); + exit(-1); + } //init graphs view->g = NULL; //no graph, gl screen should check it view->graphCount = 0; //and disable interactivity if count is zero @@ -473,8 +487,7 @@ void init_viewport(ViewInfo * view) view->cameras = '\0';; view->camera_count = 0; view->active_camera = -1; - - set_viewport_settings_from_template(view, view->default_attributes); + set_viewport_settings_from_template(view, view->systemGraphs.def_attrs); view->dfltViewType = VT_NONE; view->dfltEngine = GVK_NONE; view->Topview->Graphdata.GraphFileName = (char *) 0;