From 8ff11e49578310a0c3428113e92191f2cfb6a817 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 8 Apr 2010 23:37:46 +0000 Subject: fancytooltips 1.6 (8apr10) git-svn-id: svn://tug.org/texlive/trunk@17758 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/fancytooltips/fancytooltips.dtx | 376 ++++++++++++++++----- 1 file changed, 295 insertions(+), 81 deletions(-) (limited to 'Master/texmf-dist/source/latex/fancytooltips') diff --git a/Master/texmf-dist/source/latex/fancytooltips/fancytooltips.dtx b/Master/texmf-dist/source/latex/fancytooltips/fancytooltips.dtx index 1ec6dbf244c..233df5c5a7b 100644 --- a/Master/texmf-dist/source/latex/fancytooltips/fancytooltips.dtx +++ b/Master/texmf-dist/source/latex/fancytooltips/fancytooltips.dtx @@ -22,7 +22,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{fancytooltips} %<*package> - [2009/05/05 v1.5 fancytooltips.dtx file] + [2010/04/10 v1.6 fancytooltips.dtx file] % % %<*driver> @@ -37,13 +37,12 @@ \begin{document} \color{black} \DocInput{fancytooltips.dtx} - \PrintChanges \PrintIndex \end{document} % % \fi % -% \CheckSum{445} +% \CheckSum{695} % % \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 @@ -65,26 +64,32 @@ % \changes{v1.0}{2007/02/15}{Initial version} % % \changes{v1.1}{2007/02/20}{Clener code, better documentation, fix -% for bug with delayinterval macro, support for dvips and DIstiller +% for bug with delayinterval macro, support for dvips and Distiller % users.} % % \changes{v1.2}{2007/03/01}{Better support for dvips users, buttons % for icons are created automatically using eso-pic package and have -% the name "ikona.pagenumber", new option movetips, tooltip appears -% on the current page only and, as a consequence, animations are -% faster.} +% the name "ikona.pagenumber", new option \texttt{movetips}, tooltip +% appears on the current page only and, as a consequence, animations +% are faster.} % % \changes{v1.3}{2007/05/08}{Fixed bug which appears in dvips route. % Improved documentation -- added a note about the required version % of eforms.sty} % % \changes{v1.4}{2009/04/29}{Added support for presentations (like -% |pause| command for texpower).} +% \texttt{pause} command for texpower).} % % \changes{v1.5}{2009/05/05}{Handling number of pages via aux file % (fixes some problems issued by previous modification and page % break near tooltip).} % +% \changes{v1.6}{2010/04/10}{Added options \texttt{debug}, +% \texttt{active} and \texttt{inactive}, added an example with +% automatical previews for equations and floats. Added handling of +% this.dirty and app.focusRect. Changed the name of the file with +% tooltips. Added starred version of \texttt{tooltip} command.} +% % \GetFileInfo{fancytooltips.dtx} % % \DoNotIndex{\newcommand,\newenvironment} @@ -92,7 +97,8 @@ % % \title{The \textsf{fancytooltips} package\thanks{This document % corresponds to \textsf{fancytooltips}~\fileversion, dated -% \filedate.} \thanks{Supported by grants 18/2006 and 99/2008 of Higher +% \filedate.} \thanks{Supported by grants 18/2006, 99/2008 and 131/2010 +% of Higher % Education Development Fund (FRV\v S) }} \author{Robert Ma\v r\'\i k \\ % \texttt{marik@mendelu.cz}} % @@ -116,8 +122,19 @@ % numbers from 1 to 6). You have to use the free Adobe Reader or % nonfree Adobe Acrobat to see the effect (xpdf, evince and others % fail to work with JavaScripts). For more examples how the -% presentation may look like see the |example.pdf| and -% |example-min.pdf| files in the |examples| subdirectory. +% presentation may look like see the |examples| subdirectory. +% +% Similar functionality can be achieved using |pdfcomment| (smaller +% size of the resulting PDF, but restricted to plain text), |ocgtools| +% (works with layers, only |pdflatex| is supported) and Acro\TeX{} +% (works with layers, only |latex| + |dvips| + Adobe Distiller + Adobe +% Acrobat are supported). All these ``similar'' packages allow to +% write the text for he tooltips and the text for the main document in +% one file. In contrast to this apporach, |fancytooltips| package +% makes use of an external file. However, if you prefer to write both +% tooltips in one file, you can preprocess your file using |preview| +% package and exteract tooltips automatically, as shown in the +% |examples/fancy-preview| directory. % % The buttons are created using |eforms.sty| which is a part of % AcroTeX bundle. @@ -138,7 +155,7 @@ % Simply put |\usepackage[createtips]{fancytooltips}| into preamble % and write \texttt{\string\keytip}\marg{foo} in document. This writes % information about keyword \meta{foo} and the pagenumber into file -% |fancytips.tex|. +% |\jobname.tips|. % % \subsection{The file with presentation -- pdf\LaTeX users} % In the file with presentation, the user is responsible @@ -172,18 +189,38 @@ % tooltip appears if you move the mouse pointer to the active area (no % clicking is necessary). % +% \DescribeMacro{inactive option} This option makes the package +% inactive. +% +% \DescribeMacro{active option} This option forces the package active +% even if |inactive| option is loaded. +% +% \DescribeMacro{debug option} Prints two alerts reporting success or +% problems when opening PDF file in Adobe Acrobat (Adobe Reader). Use +% this option to find possible source of problems. See also the +% section Troubleshooting \dots in this manual. +% % \DescribeMacro{\tooltip} The user can put the tooltip into her or % his presentation using the command % \texttt{\string\tooltip}{\marg{stuff}\marg{keyword-or-pagenumber}} % where \meta{stuff} is the printed text in \meta{tooltipcolor} color % and \meta{keyword-or-pagenumber} is either the pagenumber of the % tooltip in the external file or the keyword defined by |\keytip| -% command. \DescribeMacro{\TooltipExtratext} The printed text -% \meta{stuff} is followed by |\TooltipExtratext| command. The default -% value is small blue soap in a box with zero dimensions, as you have -% seen in the second paragraph of this documentation. There is a -% package option |noextratext| which defines |\TooltipExtratext| to be -% empty. \DescribeMacro{noextratext option} +% command and stored in |\TooltipFilename.tips| file, where +% |\TooltipFilename| is set automatically from the |filename| option. +% \DescribeMacro{\TooltipExtratext} The printed text \meta{stuff} is +% followed by |\TooltipExtratext| command. The default value is small +% blue soap, as you have seen in the second paragraph of this +% documentation. There is a package option |noextratext| which defines +% |\TooltipExtratext| to be empty. \DescribeMacro{noextratext option} +% If \marg{keyword-or-pagenumber} is not recognized as valid keyword +% for tooltips, +% +% The text \marg{stuff} is inserted in |\hbox| by +% |\tooltip|. \DescribeMacro{\tooltip*}With starred version of the +% |\tooltip| macro the text \marg{stuff} is not inserted into the box +% and the active button dos not cover the text \marg{stuff}, but +% covers the mark produced by |\TooltipExtratext|. % % \DescribeMacro{\tooltipanim} The user can put a series (animation) of % tooltips into the presentation by using @@ -194,12 +231,17 @@ % default value is 200, you can change it by command % |\def\delayinterval{100}|. % -% The file |example.tex| from |exmaples| subdirectory shows, how to -% redefine these macros to gain different behavior, see the demo file -% |example.pdf|. +% \DescribeMacro{\FancyHook} Redefines |\ref| and |\eqref| commands to +% work with preview, see the demo files in |example/fancy-preview| +% directory. +% +% \DescribeMacro{\TooltipRefmark} Extra text added to |\ref| and +% |\eqref| commands with previews, see the demo files in +% |example/fancy-preview| directory. The default value is the same as +% for |\TooltipExtratext|. % % \subsection{Changes for dvips users} -% dvips users have to specify option |dvips| in |fancytips| package. +% dvips users have to specify option |dvips| in |fancytooltips| package. % \DescribeMacro{pages option} They have to use also a |pages| option % with the number of pages in the PDF file with tooltips. You have to % call the package by @@ -207,23 +249,63 @@ % |\usepackage[dvips,filename=tooltipy,pages=27]{fancytooltips}| % % You have to |latex| (two times) and |dvips| your file first. This -% produces |filename.ps| and |Tooltipsdljs.fdf| files. Distill the pdf -% file into |filename.pdf| and open this file by Adobe Acrobat - this -% imports macros from |Tooltipsdljs.fdf| file. In Acrobat's -% JavaScript console (|Crtl+J|) run (|Ctrl+Enter|) the command -% |ImportTooltips();| which is defined for the document and it creates -% invisible buttons on the first page, imports icons (the file with -% icons specified as \meta{filename} parameter when loading -% fancytooltips must be in working directory) and returns 1. Then -% save the file under another name. -% -% \section{Known problems} -% -% The package works only with the last |eforms.sty|, version -% 2006/10/03 v1.0a. You can download this version from www.arotex.net -% site. The version on CTAN and in MikTeX repositories is old and this -% package does not work with this old version. +% produces |filename.ps| and |Tooltipsdljs.fdf| files. Distill the +% |filename.ps| file into |filename.pdf| and open this file by Adobe +% Acrobat Professional -- this imports macros from |Tooltipsdljs.fdf| +% file. In Acrobat's JavaScript console (open by |Crtl+J|) run (using +% |Ctrl+Enter|) the command |ImportTooltips();| which is defined for +% the document. This command inserts invisible buttons on the first +% page, imports icons (the file with icons specified as +% \meta{filename} parameter when loading fancytooltips must be in +% working directory) and returns 1. Then save the file under another +% name. +% +% \section{Troubleshooting and known problems} +% The source code is in Mercurial repository at +% \url{http://bitbucket.org/robert.marik/fancytooltips/}. You can also +% report problems and issues in the forum at this site. +% \begin{itemize} +% \item +% The package works only with the last |eforms.sty|, version +% 2006/10/03 v1.0a. You can download this version from +% www.arotex.net site. +% \item If the graphics included by |\TooltipExtratext| and +% |\TooltipRefmark| has colors with custom opacity, Adobe Acrobat +% Pro sometimes renders the pictures bad. No problems of this type +% have been observed with Adobe Reader. +% \item For \textbf{dvips} users: In some cases the file +% |Tooltipsdljs.fdf| is not imported automatically (probably some +% setting in Adobe Acrobat). In this case you do not see any message +% even if you use |debug| option. You have troubles of this type if +% you see in the Javascript console (Ctrl+J) error messages like +% ``\texttt{aebTrustedFunctions is not defined 3:Page:Open CloseTooltips is +% not defined 1:Page:Open}''. In this case you have to import the +% file |Tooltipsdljs.fdf| manually from menu ``Form''. Then go to +% the JavaScript console and run |ImportToltips();| command. +% \end{itemize} +% +% Follow the points below if you want to find the source of your +% problems. +% \begin{itemize} +% \item For dvips users it is a good idea to check that Acro\TeX{} is +% properly installed. Do the demo files from Acro\TeX{} work for you? +% \item Try to use |debug| option, prepare the PDF file and open it in +% Adobe Acrobat or Adobe Reader. +% \begin{itemize} +% \item You should see two messages when opening the file. If not, +% the Javascript do not work in your document (are not inserted +% properly). +% \item Both messages should report success for pdflatex users. For +% dvips users one of the message should report error and if you +% run |ImportToltips();| command in Javascript console, you should +% see a message in Javascript console which confirms that the +% pictures from external PDF file have been imported. If you save +% the PDF file and open again, both messages should report +% success. +% \end{itemize} +% \end{itemize} % +% \PrintChanges % \StopEventually{} % % \section{Implementation} @@ -249,27 +331,91 @@ \newif\ifmouseover\mouseoverfalse \DeclareOptionX{mouseover}{\mouseovertrue} +\newif\if@fancytooltips@inactive\@fancytooltips@inactivefalse +\DeclareOptionX{inactive}{\@fancytooltips@inactivetrue} + +\newif\if@fancytooltips@active\@fancytooltips@activefalse +\DeclareOptionX{active}{\@fancytooltips@activetrue} + \DeclareOptionX{filename}{\xdef\TooltipFilename{#1}} \DeclareOptionX{pages}{\xdef\TooltipPages{#1}} +\def\fancytooltipsdebugmsg{} +\DeclareOptionX{debug}{\def \fancytooltipsdebugmsg +{ +if (this.getField("ikona") == null) + {app.alert("No buttons for placing tootlips are available. Contact the author. The file may need more compilations.");} + else + {app.alert("Buttons for placing tooltips are available. Congratulations! Hope everything will work.");} +if (this.getField("animtiph") == null) + {app.alert("No hidden buttons containing tooltips available. The interactive features will not work. \n\n If you created the file by dvips, run the command ImportTooltips() in the Javascript console (Ctrl+J, write the command followed by semicolon and Ctrl+Enter).");} + else + {app.alert("Hidden buttons containing tooltips are available. Congratulations! Hope everything will work.");} +}} + \ProcessOptionsX -\ifx\TooltipFilename\undefined -\PackageWarning{fancytooltips}{** The filename with tooltips is not given. **} -\fi +\newdimen\buttontipwidth +\newdimen\buttontipheight +\newdimen\fancy@a +\newdimen\fancy@b + +\if@fancytooltips@active\@fancytooltips@inactivefalse\fi + +\if@fancytooltips@inactive +\newcommand{\tooltip}{\@ifstar\tooltip@Star\tooltip@NoStar}% +\newcommand{\tooltip@Star}[2]{#1}% +\newcommand{\tooltip@NoStar}[2]{#1}% + +\newcommand{\tooltipanim}{\@ifstar\tooltipanim@Star\tooltipanim@NoStar}% +\newcommand{\tooltipanim@Star}[2]{#1}% +\newcommand{\tooltipanim@NoStar}[2]{#1}% +\def\keytip#1{}% +\def\FancyHook{}% +\def\TooltipPage#1#2{}% +\let\TooltipExtratext\relax +\let\TooltipRefmark\relax +\PackageWarning{fancytooltips}{Fancytooltips inactive}% +\expandafter\endinput\fi + +% \end{macrocode} +% Each |\ref| command has associated a number and writes new label +% into aux file. If the target page for the ref is different from the +% page with this |\ref| command, the corresponding tooltip is inserted. +% \begin{macrocode} +\newcount\fancycheckcount\fancycheckcount=0 +\def\fancy@second#1#2#3#4{#2} +\def\FancyHook{ +\global\let\oldref\ref +\gdef\ref##1{\oldref{##1}\global\advance\fancycheckcount by 1\relax +\edef\templabel{fancyanchorref:\the\fancycheckcount}% +\expandafter\label\expandafter{\templabel}% +\expandafter\ifx \csname FancyToolTip@##1\endcsname\relax \else\hbox to 0 pt{% +\expandafter\ifx \csname r@##1\endcsname \relax\else +\edef\temp{\csname r@##1\endcsname}% +\expandafter\edef\expandafter\fan@tempa\expandafter{\expandafter\fancy@second\temp}% +\fi +\expandafter\ifx \csname r@fancyanchorref:\the\fancycheckcount\endcsname \relax\else +\edef\fan@ttemp{r@fancyanchorref:\the\fancycheckcount}% +\expandafter\let\expandafter\fan@temp@w\csname \fan@ttemp\endcsname +\edef\fan@temp@ww{\expandafter\fancy@second\fan@temp@w}% +\fi +\ifx\fan@temp@ww\undefined\else +\fi +\ifx\fan@tempa\fan@temp@ww\else\smash{% + \let\TooltipExtratext\relax\tooltip{\strut\TooltipRefmark}{##1}}% +\fi +\hss}% +\fi} \ifTooltip@usepdftex -\RequirePackage[pdftex]{eforms} -\def\TooltipExtratext{\hbox to 0 pt{\smash - {\raisebox{0.5em}{\includegraphics[width=0.7em]% - {fancytipmark.pdf}}}\hss}} +\def\TooltipRefmark{\hbox {\raisebox{0.4em}{\includegraphics[width=0.7em]% + {fancytipmark.pdf}}}}% \else -\RequirePackage[dvips]{eforms} -\def\TooltipExtratext{\hbox to 0 pt{\smash - {\raisebox{0.5em}{\includegraphics[width=0.7em]% - {fancytipmark.eps}}}\hss}} +\def\TooltipRefmark{\hbox {\raisebox{0.4em}{\includegraphics[width=0.7em]% + {fancytipmark.eps}}}}% \fi%\ifTooltip@usepdftex -\ifextratext\else\let\TooltipExtratext\relax\fi +} \ifcreatetips % \end{macrocode} @@ -278,9 +424,9 @@ % of the package. % \begin{macrocode} \newwrite\tipfile -\immediate\openout\tipfile fancytips.tex +\immediate\openout\tipfile \jobname.tips \def\keytip#1{\write\tipfile{\string\tooltipname{#1}{\arabic{page}}}} -\else +\expandafter\endinput\fi % \end{macrocode} % This part is processed if the option |createtips| is not used. We % define macros which put the hidden button with the name |ikona.n| in @@ -290,11 +436,24 @@ % show the corresponding picture. % \begin{macrocode} -\newdimen\buttontipwidth -\newdimen\buttontipheight +\ifx\TooltipFilename\undefined +\PackageWarning{fancytooltips}{** The filename with tooltips is not given. **} +\fi + +\ifTooltip@usepdftex +\RequirePackage[pdftex]{eforms} +\def\TooltipExtratext{\hbox{\raisebox{0.4em}{\includegraphics[width=0.7em]% + {fancytipmark.pdf}}}} +\else +\RequirePackage[dvips]{eforms} +\def\TooltipExtratext{\hbox{\raisebox{0.4em}{\includegraphics[width=0.7em]% + {fancytipmark.eps}}}} +\fi%\ifTooltip@usepdftex +\ifextratext\else\let\TooltipExtratext\relax\fi + \AtBeginDocument{ -\buttontipwidth=\paperwidth -\buttontipheight=\paperheight +\global\buttontipwidth=\paperwidth +\global\buttontipheight=\paperheight } \ifTooltip@usepdftex @@ -343,8 +502,7 @@ % box with zero dimensions and then we build a button which covers % this text and has an associated JavaScript action. The important % part is the |\PushButton| macro. You can adjust these macros or -% write similar macros which do what you need. For some exmaples see -% the file |example.tex| from the examples directory. +% write similar macros which do what you need. % \begin{macrocode} \definecolor{tooltipcolor}{rgb}{0,0,1} @@ -358,77 +516,123 @@ \expandafter\gdef\csname TooltipPage#2\endcsname{#2}% \expandafter\gdef\csname Tooltipcount2page#1\endcsname{#2}% } +% \end{macrocode} +% We use the hack for Adobe Acrobat suggested by DPS and Jorg at +% http://www.acrotex.net/forum/showthread.php?tid=78. +% \begin{macrocode} + +\def\fancy@JS#1{\JS{var DirtyBeforeTooltip=this.dirty; #1 + this.dirty=DirtyBeforeTooltip;}} + +\newcommand{\tooltip}{\@ifstar + \tooltip@Star% + \tooltip@NoStar% +} + +\newcommand{\tooltip@Star}[2]{{\color{tooltipcolor}#1}% + {\let\SaveTooltipExtratext\TooltipExtratext + \let\TooltipExtratext\relax + \hbox to 0 pt{\tooltip@NoStar{\strut\SaveTooltipExtratext}{#2}\hss}}} -\def\tooltip#1#2{% +\newcommand{\tooltip@NoStar}[2]{% \global\advance\tooltip@count by 1% \edef\act{\write\@auxout{\noexpand\string\noexpand\TooltipPage{\the\tooltip@count}{\the\tooltip@pagetoks}}}\act \edef\tooltippage{\csname Tooltipcount2page\the\tooltip@count \endcsname}% \checkTipNumber{#2}\edef\TipNumber{\FindTipNumber{#2}}% - \leavevmode - \setbox0=\hbox{{\color{tooltipcolor}{#1}}}\hbox to 0 pt{{\copy0\TooltipExtratext\hss}}% \def\tempfancytooltips{}% \ifmovetips\edef\tempfancytooltips{nastav(\TipNumber,\tooltippage);}\fi - \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\JS{CloseTooltips();}}% + \leavevmode + \setbox0=\hbox{{\color{tooltipcolor}{#1}}}\hbox to 0 pt{\copy0\smash{\TooltipExtratext}\hss}% + \fancy@a=\ht0 + \advance\fancy@a by \dp 0 + \fancy@b=0.5\fancy@a + \advance\fancy@b by -\dp0 + \advance\fancy@b by -2bp + \lower-\fancy@b\vtop{\hbox{% + \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\fancy@JS{CloseTooltips();}}% \ifmouseover - \AAMouseEnter{\JS{this.getField("ikona."+(\tooltippage)).hidden=false; + \AAMouseEnter{\fancy@JS{this.getField("ikona."+(\tooltippage)).hidden=false; try {app.clearInterval(animace);}catch (e) {} \tempfancytooltips zobraz(\TipNumber,\tooltippage); }} \fi} - \A{\JS{this.getField("ikona."+(\tooltippage)).hidden=false; + \A{\fancy@JS{this.getField("ikona."+(\tooltippage)).hidden=false; try {app.clearInterval(animace);}catch (e) {} \tempfancytooltips zobraz(\TipNumber,\tooltippage); }}] - {TooltipField}{\wd0}{\ht0}} + {TooltipField}{\wd0}{\fancy@a}}}} + \def\delayinterval{200} -\def\tooltipanim#1#2#3{% + +\newcommand{\tooltipanim}{\@ifstar + \tooltipanim@Star% + \tooltipanim@NoStar% +} + +\newcommand{\tooltipanim@Star}[3]{{\color{tooltipcolor}#1}% + {\let\SaveTooltipExtratext\TooltipExtratext + \let\TooltipExtratext\relax + \hbox to 0 pt{\tooltipanim@NoStar{\strut\SaveTooltipExtratext}{#2}{#3}\hss}}} + +\newcommand{\tooltipanim@NoStar}[3]{% \global\advance\tooltip@count by 1% \edef\act{\write\@auxout{\noexpand\string\noexpand\TooltipPage{\the\tooltip@count}{\the\tooltip@pagetoks}}}\act \edef\tooltippage{\csname Tooltipcount2page\the\tooltip@count \endcsname}% \checkTipNumber{#2}\edef\TipNumberA{\FindTipNumber{#2}}% \checkTipNumber{#3}\edef\TipNumberB{\FindTipNumber{#3}}% \leavevmode - \setbox0=\hbox{{\color{tooltipcolor}{#1}}}\hbox to 0 pt{{\copy0\TooltipExtratext\hss}}% + \setbox0=\hbox{{\color{tooltipcolor}{#1}}}\hbox to 0 pt{\copy0\smash{\TooltipExtratext}\hss}% \def\tempfancytooltips{}% \ifmovetips\edef\tempfancytooltips{nastav(\TipNumberA,\tooltippage);}\fi - \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\JS{CloseTooltips();}} + \fancy@a=\ht0 + \advance\fancy@a by \dp 0 + \fancy@b=0.5\fancy@a + \advance\fancy@b by -\dp0 + \advance\fancy@b by -2bp + \lower-\fancy@b\vtop{\hbox{% + \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\fancy@JS{CloseTooltips();}} \ifmouseover - \AAMouseEnter{\JS{ + \AAMouseEnter{\fancy@JS{ try {app.clearInterval(animace);}catch (e) {} var cislo=\TipNumberA; \tempfancytooltips function animuj() { + var DirtyBeforeTooltipanim=this.dirty; if (cislo<\TipNumberB) cislo=cislo+1; this.getField('ikona.'+(\tooltippage)).buttonSetIcon(this.getField("animtiph."+cislo).buttonGetIcon()); + this.dirty=DirtyBeforeTooltipanim; }; this.getField('ikona.'+(\tooltippage)).buttonSetIcon(this.getField("animtiph."+\TipNumberA).buttonGetIcon()); this.getField("ikona."+(\tooltippage)).hidden=false; animace=app.setInterval('animuj();', \delayinterval); }} \fi} - \A{\JS{ + \A{\fancy@JS{ try {app.clearInterval(animace);}catch (e) {} var cislo=\TipNumberA; \tempfancytooltips function animuj() { + var DirtyBeforeTooltipanim=this.dirty; if (cislo<\TipNumberB) cislo=cislo+1; this.getField('ikona.'+(\tooltippage)).buttonSetIcon(this.getField("animtiph."+cislo).buttonGetIcon()); + this.dirty=DirtyBeforeTooltipanim; }; this.getField('ikona.'+(\tooltippage)).buttonSetIcon(this.getField("animtiph."+\TipNumberA).buttonGetIcon()); this.getField("ikona."+(\tooltippage)).hidden=false; animace=app.setInterval('animuj();', \delayinterval); }} - ]{TooltipField}{\wd0}{\ht0}} + ]{TooltipField}{\wd0}{\fancy@a}}}} % \end{macrocode} % This code closes tooltip if the page is closed. % \begin{macrocode} \ifTooltip@usepdftex \def\TooltipPageopencloseJS{ \global\pdfpageattr{% - /AA << /O << /S /JavaScript /JS (CloseTooltips();) >> >>}% + /AA << /O << /S /JavaScript /JS ( + var DirtyBeforeCloseTooltip=this.dirty; CloseTooltips(); this.dirty=DirtyBeforeCloseTooltip;) >> >>}% } \pdfximage{\TooltipFilename.pdf}% \edef\TooltipPages{\the\pdflastximagepages}% @@ -436,14 +640,16 @@ \def\TooltipPageopencloseJS{ \literalps@out{% [ {ThisPage} << /AA << - /O << /S /JavaScript /JS (CloseTooltips();) >> + /O << /S /JavaScript /JS (var DirtyBeforeCloseTooltip=this.dirty; CloseTooltips(); this.dirty=DirtyBeforeCloseTooltip;) >> >> >> /PUT pdfmark}} -\OpenAction{/S /JavaScript /JS (CloseTooltips();)} +\OpenAction{/S /JavaScript /JS (var DirtyBeforeCloseTooltip=this.dirty; CloseTooltips(); this.dirty=DirtyBeforeCloseTooltip;)} \fi%\ifTooltip@usepdftex \EveryShipout{\TooltipPageopencloseJS}% \ifTooltip@usepdftex \begin{insDLJS}[fancyTooltipsLoaded]{Tooltipsdljs}{DLJS for Tooltips} + \fancytooltipsdebugmsg + var animace; var fancyTooltipsLoaded = true; @@ -479,12 +685,17 @@ f.hidden=false; f.buttonSetIcon(g.buttonGetIcon()); } + + this.dirty=false; + app.focusRect = false; \end{insDLJS} \else \begin{insDLJS}[fancyTooltipsLoaded]{Tooltipsdljs}{DLJS for Tooltips} var animace; var fancyTooltipsLoaded = true; + \fancytooltipsdebugmsg + function CloseTooltips() { try {this.getField("ikona").hidden=true;}catch (e) {} @@ -504,7 +715,7 @@ p.hidden=true; this.getField("animtiph."+i).buttonImportIcon("\TooltipFilename.pdf",(i-1)); } - console.println("imported \TooltipPages pictures"); + console.println("Imported \TooltipPages pictures, save the PDF file."); return(1); } @@ -534,6 +745,9 @@ f.hidden=false; f.buttonSetIcon(g.buttonGetIcon()); } + + this.dirty=false; + app.focusRect = false; \end{insDLJS} \fi % \end{macrocode} @@ -577,12 +791,13 @@ \fi % \end{macrocode} % The keywords for the tooltips can be stored in the file -% |fancytips.tex|. The topics in this file are created by |\keytip| -% macro (see the first part of the code). +% |\TooltipFilename.tips|. The topics in this file are created by +% |\keytip| macro (see the first part of the code). % \begin{macrocode} -\AtBeginDocument{\IfFileExists{fancytips.tex}{\input{fancytips.tex} -\PackageInfo{fancytooltips}{Inputting fancytips.tex.}}% - {\PackageWarning{fancytooltips}{No file fancytips.tex! +\AtBeginDocument{\IfFileExists{\TooltipFilename.tips}% + {\input{\TooltipFilename.tips} + \PackageInfo{fancytooltips}{Inputting \TooltipFilename.tips.}}% + {\PackageWarning{fancytooltips}{No file \TooltipFilename.tips! Your keywords for tooltips will not work!}}} \def\tooltipname#1#2{\expandafter\xdef\csname FancyToolTip@#1\endcsname{#2}} @@ -596,7 +811,6 @@ number of the frame.}% \fi} -\fi % % \end{macrocode} % -- cgit v1.2.3