From a9896747b9e1811f116ae176e038fafece3c2876 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 26 Oct 2012 21:36:27 +0000
Subject: animate (26oct12)

git-svn-id: svn://tug.org/texlive/trunk@28095 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/animate/animate.sty | 122 +++++++++++-------------
 1 file changed, 57 insertions(+), 65 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/animate/animate.sty')

diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 26d1f564698..024dd18de85 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -12,7 +12,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 
-\def\@anim@version{2012/09/03}
+\def\@anim@version{2012/10/26}
 \ProvidesPackage{animate}
 [\@anim@version\space PDF animations from files and inline graphics]
 
@@ -231,21 +231,21 @@
   \newcount\@anim@@ocgs
   \pdfobj reserveobjnum
   \@anim@@ocgs=\pdflastobj
-  \newcount\@anim@@posterocgs
+  \newcount\@anim@@offocgs
   \pdfobj reserveobjnum
-  \@anim@@posterocgs=\pdflastobj
+  \@anim@@offocgs=\pdflastobj
   \pdfcatalog{
     /AcroForm <</Fields \the\@anim@@fields\space 0 R>>
     /OCProperties <<
       /OCGs \the\@anim@@ocgs\space 0 R
       /D <<
-        /BaseState/OFF /ON \the\@anim@@posterocgs\space 0 R
+        /BaseState/ON /OFF \the\@anim@@offocgs\space 0 R
       >>
     >>
   }
   \def\@anim@fields{}
   \def\@anim@ocgs{}
