Commit 329a4ddc authored by albert-github's avatar albert-github
Browse files

Limit images sizes and make more uniform (LaTeX)

This patch adjusts some problems regarding image sizes in LaTeX output of doxygen (a.o. Bug 738299 - When using msc or PlantUML, the default latex for the created image should include [width=\linewidth]) this has been done is such a way that all the "image" commands (i.e. image, dot, dotfile, msc, mscfile, diafile, startuml) operate in a similar way / have the same possibilities.

- commands.doc
Adjusted documentation to reflect changes.

- cmdmapper.cpp
- cmdmapper.h
Added utility function to map command id back to command name

- doctokenizer.h
- doctokenizer.l
Handle Caption  and Size indication. Required also that some other rules had to be tightened a bit (like usage of {} in startuml and usage of "" for captions. This was already described in the documentation in this way).

- docparser.cpp
- docparser.h
Created routine to uniformly handle the Caption and size indications and store them in a general way.

- latexgen.cpp
Replaced graphicx package by adjustbox package (includes graphicx) to support "min width" etc.

- doxygen.sty templates\latex
Added commands to make commands with and without caption behave similar.

- docbookvisitor.cpp
- docbookvisitor.h
- htmldocvisitor.cpp
- latexdocvisitor.cpp
- latexdocvisitor.h
- printdocvisitor.h
- xmldocvisitor.cpp
Created routine to uniformly handle the Caption and size indications in a general way.

- indexpage.xml (testing\022)
- indexpage.xml (testing\031)
- class_receiver.xml (testing\037)
- class_sender.xml (testing\037)
Adjusted example output.
parent 0fea3d4c
Loading
Loading
Loading
Loading
+83 −24
Original line number Original line Diff line number Diff line
@@ -2451,13 +2451,25 @@ only copy the detailed documentation, not the brief description.
              \ref cmdhtmlonly "\\htmlonly".
              \ref cmdhtmlonly "\\htmlonly".


<hr>
<hr>
\section cmddot \\dot
\section cmddot \\dot ["caption"] [<sizeindication>=<size>]


  \addindex \\dot
  \addindex \\dot
  Starts a text fragment which should contain a valid description of a
  Starts a text fragment which should contain a valid description of a
  dot graph. The text fragment ends with \ref cmdenddot "\\enddot".
  dot graph. The text fragment ends with \ref cmdenddot "\\enddot".
  Doxygen will pass the text on to dot and include the resulting
  Doxygen will pass the text on to dot and include the resulting
  image (and image map) into the output.
  image (and image map) into the output.

  The first argument is optional and can be used to specify the caption
  that is displayed below the image. This argument has to be specified
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.

  The second argument is also optional and can be used to specify the
  width or height of the image.
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

  The nodes of a graph can be made clickable by using the URL attribute.
  The nodes of a graph can be made clickable by using the URL attribute.
  By using the command \ref cmdref "\\ref" inside the URL value you can conveniently
  By using the command \ref cmdref "\\ref" inside the URL value you can conveniently
  link to an item inside doxygen. Here is an example:
  link to an item inside doxygen. Here is an example:
@@ -2485,12 +2497,24 @@ class C {};
\endcode
\endcode


<hr>
<hr>
\section cmdmsc \\msc
\section cmdmsc \\msc ["caption"] [<sizeindication>=<size>]


  \addindex \\msc
  \addindex \\msc
  Starts a text fragment which should contain a valid description of a
  Starts a text fragment which should contain a valid description of a
  message sequence chart. See http://www.mcternan.me.uk/mscgen/ for examples.
  message sequence chart. See http://www.mcternan.me.uk/mscgen/ for examples.
  The text fragment ends with \ref cmdendmsc "\\endmsc".
  The text fragment ends with \ref cmdendmsc "\\endmsc".

  The first argument is optional and can be used to specify the caption
  that is displayed below the image. This argument has to be specified
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.

  The second argument is also optional and can be used to specify the
  width or height of the image. 
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

  \note The text fragment should only include the part of the message
  \note The text fragment should only include the part of the message
  sequence chart that is
  sequence chart that is
  within the <code>msc {...}</code> block.
  within the <code>msc {...}</code> block.
