summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-02-13 00:36:35 +0000
committerKarl Berry <karl@freefriends.org>2014-02-13 00:36:35 +0000
commita2f9bae96bd35eba79ebf7f50dae5696248c3bf8 (patch)
tree3b7f031ad8d1d81587d5da6c606bfd563cabe00d /Master/texmf-dist/tex/latex/animate
parent1a273c426b24a5493025822fdcbc277c1906c7b2 (diff)
animate (12feb14)
git-svn-id: svn://tug.org/texlive/trunk@32950 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty476
1 files changed, 231 insertions, 245 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 96771b6038b..bdef9c3b75c 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -8,11 +8,12 @@
% graphics files or inline graphics (e. g. LaTeX-picture, PSTricks,
% pgf/TikZ, ...)
-% Supports LaTeX->dvips->ps2pdf, (Xe)LaTeX->(x)dvipdfmx and pdfLaTeX workflows.
+% Supports LaTeX->dvips->ps2pdf, (Xe)LaTeX->(x)dvipdfmx, LuaLaTeX and
+% pdfLaTeX workflows.
\NeedsTeXFormat{LaTeX2e}
-\def\@anim@version{2014/02/06}
+\def\@anim@version{2014/02/11}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
@@ -29,6 +30,7 @@
\RequirePackage{keyval}
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
+\RequirePackage{ifluatex}
\RequirePackage{ifdraft}
\RequirePackage{calc}
\RequirePackage{animfp}
@@ -152,13 +154,17 @@
%\pdfmdfivesum is used for hashing object references of embedded files based
%on their MD5 digest (in order to avoid multiple inclusion); if it is not
%available, hashing will be based on the file name
-\ifcsname pdfmdfivesum\endcsname
- \def\@anim@pdfmdfivesum#1{\pdfmdfivesum file {#1}}
+\ifluatex
+ \RequirePackage{pdftexcmds}
+ \let\@anim@pdfmdfivesum\pdf@filemdfivesum
\else
- \def\@anim@pdfmdfivesum#1{#1}
+ \ifcsname pdfmdfivesum\endcsname
+ \def\@anim@pdfmdfivesum#1{\pdfmdfivesum file {#1}}
+ \else
+ \def\@anim@pdfmdfivesum#1{#1}
+ \fi
\fi
-
%creating and using global definitions
\def\@anim@newkey#1#2{{\expandafter\xdef\csname#1\endcsname{#2}}}
\def\@anim@getkeyval#1{\ifcsname#1\endcsname\csname#1\endcsname\fi}
@@ -218,24 +224,12 @@
\newboolean{@anim@timeline} %true if `timeline' option is set
\newboolean{@anim@multipage} % multipage document?
-%add AcroForm and OCProperties entries to Catalog
+%macros for adding AcroForm and OCProperties dicts to PDF Catalog
\ifdefined\@anim@fields\else\def\@anim@fields{}\fi %takes Field object refs
+\ifdefined\@anim@ocgs\else\def\@anim@ocgs{}\fi %takes ocg object refs
+\ifdefined\@anim@offocgs\else\def\@anim@offocgs{}\fi
\ifpdf
- \newcount\@anim@@ocgs
- \pdfobj reserveobjnum
- \@anim@@ocgs=\pdflastobj
- \newcount\@anim@@offocgs
- \pdfobj reserveobjnum
- \@anim@@offocgs=\pdflastobj
- \pdfcatalog{
- /OCProperties <<
- /OCGs \the\@anim@@ocgs\space 0 R
- /D <<
- /BaseState/ON /OFF \the\@anim@@offocgs\space 0 R
- >>
- >>
- }
- %macro for adding AcroForm entry to PDF Catalog
+ %AcroForm dict
\def\@anim@acroform{%
\ifdefined\Acro@Form@added\else%
\newcount\@anim@@fields%
@@ -252,31 +246,38 @@
\gdef\Acro@Form@added{}%
\fi%
}
- \def\@anim@ocgs{}
- \def\@anim@offocgs{}
- \AtEndDocument{%
- \immediate\pdfobj useobjnum \@anim@@ocgs {%
- [\@anim@ocgs]%
- }%
- \immediate\pdfobj useobjnum \@anim@@offocgs {%
- [\@anim@offocgs]%
- }%
- }%
+ %OCProperties dict
+ \def\@anim@ocprops{%
+ \ifdefined\oc@props@added\else%
+ \newcount\@anim@@ocgs%
+ \pdfobj reserveobjnum%
+ \global\@anim@@ocgs=\pdflastobj%
+ \newcount\@anim@@offocgs%
+ \pdfobj reserveobjnum%
+ \global\@anim@@offocgs=\pdflastobj%
+ \pdfcatalog{%
+ /OCProperties <<%
+ /OCGs \the\@anim@@ocgs\space 0 R%
+ /D <<%
+ /BaseState/ON /OFF \the\@anim@@offocgs\space 0 R%
+ >>%
+ >>%
+ }%
+ \AtEndDocument{%
+ \immediate\pdfobj useobjnum \@anim@@ocgs {%
+ [\@anim@ocgs]%
+ }%
+ \immediate\pdfobj useobjnum \@anim@@offocgs {%
+ [\@anim@offocgs]%
+ }%
+ }%
+ \gdef\oc@props@added{}%
+ \fi%
+ }
\else
%counts inserted widget annots
- \newcount\@anim@fieldnum\@anim@fieldnum=\z@%
+ \newcount\@anim@fieldnum\@anim@fieldnum=\z@
\if@anim@@dvipdfmx
- %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@offocgs [ ]}
- \special{pdf:put @catalog <<
- /OCProperties <<
- /OCGs @anim@ocgs
- /D <</BaseState/ON /OFF @anim@offocgs>>
- >>
- >>}
- %macro for adding AcroForm entry to PDF Catalog
\def\@anim@acroform{%
\ifdefined\Acro@Form@added\else%
%array which takes refs to all widget annotations
@@ -289,18 +290,24 @@
\gdef\Acro@Form@added{}%
\fi%
}
- \else
- \special{ps:
- mark /_objdef {@anim@ocgs} /type/array /OBJ pdfmark
- mark /_objdef {@anim@offocgs} /type/array /OBJ pdfmark
- mark {Catalog} <<
- /OCProperties <<
- /OCGs {@anim@ocgs}
- /D <</BaseState/ON /OFF {@anim@offocgs}>>
- >>
- >> /PUT pdfmark%
+ \def\@anim@ocprops{%
+ \ifdefined\oc@props@added\else%
+ \special{pdf:obj @anim@ocgs [ ]}%
+ \special{pdf:obj @anim@offocgs [ ]}%
+ \special{pdf:put @catalog <<%
+ /OCProperties <<%
+ /OCGs @anim@ocgs
+ /D <</BaseState/ON /OFF @anim@offocgs>>
+ >>%
+ >>}%
+ \AtEndDocument{%
+ \special{pdf:put @anim@ocgs \@anim@ocgs}%
+ \special{pdf:put @anim@offocgs \@anim@offocgs}%
+ }%
+ \gdef\oc@props@added{}%
+ \fi%
}
- %macro for adding AcroForm entry to PDF Catalog
+ \else
\def\@anim@acroform{%
\ifdefined\Acro@Form@added\else%
\special{ps:
@@ -315,6 +322,27 @@
\gdef\Acro@Form@added{}%
\fi%
}
+ \def\@anim@ocprops{%
+ \ifdefined\oc@props@added\else%
+ \special{ps:
+ mark /_objdef {@anim@ocgs} /type/array /OBJ pdfmark
+ mark /_objdef {@anim@offocgs} /type/array /OBJ pdfmark
+ mark {Catalog} <<%
+ /OCProperties <<%
+ /OCGs {@anim@ocgs}%
+ /D <</BaseState/ON /OFF {@anim@offocgs}>>%
+ >>%
+ >> /PUT pdfmark%
+ }%
+ \AtEndDocument{%
+ \special{ps:
+ mark {@anim@ocgs} 0 [\@anim@ocgs] /PUTINTERVAL pdfmark
+ mark {@anim@offocgs} 0 [\@anim@offocgs] /PUTINTERVAL pdfmark
+ }%
+ }%
+ \gdef\oc@props@added{}%
+ \fi%
+ }
\fi
\fi
@@ -586,20 +614,23 @@
\xdef\@anim@curocg{\the\pdflastobj\space 0 R}%
%append to ocg array
\xdef\@anim@ocgs{\@anim@ocgs\space\@anim@curocg}%
+ \@anim@ocprops%
}
\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}%
+ \xdef\@anim@ocgs{\@anim@ocgs\space @anim@ocg@#1@#2}%
+ \@anim@ocprops%
}
\else
\def\@anim@newocg#1#2{%
\special{ps:
mark /_objdef {@anim@ocg@#1@#2} /type/dict /OBJ pdfmark
mark {@anim@ocg@#1@#2} <</Type/OCG /Name (#1.#2)>> /PUT pdfmark
- mark {@anim@ocgs} {@anim@ocg@#1@#2} /APPEND pdfmark%
}%
+ \xdef\@anim@ocgs{\@anim@ocgs\space {@anim@ocg@#1@#2}}%
+ \@anim@ocprops%
}
\fi
\fi
@@ -689,15 +720,15 @@
\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}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space @anim@ocg@#1@#2}%
}%
\else%
\ifnum#2=\z@%
\ifx\@anim@poster\@anim@posternone%
- \special{pdf:put @anim@offocgs @anim@ocg@#1@#2}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space @anim@ocg@#1@#2}%
\fi%
\else%
- \special{pdf:put @anim@offocgs @anim@ocg@#1@#2}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space @anim@ocg@#1@#2}%
\fi%
\fi%
\def\@anim@annotflag{/F 4}%
@@ -751,15 +782,15 @@
\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}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space {@anim@ocg@#1@#2}}%
}%
\else%
\ifnum#2=\z@%
\ifx\@anim@poster\@anim@posternone%
- \special{ps: mark {@anim@offocgs} {@anim@ocg@#1@#2} /APPEND pdfmark}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space {@anim@ocg@#1@#2}}%
\fi%
\else%
- \special{ps: mark {@anim@offocgs} {@anim@ocg@#1@#2} /APPEND pdfmark}%
+ \xdef\@anim@offocgs{\@anim@offocgs\space {@anim@ocg@#1@#2}}%
\fi%
\fi%
\def\@anim@annotflag{/F 4}%
@@ -814,79 +845,6 @@
\fi
\fi
-%create container XObjects for play & pause button faces
-\ifpdf
- \def\@anim@makeppcontainer#1#2#3{% #1: @anim@num, #2: Right or Left,
- % #3: index of existing button face colour combination
- \immediate\pdfobj{<</Type/OCG /Name (#1.Play#2)>>}%
- \edef\@anim@playocg{\the\pdflastobj\space 0 R}%
- \immediate\pdfobj{<</Type/OCG /Name (#1.Pause#2)>>}%
- \edef\@anim@pauseocg{\the\pdflastobj\space 0 R}%
- %append to ocg array
- \xdef\@anim@ocgs{\@anim@ocgs\space\@anim@playocg\space\@anim@pauseocg}%
- %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]%
- /Resources <<%
- /Properties <</oc0 \@anim@playocg /oc1 \@anim@pauseocg>>%
- /XObject <<%
- /im0 \@anim@getkeyval{btnPlay#2:#3}
- /im1 \@anim@getkeyval{btnPause#2:#3}%
- >>%
- >>%
- }{%
- /OC/oc0 BDC q /im0 Do Q EMC /OC/oc1 BDC q /im1 Do Q EMC%
- }%
- \@anim@newkey{btn#1.PlayPause#2}{\the\pdflastobj\space 0 R}%
- }
-\else
- \if@anim@@dvipdfmx
- \def\@anim@makeppcontainer#1#2#3{%
- \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@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]%
- /Resources <<%
- /Properties <</oc0 @#1.Play#2 /oc1 @#1.Pause#2>>%
- /XObject <</im0 @btnPlay#2:#3 /im1 @btnPause#2:#3>>%
- >>%
- >>%
- }%
- \@anim@newkey{btn#1.PlayPause#2}{@btn#1.PlayPause#2}%
- }
- \else
- \def\@anim@makeppcontainer#1#2#3{%
- \special{ps:
- %OCGs
- mark /_objdef {#1.Play#2} /type/dict /OBJ pdfmark
- mark {#1.Play#2} <</Type/OCG /Name (#1.Play#2)>> /PUT pdfmark
- mark /_objdef {#1.Pause#2} /type/dict /OBJ pdfmark
- 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@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%
- ) /PUT pdfmark
- mark {btn#1.PlayPause#2} <<
- /Type/XObject/Subtype/Form/FormType 1
- /BBox [0 0 15 15]
- /Resources <<%
- /Properties <</oc0 {#1.Play#2} /oc1 {#1.Pause#2}>>%
- /XObject <</im0 {btnPlay#2:#3} /im1 {btnPause#2:#3}>>%
- >>%
- >> /PUT pdfmark%
- }%
- }
- \fi
-\fi
-
%create XObjects of all button faces
\if@anim@@dvips
\def\@anim@btnend{%
@@ -1605,13 +1563,6 @@
\@anim@makebuttons{\the\@anim@num}%
\@anim@newkey{btncol:\@anim@bgcolour:\@anim@fgcolour}{\the\@anim@num}%
\fi%
- \if@anim@step\else%
- %combine Pause & Play button faces into one XObject
- \@anim@makeppcontainer{\the\@anim@num}{Right}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour}}%
- \@anim@makeppcontainer{\the\@anim@num}{Left}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour}}%
- \fi%
\fi%
\xdef\@anim@nfps{#2\space}% current frame rate
\xdef\@anim@nfps{\expandafter\zap@space\@anim@nfps\@empty}%
@@ -1674,8 +1625,12 @@
\@anim@buttonwidget{#1}{EndLeft}{EndLeft:#2}%
\@anim@buttonwidget{#1}{StepLeft}{StepLeft:#2}%
\if@anim@step\else%
- \@anim@buttonwidget{#1}{PlayPauseLeft}{#1.PlayPauseLeft}%
- \@anim@buttonwidget{#1}{PlayPauseRight}{#1.PlayPauseRight}%
+ \@anim@buttonwidget{#1}{PauseLeft}{PauseLeft:#2}%
+ \@anim@buttonwidget{#1}{PlayLeft}{PlayLeft:#2}%
+ \@anim@buttonwidget{#1}{PlayPauseLeft}{}%
+ \@anim@buttonwidget{#1}{PauseRight}{PauseRight:#2}%
+ \@anim@buttonwidget{#1}{PlayRight}{PlayRight:#2}%
+ \@anim@buttonwidget{#1}{PlayPauseRight}{}%
\fi%
\@anim@buttonwidget{#1}{StepRight}{StepRight:#2}%
\@anim@buttonwidget{#1}{EndRight}{EndRight:#2}%
@@ -1884,63 +1839,113 @@
\fi
%creates control button widget
+\newboolean{@anim@js}
+\newboolean{@anim@mk}
\ifpdf
\def\@anim@buttonwidget#1#2#3{%#1:@anim@num, #2:action, #3:button face XObject
- \@anim@upjscript{#1}{#2}% JavaScript actions for ButtonUp events
+ \def\@anim@annotflag{/F 0}% visible, but don't print
+ \def\@anim@buttonname{#2}\@anim@jstrue\@anim@mktrue%
+ \def\@anim@arg{PlayLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi% _
+ \def\@anim@arg{PauseLeft}% %hidden, don't print |
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%_|
+ \def\@anim@arg{PlayRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi%
+ \def\@anim@arg{PauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%
+ \def\@anim@arg{PlayPauseLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \def\@anim@arg{PlayPauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \if@anim@js\@anim@upjscript{#1}{#2}\fi% JavaScript actions for ButtonUp events
\setlength{\@anim@tmpdima}{\@anim@btnsize}%
- \hbox to \@anim@tmpdima {%
- \pdfannot
- width \@anim@tmpdima
- height \@anim@tmpdima
- depth 0pt
- {%
- /Subtype/Widget%
- /FT/Btn/Ff 65536% push button
- /BS <</W 0>>%
- /H/I%
- /MK <</TP 1/I \@anim@getkeyval{btn#3}/IF<</S/A/FB true>>>>%
- /T (#1.#2)%
- \@anim@tooltip%
- /A <</S/JavaScript/JS (\@anim@upjscriptstring)>>%
- }%
- \xdef\@anim@fields{\@anim@fields\the\pdflastannot\space 0 R\space}%
- \vrule width 0pt height \@anim@tmpdima depth 0pt%
- \hss%
+ \pdfannot
+ width \@anim@tmpdima
+ height \@anim@tmpdima
+ depth 0pt
+ {%
+ /Subtype/Widget%
+ \@anim@annotflag%
+ /FT/Btn/Ff \if@anim@js 65536\else 65537\fi%
+ /H\if@anim@js/I\else/N\fi%
+ /BS <</W 0>>%
+ \if@anim@mk/MK <</TP 1/I \@anim@getkeyval{btn#3}/IF<</S/A/FB true>>>>\fi%
+ /T (#1.#2)%
+ \@anim@tooltip%
+ \if@anim@js/A <</S/JavaScript/JS (\@anim@upjscriptstring)>>\fi%
}%
+ \xdef\@anim@fields{\@anim@fields\the\pdflastannot\space 0 R\space}%
+ \if@anim@js%
+ \hbox to \@anim@tmpdima {%
+ \vrule width 0pt height \@anim@tmpdima depth 0pt%
+ \hss%
+ }%
+ \fi%
}%
\else
\if@anim@@dvipdfmx
\def\@anim@buttonwidget#1#2#3{%
- \@anim@upjscript{#1}{#2}%
+ \def\@anim@annotflag{/F 0}% visible, but don't print
+ \def\@anim@buttonname{#2}\@anim@jstrue\@anim@mktrue%
+ \def\@anim@arg{PlayLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi% _
+ \def\@anim@arg{PauseLeft}% %hidden, don't print |
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%_|
+ \def\@anim@arg{PlayRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi%
+ \def\@anim@arg{PauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%
+ \def\@anim@arg{PlayPauseLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \def\@anim@arg{PlayPauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \if@anim@js\@anim@upjscript{#1}{#2}\fi% JavaScript actions for ButtonUp events
\setlength{\@anim@tmpdima}{\@anim@btnsize}%
- \hbox to \@anim@tmpdima {%
- \special{pdf:annot @annot@\the\@anim@fieldnum\space
- width \the\@anim@tmpdima\space height \the\@anim@tmpdima\space
- depth 0pt <<%
- /Subtype/Widget%
- /FT/Btn/Ff 65536%
- /BS <</W 0>>%
- /H/I%
- /MK <</TP 1/I @btn#3/IF<</S/A/FB true>>>>%
- /T (#1.#2)%
- \@anim@tooltip%
- /A <</S/JavaScript/JS (\@anim@upjscriptstring)>>%
- >>%
- }%
- \xdef\@anim@fields{\@anim@fields @annot@\the\@anim@fieldnum\space}%
- \global\advance\@anim@fieldnum by \@ne%
- \vrule width 0pt height \@anim@tmpdima depth 0pt%
- \hss%
+ \special{pdf:annot @annot@\the\@anim@fieldnum\space
+ width \the\@anim@tmpdima\space height \the\@anim@tmpdima\space
+ depth 0pt <<%
+ /Subtype/Widget%
+ \@anim@annotflag%
+ /FT/Btn/Ff \if@anim@js 65536\else 65537\fi%
+ /H\if@anim@js/I\else/N\fi%
+ /BS <</W 0>>%
+ \if@anim@mk/MK <</TP 1/I @btn#3/IF<</S/A/FB true>>>>\fi%
+ /T (#1.#2)%
+ \@anim@tooltip%
+ \if@anim@js/A <</S/JavaScript/JS (\@anim@upjscriptstring)>>\fi%
+ >>%
}%
+ \xdef\@anim@fields{\@anim@fields @annot@\the\@anim@fieldnum\space}%
+ \global\advance\@anim@fieldnum by \@ne%
+ \if@anim@js%
+ \hbox to \@anim@tmpdima {%
+ \vrule width 0pt height \@anim@tmpdima depth 0pt%
+ \hss%
+ }%
+ \fi%
}%
\else
\def\@anim@buttonwidget#1#2#3{%
- \@anim@upjscript{#1}{#2}%
+ \def\@anim@annotflag{/F 0}% visible, but don't print
+ \def\@anim@buttonname{#2}\@anim@jstrue\@anim@mktrue%
+ \def\@anim@arg{PlayLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi% _
+ \def\@anim@arg{PauseLeft}% %hidden, don't print |
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%_|
+ \def\@anim@arg{PlayRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\fi%
+ \def\@anim@arg{PauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@jsfalse\def\@anim@annotflag{/F 2}\fi%
+ \def\@anim@arg{PlayPauseLeft}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \def\@anim@arg{PlayPauseRight}%
+ \ifx\@anim@arg\@anim@buttonname\@anim@mkfalse\fi%
+ \if@anim@js\@anim@upjscript{#1}{#2}\fi% JavaScript actions for ButtonUp events
\setlength{\@anim@tmpdima}{\@anim@btnsize}%
\begingroup%
\setlength{\unitlength}{1pt}%
\begin{picture}(0,0)%
- \put(0,0){%
+ \put(0,0){%
\special{ps:
currentpoint /wid@lly exch def /wid@llx exch def
}%
@@ -1956,22 +1961,25 @@
mark
/_objdef {annot@\the\@anim@fieldnum}
/Rect [wid@llx wid@lly wid@urx wid@ury]
- /Subtype/Widget
- /FT/Btn/Ff 65536
- /BS <</W 0>>
- /H/I
- /MK <</TP 1/I {btn#3}/IF<</S/A/FB true>>>>%
+ /Subtype/Widget%
+ \@anim@annotflag%
+ /FT/Btn/Ff \if@anim@js 65536\else 65537\fi%
+ /H\if@anim@js/I\else/N\fi%
+ /BS <</W 0>>%
+ \if@anim@mk/MK <</TP 1/I {btn#3}/IF<</S/A/FB true>>>>\fi%
/T (#1.#2)%
\@anim@tooltip%
- /A <</S/JavaScript/JS (\@anim@upjscriptstring)>>%
+ \if@anim@js/A <</S/JavaScript/JS (\@anim@upjscriptstring)>>\fi%
/ANN pdfmark%
}%
\xdef\@anim@fields{\@anim@fields{annot@\the\@anim@fieldnum}\space}%
\global\advance\@anim@fieldnum by \@ne%
- \hbox to \the\@anim@tmpdima {%
- \vrule width 0pt height \the\@anim@tmpdima\space depth 0pt%
+ \if@anim@js%
+ \hbox to \@anim@tmpdima {%
+ \vrule width 0pt height \@anim@tmpdima depth 0pt%
\hss%
- }%
+ }%
+ \fi%
}
\fi
\fi
@@ -2021,12 +2029,6 @@
\@anim@makebuttons{\the\@anim@num}%
\@anim@newkey{btncol:\@anim@bgcolour:\@anim@fgcolour}{\the\@anim@num}%
\fi%
- \if@anim@step\else%
- \@anim@makeppcontainer{\the\@anim@num}{Right}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour}}%
- \@anim@makeppcontainer{\the\@anim@num}{Left}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour}}%
- \fi%
\fi%
\if@anim@step\else%
\xdef\@anim@nfps{-1}%
@@ -3201,40 +3203,24 @@
\def\@anim@@pojscript#1{% #1: @anim@num
% console.show();%
% console.clear();%
- \if@anim@useocg\else
- var curdoc=this;%
- var a#1_intd;%
- \fi
+ var curdoc=this;%
var a#1,a#1_int;%
if(typeof(a#1)==='undefined'){% initialize animation
a#1=new Object();% animation object
%takes references to frame ocgs/Field objects belonging to the current
%animation
a#1.fr=new Array();%
- \if@anim@controls
- a#1.btn=new Array();%takes references to control button face ocgs
- \fi%
- %initialize fr & btn properties
+ %initialize fr properties
\if@anim@useocg
%get array of ocgs of current page
var ocg=this.getOCGs(this.pageNum);%
for(var i in ocg){%
var ocgName=ocg[i].name.split('.');%
if(ocgName[0]==#1){%
- \if@anim@controls\if@anim@step\else
- if(ocgName[1].charAt(0)=='P'){% PlayLeft, PauseLeft, ...
- a#1.btn[ocgName[1]]=ocg[i];%
- %set basic button state
- a#1.btn[ocgName[1]].state=ocg[i].initState;%
- }else{% frame ocg
- \fi\fi
- %get array of animation frames
- a#1.fr[ocgName[1]]=ocg[i];%
- %set basic frame state
- a#1.fr[ocgName[1]].state=ocg[i].initState;%
- \if@anim@controls\if@anim@step\else%
- }%
- \fi\fi%
+ %get array of animation frames
+ a#1.fr[ocgName[1]]=ocg[i];%
+ %set basic frame state
+ a#1.fr[ocgName[1]].state=ocg[i].initState;%
}%
}%
\else
@@ -3242,17 +3228,13 @@
for(i=0;i<=\@anim@maxframe;i++){%
a#1.fr[i]=this.getField('#1.'+i);%
}%
- \if@anim@controls\if@anim@step\else
- var ocg=this.getOCGs(this.pageNum);%
- for(var i in ocg){%
- var ocgName=ocg[i].name.split('.');%
- if(ocgName[0]==#1){%
- a#1.btn[ocgName[1]]=ocg[i];%
- a#1.btn[ocgName[1]].state=ocg[i].initState;%
- }%
- }%
- \fi\fi%
\fi%
+ \if@anim@controls\if@anim@step\else
+ a#1.btnPauseLeft=this.getField('#1.PauseLeft');%
+ a#1.btnPlayLeft=this.getField('#1.PlayLeft');%
+ a#1.btnPauseRight=this.getField('#1.PauseRight');%
+ a#1.btnPlayRight=this.getField('#1.PlayRight');%
+ \fi\fi%
\ifx\@anim@poster\@anim@posterlast % set default frame
%holds index of the frame to be displayed
a#1.on=a#1.idx=\@anim@maxframe;%
@@ -3355,6 +3337,7 @@
\else%
\if@anim@loop
if(a#1.playing){%
+ \if@anim@meas a#1.stopMeas();\fi
a#1.seekFrame(0);%
a#1.setFps(\@anim@fps);%
}else{a#1.stopLast();}%
@@ -3390,6 +3373,7 @@
\else%
\if@anim@loop
if(a#1.playing){%
+ \if@anim@meas a#1.stopMeas();\fi
a#1.seekFrame(\@anim@maxframe);%
}else{a#1.stopFirst();}%
\else
@@ -3407,15 +3391,15 @@
\fi%
\if@anim@step\else
a#1.pause=function(){%
- \if@anim@meas if(a#1.playing){a#1.stopMeas();}\fi
try{app.clearInterval(a#1_int);}catch(e){}%
a#1.playing=false;%
a#1.isPaused=true;%
\if@anim@controls
- a#1.btn['PauseLeft'].state=false;%
- a#1.btn['PlayLeft'].state=true;%
- a#1.btn['PauseRight'].state=false;%
- a#1.btn['PlayRight'].state=true;%
+ a#1.btnPauseLeft.display=display.hidden;%
+ a#1.btnPlayLeft.display=display.visible;%
+ a#1.btnPauseRight.display=display.hidden;%
+ a#1.btnPlayRight.display=display.visible;%
+ curdoc.dirty=false;%
\fi%
};%
a#1.playRight=function(){%
@@ -3424,10 +3408,11 @@
a#1.playing=true;%
a#1.isPaused=false;%
\if@anim@controls
- a#1.btn['PauseLeft'].state=true;%
- a#1.btn['PlayLeft'].state=false;%
- a#1.btn['PauseRight'].state=true;%
- a#1.btn['PlayRight'].state=false;%
+ a#1.btnPauseLeft.display=display.visible;%
+ a#1.btnPlayLeft.display=display.hidden;%
+ a#1.btnPauseRight.display=display.visible;%
+ a#1.btnPlayRight.display=display.hidden;%
+ curdoc.dirty=false;%
\fi%
\if@anim@meas a#1.startMeas();\fi
a#1_int=app.setInterval('a#1.gotoNext()',%
@@ -3440,10 +3425,11 @@
a#1.playing=true;%
a#1.isPaused=false;%
\if@anim@controls
- a#1.btn['PauseLeft'].state=true;%
- a#1.btn['PlayLeft'].state=false;%
- a#1.btn['PauseRight'].state=true;%
- a#1.btn['PlayRight'].state=false;%
+ a#1.btnPauseLeft.display=display.visible;%
+ a#1.btnPlayLeft.display=display.hidden;%
+ a#1.btnPauseRight.display=display.visible;%
+ a#1.btnPlayRight.display=display.hidden;%
+ curdoc.dirty=false;%
\fi%
\if@anim@meas a#1.startMeas();\fi
a#1_int=app.setInterval('a#1.gotoPrev()',%