summaryrefslogtreecommitdiff
path: root/graphics/asymptote/picture.cc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/picture.cc')
-rw-r--r--graphics/asymptote/picture.cc52
1 files changed, 35 insertions, 17 deletions
diff --git a/graphics/asymptote/picture.cc b/graphics/asymptote/picture.cc
index 8f3e74570f..b3671f8280 100644
--- a/graphics/asymptote/picture.cc
+++ b/graphics/asymptote/picture.cc
@@ -17,6 +17,10 @@
#include "drawsurface.h"
#include "drawpath3.h"
+#ifdef __MSDOS__
+#include "sys/cygwin.h"
+#endif
+
using std::ifstream;
using std::ofstream;
using vm::array;
@@ -730,6 +734,25 @@ int picture::pdftosvg(const string& pdfname, const string& outname)
return status;
}
+void htmlView(string name)
+{
+ mem::vector<string> cmd;
+ push_command(cmd,getSetting<string>("htmlviewer"));
+#ifdef __MSDOS__
+ ssize_t size=cygwin_conv_path(CCP_POSIX_TO_WIN_A,
+ locateFile(name,true).c_str(),NULL,0);
+ if(size <= 0) return;
+ char filename[size];
+ size=cygwin_conv_path(CCP_POSIX_TO_WIN_A,locateFile(name,true).c_str(),
+ filename,size);
+ cmd.push_back("file://"+string(filename));
+#else
+ cmd.push_back(locateFile(name,true));
+#endif
+ push_split(cmd,getSetting<string>("htmlviewerOptions"));
+ System(cmd,2,false);
+}
+
bool picture::postprocess(const string& prename, const string& outname,
const string& outputformat,
bool wait, bool view, bool pdftex,
@@ -851,12 +874,16 @@ bool picture::postprocess(const string& prename, const string& outname,
}
}
} else {
- mem::vector<string> cmd;
- push_command(cmd,getSetting<string>("display"));
- cmd.push_back(outname);
- string application="your "+outputformat+" viewer";
- status=System(cmd,0,wait,"display",application.c_str());
- if(status != 0) return false;
+ if(outputformat == "svg")
+ htmlView(outname);
+ else {
+ mem::vector<string> cmd;
+ push_command(cmd,getSetting<string>("display"));
+ cmd.push_back(outname);
+ string application="your "+outputformat+" viewer";
+ status=System(cmd,0,wait,"display",application.c_str());
+ if(status != 0) return false;
+ }
}
}
@@ -1353,17 +1380,8 @@ bool picture::shipout3(const string& prefix, const string& format,
}
if(verbose > 0)
cout << "Wrote " << name << endl;
- if(View) {
- mem::vector<string> cmd;
- push_command(cmd,getSetting<string>("htmlviewer"));
-#ifdef __MSDOS__
- cmd.push_back("file://%CD%/"+name);
-#else
- cmd.push_back(name);
-#endif
- push_split(cmd,getSetting<string>("htmlviewerOptions"));
- System(cmd,2,false);
- }
+ if(View)
+ htmlView(name);
return true;
}
#endif