Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
dia.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2021 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#include "
dia.h
"
17
#include "
portable.h
"
18
#include "
config.h
"
19
#include "
message.h
"
20
#include "
util.h
"
21
#include "
dir.h
"
22
#include "
indexlist.h
"
23
#include "
doxygen.h
"
24
25
26
static
const
int
maxCmdLine
= 40960;
27
28
void
writeDiaGraphFromFile
(
const
QCString
&inFile,
const
QCString
&outDir,
29
const
QCString
&outFile,
DiaOutputFormat
format,
30
const
QCString
&srcFile,
int
srcLine,
bool
toIndex)
31
{
32
QCString
absOutFile = outDir;
33
absOutFile+=
Portable::pathSeparator
();
34
absOutFile+=outFile;
35
36
// chdir to the output dir, so dot can find the font file.
37
std::string oldDir =
Dir::currentDirPath
();
38
// go to the html output directory (i.e. path)
39
Dir::setCurrent
(outDir.
str
());
40
//printf("Going to dir %s\n",Dir::currentDirPath().c_str());
41
QCString
diaExe =
Config_getString
(DIA_PATH)+
"dia"
+
Portable::commandExtension
();
42
QCString
diaArgs;
43
QCString
extension;
44
diaArgs+=
"-n "
;
45
if
(format==
DiaOutputFormat::BITMAP
)
46
{
47
diaArgs+=
"-t png-libart"
;
48
extension=
".png"
;
49
}
50
else
if
(format==
DiaOutputFormat::EPS
)
51
{
52
diaArgs+=
"-t eps"
;
53
extension=
".eps"
;
54
}
55
56
diaArgs+=
" -e \""
;
57
diaArgs+=outFile;
58
diaArgs+=extension+
"\""
;
59
60
diaArgs+=
" \""
;
61
diaArgs+=inFile;
62
diaArgs+=
"\""
;
63
64
//printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile);
65
if
(
Portable::system
(diaExe,diaArgs,
FALSE
)!=0)
66
{
67
err_full
(srcFile,srcLine,
"Problems running {}. Check your installation or look typos in you dia file {}"
,
68
diaExe,inFile);
69
goto
error;
70
}
71
if
( (format==
DiaOutputFormat::EPS
) && (
Config_getBool
(USE_PDFLATEX)) )
72
{
73
QCString
epstopdfArgs(
maxCmdLine
,
QCString::ExplicitSize
);
74
epstopdfArgs.
sprintf
(
"\"%s.eps\" --outfile=\"%s.pdf\""
,
75
qPrint
(outFile),
qPrint
(outFile));
76
if
(
Portable::system
(
"epstopdf"
,epstopdfArgs)!=0)
77
{
78
err
(
"Problems running epstopdf. Check your TeX installation!\n"
);
79
}
80
else
81
{
82
Dir
().
remove
(outFile.
str
()+
".eps"
);
83
}
84
}
85
if
(toIndex)
Doxygen::indexList
->addImageFile(outFile+extension);
86
87
error:
88
Dir::setCurrent
(oldDir);
89
}
90
Dir
Class representing a directory in the file system.
Definition
dir.h:75
Dir::currentDirPath
static std::string currentDirPath()
Definition
dir.cpp:342
Dir::remove
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition
dir.cpp:314
Dir::setCurrent
static bool setCurrent(const std::string &path)
Definition
dir.cpp:350
Doxygen::indexList
static IndexList * indexList
Definition
doxygen.h:132
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
QCString::str
const std::string & str() const
Definition
qcstring.h:552
QCString::sprintf
QCString & sprintf(const char *format,...)
Definition
qcstring.cpp:29
QCString::ExplicitSize
@ ExplicitSize
Definition
qcstring.h:146
config.h
Config_getBool
#define Config_getBool(name)
Definition
config.h:33
Config_getString
#define Config_getString(name)
Definition
config.h:32
writeDiaGraphFromFile
void writeDiaGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine, bool toIndex)
Definition
dia.cpp:28
maxCmdLine
static const int maxCmdLine
Definition
dia.cpp:26
dia.h
DiaOutputFormat
DiaOutputFormat
Definition
dia.h:23
DiaOutputFormat::BITMAP
@ BITMAP
Definition
dia.h:23
DiaOutputFormat::EPS
@ EPS
Definition
dia.h:23
dir.h
doxygen.h
indexlist.h
message.h
err
#define err(fmt,...)
Definition
message.h:127
err_full
#define err_full(file, line, fmt,...)
Definition
message.h:132
Portable::pathSeparator
QCString pathSeparator()
Definition
portable.cpp:374
Portable::system
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
Definition
portable.cpp:105
Portable::commandExtension
const char * commandExtension()
Definition
portable.cpp:461
portable.h
Portable versions of functions that are platform dependent.
qPrint
const char * qPrint(const char *s)
Definition
qcstring.h:687
FALSE
#define FALSE
Definition
qcstring.h:34
util.h
A bunch of utility functions.
src
dia.cpp
Generated by
1.17.0