diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-17 23:02:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-17 23:02:36 +0000 |
commit | f51d0af7ed4d2b504e2bff7402ac9934879e842e (patch) | |
tree | e3cda1e2973a23627f5b2a7ddf202d2e4aa27fec /Master/texmf-dist/tex/latex/ocgtools | |
parent | dbf35b048ee6685fbdf772fa0186fef710cbc068 (diff) |
ocgtools 0.8a (18dec10)
git-svn-id: svn://tug.org/texlive/trunk@20780 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ocgtools')
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgtools/ocgtools.sty | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/ocgtools/ocgtools.sty b/Master/texmf-dist/tex/latex/ocgtools/ocgtools.sty index 02cc7c0e961..e49d4b67603 100644 --- a/Master/texmf-dist/tex/latex/ocgtools/ocgtools.sty +++ b/Master/texmf-dist/tex/latex/ocgtools/ocgtools.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ocgtools} - [2010/05/10 v0.8 ocgtools.dtx file] + [2010/11/19 v0.8a ocgtools.dtx file] \def\ocgtools@msg{If this message does not disappear after a short time, the author either did not compile the \LaTeX{} file three times, or your PDF viewer does not support OCG. Use Adobe Reader!} @@ -57,7 +57,7 @@ \newif\ifocg@hide@button\ocg@hide@buttontrue \DeclareOption{nobutton}{\ocg@hide@buttonfalse} \def\ocgtools@progressmsg{\lower \layerVshift\hbox to 0 pt{ %space - \textField[\V{OCGtools: processing OCG's ...}\BG{1} + \textField[\V{OCGtools: processing OCG's ...}\BG{1 1 1} \textColor{1 0 0} \textSize{10}]% {ocgtoolsmsg}{6cm}{20pt}\hss}}% \DeclareOption{noprogressmsg}{\let\ocgtools@progressmsg\relax} @@ -204,21 +204,22 @@ \ocgtools@AfterHideBtn }}]{OcgtoolsBtn.HideButton.main}{\paperwidth}{\paperheight}} \ifx\ocgtools@AfterHideMiniLayer\undefined\def\ocgtools@AfterHideMiniLayer{}\fi -\newcommand\ocgtools@HideMiniLayer[1] +\newcommand\ocgtools@HideMiniLayer[2][] {\setbox\ocgtools@box@a=\hbox{{\ocgclosechar}}% \hbox to \wd\ocgtools@box@a% {\hbox{{\ocgclosechar}}\hss% \hbox{\pushButton[\W{0}\S{S}\BG{}\BC{}\H{N}% \F{\FHidden}\A{\ocgtools@JS{ - for(var i=0; ocgtoolsOCGs && i<ocgtoolsOCGs.length;i++) - { - if(ocgtoolsOCGs[i].name == "ocgtools#1") - ocgtoolsOCGs[i].state = false; - } - this.getField("OcgtoolsBtn.HideButton.mini.#1").hidden = true; - \ocgtools@AfterHideMiniLayer - }}]% - {OcgtoolsBtn.HideButton.mini.#1}{\wd\ocgtools@box@a}{\ht\ocgtools@box@a}}}} + for(var i=0; ocgtoolsOCGs && i<ocgtoolsOCGs.length;i++) + { + if(ocgtoolsOCGs[i].name == "ocgtools#2") + ocgtoolsOCGs[i].state = false; + } + this.getField("OcgtoolsBtn.HideButton.mini.#2").hidden = true; + \ocgtools@AfterHideMiniLayer + #1 + }}]% +{OcgtoolsBtn.HideButton.mini.#2}{\wd\ocgtools@box@a}{\ht\ocgtools@box@a}}}} \ifx\ocgtools@AfterHideLayers\undefined\def\ocgtools@AfterHideLayers{}\fi \newcommand\ocgtools@HideLayers[1]{% \setbox\ocgtools@box@a=\hbox{{\ocgclosechar}}% @@ -292,9 +293,11 @@ \pdfendlink% } -\newcommand{\ocgtools@ToggleMiniLayer}[2]{% +\newcommand{\ocgtools@ToggleMiniLayer}[4]{% % #1: layer name, % #2: link text + % #3: js action if the layer is opened + % #4: js action if the layer is closed \leavevmode% \pdfstartlink user { /Subtype /Link @@ -307,7 +310,18 @@ for(var i=0; ocgtoolsOCGs && i<ocgtoolsOCGs.length;i++) { if(ocgtoolsOCGs[i].name == "ocgtools#1") - ocgtoolsOCGs[i].state = !ocgtoolsOCGs[i].state; + { + if (ocgtoolsOCGs[i].state) + { + #4 + ocgtoolsOCGs[i].state = false; + } + else + { + #3 + ocgtoolsOCGs[i].state = true; + } + } } this.getField("OcgtoolsBtn.HideButton.mini.#1").hidden = !this.getField("OcgtoolsBtn.HideButton.mini.#1").hidden; @@ -327,7 +341,7 @@ { var OpenedByMouseEnter#1=true; if(ocgtoolsOCGs[i].name == "ocgtools#1") - ocgtoolsOCGs[i].state = true; + {#3 ocgtoolsOCGs[i].state = true;} } this.getField("OcgtoolsBtn.HideButton.mini.#1").hidden = false; }} @@ -337,7 +351,7 @@ for(var i=0; ocgtoolsOCGs && i<ocgtoolsOCGs.length;i++) { if(ocgtoolsOCGs[i].name == "ocgtools#1") - ocgtoolsOCGs[i].state = false; + {#4 ocgtoolsOCGs[i].state = false; } } this.getField("OcgtoolsBtn.HideButton.mini.#1").hidden = true; } @@ -373,6 +387,8 @@ \define@key{ocg@key}{bg}[ocgpaper]{\def\ocgt@@ls@bg{#1}} \define@key{ocg@key}{color}[ocgfontcolor]{\def\ocgt@@ls@fg{#1}} \define@key{ocg@key}{fg}[ocgfontcolor]{\def\ocgt@@ls@fg{#1}} +\define@key{ocg@key}{jsopen}[]{\def\ocgt@@ls@jsopen{#1}} +\define@key{ocg@key}{jsclose}[]{\def\ocgt@@ls@jsclose{#1}} \newtoks\ocg@pdflastxpos\ocg@pdflastxpos{\the\pdflastxpos} \newtoks\ocg@pdflastypos\ocg@pdflastypos{\the\pdflastypos} @@ -380,7 +396,9 @@ \def\ocgtools@setdefault{\def\ocgt@@ls@bg{\defaultocgpapercolor}% \def\ocgt@@ls@fg{\defaultocgfontcolor}% -\def\ocgt@@ls@width{0pt}} +\def\ocgt@@ls@width{0pt}\def\ocgt@@ls@jsopen{}% +\def\ocgt@@ls@jsclose{}% +} \newcommand\ocgtext[3][0pt]{% \ocgtools@setdefault @@ -423,7 +441,7 @@ \fi \fi \ocgtools@ToggleMiniLayer{\the\ocgtools@layercount}% -{{\ocgtextstart #2\ocgtextend}}% +{{\ocgtextstart #2\ocgtextend}}{\ocgt@@ls@jsopen}{\ocgt@@ls@jsclose}% \ifocg@minitext@left\else \ifocg@minitext@bottom \vbox to 0 pt{\kern 0.7\baselineskip\pdfsavepos\vss}% @@ -431,7 +449,7 @@ \vbox to 0 pt{\vss\pdfsavepos\kern 0.7\baselineskip}% \fi \fi -\edef\ocgtools@act{\write\posHandle{\noexpand\string\noexpand\ocgtoolsplaceminitext{\the\ocgtools@layercount}{\the\ocg@pagetoks}{\the\ocg@pdflastxpos}{\the\ocg@pdflastypos}{}{width=\ocgt@@ls@width,bg=\ocgt@@ls@bg,fg=\ocgt@@ls@fg}{#4}}}% +\edef\ocgtools@act{\write\posHandle{\noexpand\string\noexpand\ocgtoolsplaceminitext{\the\ocgtools@layercount}{\the\ocg@pagetoks}{\the\ocg@pdflastxpos}{\the\ocg@pdflastypos}{}{width=\ocgt@@ls@width,bg=\ocgt@@ls@bg,fg=\ocgt@@ls@fg,jsopen={\ocgt@@ls@jsopen},jsclose={\ocgt@@ls@jsclose}}{#4}}}% \ocgtools@act \expandafter\global\expandafter\def \csname ocgtools@minitextcontent@\the\ocgtools@layercount\endcsname{#3}% @@ -572,7 +590,7 @@ \else \hbox{\copy\ocgtools@box@a\raise\ht\ocgtools@box@a \vbox to 0 pt{\hbox to 0 pt{\hss -\ocgtools@HideMiniLayer{#3}}\vss}}% +\ocgtools@HideMiniLayer[\ocgt@@ls@jsclose]{#3}}\vss}}% \fi \@ocgtools@insideminilayerfalse } |