Permalink
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.
  • Loading branch information...
albert-github committed Nov 28, 2014
1 parent 0fea3d4 commit 329a4ddc036ac9dfe72b11d62cb4043bc8488c20
View
@@ -2451,13 +2451,25 @@ only copy the detailed documentation, not the brief description.
\ref cmdhtmlonly "\\htmlonly".
<hr>
\section cmddot \\dot
\section cmddot \\dot ["caption"] [<sizeindication>=<size>]
\addindex \\dot
Starts a text fragment which should contain a valid description of a
dot graph. The text fragment ends with \ref cmdenddot "\\enddot".
Doxygen will pass the text on to dot and include the resulting
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.
By using the command \ref cmdref "\\ref" inside the URL value you can conveniently
link to an item inside doxygen. Here is an example:
@@ -2485,12 +2497,24 @@ class C {};
\endcode
<hr>
\section cmdmsc \\msc
\section cmdmsc \\msc ["caption"] [<sizeindication>=<size>]
\addindex \\msc
Starts a text fragment which should contain a valid description of a
message sequence chart. See http://www.mcternan.me.uk/mscgen/ for examples.
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
sequence chart that is
within the <code>msc {...}</code> block.
@@ -2534,7 +2558,7 @@ class Receiver
\sa section \ref cmdmscfile "\\mscfile".
<hr>
\section cmdstartuml \\startuml
\section cmdstartuml \\startuml [{file}] ["caption"] [<sizeindication>=<size>]
\addindex \\startuml
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
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.
\code
/** Sender class. Can be used to send a command to the server.
@@ -2575,19 +2621,8 @@ class Receiver
};
\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>
\section cmddotfile \\dotfile <file> ["caption"]
\section cmddotfile \\dotfile <file> ["caption"] [<sizeindication>=<size>]
\addindex \\dotfile
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
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>
\section cmdmscfile \\mscfile <file> ["caption"]
\section cmdmscfile \\mscfile <file> ["caption"] [<sizeindication>=<size>]
\addindex \\mscfile
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
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".
<hr>
\section cmddiafile \\diafile <file> ["caption"]
\section cmddiafile \\diafile <file> ["caption"] [<sizeindication>=<size>]
\addindex \\diafile
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
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>
\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.
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.
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.
The fourth argument is also optional and can be used to specify the
width or height of the image. This is only useful
for \LaTeX output
(i.e. format=<code>latex</code>). The \c sizeindication can be
either \c width or \c height. The size should be a valid
size specifier in \LaTeX (for example <code>10cm</code> or
<code>6in</code> or a symbolic width like <code>\\textwidth</code>).
width or height of the image. This can be useful for \LaTeX output
(i.e. format=<code>latex</code>).
\anchor image_sizeindicator \par Size indication
The \c sizeindication can
specify the width or height to be used )or a combination). Possible
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:
View
@@ -226,6 +226,16 @@ int Mapper::map(const char *n)
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)
{
m_map.setAutoDelete(TRUE);
View
@@ -201,6 +201,7 @@ class Mapper
{
public:
int map(const char *n);
QString map(const int n);
Mapper(const CommandMap *cm,bool caseSensitive);
private:
QDict<int> m_map;
Oops, something went wrong.

0 comments on commit 329a4dd

Please sign in to comment.