diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-06 22:15:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-06 22:15:00 +0000 |
commit | 8d918f88e6d576dc1612e5625a0ad802d17c8e13 (patch) | |
tree | 7866459f67ba7f4c37d87cf9ea8846b37915fadc /Build/source/utils/asymptote/picture.cc | |
parent | eb21dd9dc04d18b2ceda665ab6272d4a97926f38 (diff) |
asy 2.60 sources
git-svn-id: svn://tug.org/texlive/trunk@52659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/picture.cc')
-rw-r--r-- | Build/source/utils/asymptote/picture.cc | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc index 8f3e74570fa..b3671f82805 100644 --- a/Build/source/utils/asymptote/picture.cc +++ b/Build/source/utils/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 |