My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
dia.cpp File Reference
#include "dia.h"
#include "portable.h"
#include "config.h"
#include "message.h"
#include "util.h"
#include <qdir.h>

Go to the source code of this file.

Functions

void writeDiaGraphFromFile (const char *inFile, const char *outDir, const char *outFile, DiaOutputFormat format)
 

Variables

static const int maxCmdLine = 40960
 

Function Documentation

void writeDiaGraphFromFile ( const char *  inFile,
const char *  outDir,
const char *  outFile,
DiaOutputFormat  format 
)

Definition at line 28 of file dia.cpp.

References Config_getBool, Config_getString, DIA_BITMAP, DIA_EPS, err(), maxCmdLine, portable_commandExtension(), portable_pathSeparator(), portable_system(), portable_sysTimerStart(), and portable_sysTimerStop().

Referenced by DocbookDocVisitor::startDiaFile(), LatexDocVisitor::startDiaFile(), DocbookDocVisitor::writeDiaFile(), HtmlDocVisitor::writeDiaFile(), RTFDocVisitor::writeDiaFile(), and LatexDocVisitor::writeDiaFile().

{
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);
if ((exitCode=portable_system(diaExe,diaArgs,FALSE))!=0)
{
goto error;
}
if ( (format==DIA_EPS) && (Config_getBool(USE_PDFLATEX)) )
{
QCString epstopdfArgs(maxCmdLine);
epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
outFile,outFile);
if (portable_system("epstopdf",epstopdfArgs)!=0)
{
err("Problems running epstopdf. Check your TeX installation!\n");
}
}
error:
QDir::setCurrent(oldDir);
}

Variable Documentation

const int maxCmdLine = 40960
static

Definition at line 26 of file dia.cpp.

Referenced by writeDiaGraphFromFile().