From fda2b700418425c14721dd65a74c1cf908d3b851 Mon Sep 17 00:00:00 2001 From: arif Date: Thu, 23 Apr 2009 20:15:16 +0000 Subject: [PATCH] selection and moving tools fixed graph can be modified and be saved with new position info, --- cmd/smyrna/selection.c | 17 +++++++++++++++++ cmd/smyrna/topview.c | 5 ++--- cmd/smyrna/viewport.c | 7 +++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/cmd/smyrna/selection.c b/cmd/smyrna/selection.c index 5c28d2ea8..f3e45a474 100755 --- a/cmd/smyrna/selection.c +++ b/cmd/smyrna/selection.c @@ -410,6 +410,20 @@ view->Topview->Graphdata.selectedEdges = return 1; } +static void update_cgraph_pos(topview_node* N) +{ + char buf[512]; + double x, y; + Agsym_t* pos; + Agnode_t* obj=N->Node; + + if ((AGTYPE(obj) == AGNODE) && (pos = agattrsym (obj, "pos"))) + { + sprintf (buf, "%lf,%lf",N->distorted_x,N->distorted_y); + agxset(obj, pos, buf); + } +} + int deselect_node(topview_node* N) { @@ -431,10 +445,13 @@ int deselect_node(topview_node* N) N->data.Selected=0; N->data.selectionflag=0; } + /*update cgraph with pos values*/ + update_cgraph_pos(N); return 1; } + int deselect_edge(topview_edge* E) { diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 2954dbef6..8004ad0ac 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -458,11 +458,10 @@ static int drawtopviewnodes(Agraph_t * g) if (v->update_required) update_topview_node_from_cgraph(v); if (v->data.Selected == 1) { -/* glColor4f(view->selectedNodeColor.R, + glColor4f(view->selectedNodeColor.R, view->selectedNodeColor.G, view->selectedNodeColor.B, - view->selectedNodeColor.A); */ - glColor4f(1,0,0,1); + view->selectedNodeColor.A); ddx = dx; ddy = dy; ddz = dz; diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 97063dd6c..0c7688d14 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -465,6 +465,13 @@ void init_viewport(ViewInfo * view) set_viewport_settings_from_template(view, view->default_attributes); view->dfltViewType = VT_NONE; view->dfltEngine = GVK_NONE; + view->Topview->Graphdata.selectedNodesCount=0; + view->Topview->Graphdata.GraphFileName=(char*)0; + view->Topview->Graphdata.Modified=0; + view->Topview->Graphdata.selectedEdges=0; + view->Topview->Graphdata.selectedEdgesCount=0; + view->Topview->Graphdata.selectedNodes=0; + //create fontset } -- 2.40.0