From 5ac17938ed66a9c6aa7bedeb0e10f7337b0da25b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 11 Jul 2018 11:07:49 +0900 Subject: datepicker-pro update --- .../source/latex/datepicker-pro/datepicker-pro.dtx | 218 +++++++++++---------- .../source/latex/datepicker-pro/datepicker-pro.ins | 2 +- 2 files changed, 120 insertions(+), 100 deletions(-) (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/datepicker-pro/datepicker-pro.dtx b/texmf-dist/source/latex/datepicker-pro/datepicker-pro.dtx index ab133139..dff9da79 100644 --- a/texmf-dist/source/latex/datepicker-pro/datepicker-pro.dtx +++ b/texmf-dist/source/latex/datepicker-pro/datepicker-pro.dtx @@ -3,20 +3,20 @@ % makeindex -s gind.ist -o datepicker-pro.ind datepicker-pro.idx %<*copyright> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% datepicker-pro.sty package, 2016-05-06 %% -%% Copyright (C) 2013-16 D. P. Story %% +%% datepicker-pro.sty package, %% +%% Copyright (C) 2013-2018 %% %% dpstory@acrotex.net %% %% %% %% This program can redistributed and/or modified under %% %% the terms of the LaTeX Project Public License %% %% Distributed from CTAN archives in directory %% -%% macros/latex/base/lppl.txt; either version 1 of the %% -%% License, or (at your option) any later version. %% +%% macros/latex/base/lppl.txt; either version 1.2 of %% +%% the License, or (at your option) any later version. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{datepicker-pro} -% [2016/05/06 v1.0 Date picker using FLEX] +% [2018/07/02 v1.3 Date picker using Adobe Flash Builder] %<*driver> \documentclass{ltxdoc} \usepackage[colorlinks,hyperindex=false]{hyperref} @@ -37,11 +37,11 @@ \tableofcontents \DocInput{\jobname.dtx} \IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute - \texttt{makeindex -s gind.ist -o aeb\_pro.ind aeb\_pro.idx} on the command line and recompile - \texttt{aeb\_pro.dtx}.} + \texttt{makeindex -s gind.ist -o datepicker-pro.ind datepicker-pro.idx} on the command line and recompile + \texttt{datepicker-pro.dtx}.} \IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute - \texttt{makeindex -s gglo.ist -o aeb\_pro.gls aeb\_pro.glo} on the command line and recompile - \texttt{aeb\_pro.dtx}.} + \texttt{makeindex -s gglo.ist -o datepicker-pro.gls datepicker-pro.glo} on the command line and recompile + \texttt{datepicker-pro.dtx}.} \end{document} % % \fi @@ -99,6 +99,7 @@ % \end{macrocode} % \DescribeMacro{\dppToolTip} is used for setting the tool tip of the % icon push button. +% \changes{v1.2}{2016/05/17}{Added \string\cs{iconBenOpts} access to custom options for btn} % \begin{macrocode} \newcommand{\dppToolTip}[1]{\def\dpp@ToolTip{#1}} \dppToolTip{Date Picker\n Click to toggle open and close\n @@ -107,6 +108,8 @@ \pickerOpts{} \newcommand{\pickerInputOpts}[1]{\def\dpp@pickerInputOpts{#1}} \pickerInputOpts{} +\newcommand{\iconBenOpts}[1]{\def\dpp@iconBenOpts{#1}} + \iconBenOpts{} \newcommand{\pickersep}{3bp} % \end{macrocode} % Options passed through the first optional argument of \cs{datepicker}. @@ -115,11 +118,11 @@ % combinations of \texttt{M}, \texttt{D}, \texttt{Y}, and possible % \texttt{E} as well as spaces and delimiters to format the date string. % The following table was extracted from the page: -%\begin{quote}\small +%\begin{flushleft}\small % \nolinkurl{http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html} % (found \href{http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html}{here}) -%\end{quote} -%\begin{tabular}{cp{2in}cp{2in}} +%\end{flushleft} +%\par\noindent\begin{tabular}{cp{1in}cp{1in}} % \textbf{Pattern} & \textbf{Examples} &\textbf{Pattern} & \textbf{Examples}\\ % \texttt{Y} & \texttt{YY = 05}\par \texttt{YYY=2005}\par\texttt{YYY=02005}& % \texttt{D} &\texttt{D = 4}\par \texttt{DD=04}\\ @@ -182,15 +185,15 @@ % \IndexKey{daynamesLong}\texttt{daynamesLong} is used for formatting \texttt{DDDD} % and \IndexKey{daynamesShort}\texttt{daynamesShort} is used with \texttt{DDD}. % The values of each of these keys is a comma-delimited list of month or day names, for example -%\begin{verbatim} -% daynamesLong={Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,% -% Freitag,Samstag}, -% daynamesShort={So,Mo,Di,Mi,Do,Fr,Sa},% -% monthnamesLong={Januar,Februar,März,April,Mai,Juni,Juli,% -% August,September,Oktober,November,Dezember}, -% monthnamesShort={Jan,Feb,Mrz,Apr,Mai,Jun,Jul,Aug,Sep,% -% Okt,Nov,Dez}, -%\end{verbatim} +%\begin{quote}\ttfamily\def\{{\char`\{}\def\}{\char`\}} +% daynamesLong=\{Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,\%\\\null\qquad +% Freitag,Samstag\},\\ +% daynamesShort=\{So,Mo,Di,Mi,Do,Fr,Sa\},\\ +% monthnamesLong=\{Januar,Februar,M\"arz,April,Mai,Juni,Juli,\%\\\null\qquad +% August,September,Oktober,November,Dezember\},\\ +% monthnamesShort=\{Jan,Feb,Mrz,Apr,Mai,Jun,Jul,Aug,Sep,\%\\\null\qquad +% Okt,Nov,Dez\}, +%\end{quote} % \begin{macrocode} \define@key{ddp}{monthnamesLong}[]{\def\ddp@monthnamesLong{#1}} \define@key{ddp}{monthnamesShort}[]{\def\ddp@monthnamesShort{#1}} @@ -218,16 +221,20 @@ % \end{macrocode} % \DescribeMacro{\setPickerOpts} can be used to globally set picker options. % \begin{macrocode} -\newcommand{\setPickerOpts}[1]{% - \edef\@tempexp{\noexpand\setkeys{ddp}{#1}}\@tempexp} +\newcommand{\setPickerOpts}[1]{\let\ddp@bsSAVE\\\let\ddp@uSAVE\u + \def\\{\eqbs\eqbs}\def\u{\\u}% + \edef\x{\noexpand\setkeys{ddp}{#1}}\x + \let\\\ddp@bsSAVE\let\u\ddp@uSAVE +} % \end{macrocode} % \DescribeMacro{\setPickerOptsToDefaults}resets picker options back to their % original defaults. % \begin{macrocode} -\newcommand{\setPickerOptsToDefaults}{% - \setkeys{ddp}{formatstring,daynames,monthnames,firstday,halign,% - valign,hoffset,voffset,widthOfWindow,heightOfWindow,% - monthnamesLong,monthnamesShort,daynamesLong,daynamesShort}% +\newcommand{\setPickerOptsToDefaults}{\let\ddp@bsSAVE\\\let\ddp@uSAVE\u + \setkeys{ddp}{formatstring,daynames,monthnames,firstday,halign,% + valign,hoffset,voffset,widthOfWindow,heightOfWindow,% + monthnamesLong,monthnamesShort,daynamesLong,daynamesShort}% + \let\\\ddp@bsSAVE\let\u\ddp@uSAVE } \setPickerOptsToDefaults % \end{macrocode} @@ -236,21 +243,15 @@ % and closes the RMA. % \begin{macrocode} \def\dppBtnAction#1{% - var annot = this.getAnnotRichMedia(this.pageNum,"#1");\r - if (event.shift){\r\t - this.resetForm(["txt#1"]);\r\t - annot.activated=false;\r - } else { -% \end{macrocode} -% If widget is already activated close it. -% \begin{macrocode} - if ( annot.activated ) - annot.activated=false; + var annot = this.getAnnotRichMedia(this.pageNum,"#1");\r + if (event.shift){\r\t + this.resetForm(["txt#1"]);\r\t + annot.activated=false;\r + } else % \end{macrocode} -% Else, if it is not open, open it. +% If widget is already activated close it, otherwise open it. % \begin{macrocode} - else annot.activated=true; - } + annot.activated=( annot.activated )?false:true; } % \end{macrocode} % \DescribeMacro{\datepicker} is the primary command for this package. It produces @@ -264,59 +265,62 @@ % \texttt{btn\#2}. There is also a hidden text field named \texttt{htxt\#2}. % \begin{macrocode} \newcommand{\datepicker}[4][]{\begingroup + \def\\{\eqbs\eqbs}\def\u{\\u} % \end{macrocode} % Expand \texttt{\#1} then get options. Useful if options are passed as a macro. % \begin{macrocode} - \edef\@tempexp{\noexpand\setkeys{ddp}{#1}}\@tempexp + \edef\x{\noexpand\setkeys{ddp}{#1}}\x % \end{macrocode} % Set window related parameters. % \begin{macrocode} - \setWindowDimPos{width={default=\ddp@widthOfWindow},% - height={default=\ddp@heightOfWindow},% - position={halign=\ddp@halign,valign=\ddp@valign, - hoffset=\ddp@hoffset,voffset=\ddp@voffset}}% + \setWindowDimPos{width={default=\ddp@widthOfWindow},% + height={default=\ddp@heightOfWindow},% + position={halign=\ddp@halign,valign=\ddp@valign, + hoffset=\ddp@hoffset,voffset=\ddp@voffset}}% % \end{macrocode} % This hidden field holds the date selected in a standard format of \texttt{MM/DD/YYYY}, % this helps me to highlight the date when the user opens the date picker again. % \begin{macrocode} - \makebox[0pt][l]{\textField[\F{\FHidden}\BC{}\BG{}\W0 - ]{htxt#2}{1bp}{1bp}}% + \makebox[0pt][l]{\textField[\F{\FHidden}\BC{}\BG{}\W0 + ]{htxt#2}{1bp}{1bp}}% % \end{macrocode} % The text field that holds the date selected by the user through the date package. % \begin{macrocode} \expandafter\textField\expandafter[\dpp@pickerInputOpts\Ff{\FfReadOnly} - \AA{\AAValidate{% - this.getAnnotRichMedia(this.pageNum,"#2").activated=false;} - }]{txt#2}{#3}{#4}\makebox[0pt][r]{% + \AA{\AAValidate{% + this.getAnnotRichMedia(this.pageNum,"#2").activated=false;} + }]{txt#2}{#3}{#4}\makebox[0pt][r]{% % \end{macrocode} % Followed by the SWF widget, very small, invisible, transparent, and hidden by the % text field. % \begin{macrocode} \rmAnnot[invisible,transparentBG,deactivated=pageclose, - passcontext,\dpp@pickerOpts,windowed,name=#2, - flashvars={field=txt#2&formatstring=\dpp@FormatStr - \ifx\ddp@DayNames\@empty\else - &daynames=\ddp@DayNames\fi - \ifx\ddp@MonthNames\@empty\else - &monthnames=\ddp@MonthNames\fi - \ifnum\ddp@FirstDayOfWeek=0 \else - &firstday=\ddp@FirstDayOfWeek\fi - \ifx\ddp@monthnamesLong\@empty\else - &monthnamesLong=\ddp@monthnamesLong\fi - \ifx\ddp@monthnamesShort\@empty\else - &monthnamesShort=\ddp@monthnamesShort\fi - \ifx\ddp@daynamesLong\@empty\else - &daynamesLong=\ddp@daynamesLong\fi - \ifx\ddp@daynamesShort\@empty\else - &daynamesShort=\ddp@daynamesShort\fi - } - ]{4bp}{4bp}{dppDatePicker}}\kern\pickersep + passcontext,\dpp@pickerOpts,windowed,name=#2, + flashvars={field=txt#2&formatstring=\dpp@FormatStr + \ifx\ddp@DayNames\@empty\else + &daynames=\ddp@DayNames\fi + \ifx\ddp@MonthNames\@empty\else + &monthnames=\ddp@MonthNames\fi + \ifnum\ddp@FirstDayOfWeek=0 \else + &firstday=\ddp@FirstDayOfWeek\fi + \ifx\ddp@monthnamesLong\@empty\else + &monthnamesLong=\ddp@monthnamesLong\fi + \ifx\ddp@monthnamesShort\@empty\else + &monthnamesShort=\ddp@monthnamesShort\fi + \ifx\ddp@daynamesLong\@empty\else + &daynamesLong=\ddp@daynamesLong\fi + \ifx\ddp@daynamesShort\@empty\else + &daynamesShort=\ddp@daynamesShort\fi + } + ]{4bp}{4bp}{dppDatePicker}}\kern\pickersep % \end{macrocode} % Finally, the push button that has an icon for its appearance. +% \changes{v1.2}{2016/05/17}{Added access to custom options for btn} % \begin{macrocode} - \pushButton[\TU{\dpp@ToolTip}\H{O}\S{S}\BC{}\BG{} - \FB{true}\I{null}\TP{1}\A{\JS{\dppBtnAction{#2}}} - ]{btn#2}{\dp@iconWidth}{\dp@iconHeight}\endgroup + \expandafter\pushButton\expandafter[\dpp@iconBenOpts\TU{\dpp@ToolTip} + \H{O}\S{S}\BC{}\BG{}\FB{true}\I{null}\TP{1} + \A{\JS{\dppBtnAction{#2}}} + ]{btn#2}{\dp@iconWidth}{\dp@iconHeight}\endgroup } % \end{macrocode} % \paragraph*{Installing the picker icon.} We use \cs{declareMultiImages} from AeB Pro @@ -331,24 +335,24 @@ % of the \cs{datepicker} command). % \begin{macrocode} \newcommand{\setpickerIcon}[2]{% #1=path, #2=placement - \let\@thesetoks\@empty - \@for\@dppName:=#2\do{\edef\@thesetoks{\@thesetoks btn\@dppName,}}% - \def\stripOffComma##1,\@nil{\def\@placeIcons{##1}}% - \expandafter\stripOffComma\@thesetoks\@nil - \declareImageAndPlacement{name=dppIcon,path=#1,% - placement={\@placeIcons}}% + \let\@thesetoks\@empty + \@for\@dppName:=#2\do{\edef\@thesetoks{\@thesetoks btn\@dppName,}}% + \def\stripOffComma##1,\@nil{\def\@placeIcons{##1}}% + \expandafter\stripOffComma\@thesetoks\@nil + \declareImageAndPlacement{name=dppIcon,path=#1,% + placement={\@placeIcons}}% % \end{macrocode} % We then write a \texttt{execJS} environment to a CUT file, then % input it back in immediately. Here, I'm using the write handle % from the \textsf{comment} package, brought in by \textsf{AeB Pro}. % At this moment, it is not being used. % \begin{macrocode} - \immediate\openout\CommentStream=ddpdocassmbly.cut - \immediate\write\CommentStream{\string\begin{execJS}{dppicons}}% - \immediate\write\CommentStream{\string\insertPreDocAssembly}% - \immediate\write\CommentStream{\string\end{execJS}}% - \immediate\closeout\CommentStream - \input{ddpdocassmbly.cut}% + \immediate\openout\CommentStream=ddpdocassmbly.cut + \immediate\write\CommentStream{\string\begin{execJS}{dppicons}}% + \immediate\write\CommentStream{\string\insertPreDocAssembly}% + \immediate\write\CommentStream{\string\end{execJS}}% + \immediate\closeout\CommentStream + \input{ddpdocassmbly.cut}% } \@onlypreamble\setpickerIcon % \end{macrocode} @@ -374,16 +378,28 @@ % \texttt{value} is the value of the field that will appear to the user, and \texttt{svalue} % is the value formatted using the date template \texttt{MM/DD/YYYY}. This latter value is used % to highlight this date if the user returns to the same calendar to change the date. +% \changes{v1.3}{2018/07/02}{Handle non-ascii glyphs with unicode representation} % \begin{macrocode} +function _dppConvUnicode(v){ + var fm,re,str=v; + re=/\\u([0-8A-Fa-f]{4})/g + while ((fm=str.search(re))!=-1) { + str=str.substring(0,fm) + +eval("String.fromCharCode(0x" + +str.substring(fm+2,fm+6)+")") + +str.substring(fm+6); + } + return str; +} function setDateField(fname,value,svalue) { %console.println("setDateField: fname="+fname % +", value="+value+", svalue="+svalue); - var f = this.getField(fname); - var g = this.getField("h"+fname); - if (f !=null ) { - f.value = value; - g.value = svalue; - } + var f = this.getField(fname); + var g = this.getField("h"+fname); + if (f !=null ) { + f.value = _dppConvUnicode(value); + g.value = svalue; + } } % \end{macrocode} %\DescribeMacro{getDateValue}The JavaScript function \texttt{getDateValue} is also called @@ -392,12 +408,12 @@ function setDateField(fname,value,svalue) { % \begin{macrocode} function getDateValue(fname) { %console.println("getDateValue: fname="+fname); - var f = this.getField(fname); - var g = this.getField("h"+fname); - var value; - if ( f != null ) - value = { value: f.value, svalue: g.value }; - return value; + var f = this.getField(fname); + var g = this.getField("h"+fname); + var value; + if ( f != null ) + value = { value: f.value, svalue: g.value }; + return value; } \end{insDLJS} % \end{macrocode} @@ -410,14 +426,18 @@ function getDateValue(fname) { %\end{verbatim} % \begin{macrocode} \def\dpp@initdpp{% - \@ifundefined{dppPath}{\PackageError{datepicker-pro} - {You must specify the path to datepicker\flexVer.swf\MessageBreak - by defining \string\dppPath, see documentation}{}} - {\saveNamedPath{dppDatePicker}{\dppPath/datepicker\flexVer.swf}}% + \@ifundefined{dppPath}{\PackageError{datepicker-pro} + {You must specify the path to datepicker\flexVer.swf\MessageBreak + by defining \string\dppPath\space in the configuration file\MessageBreak + dp-pro.cfg, see documentation}{}} + {\saveNamedPath{dppDatePicker}{\dppPath/datepicker\flexVer.swf}}% } \AtBeginDocument{\dpp@initdpp} % \end{macrocode} +%\changes{v1.1}{2016/05/07}{Added the configuration file \string\texttt{dp-pro.cfg}, used +%for specifying the path to SWF.} % \begin{macrocode} +\InputIfFileExists{dp-pro.cfg}{}{} % % \end{macrocode} %\Finale diff --git a/texmf-dist/source/latex/datepicker-pro/datepicker-pro.ins b/texmf-dist/source/latex/datepicker-pro/datepicker-pro.ins index 7cefaca2..98667206 100644 --- a/texmf-dist/source/latex/datepicker-pro/datepicker-pro.ins +++ b/texmf-dist/source/latex/datepicker-pro/datepicker-pro.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2016 D. P. Story +%% Copyright 2016--2018 D. P. Story %% ------------------------------------------- %% %% It may be distributed under the conditions of the LaTeX Project Public -- cgit v1.2.3