]> granicus.if.org Git - graphviz/commitdiff
Fix visio plugin to work with libcgraph
authorEmden Gansner <erg@research.att.com>
Mon, 20 Feb 2012 20:08:06 +0000 (15:08 -0500)
committerEmden Gansner <erg@research.att.com>
Mon, 20 Feb 2012 20:08:06 +0000 (15:08 -0500)
plugin/visio/VisioGraphic.cpp
plugin/visio/VisioRender.cpp
plugin/visio/VisioText.cpp

index 7f7ccc29110cb54b4d7fa8ff4d0edb3608088221..43dfde4b84b6964aa04f96458d1ac73061e817a0 100644 (file)
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <algorithm>
 
 #ifdef _MSC_VER
@@ -556,4 +560,4 @@ namespace Visio
        }
        
 
-}
\ No newline at end of file
+}
index 92374b07fa2e938de558ee388e0efee47173cf60..30a6c38dd8640c6787ab8b648739c7006465ee72 100644 (file)
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #ifdef _MSC_VER
 #include <cfloat>
 #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
+}
index b18e5b7691c1843e338db6ccb83803f34b0d36a1..1647ef59724fab59ae83894489e5119db634624f 100644 (file)
  * 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 <string.h>
+#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, "</Hyperlink>\n");
        }
        
-}
\ No newline at end of file
+}