summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/external.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-05-16 00:19:13 +0000
committerKarl Berry <karl@freefriends.org>2009-05-16 00:19:13 +0000
commitbab45528d65eaafe68a705dbb2a57075c7b7cbd8 (patch)
tree10b4ae2b5195c8dede153ab89359ec00f55f325f /Build/source/utils/asymptote/base/external.asy
parent8643d90372e9c31e0f461c15c596b60a545bd7d3 (diff)
asymptote 1.72 sources (not integrated into build yet)
git-svn-id: svn://tug.org/texlive/trunk@13110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base/external.asy')
-rw-r--r--Build/source/utils/asymptote/base/external.asy36
1 files changed, 36 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/base/external.asy b/Build/source/utils/asymptote/base/external.asy
new file mode 100644
index 00000000000..5573561fc36
--- /dev/null
+++ b/Build/source/utils/asymptote/base/external.asy
@@ -0,0 +1,36 @@
+usepackage("hyperref","setpagesize=false,unicode");
+
+// Embed object to be run in an external window. An image file name can be
+// specified; if not given one will be automatically generated.
+string embed(string name, string options="", real width=0, real height=0,
+ string image="")
+{
+ string options; // Ignore movie15 options.
+ if(image == "") {
+ image=stripdirectory(stripextension(name))+"."+nativeformat();
+ convert(name+"[0]",image,nativeformat());
+
+ if(!settings.keep) {
+ exitfcn currentexitfunction=atexit();
+ void exitfunction() {
+ if(currentexitfunction != null) currentexitfunction();
+ delete(image);
+ }
+ atexit(exitfunction);
+ }
+ }
+ if(width != 0) options += ", width="+(string) (width*pt)+"pt";
+ if(height != 0) options +=", height="+(string) (height*pt)+"pt";
+ return "\href{run:"+name+"}{"+graphic(image,options)+"}";
+}
+
+string hyperlink(string url, string text)
+{
+ return "\href{"+url+"}{"+text+"}";
+}
+
+string link(string url, string text, string options="")
+{
+ return hyperlink("run:"+url,text);
+}
+