@@ -2534,7 +2558,7 @@ class Receiver
  \sa section \ref cmdmscfile "\\mscfile".
  \sa section \ref cmdmscfile "\\mscfile".


<hr>
<hr>
\section cmdstartuml \\startuml
\section cmdstartuml \\startuml [{file}] ["caption"] [<sizeindication>=<size>]


  \addindex \\startuml
  \addindex \\startuml
  Starts a text fragment which should contain a valid description of a
  Starts a text fragment which should contain a valid description of a
@@ -2544,6 +2568,28 @@ class Receiver
  if you want to use this command. The location of the jar file should be specified
  if you want to use this command. The location of the jar file should be specified
  using \ref cfg_plantuml_jar_path "PLANTUML_JAR_PATH".
  using \ref cfg_plantuml_jar_path "PLANTUML_JAR_PATH".


  The first argument is optional and is for compatibility with running PlantUML as a preprocessing
  step before running doxygen, you can also add the name of the image file after \c \\startuml
  and inside curly brackets, i.e.
  \verbatim
  @startuml{myimage.png}
  Alice -> Bob : Hello
  @enduml
  \endverbatim
  When the name of the image is specified, doxygen will generate an image with that name.
  Without the name doxygen will choose a name automatically.

  The second argument is optional and can be used to specify the caption
  that is displayed below the image. This argument has to be specified
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.

  The third argument is also optional and can be used to specify the
  width or height of the image.
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

