956 interactiveSVG = interactiveSVG && map->zoomable;
957 graphId = map->graphId;
958 relPath = map->relPath;
973 err(
"problem opening file %s for patching!\n",tmpName.
data());
984 const int maxLineLen=100*1024;
987 bool insideHeader=
FALSE;
988 bool replacedHeader=
FALSE;
989 bool foundSize=
FALSE;
993 int numBytes = fi.readLine(
line.rawData(),maxLineLen);
998 line.resize(numBytes+1);
1002 ASSERT(numBytes<maxLineLen);
1007 if (
line.find(
"<svg")!=-1 && !replacedHeader)
1010 count = sscanf(
line.data(),
"<svg width=\"%dpt\" height=\"%dpt\"",&width,&height);
1012 foundSize = count==2 && (width>500 || height>450);
1013 if (foundSize) insideHeader=
TRUE;
1015 else if (insideHeader && !replacedHeader &&
line.find(
"<title>")!=-1)
1020 t <<
"<!--zoomable " << height <<
" -->\n";
1022 t <<
"var viewWidth = " << width <<
";\n";
1023 t <<
"var viewHeight = " << height <<
";\n";
1026 t <<
"var sectionId = 'dynsection-" << graphId <<
"';\n";
1029 t <<
"<script xlink:href=\"" << relPath <<
"svgpan.js\"/>\n";
1030 t <<
"<svg id=\"graph\" class=\"graph\">\n";
1031 t <<
"<g id=\"viewport\">\n";
1034 replacedHeader=
TRUE;
1037 if (!insideHeader || !foundSize)
1045 else if ((i=
line.find(
"<!-- SVG"))!=-1 || (i=
line.find(
"[!-- SVG"))!=-1)
1050 int n = sscanf(
line.data()+i+1,
"!-- SVG %d",&mapId);
1051 if (n==1 && mapId>=0 && mapId<(
int)
m_maps.count())
1059 err(
"Problem extracting size from SVG file %s\n",map->mapFile.data());
1061 if (e!=-1)
t <<
line.mid(e+3);
1069 else if ((i=
line.find(
"<!-- MAP"))!=-1)
1073 int n = sscanf(
line.data()+i,
"<!-- MAP %d",&mapId);
1074 if (n==1 && mapId>=0 && mapId<(
int)
m_maps.count())
1079 t <<
"<map name=\"" << map->label <<
"\" id=\"" << map->label <<
"\">" <<
endl;
1080 convertMapFile(
t,map->mapFile,map->relPath,map->urlOnly,map->context);
1081 t <<
"</map>" <<
endl;
1089 else if ((i=
line.find(
"% FIG"))!=-1)
1092 int n = sscanf(
line.data()+i+2,
"FIG %d",&mapId);
1094 if (n==1 && mapId>=0 && mapId<(
int)
m_maps.count())
1101 err(
"problem writing FIG %d figure!\n",mapId);
1118 if (isSVGFile && interactiveSVG && replacedHeader)
1129 err(
"problem opening file %s for reading!\n",tmpName.
data());
1134 err(
"problem opening file %s for writing!\n",orgName.
data());
1141 int numBytes = fi.readLine(
line.rawData(),maxLineLen);
1146 line.resize(numBytes+1);
virtual bool remove(const QString &fileName, bool acceptAbsPath=TRUE)
static QCString replaceRef(const QCString &buf, const QCString relPath, bool urlOnly, const QCString &context, const QCString &target=QCString())
static QCString stripPath(const QCString &s)
QCString left(uint len) const
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Simplified and optimized version of QTextStream.
static const char svgZoomHeader[]
const char * data() const
virtual bool rename(const QString &name, const QString &newName, bool acceptAbsPaths=TRUE)
QCString right(uint len) const
static bool writeVecGfxFigure(FTextStream &out, const QCString &baseName, const QCString &figureName)
const char * data() const
#define Config_getBool(val)
void err(const char *fmt,...)
The QFile class is an I/O device that operates on files.
static QString fromUtf8(const char *, int len=-1)
static bool writeSVGFigureLink(FTextStream &out, const QCString &relPath, const QCString &baseName, const QCString &absImgName)
void line(double t, double *p, double &x, double &y, double &z)
static const char svgZoomFooter[]
static bool convertMapFile(FTextStream &t, const char *mapName, const QCString relPath, bool urlOnly=FALSE, const QCString &context=QCString())
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
QTextStream & endl(QTextStream &s)