From cc4253926526efc87385de9640e64cd5cf062ada Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 10 Sep 2019 22:19:09 +0200 Subject: Refactoring code for dot related source files --- src/CMakeLists.txt | 15 +-- src/configimpl.l | 27 +++++ src/dot.cpp | 273 +++++------------------------------------- src/dot.h | 43 ++----- src/dotdirdeps.cpp | 8 +- src/dotfilepatcher.cpp | 152 ++++++++++++++++++++++- src/dotfilepatcher.h | 21 +++- src/dotgraph.cpp | 101 +++++----------- src/dotgraph.h | 9 -- src/dotgroupcollaboration.cpp | 11 +- src/dotlegendgraph.cpp | 72 +++++++++++ src/dotlegendgraph.h | 35 ++++++ src/dotnode.cpp | 4 +- src/dotrunner.cpp | 18 +-- src/dotrunner.h | 8 +- src/doxygen.cpp | 1 - src/index.cpp | 7 +- src/util.cpp | 6 +- 18 files changed, 406 insertions(+), 405 deletions(-) create mode 100644 src/dotlegendgraph.cpp create mode 100644 src/dotlegendgraph.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7233052..217f391 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -181,16 +181,17 @@ add_library(_doxygen STATIC docparser.cpp docsets.cpp dot.cpp - dotcallgraph.cpp - dotclassgraph.cpp - dotdirdeps.cpp - dotfilepatcher.cpp + dotcallgraph.cpp + dotlegendgraph.cpp + dotclassgraph.cpp + dotdirdeps.cpp + dotfilepatcher.cpp dotgfxhierarchytable.cpp dotgraph.cpp - dotgroupcollaboration.cpp - dotincldepgraph.cpp + dotgroupcollaboration.cpp + dotincldepgraph.cpp dotnode.cpp - dotrunner.cpp + dotrunner.cpp doxygen.cpp eclipsehelp.cpp emoji.cpp diff --git a/src/configimpl.l b/src/configimpl.l index 2d91e12..e52a757 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -30,6 +30,7 @@ #include #include #include +#include #include "configimpl.h" #include "version.h" @@ -1531,6 +1532,7 @@ void Config::checkAndCorrect() // dotImageFormat = "png"; //} + // correct DOT_FONTNAME if needed QCString &dotFontName=Config_getString(DOT_FONTNAME); if (dotFontName=="FreeSans" || dotFontName=="FreeSans.ttf") { @@ -1538,7 +1540,32 @@ void Config::checkAndCorrect() "You may want to clear or change DOT_FONTNAME.\n" "Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n"); } + else if (dotFontName.isEmpty()) + { + dotFontName = "Helvetica"; + } + // clip dotFontSize against the maximum bounds + int &dotFontSize = Config_getInt(DOT_FONTSIZE); + if (dotFontSize<4) + { + dotFontSize=4; + } + else if (dotFontSize>24) + { + dotFontSize=24; + } + + // clip number of threads + int &dotNumThreads = Config_getInt(DOT_NUM_THREADS); + if (dotNumThreads>32) + { + dotNumThreads=32; + } + else if (dotNumThreads<=0) + { + dotNumThreads=QMAX(2,QThread::idealThreadCount()+1); + } // check dot path QCString &dotPath = Config_getString(DOT_PATH); diff --git a/src/dot.cpp b/src/dot.cpp index 5cdf92c..5ad3916 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -16,12 +16,6 @@ #include #include -#include -#include -#include -#include -#include -#include #include "config.h" #include "dot.h" @@ -37,34 +31,8 @@ #define MAP_CMD "cmapx" -static int DOT_NUM_THREADS; // will be initialized in initDot - //-------------------------------------------------------------------- -void initDot() -{ - DotGraph::DOT_FONTNAME = Config_getString(DOT_FONTNAME); - if (DotGraph::DOT_FONTNAME.isEmpty()) - { - DotGraph::DOT_FONTNAME="Helvetica"; - } - - DotGraph::DOT_FONTSIZE = Config_getInt(DOT_FONTSIZE); - if (DotGraph::DOT_FONTSIZE<4) DotGraph::DOT_FONTSIZE=4; - - DOT_NUM_THREADS = Config_getInt(DOT_NUM_THREADS); - if (DOT_NUM_THREADS > 32) DOT_NUM_THREADS = 32; - if (DOT_NUM_THREADS <= 0) DOT_NUM_THREADS = QMAX(2,QThread::idealThreadCount()+1); - - // these are copied to be sure to be thread save - DotRunner::DOT_CLEANUP = Config_getBool(DOT_CLEANUP); - DotRunner::DOT_MULTI_TARGETS = Config_getBool(DOT_MULTI_TARGETS); - DotRunner::DOT_EXE.init(Config_getString(DOT_PATH) + "dot"); - - DotGraph::IMG_EXT = getDotImageExtension(); -} - - static QCString g_dotFontPath; static void setDotFontPath(const char *path) @@ -102,95 +70,6 @@ static void unsetDotFontPath() g_dotFontPath=""; } -// extract size from a dot generated SVG file -static bool readSVGSize(const QCString &fileName,int *width,int *height) -{ - bool found=FALSE; - QFile f(fileName); - if (!f.open(IO_ReadOnly)) - { - return FALSE; - } - const int maxLineLen=4096; - char buf[maxLineLen]; - while (!f.atEnd() && !found) - { - int numBytes = f.readLine(buf,maxLineLen-1); // read line - if (numBytes>0) - { - buf[numBytes]='\0'; - if (qstrncmp(buf,"" << endl; } if (!m_noDivTag) t << "" << endl; @@ -247,16 +251,20 @@ void DotGraph::generateCode(FTextStream &t) t << endl; if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, getMapLabel())) { - int mapId = DotManager::instance()->addMap(m_fileName, absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel()); + int mapId = DotManager::instance()-> + createFilePatcher(m_fileName)-> + addMap(absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel()); t << "" << endl; } } } else if (m_graphFormat==GOF_EPS) // produce tex to include the .eps image { - if (m_regenerate || !writeVecGfxFigure(t,m_baseName,absBaseName())) + if (m_regenerate || !DotFilePatcher::writeVecGfxFigure(t,m_baseName,absBaseName())) { - int figId = DotManager::instance()->addFigure(m_fileName,m_baseName,absBaseName(),FALSE /*TRUE*/); + int figId = DotManager::instance()-> + createFilePatcher(m_fileName)-> + addFigure(m_baseName,absBaseName(),FALSE /*TRUE*/); t << endl << "% FIG " << figId << endl; } } @@ -264,6 +272,8 @@ void DotGraph::generateCode(FTextStream &t) void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) { + int fontSize = Config_getInt(DOT_FONTSIZE); + QCString fontName = Config_getString(DOT_FONTNAME); t << "digraph "; if (title.isEmpty()) { @@ -284,12 +294,12 @@ void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) { t << " bgcolor=\"transparent\";" << endl; } - t << " edge [fontname=\"" << DOT_FONTNAME << "\"," - "fontsize=\"" << DOT_FONTSIZE << "\"," - "labelfontname=\"" << DOT_FONTNAME << "\"," - "labelfontsize=\"" << DOT_FONTSIZE << "\"];\n"; - t << " node [fontname=\"" << DOT_FONTNAME << "\"," - "fontsize=\"" << DOT_FONTSIZE << "\",shape=record];\n"; + t << " edge [fontname=\"" << fontName << "\"," + "fontsize=\"" << fontSize << "\"," + "labelfontname=\"" << fontName << "\"," + "labelfontsize=\"" << fontSize << "\"];\n"; + t << " node [fontname=\"" << fontName << "\"," + "fontsize=\"" << fontSize << "\",shape=record];\n"; } void DotGraph::writeGraphFooter(FTextStream &t) @@ -347,54 +357,3 @@ void DotGraph::computeGraph(DotNode *root, graphStr=buf.data(); } -bool DotGraph::writeVecGfxFigure(FTextStream &out,const QCString &baseName, - const QCString &figureName) -{ - int width=400,height=550; - if (Config_getBool(USE_PDFLATEX)) - { - if (!DotRunner::readBoundingBox(figureName+".pdf",&width,&height,FALSE)) - { - //printf("writeVecGfxFigure()=0\n"); - return FALSE; - } - } - else - { - if (!DotRunner::readBoundingBox(figureName+".eps",&width,&height,TRUE)) - { - //printf("writeVecGfxFigure()=0\n"); - return FALSE; - } - } - //printf("Got PDF/EPS size %d,%d\n",width,height); - int maxWidth = 350; /* approx. page width in points, excl. margins */ - int maxHeight = 550; /* approx. page height in points, excl. margins */ - out << "\\nopagebreak\n" - "\\begin{figure}[H]\n" - "\\begin{center}\n" - "\\leavevmode\n"; - if (width>maxWidth || height>maxHeight) // figure too big for page - { - // c*width/maxWidth > c*height/maxHeight, where c=maxWidth*maxHeight>0 - if (width*maxHeight>height*maxWidth) - { - out << "\\includegraphics[width=" << maxWidth << "pt]"; - } - else - { - out << "\\includegraphics[height=" << maxHeight << "pt]"; - } - } - else - { - out << "\\includegraphics[width=" << width << "pt]"; - } - - out << "{" << baseName << "}\n" - "\\end{center}\n" - "\\end{figure}\n"; - - //printf("writeVecGfxFigure()=1\n"); - return TRUE; -} diff --git a/src/dotgraph.h b/src/dotgraph.h index 27d6938..0eda3a8 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -34,11 +34,6 @@ class DotGraph DotGraph() : m_curNodeNumber(0), m_doNotAddImageToIndex(FALSE), m_noDivTag(FALSE), m_zoomable(TRUE), m_urlOnly(FALSE) {} virtual ~DotGraph() {} - static QCString DOT_FONTNAME; // will be initialized in initDot - static int DOT_FONTSIZE; // will be initialized in initDot - - static bool writeVecGfxFigure(FTextStream& out, const QCString& baseName, const QCString& figureName); - protected: /** returns node numbers. The Counter is reset by the constructor */ int getNextNodeNumber() { return ++m_curNodeNumber; } @@ -72,10 +67,6 @@ class DotGraph virtual void computeTheGraph() = 0; - static QCString IMG_EXT; - - friend void initDot(); - QCString absBaseName() const { return m_absPath + m_baseName; } QCString absDotName() const { return m_absPath + m_baseName + ".dot"; } QCString imgName() const; diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index be55ac0..f9a11e7 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -356,9 +356,10 @@ bool DotGroupCollaboration::isTrivial() const return m_usedNodes->count() <= 1; } -void DotGroupCollaboration::writeGraphHeader(FTextStream &t, - const QCString &title) const +void DotGroupCollaboration::writeGraphHeader(FTextStream &t,const QCString &title) const { + int fontSize = Config_getInt(DOT_FONTSIZE); + QCString fontName = Config_getString(DOT_FONTNAME); t << "digraph "; if (title.isEmpty()) { @@ -374,8 +375,8 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t, { t << " bgcolor=\"transparent\";" << endl; } - t << " edge [fontname=\"" << DOT_FONTNAME << "\",fontsize=\"" << DOT_FONTSIZE << "\"," - "labelfontname=\"" << DOT_FONTNAME << "\",labelfontsize=\"" << DOT_FONTSIZE << "\"];\n"; - t << " node [fontname=\"" << DOT_FONTNAME << "\",fontsize=\"" << DOT_FONTSIZE << "\",shape=box];\n"; + t << " edge [fontname=\"" << fontName << "\",fontsize=\"" << fontSize << "\"," + "labelfontname=\"" << fontName << "\",labelfontsize=\"" << fontSize << "\"];\n"; + t << " node [fontname=\"" << fontName << "\",fontsize=\"" << fontSize << "\",shape=box];\n"; t << " rankdir=LR;\n"; } diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp new file mode 100644 index 0000000..98e1f88 --- /dev/null +++ b/src/dotlegendgraph.cpp @@ -0,0 +1,72 @@ +/****************************************************************************** +* +* Copyright (C) 1997-2019 by Dimitri van Heesch. +* +* Permission to use, copy, modify, and distribute this software and its +* documentation under the terms of the GNU General Public License is hereby +* granted. No representations are made about the suitability of this software +* for any purpose. It is provided "as is" without express or implied warranty. +* See the GNU General Public License for more details. +* +* Documents produced by Doxygen are derivative works derived from the +* input used in their production; they are not affected by this license. +* +*/ + +#include "dotlegendgraph.h" +#include "util.h" +#include "config.h" +#include "doxygen.h" +#include "dot.h" +#include "language.h" +#include "dotfilepatcher.h" + +void DotLegendGraph::writeGraph(const char *path) +{ + FTextStream ts; + DotGraph::writeGraph(ts, GOF_BITMAP, EOF_Html, path, "", "", FALSE, 0); + + if (getDotImageExtension()=="svg") + { + DotManager::instance()-> + createFilePatcher(absBaseName()+Config_getString(HTML_FILE_EXTENSION))-> + addSVGObject("graph_legend", absImgName(),QCString()); + } +} + +QCString DotLegendGraph::getBaseName() const +{ + return "graph_legend"; +} + +void DotLegendGraph::computeTheGraph() +{ + int fontSize = Config_getInt(DOT_FONTSIZE); + QCString fontName = Config_getString(DOT_FONTNAME); + FTextStream md5stream(&m_theGraph); + writeGraphHeader(md5stream,theTranslator->trLegendTitle()); + md5stream << " Node9 [shape=\"box\",label=\"Inherited\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",fillcolor=\"grey75\",style=\"filled\" fontcolor=\"black\"];\n"; + md5stream << " Node10 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node10 [shape=\"box\",label=\"PublicBase\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + md5stream << " Node11 -> Node10 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node11 [shape=\"box\",label=\"Truncated\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"red\"];\n"; + md5stream << " Node13 -> Node9 [dir=\"back\",color=\"darkgreen\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node13 [shape=\"box\",label=\"ProtectedBase\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + md5stream << " Node14 -> Node9 [dir=\"back\",color=\"firebrick4\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node14 [shape=\"box\",label=\"PrivateBase\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + md5stream << " Node15 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node15 [shape=\"box\",label=\"Undocumented\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"grey75\"];\n"; + md5stream << " Node16 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node16 [shape=\"box\",label=\"Templ< int >\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + md5stream << " Node17 -> Node16 [dir=\"back\",color=\"orange\",fontsize=\"" << fontSize << "\",style=\"dashed\",label=\"< int >\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node17 [shape=\"box\",label=\"Templ< T >\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + md5stream << " Node18 -> Node9 [dir=\"back\",color=\"darkorchid3\",fontsize=\"" << fontSize << "\",style=\"dashed\",label=\"m_usedClass\",fontname=\"" << fontName << "\"];\n"; + md5stream << " Node18 [shape=\"box\",label=\"Used\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; + writeGraphFooter(md5stream); +} + +QCString DotLegendGraph::getMapLabel() const +{ + return ""; +} + diff --git a/src/dotlegendgraph.h b/src/dotlegendgraph.h new file mode 100644 index 0000000..2d8eeec --- /dev/null +++ b/src/dotlegendgraph.h @@ -0,0 +1,35 @@ +/****************************************************************************** +* +* Copyright (C) 1997-2019 by Dimitri van Heesch. +* +* Permission to use, copy, modify, and distribute this software and its +* documentation under the terms of the GNU General Public License is hereby +* granted. No representations are made about the suitability of this software +* for any purpose. It is provided "as is" without express or implied warranty. +* See the GNU General Public License for more details. +* +* Documents produced by Doxygen are derivative works derived from the +* input used in their production; they are not affected by this license. +* +*/ + +#ifndef DOTLEGENDGRAPH_H +#define DOTLEGENDGRAPH_H + +#include "dotgraph.h" + +/** Representation of a legend explaining the meaning of boxes, arrows, and colors */ +class DotLegendGraph : public DotGraph +{ + public: + void writeGraph(const char *path); + + private: + virtual QCString getBaseName() const; + virtual void computeTheGraph(); + virtual QCString getMapLabel() const; + +}; + +#endif + diff --git a/src/dotnode.cpp b/src/dotnode.cpp index ae06fb2..491bcb5 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -540,7 +540,7 @@ void DotNode::writeArrow(FTextStream &t, if (pointBack && !umlUseArrow) t << "dir=\"back\","; t << "color=\"" << eProps->edgeColorMap[ei->color()] - << "\",fontsize=\"" << DotGraph::DOT_FONTSIZE << "\","; + << "\",fontsize=\"" << Config_getInt(DOT_FONTSIZE) << "\","; t << "style=\"" << eProps->edgeStyleMap[ei->style()] << "\""; if (!ei->label().isEmpty()) { @@ -559,7 +559,7 @@ void DotNode::writeArrow(FTextStream &t, t << ",arrowhead=\"" << eProps->arrowStyleMap[ei->color()] << "\""; } - if (format==GOF_BITMAP) t << ",fontname=\"" << DotGraph::DOT_FONTNAME << "\""; + if (format==GOF_BITMAP) t << ",fontname=\"" << Config_getString(DOT_FONTNAME) << "\""; t << "];" << endl; } diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 3a621c7..c01a4e5 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -28,6 +28,7 @@ #define MAX_LATEX_GRAPH_INCH 150 #define MAX_LATEX_GRAPH_SIZE (MAX_LATEX_GRAPH_INCH * 72) +//----------------------------------------------------------------------------------------- // since dot silently reproduces the input file when it does not // support the PNG format, we need to check the result. @@ -142,12 +143,11 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool return FALSE; } -bool DotRunner::DOT_CLEANUP; -bool DotRunner::DOT_MULTI_TARGETS; -DotConstString DotRunner::DOT_EXE; +//--------------------------------------------------------------------------------- DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) - : m_file(absDotName), m_md5Hash(md5Hash), m_cleanUp(DOT_CLEANUP) + : m_file(absDotName), m_md5Hash(md5Hash), m_cleanUp(Config_getBool(DOT_CLEANUP)), + m_dotExe(Config_getString(DOT_PATH)+"dot") { m_jobs.setAutoDelete(TRUE); } @@ -183,7 +183,7 @@ bool DotRunner::run() DotJob *s; // create output - if (DOT_MULTI_TARGETS) + if (Config_getBool(DOT_MULTI_TARGETS)) { dotArgs=QCString("\"")+m_file.data()+"\""; for (li.toFirst();(s=li.current());++li) @@ -191,14 +191,14 @@ bool DotRunner::run() dotArgs+=' '; dotArgs+=s->args.data(); } - if ((exitCode=portable_system(DOT_EXE.data(),dotArgs,FALSE))!=0) goto error; + if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } else { for (li.toFirst();(s=li.current());++li) { dotArgs=QCString("\"")+m_file.data()+"\" "+s->args.data(); - if ((exitCode=portable_system(DOT_EXE.data(),dotArgs,FALSE))!=0) goto error; + if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } } @@ -214,7 +214,7 @@ bool DotRunner::run() { if (!resetPDFSize(width,height,getBaseNameOfOutput(s->output.data()))) goto error; dotArgs=QCString("\"")+m_file.data()+"\" "+s->args.data(); - if ((exitCode=portable_system(DOT_EXE.data(),dotArgs,FALSE))!=0) goto error; + if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } } @@ -245,7 +245,7 @@ bool DotRunner::run() return TRUE; error: err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n", - exitCode,DOT_EXE.data(),dotArgs.data()); + exitCode,m_dotExe.data(),dotArgs.data()); return FALSE; } diff --git a/src/dotrunner.h b/src/dotrunner.h index 4128fe8..1b68c18 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -34,7 +34,6 @@ class DotConstString DotConstString(const DotConstString &s) : m_str(0) { set(s.data()); } const char *data() const { return m_str; } bool isEmpty() const { return m_str==0 || m_str[0]=='\0'; } - void init(const char *s) { set(s); } private: void set(char const* s) @@ -101,14 +100,9 @@ class DotRunner private: DotConstString m_file; DotConstString m_md5Hash; + DotConstString m_dotExe; bool m_cleanUp; QList m_jobs; - - static bool DOT_CLEANUP; - static bool DOT_MULTI_TARGETS; - static DotConstString DOT_EXE; - friend void initDot(); - }; /** Queue of dot jobs to run. */ diff --git a/src/doxygen.cpp b/src/doxygen.cpp index a6455fc..f8e54de 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11680,7 +11680,6 @@ void generateOutput() } initSearchIndexer(); - initDot(); bool generateHtml = Config_getBool(GENERATE_HTML); bool generateLatex = Config_getBool(GENERATE_LATEX); diff --git a/src/index.cpp b/src/index.cpp index 0631ee4..f5faea4 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -41,6 +41,7 @@ #include "ftvhelp.h" #include "dot.h" #include "dotgfxhierarchytable.h" +#include "dotlegendgraph.h" #include "pagedef.h" #include "dirdef.h" #include "vhdldocgen.h" @@ -3919,7 +3920,9 @@ void writeGraphInfo(OutputList &ol) if (!Config_getBool(HAVE_DOT) || !Config_getBool(GENERATE_HTML)) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - generateGraphLegend(Config_getString(HTML_OUTPUT)); + + DotLegendGraph gd; + gd.writeGraph(Config_getString(HTML_OUTPUT)); bool &stripCommentsStateRef = Config_getBool(STRIP_CODE_COMMENTS); bool oldStripCommentsState = stripCommentsStateRef; @@ -3944,7 +3947,7 @@ void writeGraphInfo(OutputList &ol) legendDocs = legendDocs.left(s+8) + "[!-- SVG 0 --]\n" + legendDocs.mid(e); //printf("legendDocs=%s\n",legendDocs.data()); } - FileDef *fd = createFileDef("","graph_legend"); + FileDef *fd = createFileDef("","graph_legend.dox"); ol.generateDoc("graph_legend",1,fd,0,legendDocs,FALSE,FALSE); delete fd; diff --git a/src/util.cpp b/src/util.cpp index 8816de1..4dc7c71 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -9051,9 +9051,9 @@ bool mainPageHasTitle() QCString getDotImageExtension(void) { - QCString imgExt = Config_getEnum(DOT_IMAGE_FORMAT); - imgExt = imgExt.replace( QRegExp(":.*"), "" ); - return imgExt; + QCString imgExt = Config_getEnum(DOT_IMAGE_FORMAT); + int i= imgExt.find(':'); // strip renderer part when using e.g. 'png:cairo:gd' as format + return i==-1 ? imgExt : imgExt.left(i); } bool openOutputFile(const char *outFile,QFile &f) -- cgit v0.12