summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-06-04 16:39:09 +0000
committerKarl Berry <karl@freefriends.org>2008-06-04 16:39:09 +0000
commit911511863481e550b16a41671510b964fb590198 (patch)
treee8f63c076147f0866a42373f501be272def765d9 /Master/texmf-dist/tex/latex/animate
parent0c1d6aeb7161b63c8c5d178288c2df12ea713dd9 (diff)
animate update (3jun08)
git-svn-id: svn://tug.org/texlive/trunk@8555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty140
1 files changed, 89 insertions, 51 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 88e5dfe4cb6..57202e0c89b 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -11,7 +11,7 @@
% Supports LaTeX->dvips->ps2pdf or pdfLaTeX workflows.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{animate}[2008/05/23]
+\ProvidesPackage{animate}[2008/06/03]
%test for e-TeX
\ifx\eTeXversion\@undefined%
@@ -93,9 +93,9 @@
\gdef\@anim@rerunwarned{}%
\AtEndDocument{%
\PackageWarningNoLine{animate}{%
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak
- @@ Rerun to get object references right! @@\MessageBreak
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}%
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak
+ @@ Rerun to get internal references right! @@\MessageBreak
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}%
}%
\fi%
\fi%
@@ -233,7 +233,7 @@
%create Form XObject from graphics file
\ifthenelse{\boolean{pdf}}{
\def\@anim@ximage#1#2#3#4{%#1:@anim@num, #2:@anim@curframe@zb, #3:filename,
- %#4: page number of multipage pdf
+ %#4: page number of multipage file
\ifthenelse{\equal{\@anim@fileknown{#3}{#4}}{!}}{% new file to be embedded
\@anim@filebox{#3}{#4}% store file in a box
\@anim@getsize{\@anim@box}%
@@ -241,7 +241,7 @@
\@anim@scale% scale animation widget
\fi%
\@anim@xinline{#1}{#2}{\@anim@box}{!}% delegate Form XObject creation
- \ifx\@anim@gropts\@empty\if@anim@multipdf\message{<#4>}\fi\fi%
+ \ifx\@anim@gropts\@empty\if@anim@multipage\message{<#4>}\fi\fi%
\@anim@makefileknown{#3}{#4}{\@anim@lastxform}% keep form xobject number
}{% file known, re-use existing form xobject
\ifnum#2=0
@@ -304,8 +304,8 @@
\ifthenelse{\equal{#4}{!}}{%
\begingroup%
\setlength{\unitlength}{1pt}%
- %mark BBox of the graphics
\begin{picture}(0,0)%
+ %mark BBox of the graphics
\put(0,-\@anim@framedepth){%
\special{ps:
currentpoint /frame@lly exch def /frame@llx exch def
@@ -316,11 +316,26 @@
currentpoint /frame@ury exch def /frame@urx exch def
}%
}%
+ %define some length values in current PS coordinate units
+ \put(72.27,-\@anim@framedepth){%
+ \special{ps:
+ /one@inch currentpoint pop frame@llx sub def
+ }%
+ }%
+ \put(\strip@pt\paperheight,-\@anim@framedepth){%
+ \special{ps:
+ /paper@height currentpoint pop frame@llx sub def
+ }%
+ }%
\end{picture}%
\endgroup%
- %distill graphics into XObject
\special{ps:
gsave
+ %translate graphics to lower left page corner
+ frame@llx neg frame@lly neg translate
+ one@inch neg dup translate
+ 0 paper@height translate
+ %distill graphics into XObject
mark
/_objdef {@anim@frm@#1@#2}
/BBox [frame@llx frame@lly frame@urx frame@ury]
@@ -1009,7 +1024,7 @@
`#1.jbig2',\MessageBreak%
`#1.jb2',\MessageBreak%
`#1.jp2',\MessageBreak%
- `#1.j2k', or\MessageBreak%
+ `#1.j2k' or\MessageBreak%
`#1.jpx',\MessageBreak%
could be found.\MessageBreak%
Wrong file type? Mis-spelled file name?%
@@ -1105,14 +1120,27 @@
}%
}
-\newboolean{@anim@multipdf} % multipage PDF?
+\newboolean{@anim@multipage} % multipage document?
\ifpdf
%detects multipage PDF and corrects user supplied page range
- \def\@anim@checkmultipdf#1{% #1: file base name
+ \def\@anim@checkmultipage#1{% #1: file base name
\IfFileExists{#1.pdf}{%
+ \setboolean{@anim@multipage}{true}%
\gdef\@anim@ext{.pdf}%
- \@anim@filebox{#1.pdf}{1}%
+ }{%
+ \IfFileExists{#1.jbig2}{%
+ \setboolean{@anim@multipage}{true}%
+ \gdef\@anim@ext{.jbig2}%
+ }{%
+ \IfFileExists{#1.jb2}{%
+ \setboolean{@anim@multipage}{true}%
+ \gdef\@anim@ext{.jb2}%
+ }{}%
+ }%
+ }%
+ \if@anim@multipage%
+ \@anim@filebox{#1\@anim@ext}{1}%
\ifx\@anim@first\@empty%
\global\@anim@curframe=\@ne%
\else%
@@ -1140,11 +1168,10 @@
\else%
\xdef\@anim@last{\the\@anim@curframe}%
\fi%
- \setboolean{@anim@multipdf}{true}%
- }{}%
- }
+ \fi%
+ }%
\else
- \def\@anim@checkmultipdf#1{}% no-op in dvi mode
+ \def\@anim@checkmultipage#1{}% no-op in dvi mode
\fi
%user command for embedding animation sequence
@@ -1171,14 +1198,25 @@
\def\@anim@first{#4}%
\def\@anim@last{#5}%
%
- \@anim@checkmultipdf{\@anim@base}%test for multipage pdf
+ \@anim@checkmultipage{\@anim@base}%test for multipage file
+ \if@anim@multipage\else% cope with wrong user input
+ \ifnum\@anim@first>\@anim@last
+ \edef\@anim@temp{\@anim@first}\edef\@anim@first{\@anim@last}%
+ \edef\@anim@last{\@anim@temp}%
+ \fi%
+ \ifthenelse{\@anim@first<0\OR\@anim@last<0}{%
+ \PackageError{animate}{%
+ Negative frame numbers not allowed%
+ }{}%
+ }{}%
+ \fi%
\global\@anim@curframe=\@anim@first%
\global\@anim@curframe@zb=0%
%
\if@anim@draft%
- \if@anim@multipdf%
+ \if@anim@multipage%
%store file in a box
- \@anim@filebox{\@anim@base.pdf}{\@anim@first}%
+ \@anim@filebox{\@anim@base\@anim@ext}{\@anim@first}%
\else%
%get file name extension
\@anim@getext{\@anim@base\@anim@first}%
@@ -1209,10 +1247,10 @@
%
%read all frames of the sequence
\loop\ifnum\@anim@curframe>\@anim@last\else%
- \if@anim@multipdf%
+ \if@anim@multipage%
%embed graphics
- \@anim@ximage{\the\@anim@num}{\the\@anim@curframe@zb}{\@anim@base.pdf}{%
- \the\@anim@curframe}%
+ \@anim@ximage{\the\@anim@num}{\the\@anim@curframe@zb}{%
+ \@anim@base\@anim@ext}{\the\@anim@curframe}%
\else%
%get file name extension of current file
\@anim@getext{%
@@ -2275,7 +2313,7 @@
\global\@anim@end={}%
\gdef\@anim@every{1}% frames to be included
\gdef\@anim@gropts{}%
- \setboolean{@anim@multipdf}{false}%
+ \setboolean{@anim@multipage}{false}%
\setboolean{@anim@meas}{false}%
\setboolean{@anim@autoplayorresume}{false}%
\setboolean{@anim@ctrlorplndrm}{false}%
@@ -2926,35 +2964,37 @@
/D <</S/JavaScript/JS (% pause on MouseDown
%disable focus rectangle
app.focusRect=false;%
- if(a#1.isPlaying){a#1.actnPause();}%
+ try{if(a#1.isPlaying){a#1.actnPause();}}catch(e){}%
)>>%
\fi%
/U <</S/JavaScript/JS (% play/resume on MouseUp
- \if@anim@step%
- \if@anim@palindrome
- if(a#1.playsRight){%
- a#1.actnNext();%
- }else{%
- a#1.actnPrev();%
- }%
- \else
- if(a#1.idx==\@anim@maxframe){%
- a#1.actnEndLeft();%
- }else{%
- a#1.actnNext();%
- }%
- \fi%
- \else%
- \if@anim@ctrlorplndrm
- if(a#1.playsRight){%
- a#1.actnPlayRight();%
- }else{%
- a#1.actnPlayLeft();%
- }%
+ try{%
+ \if@anim@step%
+ \if@anim@palindrome
+ if(a#1.playsRight){%
+ a#1.actnNext();%
+ }else{%
+ a#1.actnPrev();%
+ }%
+ \else
+ if(a#1.idx==\@anim@maxframe){%
+ a#1.actnEndLeft();%
+ }else{%
+ a#1.actnNext();%
+ }%
+ \fi%
\else%
- a#1.actnPlayRight();%
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){%
+ a#1.actnPlayRight();%
+ }else{%
+ a#1.actnPlayLeft();%
+ }%
+ \else%
+ a#1.actnPlayRight();%
+ \fi%
\fi%
- \fi%
+ }catch(e){}%
)>>%
}%
}
@@ -2983,12 +3023,10 @@
\fi%
\else%
\ifx\@anim@action\@anim@PlayPauseLeft
- if(a#1.isPlaying){a#1.actnPause();}%
- else{a#1.actnPlayLeft();}%
+ if(a#1.isPlaying){a#1.actnPause();}else{a#1.actnPlayLeft();}%
\else%
\ifx\@anim@action\@anim@PlayPauseRight
- if(a#1.isPlaying){a#1.actnPause();}%
- else{a#1.actnPlayRight();}%
+ if(a#1.isPlaying){a#1.actnPause();}else{a#1.actnPlayRight();}%
\else%
\ifx\@anim@action\@anim@StepRight%
\if@anim@step