summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty')
-rw-r--r--Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty218
1 files changed, 136 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty b/Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty
index 63e25d98e78..a4c2ee3a24e 100644
--- a/Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty
+++ b/Master/texmf-dist/tex/latex/fancytooltips/fancytooltips.sty
@@ -22,10 +22,11 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{fancytooltips}
- [2007/02/20 v1.1 fancytooltips.dtx file]
+ [2007/03/01 v1.2 fancytooltips.dtx file]
\RequirePackage{everyshi}
\RequirePackage{graphicx}
\RequirePackage{xkeyval}
+\RequirePackage{eso-pic}
\newif\ifcreatetips\createtipsfalse
\DeclareOptionX{createtips}{\createtipstrue}
@@ -36,6 +37,9 @@
\newif\ifextratext\extratexttrue
\DeclareOptionX{noextratext}{\extratextfalse}
+\newif\ifmovetips\movetipsfalse
+\DeclareOptionX{movetips}{\movetipstrue}
+
\DeclareOptionX{filename}{\xdef\TooltipFilename{#1}}
\DeclareOptionX{pages}{\xdef\TooltipPages{#1}}
@@ -47,12 +51,12 @@
\ifTooltip@usepdftex
\def\TooltipExtratext{\hbox to 0 pt{\smash
- {\raisebox{0.5em}{\includegraphics[width=1em]%
- {fancytooltipsmark.pdf}}}\hss}}
+ {\raisebox{0.5em}{\includegraphics[width=0.7em]%
+ {fancytipmark.pdf}}}\hss}}
\else
\def\TooltipExtratext{\hbox to 0 pt{\smash
- {\raisebox{0.5em}{\includegraphics[width=1em]%
- {fancytooltipsmark.eps}}}\hss}}
+ {\raisebox{0.5em}{\includegraphics[width=0.7em]%
+ {fancytipmark.eps}}}\hss}}
\fi%\ifTooltip@usepdftex
\ifextratext\else\let\TooltipExtratext\relax\fi
@@ -61,91 +65,85 @@
\immediate\openout\tipfile fancytips.tex
\def\keytip#1{\write\tipfile{\string\tooltipname{#1}{\arabic{page}}}}
\else
-\ifTooltip@usepdftex\else
-\ifx\everyeqIcon\undefined
-\newcommand\everyeqIcon[1]{\def\every@eqIcon{#1}}
+
+\newdimen\buttontipwidth
+\newdimen\buttontipheight
+\AtBeginDocument{
+\buttontipwidth=\paperwidth
+\buttontipheight=\paperheight
+}
+
+\ifTooltip@usepdftex
+\def\frametip@{%
+ \pdfstartlink user{%
+ /Subtype /Widget
+ /F 6
+ /T (ikona.\thepage)
+ /FT /Btn
+ /Ff 65536
+ /H /N
+ /BS << /W 1 /S /S >>
+ /MK << /TP 1 /IF <</A[1.0 1.0]/SW /B>> >>
+ }%
+ \vbox to \buttontipheight {\vss\hbox to \buttontipwidth{\hss}}\pdfendlink}
+\else
+\def\everyeqIcon#1{\def\every@eqIcon{#1}}
\def\every@eqIcon{}
-\newcommand\eqIcon[4][]
+\newcommand\eqIconFTT[4][]
{%
\push@@Button{#1}{#2}{#3}{#4}{}{\eq@setButtonProps\eq@Button@driver}%
{\eqIconDefaults\every@ButtonField\every@eqIcon}%
}
-\fi%\ifx\everyeqIcon\undefined
\def\eqIconDefaults
{%
- \rawPDF{}\S{}\mkIns{/TP 1 /IF<</A[1.0 1.0]/SW/B>>}\R{270}
+ \rawPDF{}\S{}\mkIns{/TP 1 /IF<</A[1.0 1.0]/SW/B>>}\R{0}
\CA{}\RC{}\AC{}\BC{}\BG{}\H{B}
\textColor{0 g}\Ff{\FfReadOnly}
}
+\def\frametip@{\eqIconFTT[\BC{}\BG{}\F{\FHidden}]%
+ {ikona.\thepage}{\paperwidth}{\paperheight}}%
\fi%\ifTooltip@usepdftex
-\def\frametip{\vbox to 0 pt{\hbox to 0 pt{\hss\buttontip}\vss}}
-\newdimen\buttontipwidth \buttontipwidth=5in
-\newdimen\buttontipheight \buttontipheight=5in
-\ifTooltip@usepdftex
-\def\buttontip{%
-\pdfstartlink user{%
- /Subtype /Widget
- /F 6
- /T (ikona)
- /FT /Btn
- /Ff 65536
- /H /N
- /BS << /W 1 /S /S >>
- /MK << /TP 1 /IF <</SW /B>> >>
-}%
-\vbox to \buttontipheight {\vss\hbox to \buttontipwidth{\hss}}\pdfendlink}
-\else
-\def\buttontip{%
- \eqIcon[\BC{}\BG{}\F{\FHidden}]{ikona}{\buttontipwidth}{\buttontipheight}
- }
-\fi%\ifTooltip@usepdftex
+
+\def\frametip{%
+ \expandafter\ifx \csname TooltipPage\thepage\endcsname\relax
+ \else
+ \setbox0=\hbox{\frametip@}%
+ \hbox{\raise \dp0 \box0}
+ \fi}%
+\AddToShipoutPicture{\hbox to 0 pt{\frametip\hss}}
\definecolor{tooltipcolor}{rgb}{0,0,1}
-\def\tooltip#1#2{\checkTipNumber{#2}%
- \edef\TipNumber{\FindTipNumber{#2}}%
+\def\TooltipPage#1{\expandafter\gdef\csname TooltipPage#1\endcsname{#1}}
+\def\tooltip#1#2{%
+ \write\@auxout{\noexpand\TooltipPage{\thepage}}%
+ \checkTipNumber{#2}\edef\TipNumber{\FindTipNumber{#2}}%
+ \leavevmode
\setbox0=\hbox{{\color{tooltipcolor}{#1}}}\hbox to 0 pt{{\copy0\TooltipExtratext\hss}}%
- \pushButton[\BC{}\BG{}\S{}\AA{
- \AAMouseExit{\JS{CloseTooltips();}}
- \AAMouseEnter{\JS{
- try {app.clearInterval(animace);}catch (e) {}
- if (event.shift) {this.getField("ikona").hidden=false;
- this.getField('ikona').buttonSetIcon(this.getField("animtiph\TipNumber").buttonGetIcon());}}}
- }
- \A{\JS{this.getField("ikona").hidden=false;
+ \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\JS{CloseTooltips();}}}
+ \A{\JS{this.getField("ikona."+(this.pageNum+1)).hidden=false;
try {app.clearInterval(animace);}catch (e) {}
- this.getField('ikona').buttonSetIcon(this.getField("animtiph\TipNumber").buttonGetIcon());}}]
+ \ifmovetips nastav(\TipNumber);\fi
+ zobraz(\TipNumber);
+ }}]
{TooltipField}{\wd0}{\ht0}}
\def\delayinterval{200}
\def\tooltipanim#1#2#3{%
+ \write\@auxout{\noexpand\TooltipPage{\thepage}}%
\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}}%
- \pushButton[\BC{}\BG{}\S{}\AA{
- \AAMouseExit{\JS{CloseTooltips();}}
- \AAMouseEnter{\JS{
- var cislo=\TipNumberA;
- try {app.clearInterval(animace);}catch (e) {}
- function animuj()
- {
- if (cislo<\TipNumberB) cislo=cislo+1;
- this.getField('ikona').buttonSetIcon(this.getField("animtiph"+cislo).buttonGetIcon());
- };
- if (event.shift) {
- this.getField('ikona').buttonSetIcon(this.getField("animtiph"+\TipNumberA).buttonGetIcon());
- this.getField("ikona").hidden=false;
- animace=app.setInterval('animuj();', \delayinterval);
- }
- }}
- }
+ \pushButton[\BC{}\BG{}\S{}\AA{\AAMouseExit{\JS{CloseTooltips();}}}
\A{\JS{
try {app.clearInterval(animace);}catch (e) {}
var cislo=\TipNumberA;
+ \ifmovetips nastav(\TipNumberA);\fi
function animuj()
{
if (cislo<\TipNumberB) cislo=cislo+1;
- this.getField('ikona').buttonSetIcon(this.getField("animtiph"+cislo).buttonGetIcon());
+ this.getField('ikona.'+(this.pageNum+1)).buttonSetIcon(this.getField("animtiph."+cislo).buttonGetIcon());
};
- this.getField('ikona').buttonSetIcon(this.getField("animtiph"+\TipNumberA).buttonGetIcon());
- this.getField("ikona").hidden=false;
+ this.getField('ikona.'+(this.pageNum+1)).buttonSetIcon(this.getField("animtiph."+\TipNumberA).buttonGetIcon());
+ this.getField("ikona."+(this.pageNum+1)).hidden=false;
animace=app.setInterval('animuj();', \delayinterval);
}}
]{TooltipField}{\wd0}{\ht0}}
@@ -170,24 +168,89 @@
var animace;
function CloseTooltips()
{
- this.getField("ikona").hidden=true;
+ try {this.getField("ikona").hidden=true;}catch (e) {}
try {app.clearInterval(animace);}catch (e) {}
}
+
+ function nastav(cislo)
+ {
+ var f=this.getField("ikona."+(this.pageNum+1));
+ var g=this.getField("animtiph."+cislo);
+ var sourf=f.rect;
+ var sourg=g.rect;
+ if ((mouseX+sourg[2]-sourg[0])<sourf[2])
+ var percX=100*(mouseX-sourf[0])/((sourf[2]-sourf[0])-(sourg[2]-sourg[0]));
+ else
+ var percX=100*(mouseX-sourf[0]-(sourg[2]-sourg[0]))/((sourf[2]-sourf[0])-(sourg[2]-sourg[0]));
+ var percY=100*(mouseY-sourf[3])/((sourf[1]-sourf[3])-(sourg[1]-sourg[3]));
+ if (percX>100) percX=100;
+ if (percY>100) percY=100;
+ if (percX<0) percX=0;
+ if (percY<0) percY=0;
+ f.buttonAlignX=percX;
+ f.buttonAlignY=percY;
+ }
+
+ function zobraz(cislo)
+ {
+ var f=this.getField("ikona."+(this.pageNum+1));
+ var g=this.getField("animtiph."+cislo);
+ f.hidden=false;
+ f.buttonSetIcon(g.buttonGetIcon());
+ }
\end{insDLJS}
\else
\begin{insDLJS}[clearTooltips]{Tooltipsdljs}{My Private DLJS for Tooltips}
var animace;
function CloseTooltips()
{
- this.getField("ikona").hidden=true;
+ try {this.getField("ikona").hidden=true;}catch (e) {}
try {app.clearInterval(animace);}catch (e) {}
}
+
function ImportTooltips()
{
+ console.println("importing pictures");
for (var i=1;i<=\TooltipPages;i++)
- {this.getField("animtiph"+i).buttonImportIcon("\TooltipFilename.pdf",(i-1));}
+ {
+ this.insertPages(this.numPages-1,"\TooltipFilename.pdf",(i-1),(i-1));
+ var rozm=this.getPageBox("Crop",this.numPages-1);
+ this.deletePages(this.numPages-1);
+ var p=this.addField("animtiph."+i,"button",0,rozm);
+ p.buttonPosition=position.iconOnly;
+ p.hidden=true;
+ this.getField("animtiph."+i).buttonImportIcon("\TooltipFilename.pdf",(i-1));
+ }
+ console.println("imported \TooltipPages pictures");
return(1);
}
+
+ function nastav(cislo)
+ {
+ var f=this.getField("ikona."+(this.pageNum+1));
+ var g=this.getField("animtiph."+cislo);
+ var sourf=f.rect;
+ var sourg=g.rect;
+ if ((mouseX+sourg[2]-sourg[0])<sourf[2])
+ var percX=100*(mouseX-sourf[0])/((sourf[2]-sourf[0])-(sourg[2]-sourg[0]));
+ else
+ var percX=100*(mouseX-sourf[0]-(sourg[2]-sourg[0]))/((sourf[2]-sourf[0])-(sourg[2]-sourg[0]));
+ var percY=100*(mouseY-sourf[3])/((sourf[1]-sourf[3])-(sourg[1]-sourg[3]));
+ if (percX>100) percX=100;
+ if (percY>100) percY=100;
+ if (percX<0) percX=0;
+ if (percY<0) percY=0;
+ f.buttonAlignX=percX;
+ f.buttonAlignY=percY;
+ }
+
+ function zobraz(cislo)
+ {
+ var f=this.getField("ikona."+(this.pageNum+1));
+ var g=this.getField("animtiph."+cislo);
+ f.hidden=false;
+ f.buttonSetIcon(g.buttonGetIcon());
+ }
\end{insDLJS}
\fi
\newcount\tooltip@count
@@ -196,16 +259,15 @@
\count@=0
\@whilenum\count@<\TooltipPages \do{%
\tooltip@count=\count@
- \advance \tooltip@count by 1
+ \advance \tooltip@count by 1%
\bgroup
\immediate\pdfximage
- width 0 pt height 0 pt depth 0 pt
page \the\tooltip@count{\TooltipFilename.pdf}%
\mbox{\leavevmode
- \pdfstartlink user{
+ \vbox to 0 pt{\vss\hbox to 0 pt{\pdfstartlink user{%
/Subtype /Widget
/F 6
- /T (animtiph\the\tooltip@count)
+ /T (animtiph.\the\tooltip@count)
/FT /Btn
/Ff 65536
/H /N
@@ -216,22 +278,14 @@
/IF << /SW /A >>
>>
}%
- \pdfendlink}%
+ \phantom{\pdfrefximage \pdflastximage}%
+ \pdfendlink\hss}}}%
\egroup
\advance\count@\@ne}%
}
+\AddToShipoutPicture*{\hbox to 0 pt{\TooltipHidden}}
\else
-\def\TooltipHidden{%
- \count@=0
- \@whilenum\count@<\TooltipPages \do{%
- \tooltip@count=\count@
- \advance \tooltip@count by 1
- \bgroup
- \eqIcon[\BC{}\BG{}\F{\FHidden}]
- {animtiph\the\tooltip@count}{0cm}{0cm}%
- \egroup
- \advance\count@\@ne}%
-}
+\let\TooltipHidden\relax
\fi
\AtBeginDocument{\IfFileExists{fancytips.tex}{\input{fancytips.tex}
\PackageInfo{fancytooltips}{Inputting fancytips.tex.}}%