Here is an example of the use of the \c \\startuml command.
Here is an example of the use of the \c \\startuml command.
\code
\code
/** Sender class. Can be used to send a command to the server.
/** Sender class. Can be used to send a command to the server.
@@ -2575,19 +2621,8 @@ class Receiver
};
};
\endcode
\endcode


\note For compatibility with running PlantUML as a preprocessing step before
running doxygen, you can also add the name of the image file after \c \\startuml
and inside curly brackets, i.e.
\verbatim
@startuml{myimage.png}
Alice -> Bob : Hello
@enduml
\endverbatim
When the name of the image is specified, doxygen will generate an image with that name.
Without the name doxygen will choose a name automatically.

<hr>
<hr>
\section cmddotfile \\dotfile <file> ["caption"]
\section cmddotfile \\dotfile <file> ["caption"] [<sizeindication>=<size>]


  \addindex \\dotfile
  \addindex \\dotfile
  Inserts an image generated by dot from \<file\> into the documentation.
  Inserts an image generated by dot from \<file\> into the documentation.
@@ -2604,8 +2639,16 @@ Without the name doxygen will choose a name automatically.
  between quotes even if it does not contain any spaces. The quotes are
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.
  stripped before the caption is displayed.


  The third argument is also optional and can be used to specify the
  width or height of the image.
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

  \sa section \ref cmddot "\\dot".

<hr>
<hr>
\section cmdmscfile \\mscfile <file> ["caption"]
\section cmdmscfile \\mscfile <file> ["caption"] [<sizeindication>=<size>]


  \addindex \\mscfile
  \addindex \\mscfile
  Inserts an image generated by mscgen from \<file\> into the documentation.
  Inserts an image generated by mscgen from \<file\> into the documentation.
@@ -2623,10 +2666,16 @@ Without the name doxygen will choose a name automatically.
  between quotes even if it does not contain any spaces. The quotes are
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.
  stripped before the caption is displayed.


  The third argument is also optional and can be used to specify the
  width or height of the image.
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

  \sa section \ref cmdmsc "\\msc".
  \sa section \ref cmdmsc "\\msc".


<hr>
<hr>
\section cmddiafile \\diafile <file> ["caption"]
\section cmddiafile \\diafile <file> ["caption"] [<sizeindication>=<size>]


  \addindex \\diafile
  \addindex \\diafile
  Inserts an image made in dia from \<file\> into the documentation.
  Inserts an image made in dia from \<file\> into the documentation.
@@ -2643,6 +2692,12 @@ Without the name doxygen will choose a name automatically.
  between quotes even if it does not contain any spaces. The quotes are
  between quotes even if it does not contain any spaces. The quotes are
  stripped before the caption is displayed.
  stripped before the caption is displayed.


  The third argument is also optional and can be used to specify the
  width or height of the image.
  For a descriptionm of the possibilities see the paragraph
  \ref image_sizeindicator "Size indication" with the
  \ref cmdimage "\\image" command.

<hr>
<hr>
\section cmde \\e <word>
\section cmde \\e <word>


@@ -2843,7 +2898,7 @@ Without the name doxygen will choose a name automatically.
  format you'll have to repeat this command for each format.
  format you'll have to repeat this command for each format.


  The first argument specifies the output format. Currently, the
  The first argument specifies the output format. Currently, the
  following values are supported: \c html, \c latex and \c rtf.
  following values are supported: \c html, \c latex, \c docbook and \c rtf.


  The second argument specifies the file name of the image.
  The second argument specifies the file name of the image.
  doxygen will look for files in the paths (or files) that you specified
  doxygen will look for files in the paths (or files) that you specified
@@ -2859,12 +2914,16 @@ Without the name doxygen will choose a name automatically.
  spaces. The quotes are stripped before the caption is displayed.
  spaces. The quotes are stripped before the caption is displayed.


  The fourth argument is also optional and can be used to specify the
  The fourth argument is also optional and can be used to specify the
  width or height of the image. This is only useful
  width or height of the image. This can be useful for \LaTeX output
  for \LaTeX output
  (i.e. format=<code>latex</code>).
  (i.e. format=<code>latex</code>). The \c sizeindication can be
  \anchor image_sizeindicator \par Size indication
  either \c width or \c height. The size should be a valid
  The \c sizeindication can 
  size specifier in \LaTeX (for example <code>10cm</code> or
  specify the width or height to be used )or a combination). Possible
  <code>6in</code> or a symbolic width like <code>\\textwidth</code>).
  values are (width, analogous for height): 
  `width` or `max with` or `min width`. The size should be a valid
  size specifier in \LaTeX (for example `10cm` or
  `6in` or a symbolic width like `\\textwidth`). (The `max width` etc.
  are based on the \LaTeX package `adjustbox`)


  Here is example of a comment block:
  Here is example of a comment block:


+10 −0
Original line number Original line Diff line number Diff line
@@ -226,6 +226,16 @@ int Mapper::map(const char *n)
  return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
  return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
}
}


QString Mapper::map(const int n)
{
  QDictIterator<int> mapIterator(m_map);
  for (int *curVal = mapIterator.toFirst();curVal = mapIterator.current();++mapIterator)
  {
    if (*curVal == n || (*curVal == (n | SIMPLESECT_BIT))) return mapIterator.currentKey();
  }
  return NULL;
}

Mapper::Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
Mapper::Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
{
{
  m_map.setAutoDelete(TRUE);
  m_map.setAutoDelete(TRUE);
+1 −0
Original line number Original line Diff line number Diff line
@@ -201,6 +201,7 @@ class Mapper
{
{
  public:
  public:
    int map(const char *n);
    int map(const char *n);
    QString map(const int n);
    Mapper(const CommandMap *cm,bool caseSensitive);
    Mapper(const CommandMap *cm,bool caseSensitive);
  private:
  private:
    QDict<int> m_map;
    QDict<int> m_map;
+98 −174
Original line number Original line Diff line number Diff line
@@ -36,6 +36,68 @@
#include "htmlentity.h"
#include "htmlentity.h"
#include "plantuml.h"
#include "plantuml.h"


static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name,  QCString width,  QCString height)
{
  QCString tmpStr;
  t << "    <figure>" << endl;
  t << "        <title></title>" << endl;
  t << "        <mediaobject>" << endl;
  t << "            <imageobject>" << endl;
  t << "                <imagedata";
  if (!width.isEmpty())
  {
    tmpStr = width;
    tmpStr = tmpStr.replace(QRegExp("min *width"),"minwidth");
    tmpStr = tmpStr.replace(QRegExp("max *width"),"maxwidth");
    tmpStr = tmpStr.replace(QRegExp("="),"=\"");
    tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
    tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
    tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
    t << " " << tmpStr;
  }
  else
  {
    t << " width=\"50%\"";
  }
  if (!height.isEmpty())
  {
    tmpStr = height;
    tmpStr = tmpStr.replace(QRegExp("min *height"),"mindepth");
    tmpStr = tmpStr.replace(QRegExp("max *height"),"maxdepth");
    tmpStr = tmpStr.replace(QRegExp("height="),"depth=");
    tmpStr = tmpStr.replace(QRegExp("="),"=\"");
    tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
    tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
    tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
    t << " " << tmpStr;
  }
  t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << name << "\">";
  t << "</imagedata>" << endl;
  t << "            </imageobject>" << endl;
  if (hasCaption)
  {
    t << "        <caption>" << endl;
  }
}

static void visitPostEnd(FTextStream &t, const bool hasCaption)
{
  t << endl;
  if (hasCaption)
  {
    t << "        </caption>" << endl;
  }
  t << "        </mediaobject>" << endl;
  t << "    </figure>" << endl;
}

static void visitCaption(DocbookDocVisitor *parent, QList<DocNode> children)
{
  QListIterator<DocNode> cli(children);
  DocNode *n;
  for (cli.toFirst();(n=cli.current());++cli) n->accept(parent);
}

DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
  : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
  : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
{
{
@@ -205,14 +267,7 @@ void DocbookDocVisitor::visit(DocVerbatim *s)
        }
        }
        file.writeBlock( stext, stext.length() );
        file.writeBlock( stext, stext.length() );
        file.close();
        file.close();
        m_t << "    <figure>" << endl;
        writeDotFile(baseName, s);
        m_t << "        <title>" << name << "</title>" << endl;
        m_t << "        <mediaobject>" << endl;
        m_t << "            <imageobject>" << endl;
        writeDotFile(baseName);
        m_t << "            </imageobject>" << endl;
        m_t << "       </mediaobject>" << endl;
        m_t << "    </figure>" << endl;
        m_t << "</para>" << endl;
        m_t << "</para>" << endl;
      }
      }
      break;
      break;
@@ -238,14 +293,7 @@ void DocbookDocVisitor::visit(DocVerbatim *s)
        text+="}";
        text+="}";
        file.writeBlock( text, text.length() );
        file.writeBlock( text, text.length() );
        file.close();
        file.close();
        m_t << "    <figure>" << endl;
        writeMscFile(baseName,s);
        m_t << "        <title>" << name << "</title>" << endl;
        m_t << "        <mediaobject>" << endl;
        m_t << "            <imageobject>" << endl;
        writeMscFile(baseName);
        m_t << "            </imageobject>" << endl;
        m_t << "       </mediaobject>" << endl;
        m_t << "    </figure>" << endl;
        m_t << "</para>" << endl;
        m_t << "</para>" << endl;
      }
      }
      break;
      break;
@@ -259,14 +307,8 @@ void DocbookDocVisitor::visit(DocVerbatim *s)
        {
        {
          shortName=shortName.right(shortName.length()-i-1);
          shortName=shortName.right(shortName.length()-i-1);
        }
        }
        m_t << "    <figure>" << endl;
        m_t << "<para>" << endl;
        m_t << "        <title>" << shortName << "</title>" << endl;
        writePlantUMLFile(baseName,s);
        m_t << "        <mediaobject>" << endl;
        m_t << "            <imageobject>" << endl;
        writePlantUMLFile(baseName);
        m_t << "            </imageobject>" << endl;
        m_t << "       </mediaobject>" << endl;
        m_t << "    </figure>" << endl;
        m_t << "</para>" << endl;
        m_t << "</para>" << endl;
      }
      }
      break;
      break;
@@ -850,8 +892,13 @@ void DocbookDocVisitor::visitPre(DocImage *img)
  {
  {
    if (m_hide) return;
    if (m_hide) return;
    m_t << endl;
    m_t << endl;
    m_t << "    <figure>" << endl;
    QCString baseName=img->name();
    m_t << "        <title>";
    int i;
    if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
    {
      baseName=baseName.right(baseName.length()-i-1);
    }
    visitPreStart(m_t, img -> hasCaption(), baseName, img -> width(), img -> height());
  }
  }
  else
  else
  {
  {
@@ -865,39 +912,14 @@ void DocbookDocVisitor::visitPost(DocImage *img)
  if (img->type()==DocImage::DocBook)
  if (img->type()==DocImage::DocBook)
  {
  {
    if (m_hide) return;
    if (m_hide) return;
    QCString typevar;
    visitPostEnd(m_t, img -> hasCaption());
    m_t << "</title>" << endl;
    // copy the image to the output dir
    m_t << "    <mediaobject>" << endl;
    m_t << "        <imageobject>" << endl;
    QCString baseName=img->name();
    QCString baseName=img->name();
    int i;
    int i;
    if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
    if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
    {
    {
      baseName=baseName.right(baseName.length()-i-1);
      baseName=baseName.right(baseName.length()-i-1);
    }
    }
    m_t << "            <imagedata";
    if (!img->width().isEmpty())
    {
      m_t << " width=\"";
      filter(img->width());
      m_t << "\"";
    }
    else
    {
      m_t << " width=\"50%\"";
    }
    if (!img->height().isEmpty())
    {
      m_t << " depth=\"";
      filter(img->height());
      m_t << "\"";
    }
    m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << "\">";
    m_t << "</imagedata>" << endl;
    m_t << "        </imageobject>" << endl;
    m_t << "    </mediaobject>" << endl;
    m_t << "    </figure>" << endl;
    // copy the image to the output dir
    QCString m_file;
    QCString m_file;
    bool ambig;
    bool ambig;
    FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig);
    FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig);
@@ -1203,7 +1225,7 @@ void DocbookDocVisitor::popEnabled()
  delete v;
  delete v;
}
}


void DocbookDocVisitor::writeMscFile(const QCString &baseName)
void DocbookDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s)
{
{
  QCString shortName = baseName;
  QCString shortName = baseName;
  int i;
  int i;
@@ -1213,13 +1235,12 @@ void DocbookDocVisitor::writeMscFile(const QCString &baseName)
  }
  }
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
  writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
  m_t << "                <imagedata";
  visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
  m_t << " width=\"50%\"";
  visitCaption(this, s->m_children);
  m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">";
  visitPostEnd(m_t, s->hasCaption());
  m_t << "</imagedata>" << endl;
}
}


void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName)
void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s)
{
{
  QCString shortName = baseName;
  QCString shortName = baseName;
  int i;
  int i;
@@ -1229,10 +1250,9 @@ void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName)
  }
  }
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
  generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
  m_t << "                <imagedata";
  visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
  m_t << " width=\"50%\"";
  visitCaption(this, s->m_children);
  m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">";
  visitPostEnd(m_t, s->hasCaption());
  m_t << "</imagedata>" << endl;
}
}


void DocbookDocVisitor::startMscFile(const QCString &fileName,
void DocbookDocVisitor::startMscFile(const QCString &fileName,
@@ -1255,50 +1275,17 @@ void DocbookDocVisitor::startMscFile(const QCString &fileName,
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
  writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
  m_t << "<para>" << endl;
  m_t << "<para>" << endl;
  m_t << "    <figure>" << endl;
  visitPreStart(m_t, hasCaption, baseName + ".png",  width,  height);
  m_t << "        <title></title>" << endl;
  m_t << "        <mediaobject>" << endl;
  m_t << "            <imageobject>" << endl;
  m_t << "                <imagedata";
  if (!width.isEmpty())
  {
    m_t << " width=\"";
    m_t << width;
    m_t << "\"";
  }
  else
  {
    m_t << " width=\"50%\"";
  }
  if (!height.isEmpty())
  {
    m_t << " depth=\"";
    m_t << height;
    m_t << "\"";
  }
  m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << ".png" << "\">";
  m_t << "</imagedata>" << endl;
  m_t << "            </imageobject>" << endl;
  if (hasCaption)
  {
    m_t << "        <caption>" << endl;
  }
}
}


void DocbookDocVisitor::endMscFile(bool hasCaption)
void DocbookDocVisitor::endMscFile(bool hasCaption)
{
{
  if (m_hide) return;
  if (m_hide) return;
  m_t << "endl";
  visitPostEnd(m_t, hasCaption);
  if (hasCaption)
  {
    m_t << "        </caption>" << endl;
  }
  m_t << "        </mediaobject>" << endl;
  m_t << "    </figure>" << endl;
  m_t << "</para>" << endl;
  m_t << "</para>" << endl;
}
}


void DocbookDocVisitor::writeDiaFile(const QCString &baseName)
void DocbookDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s)
{
{
  QCString shortName = baseName;
  QCString shortName = baseName;
  int i;
  int i;
@@ -1308,9 +1295,9 @@ void DocbookDocVisitor::writeDiaFile(const QCString &baseName)
  }
  }
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
  writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
  m_t << "                <imagedata";
  visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
  m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">";
  visitCaption(this, s->m_children);
  m_t << "</imagedata>" << endl;
  visitPostEnd(m_t, s->hasCaption());
}
}


void DocbookDocVisitor::startDiaFile(const QCString &fileName,
void DocbookDocVisitor::startDiaFile(const QCString &fileName,
@@ -1333,46 +1320,17 @@ void DocbookDocVisitor::startDiaFile(const QCString &fileName,
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
  writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
  m_t << "<para>" << endl;
  m_t << "<para>" << endl;
  m_t << "    <figure>" << endl;
  visitPreStart(m_t, hasCaption, baseName + ".png",  width,  height);
  m_t << "        <title></title>" << endl;
  m_t << "        <mediaobject>" << endl;
  m_t << "            <imageobject>" << endl;
  m_t << "                <imagedata";
  if (!width.isEmpty())
  {
    m_t << " width=\"";
    m_t << width;
    m_t << "\"";
  }
  else if (!height.isEmpty())
  {
    m_t << " depth=\"";
    m_t << height;
    m_t << "\"";
  }
  m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">";
  m_t << "</imagedata>" << endl;
  m_t << "            </imageobject>" << endl;
  if (hasCaption)
  {
    m_t << "        <caption>" << endl;
  }
}
}


void DocbookDocVisitor::endDiaFile(bool hasCaption)
void DocbookDocVisitor::endDiaFile(bool hasCaption)
{
{
  if (m_hide) return;
  if (m_hide) return;
  m_t << "endl";
  visitPostEnd(m_t, hasCaption);
  if (hasCaption)
  {
    m_t << "        </caption>" << endl;
  }
  m_t << "        </mediaobject>" << endl;
  m_t << "    </figure>" << endl;
  m_t << "</para>" << endl;
  m_t << "</para>" << endl;
}
}


void DocbookDocVisitor::writeDotFile(const QCString &baseName)
void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s)
{
{
  QCString shortName = baseName;
  QCString shortName = baseName;
  int i;
  int i;
@@ -1383,11 +1341,9 @@ void DocbookDocVisitor::writeDotFile(const QCString &baseName)
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString outDir = Config_getString("DOCBOOK_OUTPUT");
  QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
  QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
  writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
  writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
  m_t << "                <imagedata";
  visitPreStart(m_t, s->hasCaption(), baseName + ".dot", s->width(),s->height());
  //If no width is specified use default value for PDF rendering
  visitCaption(this, s->m_children);
  m_t << " width=\"50%\"";
  visitPostEnd(m_t, s->hasCaption());
  m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << "." << imgExt << "\">";
  m_t << "</imagedata>" << endl;
}
}


void DocbookDocVisitor::startDotFile(const QCString &fileName,
void DocbookDocVisitor::startDotFile(const QCString &fileName,
@@ -1411,46 +1367,14 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName,
  QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
  QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
  writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
  writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
  m_t << "<para>" << endl;
  m_t << "<para>" << endl;
  m_t << "    <figure>" << endl;
  visitPreStart(m_t, hasCaption, baseName + "." + imgExt,  width,  height);
  m_t << "        <title></title>" << endl;
  m_t << "        <mediaobject>" << endl;
  m_t << "            <imageobject>" << endl;
  m_t << "                <imagedata";
  if (!width.isEmpty())
  {
    m_t << " width=\"";
    m_t << width;
    m_t << "\"";
  }
  else
  {
    m_t << " width=\"50%\"";
  }
  if (!height.isEmpty())
  {
    m_t << " depth=\"";
    m_t << height;
    m_t << "\"";
  }
  m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << "." << imgExt << "\">";
  m_t << "</imagedata>" << endl;
  m_t << "            </imageobject>" << endl;
  if (hasCaption)
  {
    m_t << "        <caption>" << endl;
  }
}
}


void DocbookDocVisitor::endDotFile(bool hasCaption)
void DocbookDocVisitor::endDotFile(bool hasCaption)
{
{
  if (m_hide) return;
  if (m_hide) return;
  m_t << "endl";
  m_t << endl;
  if (hasCaption)
  visitPostEnd(m_t, hasCaption);
  {
    m_t << "        </caption>" << endl;
  }
  m_t << "        </mediaobject>" << endl;
  m_t << "    </figure>" << endl;
  m_t << "</para>" << endl;
  m_t << "</para>" << endl;
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -147,16 +147,16 @@ class DocbookDocVisitor : public DocVisitor
    void startMscFile(const QCString &fileName,const QCString &width,
    void startMscFile(const QCString &fileName,const QCString &width,
    const QCString &height, bool hasCaption);
    const QCString &height, bool hasCaption);
    void endMscFile(bool hasCaption);
    void endMscFile(bool hasCaption);
    void writeMscFile(const QCString &fileName);
    void writeMscFile(const QCString &fileName, DocVerbatim *s);
    void startDiaFile(const QCString &fileName,const QCString &width,
    void startDiaFile(const QCString &fileName,const QCString &width,
                      const QCString &height, bool hasCaption);
                      const QCString &height, bool hasCaption);
    void endDiaFile(bool hasCaption);
    void endDiaFile(bool hasCaption);
    void writeDiaFile(const QCString &fileName);
    void writeDiaFile(const QCString &fileName, DocVerbatim *s);
    void startDotFile(const QCString &fileName,const QCString &width,
    void startDotFile(const QCString &fileName,const QCString &width,
    const QCString &height, bool hasCaption);
    const QCString &height, bool hasCaption);
    void endDotFile(bool hasCaption);
    void endDotFile(bool hasCaption);
    void writeDotFile(const QCString &fileName);
    void writeDotFile(const QCString &fileName, DocVerbatim *s);
    void writePlantUMLFile(const QCString &fileName);
    void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
    //--------------------------------------
    //--------------------------------------
    // state variables
    // state variables
    //--------------------------------------
    //--------------------------------------
Loading