Commit b834da5a authored by Dimitri van Heesch's avatar Dimitri van Heesch

Merge pull request #74 from pianofab/master

Add support for honoring svg image format preference in msc
parents c5ec90d1 89639705
......@@ -2031,8 +2031,12 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName,
}
baseName.prepend("msc_");
QCString outDir = Config_getString("HTML_OUTPUT");
writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context);
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
MscOutputFormat mscFormat = MSC_BITMAP;
if ("svg" == imgExt)
mscFormat = MSC_SVG;
writeMscGraphFromFile(fileName,outDir,baseName,mscFormat);
writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat);
}
void HtmlDocVisitor::writeDiaFile(const QCString &fileName,
......
......@@ -103,15 +103,22 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir,
QCString mscExe = Config_getString("MSCGEN_PATH")+"mscgen"+portable_commandExtension();
QCString mscArgs;
QCString extension;
if (format==MSC_BITMAP)
switch (format)
{
mscArgs+="-T png";
extension=".png";
}
else if (format==MSC_EPS)
{
mscArgs+="-T eps";
extension=".eps";
case MSC_BITMAP:
mscArgs+="-T png";
extension=".png";
break;
case MSC_EPS:
mscArgs+="-T eps";
extension=".eps";
break;
case MSC_SVG:
mscArgs+="-T svg";
extension=".svg";
break;
default:
goto error; // I am not very fond of goto statements, but when in Rome...
}
mscArgs+=" -i \"";
mscArgs+=inFile;
......@@ -188,11 +195,28 @@ void writeMscImageMapFromFile(FTextStream &t,const QCString &inFile,
const QCString &outDir,
const QCString &relPath,
const QCString &baseName,
const QCString &context)
const QCString &context,
MscOutputFormat format
)
{
QCString mapName = baseName+".map";
QCString mapFile = inFile+".map";
t << "<img src=\"" << relPath << baseName << ".png\" alt=\""
t << "<img src=\"" << relPath << baseName << ".";
switch (format)
{
case MSC_BITMAP:
t << "png";
break;
case MSC_EPS:
t << "eps";
break;
case MSC_SVG:
t << "svg";
break;
default:
t << "unknown";
}
t << "\" alt=\""
<< baseName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>" << endl;
QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context);
t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">" << imap << "</map>" << endl;
......
......@@ -21,7 +21,7 @@
class QCString;
class FTextStream;
enum MscOutputFormat { MSC_BITMAP , MSC_EPS };
enum MscOutputFormat { MSC_BITMAP , MSC_EPS, MSC_SVG };
void writeMscGraphFromFile(const char *inFile,const char *outDir,
const char *outFile,MscOutputFormat format);
......@@ -31,7 +31,9 @@ QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir,
void writeMscImageMapFromFile(FTextStream &t,const QCString &inFile,
const QCString &outDir, const QCString &relPath,
const QCString &baseName, const QCString &context);
const QCString &baseName, const QCString &context,
MscOutputFormat format
);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment