summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-12-17 23:02:36 +0000
committerKarl Berry <karl@freefriends.org>2010-12-17 23:02:36 +0000
commitf51d0af7ed4d2b504e2bff7402ac9934879e842e (patch)
treee3cda1e2973a23627f5b2a7ddf202d2e4aa27fec /Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx
parentdbf35b048ee6685fbdf772fa0186fef710cbc068 (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/source/latex/ocgtools/ocgtools.dtx')
-rw-r--r--Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx76
1 files changed, 50 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx b/Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx
index 3dd5a7a77fd..2949d0be269 100644
--- a/Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx
+++ b/Master/texmf-dist/source/latex/ocgtools/ocgtools.dtx
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{ocgtools}
%<*package>
- [2010/05/10 v0.8 ocgtools.dtx file]
+ [2010/11/19 v0.8a ocgtools.dtx file]
%</package>
%
%<*driver>
@@ -40,7 +40,7 @@
%</driver>
% \fi
%
-% \CheckSum{1067}
+% \CheckSum{1082}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -66,6 +66,7 @@
% can get its own colors, fixed layerHshift and layerVshift macros,
% options \texttt{inactive} and \texttt{active}}
% \changes{v0.8}{2010/05/10}{Minor fix related to fancytooltips package}
+% \changes{v0.8a}{2010/11/19}{Minor fix related to color in new eforms package}
%
% \GetFileInfo{ocgtools.dtx}
%
@@ -278,15 +279,20 @@
% \subsection{Layer with text (or whatever) in its natural size}
% \DescribeMacro{\ocgminitext} The macro
% |\ocgminitext[width=|\meta{width}, |bg=|\meta{color1},
-% |fg=|\meta{color2}|]|\marg{text1}\marg{text2} is used to create
-% layer containing \meta{text2} which is placed near the right top
-% corner of \meta{text1}. \meta{text2} is placed into |\hbox| or
-% |\vbox| with given |\hsize| according to the value of \meta{width}
-% and other optional parameters, as has been explained at |\ocgtext|
+% |fg=|\meta{color2}|]|\marg{text1}\marg{text2} is used to create layer
+% containing \meta{text2} which is placed near the right top corner of
+% \meta{text1}. \meta{text2} is placed into |\hbox| or |\vbox| with
+% given |\hsize| according to the value of \meta{width} and other
+% optional parameters, as has been explained at |\ocgtext|
% macro. Macros |\ocgminitextrb|, |\ocgminitextlt| and
% |\ocgminitextlb| can be used to place the minilayer to the right
% bottom, left to and left bottom corner.
%
+% Starting from version 0.9 you can use keywords
+% |jsopen=|\meta{openaction} and |jsclose=|\meta{closeaction} to
+% define JavaScript action which is performed when the layer is opened
+% and closed, respectively.
+%
% \subsection{Fine-tuning, customizing}
% \DescribeMacro{\ocgtextstart}\DescribeMacro{\ocgtextend} Macros
% |\ocgtextstart| and |\ocgtextend| are used to denote the start and
@@ -460,7 +466,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}
@@ -677,21 +683,22 @@
% of each minilayer and can be used to hide the corresponding minilayer.
% \begin{macrocode}
\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}}}}
% \end{macrocode}
% We create buttons which are attached to the bottom right corner
% of the screen and can be used to hide all layers.
@@ -773,9 +780,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
@@ -788,7 +797,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;
@@ -808,7 +828,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;
}}
@@ -818,7 +838,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;
}
@@ -866,6 +886,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}
@@ -877,7 +899,9 @@
% \begin{macrocode}
\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
@@ -920,7 +944,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}%
@@ -928,7 +952,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}%
@@ -1083,7 +1107,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
}