From 6fd7ee7652de8f28f17d4723548977f3d61e6a2c Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Mon, 20 Feb 2012 15:08:06 -0500 Subject: [PATCH] Fix visio plugin to work with libcgraph --- plugin/visio/VisioGraphic.cpp | 6 +++++- plugin/visio/VisioRender.cpp | 14 +++++++++++--- plugin/visio/VisioText.cpp | 29 ++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/plugin/visio/VisioGraphic.cpp b/plugin/visio/VisioGraphic.cpp index 7f7ccc291..43dfde4b8 100644 --- a/plugin/visio/VisioGraphic.cpp +++ b/plugin/visio/VisioGraphic.cpp @@ -11,6 +11,10 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #ifdef _MSC_VER @@ -556,4 +560,4 @@ namespace Visio } -} \ No newline at end of file +} diff --git a/plugin/visio/VisioRender.cpp b/plugin/visio/VisioRender.cpp index 92374b07f..30a6c38dd 100644 --- a/plugin/visio/VisioRender.cpp +++ b/plugin/visio/VisioRender.cpp @@ -11,6 +11,10 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef _MSC_VER #include #define isfinite _finite @@ -185,8 +189,8 @@ namespace Visio Agedge_t* edge = job->obj->u.e; /* get previously saved ids for tail and head node; edge type for graph */ - NodeIds::const_iterator beginId = _nodeIds.find(edge->tail); - NodeIds::const_iterator endId = _nodeIds.find(edge->head); + NodeIds::const_iterator beginId = _nodeIds.find(agtail(edge)); + NodeIds::const_iterator endId = _nodeIds.find(aghead(edge)); /* output first connectable shape as an edge shape, all else as regular outer shapes */ bool firstConnector = true; @@ -195,7 +199,11 @@ namespace Visio _graphics[0], beginId == _nodeIds.end() ? 0 : beginId->second, endId == _nodeIds.end() ? 0 : endId->second, +#ifdef WITH_CGRAPH + EDGE_TYPE(agroot(edge)))) +#else EDGE_TYPE(edge->head->graph->root))) +#endif firstConnector = false; else PrintOuterShape(job, *nextGraphic); @@ -493,4 +501,4 @@ namespace Visio } } -} \ No newline at end of file +} diff --git a/plugin/visio/VisioText.cpp b/plugin/visio/VisioText.cpp index b18e5b769..1647ef597 100644 --- a/plugin/visio/VisioText.cpp +++ b/plugin/visio/VisioText.cpp @@ -11,10 +11,17 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "VisioText.h" #include "gvcjob.h" #include "gvio.h" +#ifdef WITH_CGRAPH +#include +#endif extern "C" char *xml_string(char* str); @@ -52,14 +59,22 @@ namespace Visio Run::Run(boxf bounds, char* text): _bounds(bounds), +#ifdef WITH_CGRAPH + _text(strdup(text)) /* copy text */ +#else _text(agstrdup(text)) /* copy text */ +#endif { } Run::~Run() { /* since we copied, we need to free */ +#ifdef WITH_CGRAPH + free(_text); +#else agstrfree(_text); +#endif } boxf Run::GetBounds() const @@ -156,17 +171,29 @@ namespace Visio } Hyperlink::Hyperlink(char* description, char* address, char* frame): +#ifdef WITH_CGRAPH + _description(strdup(description)), + _address(strdup(address)), + _frame(strdup(frame)) +#else _description(agstrdup(description)), _address(agstrdup(address)), _frame(agstrdup(frame)) +#endif { } Hyperlink::~Hyperlink() { +#ifdef WITH_CGRAPH + free(_description); + free(_address); + free(_frame); +#else agstrfree(_description); agstrfree(_address); agstrfree(_frame); +#endif } /* output the hyperlink */ @@ -184,4 +211,4 @@ namespace Visio gvputs(job, "\n"); } -} \ No newline at end of file +} -- 2.40.0