From d78773b1bd9f5d2a52f7c8e0c0bc7ffd96841667 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Mar 2015 20:25:15 +0000 Subject: animate (11mar15) git-svn-id: svn://tug.org/texlive/trunk@36484 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/animate/animate.sty | 74 ++++++++++++++++++------- 1 file changed, 55 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index b0ed13e2baa..20ddbaa033d 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} -\def\@anim@version{2015/01/21} +\def\@anim@version{2015/03/11} \ProvidesPackage{animate} [\@anim@version\space PDF animations from files and inline graphics] @@ -318,16 +318,26 @@ \ifx\empty\@ocgbase@ocgs\empty\else% \special{pdf:obj @ocgbase@ocgs []}% \special{pdf:put @ocgbase@ocgs \@ocgbase@ocgs}% - \special{pdf:obj @ocgbase@offocgs []}% - \special{pdf:put @ocgbase@offocgs \@ocgbase@offocgs}% - \special{pdf:obj @ocgbase@ocgorder []}% - \special{pdf:put @ocgbase@ocgorder \@ocgbase@ocgorder}% + \ifx\empty\@ocgbase@offocgs\empty + \gdef\@anim@offocgentry{} + \else% + \special{pdf:obj @ocgbase@offocgs []}% + \special{pdf:put @ocgbase@offocgs \@ocgbase@offocgs}% + \gdef\@anim@offocgentry{/OFF @ocgbase@offocgs} + \fi% + \ifx\empty\@ocgbase@ocgorder\empty + \gdef\@anim@ocgorderentry{} + \else% + \special{pdf:obj @ocgbase@ocgorder []}% + \special{pdf:put @ocgbase@ocgorder \@ocgbase@ocgorder}% + \gdef\@anim@ocgorderentry{/Order @ocgbase@ocgorder} + \fi% \special{pdf:put @catalog <<% /OCProperties <<% /OCGs @ocgbase@ocgs% /D <<% - /BaseState/ON /OFF @ocgbase@offocgs% - /Order @ocgbase@ocgorder /ListMode/VisiblePages% + /BaseState/ON \@anim@offocgentry% + \@anim@ocgorderentry/ListMode/VisiblePages% /AS[% <>% <>% @@ -534,7 +544,9 @@ } \def\@anim@pdfannot#1#2#3#4{%width, height, depth, dict - \pdfannot width #1\p@ height #2\p@ depth #3\p@ {#4}% + \pdfannot width #1\p@ height #2\p@ depth #3\p@ {% + #4% + }% %since all annots are Widgets \xdef\@anim@fields{\@anim@fields\the\pdflastannot\space 0 R\space}% } @@ -610,7 +622,9 @@ \def\@anim@pdfannot#1#2#3#4{%width, height, depth, dict \special{pdf:annot @anm@obj\the\@anim@objnum\space width #1pt height #2pt - depth #3pt <<#4>>}% + depth #3pt <<% + #4% + >>}% \xdef\@anim@fields{\@anim@fields @anm@obj\the\@anim@objnum\space}% \global\advance\@anim@objnum by \@ne% } @@ -867,7 +881,7 @@ \ifnum\@anim@poster>\@anim@mtwo% insert poster frame \ifnum#2=\@anim@poster% \edef\@anim@posterap{\@anim@lastxform}% - \else% + \else% \ifnum\@anim@poster=\@anim@mone% use last frame as poster \edef\@anim@posterap{\@anim@lastxform}% \fi% @@ -885,7 +899,7 @@ \ifnum\@anim@poster>\@anim@mtwo% insert poster frame \ifnum#2=\@anim@poster% \def\@anim@annotflag{/F 4}% not hidden + print (4) - \else% + \else% \ifnum\@anim@poster=\@anim@mone% use last frame as poster \@anim@keytoaux{a#1.poster}{#2}% \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{% @@ -904,6 +918,7 @@ /AP <>% /MK <>>>% /T (#1.#2)% + \ifdefined\fxocg@insert@OC\fxocg@insert@OC\fi% }% \or% ocg based \@anim@newocg{#1}{#2}% @@ -1344,7 +1359,7 @@ Wrong file type? Mis-spelled file name?% }{}% }}}}}}}}}}% - \else% + \else% \gdef\@anim@ext{.#2}% \IfFileExists{#1\@anim@ext}{}{% \PackageError{animate}{% @@ -1389,7 +1404,7 @@ Wrong file type? Mis-spelled file name?% }{}% }}}}}}}}% - \else% + \else% \gdef\@anim@ext{.#2}% \IfFileExists{#1\@anim@ext}{}{% \PackageError{animate}{% @@ -1418,7 +1433,7 @@ Wrong file type? Mis-spelled file name?% }{}% }}}% - \else% + \else% \gdef\@anim@ext{.#2}% \IfFileExists{#1\@anim@ext}{}{% \PackageError{animate}{% @@ -1521,7 +1536,7 @@ }{}% }% }% - \else% + \else% \IfFileExists{#1.#2}{% \setboolean{@anim@multipage}{true}% \gdef\@anim@ext{.#2}% @@ -1565,7 +1580,7 @@ \setboolean{@anim@multipage}{true}% \gdef\@anim@ext{.pdf}% }{}% - \else% + \else% \IfFileExists{#1.#2}{% \setboolean{@anim@multipage}{true}% \gdef\@anim@ext{.#2}% @@ -1897,6 +1912,18 @@ \fi% \def\@anim@apmk{\@anim@refobj{\@anim@apdummy}}% \fi% + %With icon and ocg method, we put one dummy widget below; this seems to be + %necessary for the OCG visibility referenced by the /OC entry to work + %as expected (if we place the animation on a PDF layer using fixocgx.sty). + \ifnum\@anim@method=\@ne\else% + \ifdefined\fxocg@insert@OC% + \ifthenelse{\equal{\fxocg@insert@OC}{}}{}{% + \@anim@pdfannot{\@anim@animwidth}{\@anim@animheight}{\@anim@animdepth}{% + /Subtype/Widget/F 2% + }% + }% + \fi% + \fi% \@anim@pdfannot{\@anim@animwidth}{\@anim@animheight}{\@anim@animdepth}{% /Subtype/Widget% /FT/Btn/Ff \@anim@btnflag% @@ -1913,6 +1940,7 @@ >>% /AP <>% /MK <>>>% + \ifdefined\fxocg@insert@OC\fxocg@insert@OC\fi% }% \hbox to \@anim@animwidth\p@ {% \vrule width 0pt height \@anim@animheight\p@ depth \@anim@animdepth\p@% @@ -1947,6 +1975,13 @@ \fi% \if@anim@js\@anim@upjscript{#1}{#2}\fi% JavaScript actions for ButtonUp events \setlength{\@anim@tmpdima}{\@anim@btnsize}% + \ifdefined\fxocg@insert@OC% put dummy widget below (for fixocgx compatibility) + \ifthenelse{\equal{\fxocg@insert@OC}{}}{}{% + \@anim@pdfannot{\strip@pt\@anim@tmpdima}{\strip@pt\@anim@tmpdima}{0}{% + /Subtype/Widget/F 2% + }% + }% + \fi% \@anim@pdfannot{\strip@pt\@anim@tmpdima}{\strip@pt\@anim@tmpdima}{0}{% /Subtype/Widget% \@anim@annotflag% @@ -1963,6 +1998,7 @@ /T (#1.#2)% \@anim@tooltip% \if@anim@js/A <>\fi% + \ifdefined\fxocg@insert@OC\fxocg@insert@OC\fi% }% \if@anim@js% \hbox to \@anim@tmpdima {% @@ -3364,7 +3400,7 @@ \fi a#1.idx=-1;% }% - \fi + \fi if(f>\@anim@maxframe||f<0){return -1;}% a#1.idx=f;% \if@anim@usrjs @@ -3666,7 +3702,7 @@ if(a#1.playing){ \if@anim@autopause a#1.pause();% - \else + \else a#1.pause(true);% stop \fi% }% @@ -3731,7 +3767,7 @@ \else% \if@anim@loop\else if(a#1.idx==\@anim@maxframe){a#1.stopFirst();}% - \fi + \fi a#1.playRight();% \fi% \fi% -- cgit v1.2.3