From 4f3875bdc3eef51b36c5bc745af29053080a1775 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Dec 2008 23:34:58 +0000 Subject: new package tdclock (22dec08) git-svn-id: svn://tug.org/texlive/trunk@11691 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/tdclock/tdclock.sty | 296 ++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/tdclock/tdclock.sty (limited to 'Master/texmf-dist/tex/latex/tdclock') diff --git a/Master/texmf-dist/tex/latex/tdclock/tdclock.sty b/Master/texmf-dist/tex/latex/tdclock/tdclock.sty new file mode 100644 index 00000000000..3fcf6d82065 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tdclock/tdclock.sty @@ -0,0 +1,296 @@ +\ProvidesPackage{tdclock} [2007/10/30 v2.0 clock accessory] + +% +% Luis Randez randez@unizar.es +% Juan I. Montijano monti@unizar.es +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\RequirePackage{hyperref} +\RequirePackage{xcolor}[2004/05/09] +\RequirePackage{xkeyval} + + +\ifdefined\clock@font\else\def\clock@font{"font.Helv"}\fi +\ifdefined\clock@interval\else\def\clock@interval{29}\fi +% +\ifdefined\clock@fontsize\else\newdimen\clock@fontsize\clock@fontsize=\f@size pt\fi +\ifdefined\clock@height\else\newdimen\clock@height\fi +%\ifdefined\clock@fontcolor\else\newcommand{\clock@fontcolor}{0 0 0}\fi + + +\DeclareOptionX{font}{\def\clock@font{"font.#1"}} +\DeclareOptionX{timeinterval}{\renewcommand{\clock@interval}{#1}} +\ProcessOptionsX + +\def\a@a{1.0} +\def\b@b{1.080} +\def\a@one{1.1} +\def\b@one{0.3} +\def\a@h{0.1} +\def\b@h{0.1} + +\def\@Helv{"font.Helv"} +\def\@HelvB{"font.HelvB"} +\def\@HelvI{"font.HelvI"} +\def\@HelvBI{"font.HelvBI"} +\def\@Times{"font.Times"} +\def\@TimesB{"font.TimesB"} +\def\@TimesI{"font.TimesI"} +\def\@TimesBI{"font.TimesBI"} +\def\@Cour{"font.Cour"} +\def\@CourB{"font.CourB"} +\def\@CourI{"font.CourI"} +\def\@CourBI{"font.CourBI"} +\ifx\clock@font\@Helv \def\@hfac{0.9}\def\a@a{1.1}\def\b@b{1.080}\def\a@one{1.1}\def\b@one{0.300}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@HelvB \def\@hfac{0.9}\def\a@a{1.1}\def\b@b{1.080}\def\a@one{1.1}\def\b@one{0.300}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@HelvI \def\@hfac{0.9}\def\a@a{1.1}\def\b@b{1.080}\def\a@one{1.1}\def\b@one{0.300}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@HelvBI \def\@hfac{0.9}\def\a@a{1.1}\def\b@b{1.080}\def\a@one{1.1}\def\b@one{0.300}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@Times \def\@hfac{0.9}\def\a@a{1.0}\def\b@b{1.000}\def\a@one{1.10}\def\b@one{0.280}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@TimesB \def\@hfac{0.9}\def\a@a{1.0}\def\b@b{1.000}\def\a@one{1.10}\def\b@one{0.280}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@TimesI \def\@hfac{0.9}\def\a@a{1.0}\def\b@b{1.000}\def\a@one{1.10}\def\b@one{0.280}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@TimesBI \def\@hfac{0.9}\def\a@a{1.0}\def\b@b{1.000}\def\a@one{1.10}\def\b@one{0.280}\def\a@h{0.10}\def\b@h{0.10}\fi +\ifx\clock@font\@Cour \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 +\ifx\clock@font\@CourB \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 +\ifx\clock@font\@CourI \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 +\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}} + +\def\fac@font{1.0} +\def\factorclockfont#1{\def\fac@font{#1}} + +\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\toggleclock#1{\PushButton[name=button1, onclick={\auxiliar;}]{#1}} +\def\resetcrono#1{\PushButton[name=button2, onclick={\resetclock;}]{{#1}}} + +\def\dateseparator{\pdfslash} +\def\timeseparator{\pdfcolon} +% +\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\hhmm{% +\def\tdtime{\tdhours\timeseparator\tdminutes}% +\def\crono{\cronohours\timeseparator\cronominutes}% +} +% +\def\hhmmss{% +\def\tdtime{\tdhours\timeseparator\tdminutes\timeseparator\tdseconds}% +\def\crono{\cronohours\timeseparator\cronominutes\timeseparator\cronoseconds}% +} + +\def\mmddyyyy{% +\def\tddate{\tdmonth\dateseparator\tdday\dateseparator\tdyear}% +} +\def\ddmmyyyy{% +\def\tddate{\tdday\dateseparator\tdmonth\dateseparator\tdyear}% +} + +\def\tdday{\clockfield{day}} +\def\tdmonth{\clockfield{month}} +\def\tdhours{\clockfield{hours}} +\def\tdminutes{\clockfield{minutes}} +\def\tdseconds{\clockfield{seconds}} +\def\cronohours{\clockfield{cronohours}} +\def\cronominutes{\clockfield{cronominutes}} +\def\cronoseconds{\clockfield{crseconds}} + +\newbox\sizebox + +\def\tdyear{% +\clock@setfonsize\clock@setheight\clock@setfontcolor%\clock@setwidth +\setbox\sizebox=\hbox{\TextField[name=year, width=60pt, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize]{}}% +\vrule width 0pt height 2pt\kern-1pt\kern-\wd\sizebox\kern 60pt{\raisebox{-\b@h\clock@fontsize}{\raisebox{-\a@h pt}{\mbox{\TextField[name=year, width=60pt, height=\clock@height, align = 0, color =\clock@fontcolor, charsize = \clock@fontsize,readonly=true, +value={}]{}\kern-60pt\kern \a@a pt\kern \b@b\clock@fontsize\kern \b@b\clock@fontsize\vrule width 0pt height 2pt}}}}% +} + +\def\pdfslash{% +\clock@setfonsize\clock@setheight\clock@setfontcolor%\clock@setwidth +\setbox\sizebox=\hbox{\TextField[ 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=separatordate, 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}}}}% +} + +\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}}}}% +} + +\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}}}}% +} + +\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={}]{}} +\end{Form}% +%\TextField[name=resultado1, hidden=true, width=0pt, height=0pt,charsize=0pt]{} +\TextField[name=hours, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=minutes, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=seconds, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=cronohours, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=cronominutes, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=crseconds, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=day, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=month, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\TextField[name=year, hidden=true, width=0pt, height=0pt,charsize=0pt]{}% +\PushButton[name=button1, onclick={\auxiliar;},hidden=true]{}% +\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=:]{}% +} + +\def\initclock{% +\setbox\sizebox=\hbox{\initfields}% +\initfields% +\kern -\wd\sizebox% +\unskip +} +% +% +\def\resetclock{% +fecha1 = rresett(); +}% +% +% +\def\auxiliar{% +var iop= -iop; +}% +% +% +\def\startclock{% +% +global.iop; +global.fuente; +global.interval; +var iop=1; +var fuente=eval(\clock@font); +%var interval=eval(#2); +%var fuente="clock"; +fecha1 = rresett(); +fecha1 = reloj(); +run = app.setInterval("reloj();",\clock@interval000); +% +function rresett() +{ +var fObj0 = new Date(); +global.horas0 = fObj0.getHours(); +global.minutos0 = fObj0.getMinutes(); +global.segundos0 = fObj0.getSeconds(); +} +% +function reloj() +{ +% +var fObj = new Date(); +var dia = formateo(fObj.getDate()); +var mes = formateo(fObj.getMonth()+1); +var year = fObj.getFullYear(); +var horas = fObj.getHours(); horas1 = horas; +var minutos = fObj.getMinutes() ; minutos1 = minutos; +var segundos = fObj.getSeconds(); segundos1= segundos; +% +horas = formateo(horas); +minutos = formateo(minutos); +segundos = formateo(segundos); +% +resta = (eval(horas1-global.horas0)*60+eval(minutos1-global.minutos0))*60+eval(segundos1-global.segundos0); +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); +% +if (iop == 1) +{fecha1= dia+"/"+mes+"/"+year+ " "+horas + ":"+minutos+":"+segundos; +casio1=horas;casio2=minutos;casio3=segundos;} +else +{fecha1=dia+"/"+mes+"/"+year+ " "+htexto+":"+mtexto+":"+stexto; +casio1=htexto;casio2=mtexto;casio3=stexto;} +%this.getField("resultado1").value=fecha1; +%this.getField("resultado1").textFont=fuente; +%this.getField("resultado1").fillColor=["T"]; +%this.getField("resultado1").strokeColor=["T"]; +% +this.getField("hours").value=casio1; +this.getField("hours").textFont=fuente; +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").strokeColor=["T"]; +% +this.getField("seconds").value=casio3; +this.getField("seconds").textFont=fuente; +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").strokeColor=["T"]; +casio5=mtexto; +this.getField("cronominutes").value=casio5; +this.getField("cronominutes").textFont=fuente; +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").strokeColor=["T"]; +casio7=dia; +this.getField("day").value=casio7; +this.getField("day").textFont=fuente; +this.getField("day").fillColor=["T"]; +this.getField("day").strokeColor=["T"]; +casio8=mes; +this.getField("month").value=casio8; +this.getField("month").textFont=fuente; +this.getField("month").fillColor=["T"]; +this.getField("month").strokeColor=["T"]; +casio9=year; +this.getField("year").value=casio9; +this.getField("year").textFont=fuente; +this.getField("year").fillColor=["T"]; +this.getField("year").strokeColor=["T"]; +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").strokeColor=["T"]; +%this.getField("button1").textFont=fuente; +this.getField("button1").fillColor=["T"]; +this.getField("button1").strokeColor=["T"]; +%this.getField("button2").textFont=fuente; +this.getField("button2").fillColor=["T"]; +this.getField("button2").strokeColor=["T"]; +% +} +% +function formateo(uin) +{ +if (uin <= 9) uin = "0" + uin; +return uin; +} +} + +%\initclock +% +\endinput + -- cgit v1.2.3