diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-06-23 18:15:44 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-06-23 18:50:56 (GMT) |
commit | 6fb61b2c6561149c1a318df26fd1acac619b3519 (patch) | |
tree | ad73d56e94aebbd888db4077bc367895fbb8ad83 /src | |
parent | 15678e7ccb524af8c90a4018f3b882ba184e6a39 (diff) | |
download | Doxygen-6fb61b2c6561149c1a318df26fd1acac619b3519.zip Doxygen-6fb61b2c6561149c1a318df26fd1acac619b3519.tar.gz Doxygen-6fb61b2c6561149c1a318df26fd1acac619b3519.tar.bz2 |
issue #6880 mscgen links placed in the wrong place when using SVG output
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/msc.cpp | 76 |
2 files changed, 25 insertions, 55 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e3265d..bc79194 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/qtools ${CMAKE_SOURCE_DIR}/libmd5 ${CMAKE_SOURCE_DIR}/liblodepng - ${CMAKE_SOURCE_DIR}/vhdlparser/ + ${CMAKE_SOURCE_DIR}/libmscgen + ${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/src ${CLANG_INCLUDEDIR} ${GENERATED_SRC} @@ -283,6 +284,7 @@ target_link_libraries(doxygen qtools md5 lodepng + mscgen vhdlparser ${SQLITE3_LIBRARIES} ${ICONV_LIBRARIES} diff --git a/src/msc.cpp b/src/msc.cpp index 71d37c4..ed049c6 100644 --- a/src/msc.cpp +++ b/src/msc.cpp @@ -24,6 +24,7 @@ #include "index.h" #include "util.h" #include "ftextstream.h" +#include "mscgen_api.h" #include <qdir.h> @@ -97,47 +98,33 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir, absOutFile+=portable_pathSeparator(); absOutFile+=outFile; - // chdir to the output dir, so dot can find the font file. - QCString oldDir = QDir::currentDirPath().utf8(); - // go to the html output directory (i.e. path) - QDir::setCurrent(outDir); - //printf("Going to dir %s\n",QDir::currentDirPath().data()); - QCString mscExe = Config_getString(MSCGEN_PATH)+"mscgen"+portable_commandExtension(); - QCString mscArgs; + mscgen_format_t msc_format; QCString imgName = outFile; switch (format) { case MSC_BITMAP: - mscArgs+="-T png"; + msc_format = mscgen_format_png; imgName+=".png"; break; case MSC_EPS: - mscArgs+="-T eps"; + msc_format = mscgen_format_eps; imgName+=".eps"; break; case MSC_SVG: - mscArgs+="-T svg"; + msc_format = mscgen_format_svg; imgName+=".svg"; break; default: - goto error; // I am not very fond of goto statements, but when in Rome... + return; } - mscArgs+=" -i \""; - mscArgs+=inFile; - - mscArgs+="\" -o \""; - mscArgs+=imgName+"\""; - int exitCode; -// printf("*** running: %s %s outDir:%s %s\n",mscExe.data(),mscArgs.data(),outDir,outFile); - portable_sysTimerStart(); - if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0) + int code; + if ((code=mscgen_generate(inFile,imgName,msc_format))!=0) { - err("Problems running %s. Check your installation or look typos in you msc file %s\n", - mscExe.data(),inFile); - portable_sysTimerStop(); - goto error; + err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", + mscgen_error2str(code),inFile); + return; } - portable_sysTimerStop(); + if ( (format==MSC_EPS) && (Config_getBool(USE_PDFLATEX)) ) { QCString epstopdfArgs(maxCmdLine); @@ -153,47 +140,28 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir, Doxygen::indexList->addImageFile(imgName); -error: - QDir::setCurrent(oldDir); } -QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, - const QCString& relPath,const QCString& context) +static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, + const QCString& relPath,const QCString& context, + bool writeSVGMap) { QCString outFile = inFile + ".map"; - - //printf("*** running:getMscImageMapFromFile \n"); - // chdir to the output dir, so dot can find the font file. - QCString oldDir = QDir::currentDirPath().utf8(); - // go to the html output directory (i.e. path) - QDir::setCurrent(outDir); - //printf("Going to dir %s\n",QDir::currentDirPath().data()); - - QCString mscExe = Config_getString(MSCGEN_PATH)+"mscgen"+portable_commandExtension(); - QCString mscArgs = "-T ismap -i \""; - mscArgs+=inFile; - mscArgs+="\" -o \""; - mscArgs+=outFile + "\""; - - int exitCode; - portable_sysTimerStart(); - if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0) + int code; + if ((code=mscgen_generate(inFile,outFile, + writeSVGMap ? mscgen_format_svgmap : mscgen_format_pngmap))!=0) { - err("Problems running %s (mapping phase). Check your installation or look typos in you msc file %s\n", - mscExe.data(),inFile.data()); - portable_sysTimerStop(); - QDir::setCurrent(oldDir); + err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", + mscgen_error2str(code),inFile.data()); return ""; } - portable_sysTimerStop(); - + QGString result; FTextStream tmpout(&result); convertMapFile(tmpout, outFile, relPath, context); QDir().remove(outFile); - QDir::setCurrent(oldDir); return result.data(); } @@ -221,7 +189,7 @@ void writeMscImageMapFromFile(FTextStream &t,const QCString &inFile, default: t << "unknown"; } - QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context); + QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context,format==MSC_SVG); if (!imap.isEmpty()) { t << "\" alt=\"" |