diff options
author | albert-github <albert.tests@gmail.com> | 2018-08-09 17:49:58 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2018-08-09 17:49:58 (GMT) |
commit | 4682b91364247aafe66b6af472e321511e115e7c (patch) | |
tree | e267667bec90cebd6a38c757c7b2047f7d7e22ec /src/latexdocvisitor.cpp | |
parent | 69829b043fb36a56d194dc31522b694379636855 (diff) | |
download | Doxygen-4682b91364247aafe66b6af472e321511e115e7c.zip Doxygen-4682b91364247aafe66b6af472e321511e115e7c.tar.gz Doxygen-4682b91364247aafe66b6af472e321511e115e7c.tar.bz2 |
Inline images
Create the possibility of inline images with the `\image` command by means of the option `inline`.
Diffstat (limited to 'src/latexdocvisitor.cpp')
-rw-r--r-- | src/latexdocvisitor.cpp | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index d2c4c5d..03f9872 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -48,16 +48,23 @@ static const char *getSectionName(int level) return secLabels[QMIN(maxLevels-1,l)]; } -static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height) +static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height, const bool inlineImage = FALSE) { - if (hasCaption) + if (inlineImage) { - t << "\n\\begin{DoxyImage}\n"; + t << "\n\\begin{DoxyInlineImage}\n"; } else { - t << "\n\\begin{DoxyImageNoCaption}\n" - " \\mbox{"; + if (hasCaption) + { + t << "\n\\begin{DoxyImage}\n"; + } + else + { + t << "\n\\begin{DoxyImageNoCaption}\n" + " \\mbox{"; + } } t << "\\includegraphics"; @@ -80,7 +87,14 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, if (width.isEmpty() && height.isEmpty()) { /* default setting */ - t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]"; + if (inlineImage) + { + t << "[height=\\baselineskip,keepaspectratio=true]"; + } + else + { + t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]"; + } } else { @@ -91,21 +105,36 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, if (hasCaption) { - t << "\n\\doxyfigcaption{"; + if (!inlineImage) + { + t << "\n\\doxyfigcaption{"; + } + else + { + t << "%"; // to catch the caption + } } } -static void visitPostEnd(FTextStream &t, const bool hasCaption) +static void visitPostEnd(FTextStream &t, const bool hasCaption, const bool inlineImage = FALSE) { - t << "}\n"; // end mbox or caption - if (hasCaption) + if (inlineImage) { - t << "\\end{DoxyImage}\n"; + t << "\n\\end{DoxyInlineImage}\n"; } - else{ - t << "\\end{DoxyImageNoCaption}\n"; + else + { + t << "}\n"; // end mbox or caption + if (hasCaption) + { + t << "\\end{DoxyImage}\n"; + } + else + { + t << "\\end{DoxyImageNoCaption}\n"; + } } } @@ -1280,7 +1309,7 @@ void LatexDocVisitor::visitPre(DocImage *img) gfxName=gfxName.left(gfxName.length()-4); } - visitPreStart(m_t,img->hasCaption(), gfxName, img->width(), img->height()); + visitPreStart(m_t,img->hasCaption(), gfxName, img->width(), img->height(), img->isInlineImage()); } else // other format -> skip { @@ -1294,7 +1323,7 @@ void LatexDocVisitor::visitPost(DocImage *img) if (img->type()==DocImage::Latex) { if (m_hide) return; - visitPostEnd(m_t,img->hasCaption()); + visitPostEnd(m_t,img->hasCaption(), img->isInlineImage()); } else // other format { |