-  \def\@anim@posterocgs{}
+  \def\@anim@offocgs{}
   \AtEndDocument{%
     \immediate\pdfobj useobjnum \@anim@@fields {%
       [\@anim@fields]%
@@ -253,8 +253,8 @@
     \immediate\pdfobj useobjnum \@anim@@ocgs {%
       [\@anim@ocgs]%
     }%
-    \immediate\pdfobj useobjnum \@anim@@posterocgs {%
-      [\@anim@posterocgs]%
+    \immediate\pdfobj useobjnum \@anim@@offocgs {%
+      [\@anim@offocgs]%
     }%
   }%
 \else
@@ -266,12 +266,12 @@
     %array which takes all ocgs (one per animation frame)
     \special{pdf:obj @anim@ocgs [ ]}
     %array which takes ocgs shown by default (the poster frames)
-    \special{pdf:obj @anim@posterocgs [ ]}
+    \special{pdf:obj @anim@offocgs [ ]}
     \special{pdf:put @catalog <<
       /AcroForm <</Fields @anim@fields>>
       /OCProperties <<
         /OCGs @anim@ocgs
-        /D <</BaseState/OFF /ON @anim@posterocgs>>
+        /D <</BaseState/ON /OFF @anim@offocgs>>
       >>
     >>}
   \else
@@ -281,11 +281,11 @@
     \fi\fi
     \special{ps:
       mark /_objdef {@anim@ocgs} /type/array /OBJ pdfmark
-      mark /_objdef {@anim@posterocgs} /type/array /OBJ pdfmark
+      mark /_objdef {@anim@offocgs} /type/array /OBJ pdfmark
       mark {Catalog} <<
         /OCProperties <<
           /OCGs {@anim@ocgs}
-          /D <</BaseState/OFF /ON {@anim@posterocgs}>>
+          /D <</BaseState/ON /OFF {@anim@offocgs}>>
         >>
       >> /PUT pdfmark
     }
@@ -568,33 +568,12 @@
     \xdef\@anim@curocg{\the\pdflastobj\space 0 R}%
     %append to ocg array
     \xdef\@anim@ocgs{\@anim@ocgs\space\@anim@curocg}%
-    %store ref to ocg if it's a poster
-    \ifx\@anim@poster\@anim@posternone\else%
-      \ifnum#2=\z@%
-        \ifx\@anim@poster\@anim@posterfirst%
-          \xdef\@anim@posterocg{\@anim@curocg}%
-        \fi%
-      \fi%
-      \ifx\@anim@poster\@anim@posterlast%
-        \xdef\@anim@posterocg{\@anim@curocg}%
-      \fi%
-    \fi%
   }
 \else
   \if@anim@@dvipdfmx
     \def\@anim@newocg#1#2{%
       \special{pdf:obj @anim@ocg@#1@#2 <</Type/OCG /Name (#1.#2)>>}%
       \special{pdf:put @anim@ocgs @anim@ocg@#1@#2}%
-      \ifx\@anim@poster\@anim@posternone\else%
-        \ifnum#2=\z@%
-          \ifx\@anim@poster\@anim@posterfirst%
-            \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
-          \fi%
-        \fi%
-        \ifx\@anim@poster\@anim@posterlast%
-          \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
-        \fi%
-      \fi%
     }
   \else
     \def\@anim@newocg#1#2{%
@@ -603,16 +582,6 @@
         mark {@anim@ocg@#1@#2} <</Type/OCG /Name (#1.#2)>> /PUT pdfmark
         mark {@anim@ocgs} {@anim@ocg@#1@#2} /APPEND pdfmark
       }%
-      \ifx\@anim@poster\@anim@posternone\else%
-        \ifnum#2=\z@%
-          \ifx\@anim@poster\@anim@posterfirst%
-            \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
-          \fi%
-        \fi%
-        \ifx\@anim@poster\@anim@posterlast%
-          \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
-        \fi%
-      \fi%
     }
   \fi
 \fi
@@ -634,6 +603,20 @@
       /XObject <<\@anim@getkeyval{frmxobject@#2}>>}\@anim@box%
     \if@anim@useocg%
       \@anim@newocg{#1}{#2}%
+      \ifx\@anim@poster\@anim@posterlast%
+        \@anim@keytoaux{a#1.poster}{#2}%
+        \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{}{%
+          \xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
+        }%
+      \else%
+        \ifnum#2=\z@%
+          \ifx\@anim@poster\@anim@posternone%
+            \xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
+          \fi%
+        \else%
+          \xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
+        \fi%
+      \fi%
       \def\@anim@annotflag{/F 4}%, print, visibility set by OCG
     \else%
       %widget visibility state
@@ -685,6 +668,20 @@
       \special{pdf:exobj}%
       \if@anim@useocg%
         \@anim@newocg{#1}{#2}%
+        \ifx\@anim@poster\@anim@posterlast%
+          \@anim@keytoaux{a#1.poster}{#2}%
+          \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{}{%
+            \special{pdf:put @anim@offocgs @anim@ocg@#1@#2}%
+          }%
+        \else%
+          \ifnum#2=\z@%
+            \ifx\@anim@poster\@anim@posternone%
+              \special{pdf:put @anim@offocgs @anim@ocg@#1@#2}%
+            \fi%
+          \else%
+            \special{pdf:put @anim@offocgs @anim@ocg@#1@#2}%
+          \fi%
+        \fi%
         \def\@anim@annotflag{/F 4}%
       \else%
         \def\@anim@annotflag{/F 2}%
@@ -733,6 +730,20 @@
       }%
       \if@anim@useocg%
         \@anim@newocg{#1}{#2}%
+        \ifx\@anim@poster\@anim@posterlast%
+          \@anim@keytoaux{a#1.poster}{#2}%
+          \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{}{%
+            \special{ps: mark {@anim@offocgs} {@anim@ocg@#1@#2} /APPEND pdfmark}%
+          }%
+        \else%
+          \ifnum#2=\z@%
+            \ifx\@anim@poster\@anim@posternone%
+              \special{ps: mark {@anim@offocgs} {@anim@ocg@#1@#2} /APPEND pdfmark}%
+            \fi%
+          \else%
+            \special{ps: mark {@anim@offocgs} {@anim@ocg@#1@#2} /APPEND pdfmark}%
+          \fi%
+        \fi%
         \def\@anim@annotflag{/F 4}%
       \else%
         \def\@anim@annotflag{/F 2}%
@@ -795,8 +806,8 @@
     \edef\@anim@pauseocg{\the\pdflastobj\space 0 R}%
     %append to ocg array
     \xdef\@anim@ocgs{\@anim@ocgs\space\@anim@playocg\space\@anim@pauseocg}%
-    %although not really necessary, append play button ocg to posterocg array
-    \xdef\@anim@posterocgs{\@anim@posterocgs\space\@anim@playocg}%
+    %set initial ocg state (off) for pause button
+    \xdef\@anim@offocgs{\@anim@offocgs\space\@anim@pauseocg}%
     %new container XObject
     \immediate\pdfobj stream attr{%
       /Type/XObject/Subtype/Form/BBox [0 0 15 15]%
@@ -818,7 +829,7 @@
       \special{pdf:obj @#1.Play#2 <</Type/OCG /Name (#1.Play#2)>>}%
       \special{pdf:obj @#1.Pause#2 <</Type/OCG /Name (#1.Pause#2)>>}%
       \special{pdf:put @anim@ocgs @#1.Play#2 @#1.Pause#2}%
-      \special{pdf:put @anim@posterocgs @#1.Play#2}%
+      \special{pdf:put @anim@offocgs @#1.Pause#2}%
       \special{pdf:stream @btn#1.PlayPause#2\space
         (/OC/oc0 BDC q /im0 Do Q EMC /OC/oc1 BDC q /im1 Do Q EMC) <<%
           /Type/XObject/Subtype/Form/BBox [0 0 15 15]%
@@ -840,7 +851,7 @@
         mark {#1.Pause#2} <</Type/OCG /Name (#1.Pause#2)>> /PUT pdfmark
         mark {@anim@ocgs} {#1.Play#2} /APPEND pdfmark
         mark {@anim@ocgs} {#1.Pause#2} /APPEND pdfmark
-        mark {@anim@posterocgs} {#1.Play#2} /APPEND pdfmark
+        mark {@anim@offocgs} {#1.Pause#2} /APPEND pdfmark
         mark  /_objdef {btn#1.PlayPause#2} /type/stream /OBJ pdfmark
         mark {btn#1.PlayPause#2} (%
           /OC/oc0 BDC q /im0 Do Q EMC /OC/oc1 BDC q /im1 Do Q EMC%
@@ -1746,12 +1757,6 @@
     %create JavaScript objects
     \@anim@pojscript{#1}% to be executed on PO event
     \@anim@otherjscript{#1}% on other events in the AA dict
-    \if@anim@useocg%
-      %add poster to posterocg array
-      \ifx\@anim@poster\@anim@posternone\else%
-        \xdef\@anim@posterocgs{\@anim@posterocgs\space\@anim@posterocg}%
-      \fi%
-    \fi%
     \pdfannot
       width \@anim@animwidth\p@ height \@anim@animheight\p@
       depth \@anim@animdepth\p@
@@ -1781,11 +1786,6 @@
     \def\@anim@animwidget#1{%
       \@anim@pojscript{#1}%
       \@anim@otherjscript{#1}%
-      \if@anim@useocg%
-        \ifx\@anim@poster\@anim@posternone\else%
-          \special{pdf:put @anim@posterocgs \@anim@posterocg}%
-        \fi%
-      \fi%
       \special{pdf:annot @annot@\the\@anim@fieldnum\space
         width \@anim@animwidth pt height \@anim@animheight pt
         depth \@anim@animdepth pt <<%
@@ -1830,13 +1830,6 @@
       \endgroup%
       \@anim@pojscript{#1}%
       \@anim@otherjscript{#1}%
-      \if@anim@useocg%
-        \ifx\@anim@poster\@anim@posternone\else%
-          \special{ps:
-            mark {@anim@posterocgs} {\@anim@posterocg} /APPEND pdfmark
-          }%
-        \fi%
-      \fi%
       \special{ps:
         mark
           /_objdef {annot@\the\@anim@fieldnum}%
@@ -2967,7 +2960,6 @@
   \global\let\if@anim@step=\if@anim@@step%
   \global\let\if@anim@draft=\if@anim@@draft%
   \global\let\if@anim@useocg=\if@anim@@useocg%
-  \gdef\@anim@posterocg{}%
   \gdef\@anim@properties{}%
   \setboolean{@anim@pauseframes}{false}%
   \gdef\@anim@pauseat{}%
-- 
cgit v1.2.3

