diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-24 01:08:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-24 01:08:50 +0000 |
commit | f805abd4a4532d40e6f20e57a7597e5285f9b320 (patch) | |
tree | e0003517ddfd357fdf32587d6cb71d7ed974d418 /Master/texmf-dist/tex/latex/tdclock | |
parent | b6c481dc1f95f796eb2bb78fd70110281d7a4c58 (diff) |
tdlock update (23jun09)
git-svn-id: svn://tug.org/texlive/trunk@13931 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tdclock')
-rw-r--r-- | Master/texmf-dist/tex/latex/tdclock/tdclock.sty | 139 |
1 files changed, 118 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/tdclock/tdclock.sty b/Master/texmf-dist/tex/latex/tdclock/tdclock.sty index 3fcf6d82065..3608eb4c534 100644 --- a/Master/texmf-dist/tex/latex/tdclock/tdclock.sty +++ b/Master/texmf-dist/tex/latex/tdclock/tdclock.sty @@ -1,4 +1,4 @@ -\ProvidesPackage{tdclock} [2007/10/30 v2.0 clock accessory] +\ProvidesPackage{tdclock} [2009/06/01 v2.2 clock accessory] % % Luis Randez randez@unizar.es @@ -15,6 +15,14 @@ \ifdefined\clock@font\else\def\clock@font{"font.Helv"}\fi \ifdefined\clock@interval\else\def\clock@interval{29}\fi +\ifdefined\clock@duration\else\def\clock@duration{6000.0}\fi +\ifdefined\clock@timewarningfirst\else\def\clock@timewarningfirst{90}\fi +\ifdefined\clock@timewarningsecond\else\def\clock@timewarningsecond{95}\fi +\ifdefined\clock@death\else\def\clock@death{0}\fi +\ifdefined\clock@colorwarningfirst\else\def\clock@colorwarningfirst{orange}\fi +\ifdefined\clock@colorwarningsecond\else\def\clock@colorwarningsecond{red}\fi +\ifdefined\clock@fillcolorwarningfirst\else\def\clock@fillcolorwarningfirst{"T"}\fi +\ifdefined\clock@fillcolorwarningsecond\else\def\clock@fillcolorwarningsecond{"T"}\fi % \ifdefined\clock@fontsize\else\newdimen\clock@fontsize\clock@fontsize=\f@size pt\fi \ifdefined\clock@height\else\newdimen\clock@height\fi @@ -23,6 +31,15 @@ \DeclareOptionX{font}{\def\clock@font{"font.#1"}} \DeclareOptionX{timeinterval}{\renewcommand{\clock@interval}{#1}} +\DeclareOptionX{timeduration}{\renewcommand{\clock@duration}{#1}} +\DeclareOptionX{timewarningfirst}{\renewcommand{\clock@timewarningfirst}{#1}} +\DeclareOptionX{timewarningsecond}{\renewcommand{\clock@timewarningsecond}{#1}} +\DeclareOptionX{timedeath}{\renewcommand{\clock@death}{#1}} +\DeclareOptionX{colorwarningfirst}{\renewcommand{\clock@colorwarningfirst}{#1}} +\DeclareOptionX{colorwarningsecond}{\renewcommand{\clock@colorwarningsecond}{#1}} +\DeclareOptionX{fillcolorwarningfirst}{\renewcommand{\clock@fillcolorwarningfirst}{#1}} +\DeclareOptionX{fillcolorwarningsecond}{\renewcommand{\clock@fillcolorwarningsecond}{#1}} + \ProcessOptionsX \def\a@a{1.0} @@ -58,7 +75,8 @@ \ifx\clock@font\@CourBI \def\@hfac{0.8}\def\a@a{1.0}\def\b@b{1.200}\def\a@one{1.1}\def\b@one{0.590}\def\a@h{0.04}\def\b@h{0.07}\fi \def\clock@temp#1{\def\clock@tempa##1,##2,##3\@nil{##1 ##2 ##3}% -\extractcolorspec{#1}\clock@tempb\expandafter\convertcolorspec\clock@tempb{rgb}\clock@tempb\edef\clock@tempa{\expandafter\clock@tempa\clock@tempb\@nil}} +\extractcolorspec{#1}\clock@tempb\expandafter\convertcolorspec\clock@tempb{rgb}% +\clock@tempb\edef\clock@tempa{\expandafter\clock@tempa\clock@tempb\@nil}} \def\fac@font{1.0} \def\factorclockfont#1{\def\fac@font{#1}} @@ -66,6 +84,27 @@ \def\clock@setfonsize{\clock@fontsize=\f@size pt\clock@fontsize=\fac@font\clock@fontsize} \def\clock@setfontcolor{\clock@temp{.}\let\clock@fontcolor=\clock@tempa} \def\clock@setheight{\clock@height=\@hfac\clock@fontsize} + +\def\clock@tempf#1{\def\clock@tempaf##1,##2,##3\@nil{##1 ##2 ##3}% +\extractcolorspec{#1}\clock@tempbf\expandafter\convertcolorspec\clock@tempbf{rgb}% +\clock@tempbf\edef\clock@tempaf{\expandafter\clock@tempaf\clock@tempbf\@nil}} + +\def\clock@tempff#1{\def\clock@tempaff##1,##2,##3\@nil{##1 ##2 ##3}% +\extractcolorspec{#1}\clock@tempbff\expandafter\convertcolorspec\clock@tempbff{rgb}% +\clock@tempbff\edef\clock@tempaff{\expandafter\clock@tempaff\clock@tempbff\@nil}} + +\def\clock@tempfff#1{\def\clock@tempafff##1,##2,##3\@nil{##1 ##2 ##3}% +\extractcolorspec{#1}\clock@tempbfff\expandafter\convertcolorspec\clock@tempbfff{rgb}% +\clock@tempbfff\edef\clock@tempafff{\expandafter\clock@tempafff\clock@tempbfff\@nil}} + +\def\@Transp{"T"} +\clock@temp{\clock@colorwarningfirst}\def\colorninety{["RGB",\clock@tempb]} +\clock@tempf{\clock@colorwarningsecond}\def\colorninetyfive{["RGB",\clock@tempbf]} +\ifx\clock@fillcolorwarningfirst\@Transp\def\fillcolorninety{["T"]}% +\else\clock@tempff{\clock@fillcolorwarningfirst}\def\fillcolorninety{["RGB",\clock@tempbff]}\fi +\ifx\clock@fillcolorwarningsecond\@Transp\def\fillcolorninetyfive{["T"]}% +\else\clock@tempfff{\clock@fillcolorwarningsecond}\def\fillcolorninetyfive{["RGB",\clock@tempbfff]}\fi + % \def\toggleclock#1{\PushButton[name=button1, onclick={\auxiliar;}]{#1}} \def\resetcrono#1{\PushButton[name=button2, onclick={\resetclock;}]{{#1}}} @@ -75,17 +114,24 @@ % \def\tdclock{\tddate\ \ \tdtime} \def\tddate{\tdday\dateseparator\tdmonth\dateseparator\tdyear} -\def\tdtime{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds} -\def\crono{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds} +\def\tdtime{\tdwarningbox{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds}} +\def\crono{\tdwarningbox{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds}} +%\def\crono{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds} +%\def\tdtime{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds} +% +\def\mm{% +\def\tdtime{\tdwarningbox{\tdminutes}}% +\def\crono{\tdwarningbox{\cronominutes}}% +} % \def\hhmm{% -\def\tdtime{\tdhours\timeseparator\tdminutes}% -\def\crono{\cronohours\timeseparator\cronominutes}% +\def\tdtime{\tdwarningbox{\tdhours\timeseparator\tdminutes}}% +\def\crono{\tdwarningbox{\cronohours\timeseparator\cronominutes}}% } % \def\hhmmss{% -\def\tdtime{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds}% -\def\crono{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds}% +\def\tdtime{\tdwarningbox{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds}}% +\def\crono{\tdwarningbox{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds}}% } \def\mmddyyyy{% @@ -122,18 +168,27 @@ readonly=true,value=/]{}\kern-60pt\kern \a@one pt\kern \b@one\clock@fontsize\vru \def\pdfcolon{% \clock@setfonsize\clock@setheight\clock@setfontcolor%\clock@setwidth -\setbox\sizebox=\hbox{\TextField[name=separatortime, width=60pt, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize,value=:]{}}% -\vrule width 0pt height 2pt\kern-0.75pt\kern-\wd\sizebox\kern 60pt{\raisebox{-\b@h\clock@fontsize}{\raisebox{-\a@h pt}{\mbox{\TextField[name=separatortime, width=60pt, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize, -readonly=true,value=:]{}\kern-60pt\kern \a@one pt\kern \b@one\clock@fontsize\vrule width 0pt height 2pt}}}}% +\setbox\sizebox=\hbox{\TextField[name=separatortime, width=0.90\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize,value=:]{}}% +\vrule width 0pt height 2pt\kern-0.4pt\kern-\wd\sizebox\kern 0.90\clock@fontsize{\raisebox{-\b@h\clock@fontsize}{\raisebox{-\a@h pt}% +{\mbox{\TextField[name=separatortime, width=0.90\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize, +readonly=true,value=:]{}\kern-0.90\clock@fontsize\kern\a@one pt\kern \b@one\clock@fontsize\vrule width 0pt height 2pt}}}}% } \def\clockfield#1{% \clock@setfonsize\clock@setheight\clock@setfontcolor%\clock@setwidth -\setbox\sizebox=\hbox{\TextField[name=#1, width=1.3\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize]{}}% -\vrule width 0pt height 2pt\kern-\a@a pt\kern-\wd\sizebox\kern 1.3\clock@fontsize{\raisebox{-\b@h\clock@fontsize}{\raisebox{-\a@h pt}{\mbox{\TextField[name=#1, width=1.3\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize,readonly=true, -value={}]{}\kern-1.3\clock@fontsize\kern\a@a pt\kern \b@b\clock@fontsize\vrule width 0pt height 2pt}}}}% +\setbox\sizebox=\hbox{\TextField[name=#1, width=1.31\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize]{}}% +\vrule width 0pt height 2pt\kern-\a@a pt\kern-\wd\sizebox\kern 1.31\clock@fontsize{\raisebox{-\b@h\clock@fontsize}% +{\raisebox{-\a@h pt}{\mbox{\TextField[name=#1, width=1.31\clock@fontsize, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize,readonly=true, +value={}]{}\kern-1.31\clock@fontsize\kern\a@a pt\kern \b@b\clock@fontsize\vrule width 0pt height 2pt}}}}% } +\def\tdwarningbox#1{% +\clock@setfonsize\clock@setheight\clock@setfontcolor% +\setbox\sizebox=\hbox{#1}% +\vrule width 0pt height 2pt\kern-2pt\kern-\a@a pt\raisebox{-\dp\sizebox}{\raisebox{-\a@h pt}% +{\mbox{\TextField[name=cronobox, width=1.01\wd\sizebox, height=1.08\ht\sizebox, align = 0, readonly=true,value= ]{}}}}% +\vrule width 0pt height 2pt\kern0.1pt\kern-1.01\wd\sizebox\vrule width 0pt height 2pt#1\kern 1pt} + \def\initfields{% \begin{Form} \mbox{\TextField[format=\startclock,name=resultado2, hidden=true, width=0truecm, height=0truecm, bordercolor= 1 1 1, backgroundcolor= 1 1 1,value={}]{}} @@ -152,6 +207,7 @@ value={}]{}\kern-1.3\clock@fontsize\kern\a@a pt\kern \b@b\clock@fontsize\vrule w \PushButton[name=button2, onclick={\resetclock;},hidden=true]{}% \TextField[name=separatordate, hidden=true, width=0pt, height=0pt,charsize=0pt, value=/]{}% \TextField[name=separatortime, hidden=true, width=0pt, height=0pt,charsize=0pt, value=:]{}% +\TextField[name=cronobox, hidden=true, width=0pt, height=0pt,charsize=0pt, value= ]{}% } \def\initclock{% @@ -177,8 +233,15 @@ var iop= -iop; global.iop; global.fuente; global.interval; +global.duration; +global.death; +% var iop=1; var fuente=eval(\clock@font); +var duration=eval(\clock@duration)*60; +var firstwarning=eval(\clock@timewarningfirst)/100; +var secondwarning=eval(\clock@timewarningsecond)/100; +var death=eval(\clock@death); %var interval=eval(#2); %var fuente="clock"; fecha1 = rresett(); @@ -193,9 +256,22 @@ global.minutos0 = fObj0.getMinutes(); global.segundos0 = fObj0.getSeconds(); } % +function alerta(kolor,kolorfill) +{ +this.getField("minutes").textColor=kolor; +this.getField("hours").textColor=kolor; +this.getField("seconds").textColor=kolor; +this.getField("cronominutes").textColor=kolor; +this.getField("cronohours").textColor=kolor; +this.getField("crseconds").textColor=kolor; +this.getField("separatortime").textColor=kolor; +this.getField("cronobox").fillColor=kolorfill; +} +% function reloj() { % +% var fObj = new Date(); var dia = formateo(fObj.getDate()); var mes = formateo(fObj.getMonth()+1); @@ -213,6 +289,26 @@ h = Math.floor(resta/3600); htexto=formateo(h); m = Math.floor((resta-3600*h)/60); mtexto=formateo(m); s = resta-3600*h-60*m; stexto=formateo(s); % +% +% +var cociente = eval(resta/duration); +if ( cociente < firstwarning) { +this.getField("minutes").fillColor=["T"]; +this.getField("hours").fillColor=["T"]; +this.getField("seconds").fillColor=["T"]; +this.getField("cronominutes").fillColor=["T"]; +this.getField("cronohours").fillColor=["T"]; +this.getField("crseconds").fillColor=["T"]; +this.getField("separatortime").fillColor=["T"]; +this.getField("cronobox").fillColor=["T"]; +} +if ( cociente >= firstwarning) { + alerta(\colorninety,\fillcolorninety); + if ( cociente >= secondwarning) {alerta(\colorninetyfive,\fillcolorninetyfive);} +} +if( (death == 1) && ( resta > duration*1.10 )) { closeDoc();} +% +console.println("aaa " + fuente+ " " + duration); if (iop == 1) {fecha1= dia+"/"+mes+"/"+year+ " "+horas + ":"+minutos+":"+segundos; casio1=horas;casio2=minutos;casio3=segundos;} @@ -226,32 +322,32 @@ casio1=htexto;casio2=mtexto;casio3=stexto;} % this.getField("hours").value=casio1; this.getField("hours").textFont=fuente; -this.getField("hours").fillColor=["T"]; +%this.getField("hours").fillColor=["T"]; this.getField("hours").strokeColor=["T"]; % this.getField("minutes").value=casio2; this.getField("minutes").textFont=fuente; -this.getField("minutes").fillColor=["T"]; +%this.getField("minutes").fillColor=["T"]; this.getField("minutes").strokeColor=["T"]; % this.getField("seconds").value=casio3; this.getField("seconds").textFont=fuente; -this.getField("seconds").fillColor=["T"]; +%this.getField("seconds").fillColor=["T"]; this.getField("seconds").strokeColor=["T"]; casio4=htexto; this.getField("cronohours").value=casio4; this.getField("cronohours").textFont=fuente; -this.getField("cronohours").fillColor=["T"]; +%this.getField("cronohours").fillColor=["T"]; this.getField("cronohours").strokeColor=["T"]; casio5=mtexto; this.getField("cronominutes").value=casio5; this.getField("cronominutes").textFont=fuente; -this.getField("cronominutes").fillColor=["T"]; +%this.getField("cronominutes").fillColor=["T"]; this.getField("cronominutes").strokeColor=["T"]; casio6=stexto; this.getField("crseconds").value=casio6; this.getField("crseconds").textFont=fuente; -this.getField("crseconds").fillColor=["T"]; +%this.getField("crseconds").fillColor=["T"]; this.getField("crseconds").strokeColor=["T"]; casio7=dia; this.getField("day").value=casio7; @@ -272,8 +368,9 @@ this.getField("separatordate").textFont=fuente; this.getField("separatordate").fillColor=["T"]; this.getField("separatordate").strokeColor=["T"]; this.getField("separatortime").textFont=fuente; -this.getField("separatortime").fillColor=["T"]; +%this.getField("separatortime").fillColor=["T"]; this.getField("separatortime").strokeColor=["T"]; +this.getField("cronobox").strokeColor=["T"]; %this.getField("button1").textFont=fuente; this.getField("button1").fillColor=["T"]; this.getField("button1").strokeColor=["T"]; |