From: arif <devnull@localhost> Date: Thu, 23 Jul 2009 20:00:43 +0000 (+0000) Subject: smyrna : X-Git-Tag: LAST_LIBGRAPH~32^2~1800 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ba569c4d2fa63a7de1c7e62f4e8dbfc747ad46f;p=graphviz smyrna : 1)Node size bug is fixed 2)Console widget is implemented (outputwidget) 3)non-visible edges and nodes are not pickable anymore --- diff --git a/cmd/smyrna/gui/beacon.c b/cmd/smyrna/gui/beacon.c index 8b33e21dd..c7fd9bd6d 100644 --- a/cmd/smyrna/gui/beacon.c +++ b/cmd/smyrna/gui/beacon.c @@ -25,6 +25,9 @@ void pick_node_from_coords(float x,float y,float z) for (ind = 0; ind < view->Topview->Nodecount; ind++) { n = &view->Topview->Nodes[ind]; + if (!n->data.Visible) + continue; + a = ABS(n->distorted_x - view->mouse.GLX); b = ABS(n->distorted_y - view->mouse.GLY); c = ABS(n->distorted_z - view->mouse.GLZ); @@ -40,6 +43,8 @@ void pick_node_from_coords(float x,float y,float z) { XYZ p1,p2,p3; e = &view->Topview->Edges[ind]; + if (!e->data.Visible) + continue; p1.X=e->Node1->distorted_x; p1.Y=e->Node1->distorted_y; diff --git a/cmd/smyrna/gui/callbacks.c b/cmd/smyrna/gui/callbacks.c index c6976cc9f..8f8e2a0a3 100755 --- a/cmd/smyrna/gui/callbacks.c +++ b/cmd/smyrna/gui/callbacks.c @@ -227,25 +227,25 @@ _BB void on_clearconsolebtn_clicked(GtkWidget * widget, gpointer user_data) } _BB void on_hideconsolebtn_clicked(GtkWidget * widget, gpointer user_data) { - gtk_widget_hide(glade_xml_get_widget(xml, "hbox11")); + gtk_widget_hide(glade_xml_get_widget(xml, "vbox13")); } _BB void on_consoledecbtn_clicked(GtkWidget * widget, gpointer user_data) { int w,h; gtk_widget_get_size_request((GtkTextView*) glade_xml_get_widget(xml,"scrolledwindow7"),&w,&h); - h=h-5; + w=w-5; gtk_widget_set_size_request(((GtkTextView*) glade_xml_get_widget(xml,"scrolledwindow7")), - 0,h); + w,0); } _BB void on_consoleincbtn_clicked(GtkWidget * widget, gpointer user_data) { int w,h; gtk_widget_get_size_request((GtkTextView*) glade_xml_get_widget(xml,"scrolledwindow7"),&w,&h); - h=h+5; + w=w+5; gtk_widget_set_size_request(((GtkTextView*) glade_xml_get_widget(xml,"scrolledwindow7")), - 0,h); + w,0); } diff --git a/cmd/smyrna/gui/menucallbacks.c b/cmd/smyrna/gui/menucallbacks.c index f40966e1d..9295178f5 100755 --- a/cmd/smyrna/gui/menucallbacks.c +++ b/cmd/smyrna/gui/menucallbacks.c @@ -172,12 +172,12 @@ void mMenuZoom(GtkWidget * widget, gpointer user_data) } void mShowConsoleSlot(GtkWidget * widget, gpointer user_data) { - gtk_widget_show(glade_xml_get_widget(xml, "hbox11")); + gtk_widget_show(glade_xml_get_widget(xml, "vbox13")); } void mHideConsoleSlot(GtkWidget * widget, gpointer user_data) { - gtk_widget_hide(glade_xml_get_widget(xml, "hbox11")); + gtk_widget_hide(glade_xml_get_widget(xml, "vbox13")); } diff --git a/cmd/smyrna/gui/topviewsettings.c b/cmd/smyrna/gui/topviewsettings.c index 7547daf3b..79b42b420 100644 --- a/cmd/smyrna/gui/topviewsettings.c +++ b/cmd/smyrna/gui/topviewsettings.c @@ -31,7 +31,9 @@ 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); + update_topview(view->g[view->activeGraph],view->Topview,0,0); +/* settvcolorinfo(view->g[view->activeGraph],view->Topview); + init_node_size(view->g[view->activeGraph])*/ } diff --git a/cmd/smyrna/gvprpipe.c b/cmd/smyrna/gvprpipe.c index d57111882..6942394f4 100644 --- a/cmd/smyrna/gvprpipe.c +++ b/cmd/smyrna/gvprpipe.c @@ -28,25 +28,24 @@ #include <gvpr.h> extern GladeXML *xml; //global libglade vars -static ssize_t outfn (void* sp, const char *buf, size_t nbyte, void* dp) +static void append_textview(GtkTextView* textv,char* s) { + GtkTextIter endit; GtkTextBuffer * gtkbuf; /*get text view buffer*/ - gtkbuf = gtk_text_view_get_buffer((GtkTextView*) glade_xml_get_widget(xml,"gvprtextoutput")); + gtkbuf = gtk_text_view_get_buffer(textv); /*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); - - gtkbuf = gtk_text_view_get_buffer((GtkTextView*) glade_xml_get_widget(xml,"mainsconsole")); - /*set iterator to the end of the buffer*/ - gtk_text_buffer_get_end_iter (gtkbuf,&endit); + gtk_text_buffer_insert(gtkbuf,&endit,s,-1); - /* insert buf to the end */ - gtk_text_buffer_insert(gtkbuf,&endit,buf,nbyte); +} +static ssize_t outfn (void* sp, const char *buf, size_t nbyte, void* dp) +{ + append_textview((GtkTextView*) glade_xml_get_widget(xml,"gvprtextoutput"),buf); + append_textview((GtkTextView*) glade_xml_get_widget(xml,"mainconsole"),buf); return nbyte; } diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 630259815..0d1911682 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -210,7 +210,9 @@ int main(int argc, char *argv[]) gtk_gl_init(0, 0); /* Configure OpenGL framebuffer. */ glconfig = configure_gl(); - gladewidget = glade_xml_get_widget(xml, "vbox2"); +// gladewidget = glade_xml_get_widget(xml, "vbox2"); + gladewidget = glade_xml_get_widget(xml, "hbox11"); + create_window(glconfig, gladewidget); change_cursor(GDK_TOP_LEFT_ARROW); diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 1657610a5..8c3d0700e 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -320,28 +320,32 @@ void settvxdot(Agraph_t* g,topview* t) parseXdotwithattrs(ep->Edge, t->xdot_list); } } - -void update_topview(Agraph_t * g, topview * t,int init,int resetview) +float init_node_size(Agraph_t * g,topview * t) { - - if (init) { float vsize; int percent; + percent = atoi(agget(g,"nodesize")); + if (percent == 0) + percent=0.000001; + vsize = 0.05*sqrt((view->bdxRight - view->bdxLeft)*(view->bdyTop - view->bdyBottom)); + t->init_node_size = vsize*2/GetOGLDistance(2)*percent/100.0/sqrt(t->Nodecount); + t->init_zoom = view->zoom; + +} - preparetopview(g,t); +void update_topview(Agraph_t * g, topview * t,int init,int resetview) +{ - percent = atoi(agget(view->g[view->activeGraph],"nodesize")); - vsize = 0.05*sqrt((view->bdxRight - view->bdxLeft)*(view->bdyTop - view->bdyBottom)); - t->init_node_size = vsize*2/GetOGLDistance(2)*percent/100.0/sqrt(t->Nodecount); - t->init_zoom = view->zoom; - free_xdotset(view->Topview->xdot_list); - t->xdot_list=init_xdot_set(); - } + if (init) + preparetopview(g,t); + free_xdotset(view->Topview->xdot_list); + t->xdot_list=init_xdot_set(); settvposinfo(g,t); settvcolorinfo(g,t); set_boundaries(t); set_update_required(t); settvxdot(view->g[view->activeGraph],view->Topview); + init_node_size(g,t); if (resetview) btnToolZoomFit_clicked(NULL,NULL); } @@ -618,9 +622,9 @@ static int drawtopviewnodes(Agraph_t * g) else if (view->defaultnodeshape==1) { if(v->size > 0) - drawCircle(v->distorted_x - ddx,v->distorted_y - ddy,v->size*dotsize,0); + drawCircle(v->distorted_x - ddx,v->distorted_y - ddy,v->size*view->Topview->init_node_size,0); else - drawCircle(v->distorted_x - ddx,v->distorted_y - ddy,dotsize,0); + drawCircle(v->distorted_x - ddx,v->distorted_y - ddy,view->Topview->init_node_size,0); } } else { diff --git a/share/gui/smyrna.glade b/share/gui/smyrna.glade index e4226efc7..adcf6a882 100755 --- a/share/gui/smyrna.glade +++ b/share/gui/smyrna.glade @@ -1077,129 +1077,146 @@ <property name="spacing">0</property> <child> - <widget class="GtkScrolledWindow" id="scrolledwindow7"> - <property name="width_request">626</property> - <property name="height_request">76</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="mainconsole"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_NONE</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> + <placeholder/> </child> <child> - <widget class="GtkTable" id="table17"> + <widget class="GtkVBox" id="vbox13"> <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> <property name="homogeneous">False</property> - <property name="row_spacing">0</property> - <property name="column_spacing">0</property> + <property name="spacing">0</property> <child> - <widget class="GtkButton" id="clearconsolebtn"> + <widget class="GtkScrolledWindow" id="scrolledwindow7"> + <property name="width_request">215</property> + <property name="height_request">488</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Clear</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_clearconsolebtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:22:56 GMT"/> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> + <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - <child> - <widget class="GtkButton" id="consoledecbtn"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">-</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_consoledecbtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:24:50 GMT"/> + <child> + <widget class="GtkTextView" id="mainconsole"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="overwrite">False</property> + <property name="accepts_tab">True</property> + <property name="justification">GTK_JUSTIFY_LEFT</property> + <property name="wrap_mode">GTK_WRAP_NONE</property> + <property name="cursor_visible">True</property> + <property name="pixels_above_lines">0</property> + <property name="pixels_below_lines">0</property> + <property name="pixels_inside_wrap">0</property> + <property name="left_margin">0</property> + <property name="right_margin">0</property> + <property name="indent">0</property> + <property name="text" translatable="yes"></property> + </widget> + </child> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> <child> - <widget class="GtkButton" id="consoleincbtn"> + <widget class="GtkTable" id="table17"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">+</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_consoleincbtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:24:05 GMT"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> + <property name="n_rows">1</property> + <property name="n_columns">4</property> + <property name="homogeneous">False</property> + <property name="row_spacing">0</property> + <property name="column_spacing">0</property> - <child> - <widget class="GtkButton" id="hideconsolebtn"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Hide</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_hideconsolebtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:23:55 GMT"/> + <child> + <widget class="GtkButton" id="consoledecbtn"> + <property name="width_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">-</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_consoledecbtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:24:50 GMT"/> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="consoleincbtn"> + <property name="width_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">+</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_consoleincbtn_clicked" last_modification_time="Thu, 23 Jul 2009 18:54:38 GMT"/> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="clearconsolebtn"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Clear</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_clearconsolebtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:22:56 GMT"/> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="hideconsolebtn"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Hide</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_hideconsolebtn_clicked" last_modification_time="Wed, 22 Jul 2009 15:23:55 GMT"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> </packing> </child> </widget> @@ -1212,14 +1229,10 @@ </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> </packing> </child> - - <child> - <placeholder/> - </child> </widget> </child> </widget>