%%
%% This is file `datepicker-pro.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datepicker-pro.dtx  (with options: `copyright,package')
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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.2 of    %%
%% the License, or (at your option) any later version.  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{datepicker-pro}
 [2018/07/02 v1.3 Date picker using Adobe Flash Builder]
\RequirePackage{aeb_pro}[2013/08/05]
\RequirePackage{eforms}[2013/06/05]
\RequirePackage{rmannot}[2011/09/11]
\newcommand{\useFLEXVer}[1]{\def\argi{#1}\ifnum\argi=3\relax
    \def\flexVer{3}\else\ifnum\argi=4\relax\def\flexVer{4}\else
    \def\flexVer{3}\PackageInfo{datepicker-pro}{FLEX version number not
    supported,\space\MessageBreak using FLEX 3}\fi\fi}
\def\flexVer{3}
\@onlypreamble\useFLEXVer
\newcommand{\dppToolTip}[1]{\def\dpp@ToolTip{#1}}
\dppToolTip{Date Picker\n Click to toggle open and close\n
    Shift-click to clear and close}
\newcommand{\pickerOpts}[1]{\def\dpp@pickerOpts{#1}}
    \pickerOpts{}
\newcommand{\pickerInputOpts}[1]{\def\dpp@pickerInputOpts{#1}}
    \pickerInputOpts{}
\newcommand{\iconBenOpts}[1]{\def\dpp@iconBenOpts{#1}}
    \iconBenOpts{}
\newcommand{\pickersep}{3bp}
\define@key{ddp}{formatstring}[MM/DD/YYYY]{\def\dpp@FormatStr{#1}}
\define@key{ddp}{daynames}[]{\def\ddp@DayNames{#1}}
\define@key{ddp}{monthnames}[]{\def\ddp@MonthNames{#1}}
\def\warningMsgFirstDay{%
    The value of firstday must be a\MessageBreak
    nonnegative integer less than 6.\MessageBreak
    Setting firstday=0%
}
\define@key{ddp}{firstday}[0]{%
    \@tempcnta=#1
    \def\ddp@FirstDayOfWeek{#1}%
    \ifnum\@tempcnta<0\relax\PackageWarning{datepicker-pro}
        {\warningMsgFirstDay}{}\def\ddp@FirstDayOfWeek{0}\else
    \ifnum\@tempcnta>6\relax\PackageWarning{datepicker-pro}
        {\warningMsgFirstDay}{}\def\ddp@FirstDayOfWeek{0}\fi\fi
}
\define@key{ddp}{monthnamesLong}[]{\def\ddp@monthnamesLong{#1}}
\define@key{ddp}{monthnamesShort}[]{\def\ddp@monthnamesShort{#1}}
\define@key{ddp}{daynamesLong}[]{\def\ddp@daynamesLong{#1}}
\define@key{ddp}{daynamesShort}[]{\def\ddp@daynamesShort{#1}}
\define@key{ddp}{halign}[center]{\def\ddp@halign{#1}}
\define@key{ddp}{valign}[center]{\def\ddp@valign{#1}}
\define@key{ddp}{hoffset}[0]{\def\ddp@hoffset{#1}}
\define@key{ddp}{voffset}[0]{\def\ddp@voffset{#1}}
\define@key{ddp}{widthOfWindow}[180]{\def\ddp@widthOfWindow{#1}}
\define@key{ddp}{heightOfWindow}[180]{\def\ddp@heightOfWindow{#1}}
\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
}
\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
\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
        annot.activated=( annot.activated )?false:true;
}
\newcommand{\datepicker}[4][]{\begingroup
  \def\\{\eqbs\eqbs}\def\u{\\u}
    \edef\x{\noexpand\setkeys{ddp}{#1}}\x
  \setWindowDimPos{width={default=\ddp@widthOfWindow},%
    height={default=\ddp@heightOfWindow},%
    position={halign=\ddp@halign,valign=\ddp@valign,
    hoffset=\ddp@hoffset,voffset=\ddp@voffset}}%
  \makebox[0pt][l]{\textField[\F{\FHidden}\BC{}\BG{}\W0
    ]{htxt#2}{1bp}{1bp}}%
    \expandafter\textField\expandafter[\dpp@pickerInputOpts\Ff{\FfReadOnly}
      \AA{\AAValidate{%
        this.getAnnotRichMedia(this.pageNum,"#2").activated=false;}
    }]{txt#2}{#3}{#4}\makebox[0pt][r]{%
    \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
  \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
}
\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}}%
  \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
\newcommand\pickerIconWidth[1]{\def\dp@iconWidth{#1}}
\pickerIconWidth{10bp}
\newcommand\pickerIconHeight[1]{\def\dp@iconHeight{#1}}
\pickerIconHeight{12bp}
\begin{insDLJS}{dppdljs}{JavaScript for Date Picker Pro}
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) {
  var f = this.getField(fname);
  var g = this.getField("h"+fname);
  if (f !=null ) {
      f.value = _dppConvUnicode(value);
      g.value = svalue;
  }
}
function getDateValue(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;
}
\end{insDLJS}
\def\dpp@initdpp{%
  \@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}
\InputIfFileExists{dp-pro.cfg}{}{}
\endinput
%%
%% End of file `datepicker-pro.sty'.
