diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-15 19:52:11 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-15 19:52:11 (GMT) |
commit | 640babbbb6882ce1b1e52563c0617e2f4213eeb8 (patch) | |
tree | bc73f10ae9a4b60f97e656106d08de380d012457 /src/latexdocvisitor.cpp | |
parent | 79ad8414d813c1126e2807f4321ca4c70d6291fa (diff) | |
download | Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.zip Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.tar.gz Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.tar.bz2 |
Release-1.3.3-20030915
Diffstat (limited to 'src/latexdocvisitor.cpp')
-rw-r--r-- | src/latexdocvisitor.cpp | 134 |
1 files changed, 87 insertions, 47 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 459fddb..1a6c889 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -263,6 +263,31 @@ void LatexDocVisitor::visit(DocVerbatim *s) case DocVerbatim::LatexOnly: m_t << s->text(); break; + case DocVerbatim::Dot: + { + static int dotindex = 1; + QCString fileName(4096); + + fileName.sprintf("%s%d", + (Config_getString("LATEX_OUTPUT")+"/inline_dotgraph_").data(), + dotindex++ + ); + QFile file(fileName); + if (!file.open(IO_WriteOnly)) + { + err("Could not open file %s for writing\n",fileName.data()); + } + file.writeBlock( s->text(), s->text().length() ); + file.close(); + + m_t << "\\begin{center}\n"; + startDotFile(fileName,"","",FALSE); + endDotFile(FALSE); + m_t << "\\end{center}\n"; + + file.remove(); + } + break; } } @@ -742,58 +767,13 @@ void LatexDocVisitor::visitPost(DocImage *img) void LatexDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; - QString baseName=df->file(); - int i; - if ((i=baseName.findRev('/'))!=-1) - { - baseName=baseName.right(baseName.length()-i-1); - } - if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") - { - baseName=baseName.left(baseName.length()-4); - } - if (baseName.right(4)==".dot") - { - baseName=baseName.left(baseName.length()-4); - } - QString outDir = Config_getString("LATEX_OUTPUT"); - QString name = df->file(); - writeDotGraphFromFile(name,outDir,baseName,EPS); - if (df->hasCaption()) - { - m_t << "\\begin{figure}[H]" << endl; - m_t << "\\begin{center}" << endl; - } - else - { - m_t << "\\mbox{"; - } - m_t << "\\includegraphics"; - if (!df->width().isEmpty()) - { - m_t << "[width=" << df->width() << "]"; - } - else if (!df->height().isEmpty()) - { - m_t << "[height=" << df->height() << "]"; - } - m_t << "{" << baseName << "}"; - - if (df->hasCaption()) - { - m_t << "\\caption{"; - } + startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); } void LatexDocVisitor::visitPost(DocDotFile *df) { if (m_hide) return; - m_t << "}" << endl; // end mbox or caption - if (df->hasCaption()) - { - m_t << "\\end{center}" << endl; - m_t << "\\end{figure}" << endl; - } + endDotFile(df->hasCaption()); } void LatexDocVisitor::visitPre(DocLink *lnk) @@ -1016,3 +996,63 @@ void LatexDocVisitor::popEnabled() delete v; } +void LatexDocVisitor::startDotFile(const QString &fileName, + const QString &width, + const QString &height, + bool hasCaption + ) +{ + QString baseName=fileName; + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") + { + baseName=baseName.left(baseName.length()-4); + } + if (baseName.right(4)==".dot") + { + baseName=baseName.left(baseName.length()-4); + } + QString outDir = Config_getString("LATEX_OUTPUT"); + QString name = fileName; + writeDotGraphFromFile(name,outDir,baseName,EPS); + if (hasCaption) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + m_t << "\\includegraphics"; + if (!width.isEmpty()) + { + m_t << "[width=" << width << "]"; + } + else if (!height.isEmpty()) + { + m_t << "[height=" << height << "]"; + } + m_t << "{" << baseName << "}"; + + if (hasCaption) + { + m_t << "\\caption{"; + } +} + +void LatexDocVisitor::endDotFile(bool hasCaption) +{ + if (m_hide) return; + m_t << "}" << endl; // end mbox or caption + if (hasCaption) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } +} + |