summaryrefslogtreecommitdiffstats
path: root/src/dia.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-10-06 19:28:00 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-10-06 21:39:40 (GMT)
commit4fc5b2b154331fbf35800935889f1d0372334f0a (patch)
treea87e075516435e0d855a4af6aecb356a517c4b33 /src/dia.cpp
parent983507e0a65e5c2d51209740a89311e122e4f389 (diff)
downloadDoxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.zip
Doxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.tar.gz
Doxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.tar.bz2
Bug 707713 - Add support for dia diagrams
Diffstat (limited to 'src/dia.cpp')
-rw-r--r--src/dia.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/dia.cpp b/src/dia.cpp
new file mode 100644
index 0000000..1032564
--- /dev/null
+++ b/src/dia.cpp
@@ -0,0 +1,88 @@
+/******************************************************************************
+ *
+ *
+ *
+ * Copyright (C) 1997-2013 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#include "dia.h"
+#include "portable.h"
+#include "config.h"
+#include "message.h"
+#include "util.h"
+
+#include <qdir.h>
+
+static const int maxCmdLine = 40960;
+
+void writeDiaGraphFromFile(const char *inFile,const char *outDir,
+ const char *outFile,DiaOutputFormat format)
+{
+ QCString absOutFile = 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 diaExe = Config_getString("DIA_PATH")+"dia"+portable_commandExtension();
+ QCString diaArgs;
+ QCString extension;
+ diaArgs+="-n ";
+ if (format==DIA_BITMAP)
+ {
+ diaArgs+="-t png-libart";
+ extension=".png";
+ }
+ else if (format==DIA_EPS)
+ {
+ diaArgs+="-t eps";
+ extension=".eps";
+ }
+
+ diaArgs+=" -e \"";
+ diaArgs+=outFile;
+ diaArgs+=extension+"\"";
+
+ diaArgs+=" \"";
+ diaArgs+=inFile;
+ diaArgs+="\"";
+
+ int exitCode;
+ //printf("*** running: %s %s outDir:%s %s\n",diaExe.data(),diaArgs.data(),outDir,outFile);
+ portable_sysTimerStart();
+ if ((exitCode=portable_system(diaExe,diaArgs,FALSE))!=0)
+ {
+ portable_sysTimerStop();
+ goto error;
+ }
+ portable_sysTimerStop();
+ if ( (format==DIA_EPS) && (Config_getBool("USE_PDFLATEX")) )
+ {
+ QCString epstopdfArgs(maxCmdLine);
+ epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
+ outFile,outFile);
+ portable_sysTimerStart();
+ if (portable_system("epstopdf",epstopdfArgs)!=0)
+ {
+ err("Problems running epstopdf. Check your TeX installation!\n");
+ }
+ portable_sysTimerStop();
+ }
+
+error:
+ QDir::setCurrent(oldDir);
+}
+