Skip to content

Commit 0743cc5

Browse files
authored
Merge pull request doxygen#11324 from albert-github/feature/issue_11308_svg
issue doxygen#11308 SVG dot graphs have added padding
2 parents 8e4cc0c + eeed4d6 commit 0743cc5

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

src/config.xml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,8 +4050,10 @@ UML notation for the relationships.
40504050
<![CDATA[
40514051
The \c DOT_IMAGE_FORMAT tag can be used to set the image format of the images
40524052
generated by \c dot. For an explanation of the image formats see the section output formats
4053-
in the documentation of the \c dot tool
4054-
(<a href="https://www.graphviz.org/">Graphviz</a>).
4053+
in the documentation of the \c dot tool (<a href="https://www.graphviz.org/">Graphviz</a>).
4054+
<br>Note the formats `svg:cairo` and `svg:cairo:cairo` cannot be used in combination with
4055+
\ref cfg_interactive_svg "INTERACTIVE_SVG" (the \ref cfg_interactive_svg "INTERACTIVE_SVG"
4056+
will be set to `NO`).
40554057
]]>
40564058
</docs>
40574059
<value name='png'/>
@@ -4066,14 +4068,35 @@ UML notation for the relationships.
40664068
<value name='png:cairo:gdiplus'/>
40674069
<value name='png:gdiplus'/>
40684070
<value name='png:gdiplus:gdiplus'/>
4071+
<value name='svg:cairo'/>
4072+
<value name='svg:cairo:cairo'/>
4073+
<value name='svg:svg'/>
4074+
<value name='svg:svg:core'/>
4075+
<value name='gif:cairo'/>
4076+
<value name='gif:cairo:gd'/>
4077+
<value name='gif:cairo:gdiplus'/>
4078+
<value name='gif:gdiplus'/>
4079+
<value name='gif:gdiplus:gdiplus'/>
4080+
<value name='gif:gd'/>
4081+
<value name='gif:gd:gd'/>
4082+
<value name='jpg:cairo'/>
4083+
<value name='jpg:cairo:gd'/>
4084+
<value name='jpg:cairo:gdiplus'/>
4085+
<value name='jpg:gd'/>
4086+
<value name='jpg:gd:gd'/>
4087+
<value name='jpg:gdiplus'/>
4088+
<value name='jpg:gdiplus:gdiplus'/>
40694089
</option>
40704090
<option type='bool' id='INTERACTIVE_SVG' defval='0' depends='HAVE_DOT'>
40714091
<docs>
40724092
<![CDATA[
4073-
If \ref cfg_dot_image_format "DOT_IMAGE_FORMAT" is set to \c svg, then this option can be set to \c YES to
4093+
If \ref cfg_dot_image_format "DOT_IMAGE_FORMAT" is set to `svg` or `svg:svg` or `svg:svg:core`,
4094+
then this option can be set to \c YES to
40744095
enable generation of interactive SVG images that allow zooming and panning.
40754096
<br>Note that this requires a modern browser other than Internet Explorer.
40764097
Tested and working are Firefox, Chrome, Safari, and Opera.
4098+
<br>Note This option will be automatically disabled when \ref cfg_dot_image_format "DOT_IMAGE_FORMAT"
4099+
is set to `svg:cairo` or `svg:cairo:cairo`.
40774100
]]>
40784101
</docs>
40794102
</option>

src/configimpl.l

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,19 @@ void Config::checkAndCorrect(bool quiet, const bool check)
21892189
Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000);
21902190
}
21912191

2192+
//------------------------
2193+
if (Config_getBool(INTERACTIVE_SVG))
2194+
{
2195+
// issue 11308
2196+
if ((Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo) ||
2197+
(Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo_cairo))
2198+
{
2199+
err("When using DOT_IMAGE_FORMAT with %s the %s option should be %s. I'll adjust it for you.\n",
2200+
qPrint(Config_getEnumAsString(DOT_IMAGE_FORMAT)),"INTERACTIVE_SVG","disabled");
2201+
Config_updateBool(INTERACTIVE_SVG,FALSE);
2202+
}
2203+
}
2204+
21922205
//------------------------
21932206
// check for settings that are inconsistent with having OPTIMIZED_OUTPUT_VHDL enabled
21942207
if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))

src/dotfilepatcher.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ bool DotFilePatcher::run() const
361361
if (line.find("<svg")!=-1 && !replacedHeader)
362362
{
363363
int count = sscanf(line.data(),"<svg width=\"%dpt\" height=\"%dpt\"",&width,&height);
364+
if (count != 2) count = sscanf(line.data(),"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"%d\" height=\"%d\"",&width,&height);
364365
//printf("width=%d height=%d\n",width,height);
365366
useNagivation = count==2 && (width>500 || height>450);
366367
insideHeader = count==2;
@@ -562,6 +563,10 @@ static bool readSVGSize(const QCString &fileName,int *width,int *height)
562563
{
563564
found=true;
564565
}
566+
else if (sscanf(line.c_str(),"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"%d\" height=\"%d\"",width,height)==2)
567+
{
568+
found=true;
569+
}
565570
}
566571
return true;
567572
}

0 commit comments

Comments
 (0)