From 7591d4fef01d0e7df86c0ce8ebee2bb331012995 Mon Sep 17 00:00:00 2001 From: arif Date: Mon, 20 Jul 2009 16:46:04 +0000 Subject: [PATCH] gvpr output window ,settings window Apply button ,fe wbugs cleaned up --- cmd/smyrna/gui/beacon.c | 3 --- cmd/smyrna/gui/menucallbacks.c | 36 ++++++++++++++------------ cmd/smyrna/gui/topviewsettings.c | 8 +++++- cmd/smyrna/gui/topviewsettings.h | 5 ++-- cmd/smyrna/gvprpipe.c | 31 ++++++++++++++++------ cmd/smyrna/topview.c | 2 +- share/gui/smyrna.glade | 44 ++++++++++++++++++++------------ 7 files changed, 82 insertions(+), 47 deletions(-) diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index eca98c44c..bfca0288e 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -257,9 +257,6 @@ int draw_node_hint_boxes(void) glVertex3f(x2,y2,z2); - /*blue font color*/ - glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,dy,dz,"["); - glprintfglut (GLUT_BITMAP_HELVETICA_12, dx,(dy+fs+fs/(GLfloat)5.0),dz,lbl); } glEnd(); glLineWidth(0); diff --git a/cmd/smyrna/gui/menucallbacks.c b/cmd/smyrna/gui/menucallbacks.c index 7e1d9a23b..4a5c7c6ce 100755 --- a/cmd/smyrna/gui/menucallbacks.c +++ b/cmd/smyrna/gui/menucallbacks.c @@ -578,23 +578,27 @@ on_gvprbuttonload_clicked(GtkWidget * widget, gpointer user_data) agxbinit (&xbuf, SMALLBUF, xbuffer); /*file name should be returned in xbuf*/ - if (openfiledlg(0,NULL,&xbuf)) { - input_file = fopen(agxbuse (&xbuf), "r"); - if (input_file) { - while (fgets(buf, BUFSIZ, input_file)) { - agxbput (&xbuf, buf); - } - gtkbuf = gtk_text_view_get_buffer((GtkTextView*) glade_xml_get_widget(xml,"gvprtextinput")); - str=agxbuse (&xbuf); - if(g_utf8_validate(str,-1,NULL)) { - gtk_text_buffer_set_text (gtkbuf, str, -1); - } - else { - show_gui_warning ("File format is not UTF8!"); - } - fclose (input_file); + if (openfiledlg(0,NULL,&xbuf)) + { + input_file = fopen(agxbuse (&xbuf), "r"); + if (input_file) + { + while (fgets(buf, BUFSIZ, input_file)) + agxbput (&xbuf, buf); + gtkbuf = gtk_text_view_get_buffer((GtkTextView*) glade_xml_get_widget(xml,"gvprtextinput")); + str=agxbuse (&xbuf); + if(g_utf8_validate(str,-1,NULL)) + { + gtk_text_buffer_set_text (gtkbuf, str, -1); + } + else + { + show_gui_warning ("File format is not UTF8!"); + } + fclose (input_file); } - else { + else + { show_gui_warning ("file couldn't be opened\n"); } } diff --git a/cmd/smyrna/gui/topviewsettings.c b/cmd/smyrna/gui/topviewsettings.c index 3f956ad5b..4b8855a5a 100644 --- a/cmd/smyrna/gui/topviewsettings.c +++ b/cmd/smyrna/gui/topviewsettings.c @@ -22,13 +22,19 @@ #include "memory.h" void on_settingsOKBtn_clicked(GtkWidget * widget, gpointer user_data) +{ + on_settingsApplyBtn_clicked (widget,user_data); + gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings")); +} +void on_settingsApplyBtn_clicked(GtkWidget * widget, gpointer user_data) + { update_graph_from_settings(view->g[view->activeGraph]); set_viewport_settings_from_template(view, view->g[view->activeGraph]); settvcolorinfo(view->g[view->activeGraph],view->Topview); - gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings")); } + void on_settingsCancelBtn_clicked(GtkWidget * widget, gpointer user_data) { gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings")); diff --git a/cmd/smyrna/gui/topviewsettings.h b/cmd/smyrna/gui/topviewsettings.h index a3bbc1c88..d58d39610 100644 --- a/cmd/smyrna/gui/topviewsettings.h +++ b/cmd/smyrna/gui/topviewsettings.h @@ -19,8 +19,9 @@ #include "smyrnadefs.h" _BB void on_settingsOKBtn_clicked(GtkWidget * widget, gpointer user_data); -_BB void on_settingsCancelBtn_clicked(GtkWidget * widget, - gpointer user_data); +_BB void on_settingsCancelBtn_clicked(GtkWidget * widget,gpointer user_data); +_BB void on_settingsApplyBtn_clicked(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(); diff --git a/cmd/smyrna/gvprpipe.c b/cmd/smyrna/gvprpipe.c index c7105b7aa..65ceeeb72 100644 --- a/cmd/smyrna/gvprpipe.c +++ b/cmd/smyrna/gvprpipe.c @@ -20,15 +20,25 @@ #include #include #include +#include +#include "draw.h" //#include //#include #include - +extern GladeXML *xml; //global libglade vars static ssize_t outfn (void* sp, const char *buf, size_t nbyte, void* dp) { - return write (1, buf, nbyte); + GtkTextIter endit; + GtkTextBuffer * gtkbuf; + /*get text view buffer*/ + gtkbuf = gtk_text_view_get_buffer((GtkTextView*) glade_xml_get_widget(xml,"gvprtextoutput")); + /*set iterator to the end of the buffer*/ + gtk_text_buffer_get_end_iter (gtkbuf,&endit); + /*insert buf to the end*/ + gtk_text_buffer_insert(gtkbuf,&endit,buf,nbyte); + return nbyte; } static ssize_t errfn (void* sp, const char *buf, size_t nbyte, void* dp) @@ -36,6 +46,9 @@ static ssize_t errfn (void* sp, const char *buf, size_t nbyte, void* dp) return write (2, buf, nbyte); } + + + int run_gvpr (Agraph_t* srcGraph, int argc, char* argv[]) { int i, rv = 1; @@ -50,16 +63,18 @@ int run_gvpr (Agraph_t* srcGraph, int argc, char* argv[]) opts.out = outfn; opts.err = errfn; opts.flags = GV_USE_OUTGRAPH; - + rv = gvpr (argc, argv, &opts); if (rv) { /* error */ - fprintf (stderr, "Error in gvpr\n"); + fprintf (stderr, "Error in gvpr\n"); } - else if (opts.n_outgraphs) { - refreshViewport (0); - sprintf (buf, "<%d>", ++count); - add_graph_to_viewport(opts.outgraphs[0], buf); + else if (opts.n_outgraphs) + { + refreshViewport (0); + sprintf (buf, "<%d>", ++count); + if (opts.outgraphs[0] != view->g[view->activeGraph]) + add_graph_to_viewport(opts.outgraphs[0], buf); if (opts.n_outgraphs > 1) fprintf (stderr, "Warning: multiple output graphs-discarded\n"); for (i = 1; i < opts.n_outgraphs; i++) { diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index eddee0d72..f62c21ad5 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -762,7 +762,7 @@ void drawTopViewGraph(Agraph_t * g) drawtopviewedges(g); drawtopviewedgelabels(g); enddrawcycle(g); - draw_xdot_set(view->Topview->xdot_list); +// draw_xdot_set(view->Topview->xdot_list); draw_node_hint_boxes(); if ((view->Selection.Active > 0) && (!view->SignalBlock)) { view->Selection.Active = 0; diff --git a/share/gui/smyrna.glade b/share/gui/smyrna.glade index 640e945ec..86b70eb25 100755 --- a/share/gui/smyrna.glade +++ b/share/gui/smyrna.glade @@ -2562,7 +2562,19 @@ - + + True + Apply + True + GTK_RELIEF_NORMAL + True + 0 + + + + + + True OK True @@ -5278,24 +5290,24 @@ Custom - - - True - True - True - True - 0 - - True - * - False - - + + + True + True + True + True + 0 + + True + * + False + + 0 False False - - + + -- 2.50.1