summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/slide.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
committerKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
commit16d128e5e10d541a78654b86409d5a3539f07708 (patch)
tree66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/base/slide.asy
parentb20f78c549859ec0e8610bdd3ad904245e86b489 (diff)
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base/slide.asy')
-rw-r--r--Build/source/utils/asymptote/base/slide.asy75
1 files changed, 56 insertions, 19 deletions
diff --git a/Build/source/utils/asymptote/base/slide.asy b/Build/source/utils/asymptote/base/slide.asy
index b154c1d4746..b23a352fc5d 100644
--- a/Build/source/utils/asymptote/base/slide.asy
+++ b/Build/source/utils/asymptote/base/slide.asy
@@ -217,11 +217,10 @@ bool checkposition()
return true;
}
-void step()
-{
+void erasestep(int erasenode) {
if(!stepping || !allowstepping) return;
if(!checkposition()) return;
- lastnode.push(currentpicture.nodes.length-1);
+ lastnode.push(erasenode);
nextpage(steppagenumberpen);
for(int i=0; i < firstnode.length; ++i) {
for(int j=firstnode[i]; j <= lastnode[i]; ++j) {
@@ -233,6 +232,12 @@ void step()
tex(bulletcolor(newbulletcolor));
}
+void step()
+{
+ // Step without erasing anything.
+ erasestep(currentpicture.nodes.length-1);
+}
+
void incrementposition(pair z)
{
currentposition += z;
@@ -279,11 +284,13 @@ void remark(bool center=false, string s, pair align=0, pen p=itempen,
pair M=tinv*min(f);
if(abs(offset.x+M.x) > 1)
- write("warning: slide too wide on page "+(string) page+':\n'+(string) s);
+ warning("slidetoowide","slide too wide on page "+(string) page+':\n'+
+ (string) s);
if(abs(offset.y+M.y) > 1) {
void toohigh() {
- write("warning: slide too high on page "+(string) page+':\n'+(string) s);
+ warning("slidetoohigh","slide too high on page "+(string) page+':\n'+
+ (string) s);
}
if(M.y-m.y < 2) {
newslide(); offset=(offset.x,currentposition.y);
@@ -326,7 +333,7 @@ void skip(real n=1)
}
void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
if(f.length == 0) return;
real[] width=new real[f.length];
@@ -336,7 +343,7 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
sum += width[i];
}
if(sum > pagewidth)
- write("warning: slide too wide on page "+(string) page);
+ warning("toowide","slide too wide on page "+(string) page);
else margin=(pagewidth-sum)/(f.length+1);
real pos;
frame F;
@@ -347,19 +354,22 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
pos += w;
}
add(F,(0,currentposition.y),align);
- real a=0.5(unit(align).y-1);
- incrementposition((0,(tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ if (final) {
+ real a=0.5(unit(align).y-1);
+ incrementposition(
+ (0, (tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ }
}
void display(frame f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new frame[] {f},margin,align,p,figuremattpen);
+ display(new frame[] {f},margin,align,p,figuremattpen, final);
}
void display(string[] s, real margin=0, string[] captions=new string[],
string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
frame[] f=new frame[s.length];
frame F;
@@ -374,32 +384,59 @@ void display(string[] s, real margin=0, string[] captions=new string[],
if(captions[i] != "")
label(f[i],captions[i],point(f[i],S).x+I*y,S);
}
- display(f,margin,align,p,figuremattpen);
+ display(f,margin,align,p,figuremattpen, final);
if(caption != "") center(caption,p);
}
void display(string s, string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new string[] {s},caption,align,p,figuremattpen);
+ display(new string[] {s},caption,align,p,figuremattpen, final);
}
void figure(string[] s, string options="", real margin=0,
string[] captions=new string[], string caption="",
- pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen,
+ bool final=true)
{
string[] S;
for(int i=0; i < s.length; ++i) {
S[i]=graphic(s[i],options);
}
- display(S,margin,captions,caption,align,itempen,figuremattpen);
+ display(S,margin,captions,caption,align,itempen,figuremattpen, final);
}
void figure(string s, string options="", string caption="", pair align=S,
- pen p=itempen, pen figuremattpen=figuremattpen)
+ pen p=itempen, pen figuremattpen=figuremattpen, bool final=true)
+{
+ figure(new string[] {s},options,caption,align,p,figuremattpen, final);
+}
+
+void multifigure(string[] slist, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+{
+ if (stepping) {
+ int lastnode = currentpicture.nodes.length-1;
+ for (int i=0; i<slist.length-1; ++i) {
+ figure(slist[i], options, caption, align, p, figuremattpen, final=false);
+ erasestep(lastnode);
+ }
+ }
+ figure(slist[slist.length-1], options, caption, align, p, figuremattpen,
+ final=true);
+
+ if(!firststep) step();
+ firststep=false;
+}
+
+void indexedfigure(string prefix, int n, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
{
- figure(new string[] {s},options,caption,align,p,figuremattpen);
+ string[] s;
+ for (int i=0; i<n; ++i)
+ s.push(prefix+"+"+string(i));
+ multifigure(s, options, caption, align, p, figuremattpen);
}
string[] codefile;