From adaabf093fe9a662e25c7fca1d4e18bf3a59e566 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 16 Jun 2018 14:45:29 +0900 Subject: add mkstmpdad --- texmf-dist/doc/latex/mkstmpdad/README.md | 33 + .../latex/mkstmpdad/examples/aeb_dad/dd_uspres.pdf | Bin 0 -> 167752 bytes .../latex/mkstmpdad/examples/aeb_dad/dd_uspres.tex | 67 ++ .../examples/mkstmp_pro/images/uspres.pdf | Bin 0 -> 112955 bytes .../examples/mkstmp_pro/uspres_stamps.pdf | Bin 0 -> 124597 bytes .../examples/mkstmp_pro/uspres_stamps.tex | 30 + texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.pdf | Bin 0 -> 740061 bytes texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.tex | 860 +++++++++++++++++++++ texmf-dist/source/latex/mkstmpdad/aeb_dad.dtx | 600 ++++++++++++++ texmf-dist/source/latex/mkstmpdad/aeb_dad.ins | 63 ++ texmf-dist/source/latex/mkstmpdad/mkstmp_pro.dtx | 167 ++++ texmf-dist/source/latex/mkstmpdad/mkstmp_pro.ins | 63 ++ texmf-dist/tex/latex/mkstmpdad/aeb_dad.sty | 364 +++++++++ texmf-dist/tex/latex/mkstmpdad/mkstmp_pro.sty | 62 ++ 14 files changed, 2309 insertions(+) create mode 100644 texmf-dist/doc/latex/mkstmpdad/README.md create mode 100644 texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.pdf create mode 100644 texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.tex create mode 100644 texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/images/uspres.pdf create mode 100644 texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.pdf create mode 100644 texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.tex create mode 100644 texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.pdf create mode 100644 texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.tex create mode 100644 texmf-dist/source/latex/mkstmpdad/aeb_dad.dtx create mode 100644 texmf-dist/source/latex/mkstmpdad/aeb_dad.ins create mode 100644 texmf-dist/source/latex/mkstmpdad/mkstmp_pro.dtx create mode 100644 texmf-dist/source/latex/mkstmpdad/mkstmp_pro.ins create mode 100644 texmf-dist/tex/latex/mkstmpdad/aeb_dad.sty create mode 100644 texmf-dist/tex/latex/mkstmpdad/mkstmp_pro.sty (limited to 'texmf-dist') diff --git a/texmf-dist/doc/latex/mkstmpdad/README.md b/texmf-dist/doc/latex/mkstmpdad/README.md new file mode 100644 index 00000000..0968e7f6 --- /dev/null +++ b/texmf-dist/doc/latex/mkstmpdad/README.md @@ -0,0 +1,33 @@ +The mkstmpdad Bundle: The mkstmp_pro and aeb_dad Packages +Author: D. P. Story +Dated: 2016/10/26 + + +This bundle contains two related packages: mkstmp_pro and aeb_dad. +These use Adobe Distiller as the PDF creator, and Adobe Acrobat as well. + +1. mkstmp_pro: Is a simple workflow for creating custom stamps, that + Acrobat uses for commenting. +2. aeb_dad: This package uses stamps (created by mkstmp_pro) build a + Drag and Drop Matching (Game). The end user may drag and drop stamps + onto target push buttons. If the stamp is dropped onto the wrong + button, an alert box appears announcing "Wrong!", and the stamp is + returned to its original place; if the stamp is dropped on the correct + button, the alert box announces "Right!". This is as close to DAD + (Drag and Drop) as we can get in PDF. + + Users of Adobe Acrobat can, of course, enjoy DAD Matching, but more + importantly, users of Adobe Reader XI (version 11) or later can too! One + of the splendid features of ARXI is it enables full support for + commenting (and for saving fill-in form fields). Previous versions of AR, + users could view stamps and view the associated comments, but could not + move the stamps around on the page. With version 11, you can now move + stamps (and other comments) around; this feature was the inspiration for + DAD Matching (the aeb_dad package). + +Enjoy! + +Now, I must get back to my retirement. + +D. P. Story +dpstory at acrotex dot net diff --git a/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.pdf b/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.pdf new file mode 100644 index 00000000..8bbaed4f Binary files /dev/null and b/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.pdf differ diff --git a/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.tex b/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.tex new file mode 100644 index 00000000..a7e35c66 --- /dev/null +++ b/texmf-dist/doc/latex/mkstmpdad/examples/aeb_dad/dd_uspres.tex @@ -0,0 +1,67 @@ +\listfiles +\documentclass{article} +\usepackage{web} +\usepackage{eforms} +\usepackage{aeb_dad} + +\marginsize{.25in}{.25in}{24pt}{.25in} +\screensize{4.5in}{6.5in} + +\title{Using Stamps in a Matching Game} +\author{D. P. Story} +\university{Acro\negthinspace\TeX.Net} +\subject{Demo for using stamps as part of a drag and drop game} +\keywords{acrotex,forms,stamps} +\email{dpstory@acrotex.net} +\version{1.0} + +\pagestyle{empty} + +\setAnnotOptions{title={D.P. Story}} + +\parindent0pt\parskip6pt + +\optionalPageMatter{\begin{center} +\fbox{\begin{minipage}{.67\linewidth} +\textbf{\textcolor{red}{Important:}} This document needs to be viewed +using \textsf{Adobe Reader XI}, or later; otherwise, the functionality of +the game presented here is lost. The document will behave as designed when +viewed using \textsf{Adobe Acrobat}, any version. Also, for the drag and +drop matching to work, this file needs to be \emph{viewed outside of a +browser}. +\end{minipage}} +\end{center}} + +\begin{document} + +\maketitle + +\initDDGame{Presidents} + +\ddDimens +{% + iconwidth=1in,iconheight=1.5in, + targetwidth=1in,targetheight=1.5in +} + +\centering + +\ddGameIcon{George Washington}\quad +\ddGameIcon{John Adams}\quad +\ddGameIcon{Thomas Jefferson}\quad +\ddGameIcon{James Madison}\quad +\ddGameIcon{John Quincy Adams} + +\ddTargetFmt{\sffamily\small\bfseries} + + +\ddTargetOfIcon{John Quincy Adams}{John Quincy Adams}\quad +\ddTargetOfIcon{Thomas Jefferson}{Thomas Jefferson}\quad +\ddTargetOfIcon{James Madison}{James Madison}\quad +\ddTargetOfIcon{George Washington}{George Washington}\quad +\ddTargetOfIcon{John Adams}{John Adams} + +\ddReset + + +\end{document} diff --git a/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/images/uspres.pdf b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/images/uspres.pdf new file mode 100644 index 00000000..249537f4 Binary files /dev/null and b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/images/uspres.pdf differ diff --git a/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.pdf b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.pdf new file mode 100644 index 00000000..eb729c53 Binary files /dev/null and b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.pdf differ diff --git a/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.tex b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.tex new file mode 100644 index 00000000..06a3f0b7 --- /dev/null +++ b/texmf-dist/doc/latex/mkstmpdad/examples/mkstmp_pro/uspres_stamps.tex @@ -0,0 +1,30 @@ +\documentclass{article} +\usepackage[web=designi]{aeb_pro} +\usepackage{mkstmp_pro} +\pagestyle{empty} + +\title{U. S. Presidents Stamps} +\author{D. P. Story} + +\setStampPath{C:/Users/Public/Documents/% + My TeX Files/tex/latex/aeb/aebpro/mkstmpdad/% + examples/mkstmp_pro/images/uspres.pdf} +\makeStamps{% + {name=George Washington,page=0} + {name=John Adams,page=1} + {name=Thomas Jefferson,page=4} + {name=James Madison,page=3} + {name=John Quincy Adams,page=2} +} + +\begin{docassembly} +\insertPreDocAssembly +\end{docassembly} + +\begin{document} +\null\vfil +\begin{center} +\huge\sffamily\bfseries U. S. Presidents Stamps +\end{center} +\vfil +\end{document} diff --git a/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.pdf b/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.pdf new file mode 100644 index 00000000..2378ceb0 Binary files /dev/null and b/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.pdf differ diff --git a/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.tex b/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.tex new file mode 100644 index 00000000..b326057c --- /dev/null +++ b/texmf-dist/doc/latex/mkstmpdad/mkstmpdad_man.tex @@ -0,0 +1,860 @@ +% makeindex < aebpro_man.idx > aebpro_man.ind +% http://www.acrotex.net/blog/?tag=mkstmpdad +\documentclass{article} +\usepackage[fleqn]{amsmath} +\usepackage[ + web={centertitlepage,designv,forcolorpaper,tight*,latextoc,pro}, + eforms, +% linktoattachments, +% attachments={../aeb_pro.dtx}, +% uselayers, + aebxmp +]{aeb_pro} +\usepackage{aeb_mlink} +\usepackage{aeb_dad} +\usepackage{picins} + +\usepackage{graphicx,array} +%\usepackage{myriadpro} +\usepackage[altbullet]{lucidbry} + +%\usepackage{makeidx} +%\makeindex +\usepackage{acroman} + +\usepackage[active]{srcltx} + +\urlstyle{rm} +\def\pkg{\textsf} +\let\app\textsf +\let\uif\textsf +\def\meta#1{\textit{\texttt{#1}}} +\newdimen\aebdimen \aebdimen6pt %\partopsep \advance\aebdimen\partopsep +\renewcommand\bVerb[1][]{\begingroup#1\vskip\aebdimen\parindent0pt}% +\def\eVerb{\vskip\aebdimen\endgroup\noindent} + +\def\darg#1{\texttt{\{#1\}}} +\def\takeMeasure{\bgroup\obeyspaces\takeMeasurei} +\def\takeMeasurei#1{\global\setbox\webtempboxi\hbox{\ttfamily#1}\egroup} +\def\bxSize{\wd\webtempboxi+2\fboxsep+2\fboxrule} + +% The mkstmpdad Bundle: Using the mkstmp_pro Package to Create Custom +% Stamps, and Using the aeb_dad Package to Create Drag and Drop Matching + +%\def\tutpath{doc/tutorial} +%\def\tutpathi{tutorial} + +\DeclareDocInfo +{ + university={\AcroTeX.Net}, + title={\texorpdfstring{\huge}{}The \pkg{mkstmpdad} Bundle\texorpdfstring{\\[8pt]}{: }% + \texorpdfstring{\Large}{}Using the \pkg{mkstmp\_pro} Package\texorpdfstring{\\}{ }% + to Create Custom Stamps\texorpdfstring{\\[4pt]and\\[4pt]}{, and }% + Using the \pkg{aeb\_dad} Package\texorpdfstring{\\}{ }% + to Create Drag and Drop Matching + }, + author={D. P. Story}, + email={dpstory@acrotex.net}, + subject=Documentation for the mkstmpdad bundle, + talksite={\url{www.acrotex.net}}, + version={2016/10/26}, + Keywords={LaTeX,PDF,Stamps,drag and drop game}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL={http://www.acrotex.net} +} + +\versionLabel{Bundle dated: } + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\universityLayout{fontsize=Large} +\titleLayout{fontsize=LARGE} +\authorLayout{fontsize=Large} +\tocLayout{fontsize=Large,color=aeb} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} +\subsectionLayout{indent=-31.25pt,color=aeb} +\subsubsectionLayout{indent=0pt,color=aeb} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} + +\makeatletter +\renewcommand{\makeinlinetitle} +{% + \begingroup\parskip0pt\parindent0pt + \par\vspace*{6pt} + \noindent\makebox[\linewidth][c]{\bfseries + \color{\webuniversity@color}\webuniversity}\par\kern6pt\noindent + \makebox[\linewidth][c]{\parbox[c]{.75\linewidth}{\centering + \bfseries\color{\webtitle@color}\webtitle}}\par\kern12pt + \noindent\parbox{\linewidth}{\scriptsize + \web@copyright\space\the\year\hfill\thewebemail\\ + \@date\hfill\@ifundefined{aeb@talksite}{\webversion} + {\ifx\aeb@talksite\@empty\webversion + \else\aeb@talksite\fi}% + }\par + \noindent\makebox[\linewidth]{\rule{.67\linewidth}{.4pt}}% + \par\endgroup +} +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewcommand{\subparagraph} + {\@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}% + {\normalfont\normalsize\bfseries}} + +\makeatother + +%\pagestyle{empty} +%\parindent0pt\parskip\medskipamount\setlength{\marginparsep}{4pt} + + +\chngDocObjectTo{\newDO}{doc} +\begin{docassembly} +var titleOfManual="The mkstmpdad Bundle"; +var manualfilename="Manual_BG_Print_dad.pdf"; +var manualtemplate="Manual_BG_Green.pdf"; // Blue, Green, Brown +var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate; +var doc; +var buildIt=false; +if ( buildIt ) { + console.println("Creating new " + manualfilename + " file."); + doc = \appopenDoc({cPath: _pathToBlank, bHidden: true}); + var _path=this.path; + var pos=_path.lastIndexOf("/"); + _path=_path.substring(0,pos)+"/"+manualfilename; + \docSaveAs\newDO ({ cPath: _path }); + doc.closeDoc(); + doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true}); + f=doc.getField("ManualTitle"); + f.value=titleOfManual; + doc.flattenPages(); + \docSaveAs\newDO({ cPath: manualfilename }); + doc.closeDoc(); +} else { + console.println("Using the current "+manualfilename+" file."); +} +var _path=this.path; +var pos=_path.lastIndexOf("/"); +_path=_path.substring(0,pos)+"/"+manualfilename; +\addWatermarkFromFile({ + bOnTop:false, + bOnPrint:false, + cDIPath:_path +}); +\executeSave(); +\end{docassembly} +\begin{document} + +\maketitle + +\selectColors{linkColor=black} +\tableofcontents +\selectColors{linkColor=webgreen} + +\section{Introduction} + +This bundle consists of two related {\LaTeX} packages: +\begin{quote} +\begin{description} + \item \pkg{mkstmp\_pro} is used to create stamps for display in + \app{Adobe Acrobat} or \app{Adobe Reader}. \app{Adobe Acrobat} + (and \app{Adobe Distiller}) are required to produce these stamps. + The package requires \pkg{aeb\_pro} + (\href{http://ctan.org/pkg/aeb-pro}{pkg/aeb-pro}), for it uses + the \texttt{docassembly} environment to create the stamp file. + + The contents of the stamp file appears in the + Comment panel, under the Add Stamp tool. A stamp + can be dragged and dropped into a PDF document and a comment + can be attached to it. + + \item \pkg{aeb\_dad} is an application to \pkg{mkstmp\_pro} and + requires the \pkg{annot\_pro} package + (\href{http://ctan.org/pkg/annot-pro}{pkg/annot-pro}). The + \pkg{aeb\_dad} package is used to create a ``matching'' game, in + which the user drags a stamp and drops it into a target region. + Underlying JavaScript then determines whether the user has + dropped the stamp in the correct region or not. This is as close + to a drag and drop feature that you can get using Adobe PDF + (without writing a plugin). +\end{description} +\end{quote} +The matching ``game'' created by the \pkg{aeb\_dad} package works for users +that have \app{Adobe Acrobat}, but the big news here is that it works also +for users of \app{Adobe Reader XI}! In the version~11 release, \app{Adobe +Reader} is now able to fill in forms and save and to provide access to all +comment features without requiring Reader Extended PDF;\footnote{This only +applies to non-XFA documents. XFA still requires Reader Extensions to save +filled in forms.} however, Adobe has dropped its support for browser-based +commenting, so functionality is limited from within a browser. + +For more information on stamps, I recommend the book \emph{All About PDF Stamps, +In Acrobat \& Paperless Workflows}, by Thom Parker. See Thom's web site +\textbf{WindJack Solutions} at \url{windjack.com}. + +\section{The \texorpdfstring{\pkg{mkstmp\_pro}}{mkstmp\_pro} Package} + +The \pkg{mkstmp\_pro} enables the user of \app{Acrobat Pro} to +\textit{conveniently} create custom stamps. + +\subsection{Requirements and Installation} + +\pkg{mkstmp\_pro} requires \pkg{aeb\_pro} dated 2012/11/09 or later; in +particular, there has been a change to the \texttt{aeb\_pro.js} file, so +this new file must be installed, following the steps described in the +\pkg{aeb\_pro} manual. + +As for the installation of \pkg{mkstmp\_pro}, if not automatically installed +by a {\TeX} system, just copy \texttt{mkstmp\_pro.sty} into a folder named +\texttt{mkstmpdad}. If appropriate, refresh the filename database of your +{\TeX} system. + +\subparagraph*{Examples and Documentation.} Unzip \texttt{mkstmpdad.zip} +anywhere you want, outside the {\LaTeX} search path. The \textsf{ZIP} file will +create a folder named \texttt{mkstmpdad}, containing program files, and +folders \texttt{doc} and \texttt{examples}. + +\subsection{Testing the system} + +The \pkg{mkstmp\_pro} package comes with an example file, +\texttt{uspres\_stamps.tex}, which is found in the \texttt{mkstmpdad/\penalty0 +examples/\penalty0mkstmp\_pro} folder. Accompanying this file is +\texttt{uspres.pdf}, found in the \texttt{images} subfolder. + +The verbatim listing of \texttt{uspres\_stamps.tex} is given below. +\begin{Verbatim}[numbers=left,xleftmargin=20pt] +\documentclass{article} +\usepackage[web=designi]{aeb_pro} +\usepackage{mkstmp_pro} +\pagestyle{empty} + +\title{U. S. Presidents Stamps} +\author{D. P. Story} + +\setStampPath{C:/Users/Public/Documents/% + My TeX Files/tex/latex/aeb/aebpro/mkstmpdad/% + examples/mkstmp_pro/images/uspres.pdf} +\makeStamps{% + {name=George Washington,page=0} + {name=John Adams,page=1} + {name=Thomas Jefferson,page=4} + {name=James Madison,page=3} + {name=John Quincy Adams,page=2} +} +\begin{docassembly} +\insertPreDocAssembly +\end{docassembly} + +\begin{document} +\null\vfil +\begin{center} +\huge\sffamily\bfseries U. S. Presidents Stamps +\end{center} +\vfil +\end{document} +\end{Verbatim} +Before you can compile this file, you must edit lines~(9)--(10) to match +the path to the \texttt{examples} folder on your computer and save the +changes. Follow the steps outlined in the next paragraph, in these general +instructions, \ameta{my\_stamps} refers to the demo stamp file +\texttt{uspres\_stamps}. + +\paragraph*{Procedure to create stamps.} The following are the steps for creating a stamp +file, \ameta{my\_stamps}. +\begin{enumerate} +\item \textbf{Create the Stamp file.} Now, {\LaTeX} + \texttt{\ameta{my\_stamps}.tex}, convert the \textsf{DVI} to + \textsf{PS} using \app{dvips}, then convert to PDF using + \app{Adobe Distiller}. If all works out, the file + \texttt{\ameta{my\_stamps}.pdf} is produced. When the file first opens + in \app{Acrobat} after distillation, there are document assembly + methods that import the images of the presidents into the newly + created file. Give it a second or two for the process to complete + before saving \texttt{\ameta{my\_stamps}.pdf}. + +\item \textbf{Move the Stamp file.} After the stamp file is created, + you need to move it to the stamp folder, where \app{Acrobat} expects it + to be. To find this location, start \app{Acrobat} and open the + JavaScript Debugger Window (\texttt{Ctrl+J}/\texttt{Cmd+J}), and + type in the following line of code, +\begin{Verbatim}[xleftmargin=20pt] +app.getPath("user","stamps"); +\end{Verbatim} +Place your cursor on this line and press +\uif{Ctrl+Enter}/\penalty0\uif{Cmd+Enter} (or just use the \uif{Enter} key +on the keypad). \app{Acrobat} will execute this line and return the path to +the user stamp folder. Navigate to this folder, and copy (or move) +\texttt{\ameta{my\_stamps}.pdf} to this folder. + +\item Restart \app{Acrobat}. + +\item\label{useannotpro} On restart, your newly installed stamps should be + visible: Open the \uif{Comment} panel of \app{Acrobat}, and + select the \uif{Add Stamp} tool. +\end{enumerate} +\bgroup +\parpic(50bp,50bp){\annotpro[subject={AcroTeX makes stamps},title={D. P. +Story},type=stamp,name=\#DPStory]{AcroTeX Rocks!}} +If you built and installed the \texttt{uspres\_stamp.pdf} file correctly, +\marginpar{\parbox[t]{40pt}{\vskip-.6\baselineskip\noindent\kern0pt +\annotpro[width=40bp,subject={AcroTeX makes stamps},title={D. P. +Story},type=stamp,name=\#George Washington]{You can use your stamps +through the user interface of Acrobat, or reference them with the +annot\_pro package!\n\n So says George Washington!}}} +you can use your stamps through the user interface of \app{Acrobat}, or +reference them with the \pkg{annot\_pro} package, as I did here (see the +comments of George Washington in the margin).\par\egroup + +\begin{figure}[htb]\centering +\includegraphics[width=.33\linewidth]{graphics/comment_pane} +\caption{Stamp tool}\label{stamptool} +\end{figure} + +\ding{228} To use stamps through the user interface of \app{Acrobat}: +\begin{itemize} +\item For \app{Acrobat 9} or earlier, select \uif{Comments > Show Comments + \& Markup}. The Stamp tool can be seen on this toolbar. For + \app{Acrobat~10} and later, select the \uif{Comment} panel on the + right, again, the \uif{Stamp} tool is revealed. Figure~\ref{stamptool}, + page~\pageref{stamptool}, show the stamp tool, with \textbf{U.S. + Presidents Stamps} selected.\footnote{The user-interface of + \app{Acrobat} is ever changing.} +\item Select a stamp, click on it, and bring your mouse back over the + document. An image of the stamp should appear. Place it by + left-clicking. +\item Double click on the stamp to open the associated Pop-Up Note, + used to associate a note with the stamp. +\end{itemize} + +\subsection{The details} + +A PDF file is used to create a stamp file. Each page that contains an +image for a stamp must be a \emph{page template} for that image to be +recognized as a stamp. A page template has an associated \emph{name} that is used +as the \emph{name} of the stamp, as can be seen through the user interface. The +stamps that appear in a stamp file are listed under that \textit{title} of the +stamp file in the Stamp tool menu, listing all available stamps, see +Figure~\ref{stamptool}, page~\pageref{stamptool}. + +In light of the above paragraph describing the essentials of stamps, let's +go through the listing of \texttt{uspres\_stamps.tex}, which we'll +reproduce on this page. + +%-62.5pt-31.25pt + +\medskip + +\def\Wdth{3.2in} +\hspace*{-62.5pt}\begin{minipage}[t]{\Wdth}\kern0pt +\begin{Verbatim}[numbers=left,xleftmargin=20pt,fontsize=\small] +\documentclass{article} +\usepackage[web=designi]{aeb_pro} +\usepackage{mkstmp_pro} +\pagestyle{empty} + +\title{U. S. Presidents Stamps} +\author{D. P. Story} + +\setStampPath{C:/Users/Public/Documents/% + My TeX Files/tex/latex/aeb/aebpro/% + mkstmpdad/examples/mkstmp_pro/images/% + uspres.pdf} + +\makeStamps{% + {name=George Washington,page=0} + {name=John Adams,page=1} + {name=Thomas Jefferson,page=4} + {name=James Madison,page=3} + {name=John Quincy Adams,page=2} +} + +\begin{docassembly} +\insertPreDocAssembly +\end{docassembly} + +\begin{document} +\null\vfil +\begin{center}\huge\sffamily\bfseries +U. S. Presidents Stamps +\end{center} +\vfil +\end{document} +\end{Verbatim} +\end{minipage}\hfill +\begin{minipage}[t]{\linewidth+62.5pt-\Wdth-20pt} +Line~(2) we use the \textsf{aeb\_pro} package, which defines the +\texttt{docassembly} environment, seen in lines~(21)--(23). Line~(3) +inputs \textsf{mkstmp\_pro}, this package. +\vskip6pt +On line~(6) we title this document, the title appears in the Stamp menu, as +seen in Figure~\ref{stamptool} of page~\pageref{stamptool}. +\vskip6pt +The \cs{setStampPath} command is defined in this package to point to the +file containing the images to be made into stamps, call this the +\emph{images file}. It is an absolute path. +\vskip6pt +The \cs{makeStamps} command is the one that describes the images to be +imported into the document as stamps. Details are found below; in this example we specify +a \texttt{name} for the stamp, and the \texttt{page} on which this stamp +is to be found in the images file. +\vskip6pt +The \texttt{docassembly} environment, lines~(21)--(23), encloses the command +\cs{in\-sert\-Pre\-Doc\-As\-sem\-bly}. These two are defined in \textsf{aeb\_pro}, but +\textsf{mkstmp\_pro} modifies \cs{in\-sert\-Pre\-Doc\-As\-sem\-bly} to import and name +the images. +\vskip6pt +This content of the actual document is listed in lines~(26)-(30). No DVI +file is produced unless there is content. Here, we have a +simple title page. +\end{minipage} + +\subsubsection{Commands of \texorpdfstring{\pkg{mkstmp\_pro}}{mkstmp\_pro}} + +The \textsf{mkstmp\_pro} only defines two commands, \cs{setStampPath} and +\cs{makeStamps}. +\begin{itemize} + \item \cs{setStampPath\{\ameta{absolute\_path}\}} defines the absolute path to + the images file, the file that contains the images to be imported into + the stamp file and used as stamps. + \item \cs{makeStamps} takes a single argument that describes the images + to be imported. The syntax is, +\begin{Verbatim}[numbers=left,xleftmargin=20pt,commandchars=!()] +\makeStamps{% + {name=!meta(name!SUB1),page=!meta(page!SUB1)} + {name=!meta(name!SUB2),page=!meta(page!SUB2)} + ... + {name=!meta(name!SUB(n)),page=!meta(page!SUB(n))} +} +\end{Verbatim} +The images will appear in the stamp file in the same order they are +listed. The value of the \texttt{name} key is the name to be associated +with the stamp. The value of the \texttt{page} key is the page that this +image is found on in the \emph{image} file. (Notice that in the verbatim +listing, the images are not imported in the same order they are listed in +the images file.) There is another key, not shown above, called +\texttt{path}. In theory, you can import an image in another file, +different from the one declared by \cs{setStampPath}. It is perhaps best +to have all images in a single file, however. +\end{itemize} + +\subsection{The \textsf{mkstmp\_pro} workflow} + +The workflow comes in two steps, prepare an \emph{images file}, create and install +the \emph{stamp file}. + +\subsubsection{The images file} + +The \pkg{mkstmp\_pro} package requires an \emph{images file}, a file +containing all the images to be made into stamps in the stamp file. +For the \texttt{uspres\_stamps.tex} file, the images file is +\texttt{uspres.pdf}, as seen at the end the absolute path declared by +\cs{setStampPath}. + + +Creating an images file is easy, given that you are using \app{Acrobat}. +Combining files into a single PDF is accomplished by opening \app{Acrobat} +and selecting \uif{Combine Files} into PDF from the menu or toolbar. Now the +good folks have moved things around over the years, so this features can +appear in diverse location depending on the version you are using. Your +\app{Acrobat} may have a Create button on the toolbar, as seen in +Figure~\ref{combine}.\footnote{Version~9 of \app{Acrobat} has a Create +button, but the feature here is now called Merge Files into a Single PDF. +It is also found under \uif{File > Combine}.} + +\begin{figure}[htb] +\begin{center} +\includegraphics[width=.33\linewidth]{graphics/combine} +\caption{Combine Files into a Single PDF}\label{combine} +\end{center} +\end{figure} + +The use of this feature is quite intuitive. Select the files you want to +include in your images file. Combine and save them to the appropriate +location. (\app{Acrobat} supports an enormous variety of file types, +includes PDF, JPG, PNG, GIF, etc.) + +\subsubsection{Create and install a stamp file}\label{createinstall} + +\textbf{Create.} To create a stamp file, take the sample file +\texttt{upres\_stamp.tex} and save it under a different name, say +\ameta{my\_stamps}\texttt{.tex}. Bring your newly created stamp file into +your editor. +\begin{enumerate} + \item Set the \cs{title} and \cs{author} of \ameta{my\_stamps} as + desired. The \cs{title} will appear as a menu item of the + \uif{Stamp} tool. + \item Edit the argument of \cs{setStampPath} to point to the + \texttt{image} file. + \item Edit the argument of \cs{makeStamps}. There should be one + token for each of the stamp images you are importing. Follow + the formatting of the sample file. + \item Compile \ameta{my\_stamps}\texttt{.tex}, convert to \textsf{PS} + (using \app{dvips}), and distill using \app{Adobe + Distiller}. This creates your stamp file + \ameta{my\_stamps}\texttt{.pdf}. +\end{enumerate} + +\textbf{Install.} After the stamp file is created, move it to the stamp + folder, where \app{Acrobat} expects it to be. To find this location, + start \app{Acrobat} and open the JavaScript Debugger Window + (\texttt{Ctrl+J}/\texttt{Cmd+J}), and type in the following line of + code, +\begin{Verbatim}[xleftmargin=20pt] +app.getPath("user","stamps"); +\end{Verbatim} +Place your mouse cursor on this line and press +\texttt{Ctrl+Enter}/\texttt{Cmd+Enter} (or just use the \texttt{Enter} key on +the keypad). \app{Acrobat} will execute this line and return the path to the +user stamp folder. Navigate to this folder, and copy/move +\texttt{\ameta{my\_stamps}.pdf} to this folder. + +Restart \app{Acrobat}, if all went as planned, your new stamps should be +listed in the menu listing of the \uif{Stamp} tool. Verify this. If successful, +they are ready for use! + +\subsection{Using stamps with \textsf{annot\_pro}} + +Earlier, on page~\pageref*{useannotpro}, the George Washington stamp was +used. The verbatim listing of that is given below. +\begin{Verbatim}[xleftmargin=20pt] +\annotpro[subject={AcroTeX makes stamps},title={D. P. Story}, +type=stamp,name=\#George Washington]{You can use your +stamps through the user interface of Acrobat, or reference +them with the annot\_pro package!\n\n So says George +Washington!} +\end{Verbatim} +Note that the value of the \texttt{name} key is specified as \texttt{\#George +Washington}, not simply as \texttt{George Washington}. Custom stamp names +require their name be prefixed with a \texttt{\#}. The \pkg{mkstmp\_pro} +package automatically inserts the required prefix, but +\pkg{annot\_pro} does not. + +See the documentation of \pkg{annot\_pro} for more details on how to use +the \cs{annotpro} command. + +\section{The \texorpdfstring{\pkg{aeb\_dad}}{aeb\_dad} Package} + +When \app{Adobe Reader XI} was released with its full support for comments +(and saving form fields), I saw this opened up possibilities for using +dragging and dropping stamps (DAD). Suppose you had a series of stamps, +and a series of push buttons. Each button is associated with one of the +stamps, but which one? The user, even using \app{ARXI}, drags and drops a +stamp onto one of the push buttons. The underlying JavaScript determines +whether it was the right choice, if not, the stamp is returned to its +starting position. Below is the example demonstrated in +\texttt{dd\_uspres.tex}, the demo file for this package. + +\begin{center} +{\large\bfseries DAD Matching (Game)}\medskip +\ddDimens +{% + iconwidth=1in*\ratio{8bp}{10bp},iconheight=1.5in*\ratio{8bp}{10bp}, + targetwidth=1in*\ratio{8bp}{10bp},targetheight=1.5in*\ratio{8bp}{10bp} +} +\ddTargetFmt{\sffamily\small\bfseries} +\initDDGame{Presidents} + +\ddGameIcon{George Washington}\quad +\ddGameIcon{John Adams}\quad +\ddGameIcon{Thomas Jefferson}\quad +\ddGameIcon{James Madison}\quad +\ddGameIcon{John Quincy Adams} + +\medskip + +\ddTargetOfIcon{John Quincy Adams}{John Quincy Adams}\quad +\ddTargetOfIcon{Thomas Jefferson}{Thomas Jefferson}\quad +\ddTargetOfIcon{James Madison}{James Madison}\quad +\ddTargetOfIcon{George Washington}{George Washington}\quad +\ddTargetOfIcon{John Adams}{John Adams} + +\medskip + +\ddReset +\end{center} +Drag and drop the image of each President onto the corresponding +rectangular region. Use your little gray cells, I am watching. + +\textbf{\textcolor{red}{Important:}} Adobe has dropped its support for +online commenting, as a result, DAD Matching does not work from within a +browser. The user should download the file and view with \textsf{Adobe Reader +XI} (or later), or with the \textsf{Acrobat} application. + +\subsection{Requirements and Installation} + +The \pkg{aeb\_dad} package requires \pkg{annot\_pro} dated 2012/11/10 or later. + +As for the installation of \pkg{aeb\_dad}, if not automatically +installed by a {\TeX} system, just copy \texttt{{aeb\_dad}.sty} into a +folder named \texttt{aeb\_dad}. If appropriate, refresh the filename +database of your {\TeX} system. + +\subparagraph*{Examples and Documentation.} Unzip \texttt{mkstmpdad.zip} +anywhere you want, outside the {\LaTeX} search path. The \textsf{ZIP} file will +create a folder named \texttt{mkstmpdad}, containing program files, and +folders \texttt{doc} and \texttt{examples}. + +\subsection{Testing the system} + +The example file for this package is \texttt{dd\_upres.tex}. Assuming you +have installed and tested the Presidential stamps as per the instructions +in the section titled \mlNameref{createinstall}, you are ready to compile +the example file. After you compile, convert to \textsf{PS}, and distill +using \app{Adobe Distiller}, you get the PDF file, \texttt{dd\_upres.pdf}. +\emph{Don't forget to save the file}, this also saves the JavaScript that is +imported into the document. + +The behavior of the stamps and push buttons in the file +\texttt{dd\_upres.pdf} is the same as the Presidents drag and drop +demonstration seen on the previous page. + +\subsection{The details} + +Let's look at the verbatim listing of \texttt{dd\_upres.tex}. + +\def\Wdth{3.2in} +\hspace*{-62.5pt}\begin{minipage}[t]{\Wdth}\kern0pt +\begin{Verbatim}[numbers=left,xleftmargin=20pt,fontsize=\small] +\initDDGame{Presidents} + +\ddDimens{% + iconwidth=1in,iconheight=1.5in, + targetwidth=1in,targetheight=1.5in} + +\ddGameIcon{George Washington}\quad +... +\ddGameIcon{John Quincy Adams} + +\ddTargetOfIcon{John Quincy Adams} + {John Quincy Adams}\quad +... +\ddTargetOfIcon{George Washington} + {George Washington}\quad +... +\ddReset +\end{Verbatim} +\end{minipage}\hfill +\begin{minipage}[t]{\linewidth+62.5pt-\Wdth-20pt}\kern0pt +\cs{initDDGame} initializes the DAD game, each game must have a unique +name.\vskip6pt +\cs{ddDimens} sets up the dimensions of the stamps and the push buttons. +\vskip6pt +\cs{ddGameIcon} is a command that sets up the positioning of the stamps, +the argument of this command is the \textit{name} of the stamp to be used. +\vskip6pt +\cs{ddTargetOfIcon} is a comment that creates a push button that is a +target of one of the stamps. The first argument is the \textit{name} of +the stamp, the second is the caption that appears beneath the push button. +\vskip6pt +\cs{ddReset} is a reset button. It puts the stamps back into their initial +positions, and returns the push buttons to their original appearance. +\end{minipage} +\par\medskip\noindent +The details follow in the order they appear in the document. + +\subsubsection{Commands of \texorpdfstring{\pkg{aeb\_dad}}{aeb\_dad}} + +In this section, several commands are presented; these are used to define and design your +DAD Game. +$$ + \fbox{\parbox{4in}{\textbf{A DAD Game must appear on a single page.} You must + design the `game board' to appear in one page, that might require + making the stamps and targets smaller, or the page width wider.}} +$$ +Begin by declaring the game title of the DAD Game. +\bVerb\takeMeasure{\string\initDDGame\darg{\ameta{title}}} +\begin{minipage}{\bxSize} +\begin{Verbatim}[frame=single,commandchars=!()] +\initDDGame{!ameta(title)} +\end{Verbatim} +\end{minipage}\eVerb +The \cs{initDDGame} command must appear on the same page on which the +stamps and push buttons appear. The argument \meta{title} is the title of +the DAD game; typically, it should follow the same rules as a JavaScript +variable, because it forms the base name of the push buttons and the reset +button. \cs{initDDGame} defines a page option action that sorts through +the stamps on the page for the ones that belong to the DAD Matching Game +with a name of \meta{title} and places them in an array. + +\bVerb\takeMeasure{\string\ddDimens\darg{\ameta{KV-pairs}}} +\begin{minipage}{\bxSize} +\begin{Verbatim}[frame=single,commandchars=!()] +\ddDimens{!ameta(KV-pairs)} +\end{Verbatim} +\end{minipage}\eVerb +The key-values are, +\begin{itemize} +\item \texttt{iconwidth=\ameta{width}} is the width allotted to the icon +(stamp). The default value is \cs{defaultStampWidth}, defined in +\pkg{annot\_pro} as 50bp. +\item \texttt{iconheight=\ameta{height}} is the height allotted to the icon +(stamp). The default value is \cs{defaultStampHeight}, defined in +\pkg{annot\_pro} as 50bp. +\item \texttt{targetwidth=\ameta{width}} is the width of the target push +button. The default value is 1.25in, as set by \pkg{aeb\_dad}. +\item \texttt{targetheight=\ameta{height}} is the height of the target push +button. The default value is 1.25in, as set by \pkg{aeb\_dad}. +\end{itemize} + +\bVerb\takeMeasure{\string\ddGameIcon\darg{\ameta{icon\_name}}} +\begin{minipage}{\bxSize} +\begin{Verbatim}[frame=single,commandchars=!()] +\ddGameIcon{!ameta(icon_name)} +\end{Verbatim} +\end{minipage}\eVerb +This is the command that places a stamp with name of \ameta{icon\_name}. +Use this command repeatedly with, of course, different names. Arrange +them on the page as desired. + +\bVerb\takeMeasure{\string\ddTargetOfIcon\darg{\ameta{icon\_name}}\darg{\ameta{caption}}} +\begin{minipage}{\bxSize} +\begin{Verbatim}[frame=single,commandchars=!()] +\ddTargetOfIcon{!ameta(icon_name)}{!ameta(caption)} +\end{Verbatim} +\end{minipage}\eVerb +This command creates a target push button. There must be one +\cs{ddTargetOfIcon} for each \cs{ddGameIcon}. The first argument, +\ameta{icon\_name} must match one and only one \ameta{icon\_name} argument +of \cs{ddGameIcon}. (There must be a one-to-one correspondence between +stamps and push buttons.) The second argument \ameta{caption} is a short +caption that appears at the bottom of the button. This caption should be +descriptive on the icon (stamp) that it matches with. + +\pkg{aeb\_dad} defines two other commands that relate to \cs{ddTargetOfIcon}, these +are \cs{ddTargetCaption} and \cs{ddTargetFmt}, the default definitions of which +are seen below. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\newcommand{\ddTargetCaption}[1]{\\[3pt]% + \parbox[t]{\linewidth}{\centering\ddm@targetfmt#1}} +\newcommand{\ddTargetFmt}[1]{\def\ddm@targetfmt{#1}} +\ddTargetFmt{} +\end{Verbatim} +\cs{ddTargetCaption} sets the caption in a \cs{parbox} that is 3pt beneath +the button. The command \cs{ddm@targetfmt} is a formatting command, it is +defined by \cs{ddTargetFmt}. Use the command \cs{ddTargetFmt} to set the +formatting (or styling) of the captions, it takes one argument which is +passed to the tex stream prior to the caption. For example, for the +President Stamp game appearing on page~\pageref{useannotpro}, we declared +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\ddTargetFmt{\sffamily\small\bfseries} +\end{Verbatim} +The default is \verb!\ddTargetFmt{}!, no styling. + +\bVerb\takeMeasure{\string\ddReset\darg{\ameta{title}}} +\begin{minipage}{\bxSize} +\begin{Verbatim}[frame=single,commandchars=!()] +\ddReset[!ameta(title)] +\end{Verbatim} +\end{minipage}\eVerb +The \cs{ddReset} button restores the most recently defined DAD Matching +Game to its original state. If, for some reason, the most recent one is +not the one you want reset, use the optional argument \meta{title} to pass +the title of the game you want reset. + +It is recommended that the reset button be always on the screen when the user +is matching icons. The game executes a \texttt{Field.setFocus()} method to +take the focus off the stamps when they are dropped. The focus goes on the +reset button. If the reset button is out of the user's viewing, \app{AA} or +\app{AR} will scroll the page to place the reset button in the (middle of +the) viewing area. This would not be a good experience for the user. For +documents that are screen size, placement below the game is probably +acceptable; for paper size pages, placement of the reset button between the +row of stamps and the row of target buttons may work. + + +\subsubsection{Customizing the JavaScript} + +When a correct matching is made, the JavaScript function +\texttt{ddCorrectAction()} is executed; and when an incorrect matching is +made, \texttt{ddWrongAction()}. These two functions simply +place an alert box on the screen with the message ``Right!'' or ``Wrong'', +depending. These two messages, as well as three others, are +defined below. +\begin{Verbatim}[xleftmargin=20pt] +\newcommand{\ddRightMsg}{"Right!"} +\newcommand{\ddWrongMsg}{"Wrong!"} +\newcommand{\ddDragOnlyOne}{"Drag one icon at a time"} +\newcommand{\ddExternalMsg}{% + "Drag and Drop of icons does not work in a browser. " + + "Save this file to your computer and view it in " + + "Adobe Reader XI or later, or in the " + + Acrobat application." +} +\newcommand{\ddBadAppMsg}{% + "Any version of Adobe Acrobat, " + +"or Adobe Reader XI is required!" +} +\end{Verbatim} +These may be redefined to other messages as desired. + +The two functions \texttt{ddCorrectAction()} and \texttt{ddWrongAction()} +first test for the presence of \texttt{ddCustomCorrectAction()} and +\texttt{ddCustomWrongAction()}. If either one (or both) are defined, then +these functions will be executed. The two JavaScript functions, +then, are hooks into the system to modify how the game reacts to being +right or wrong. See the second demo file \texttt{dd\_uspres\_custom.tex} +for an example. The verbatim listing of the definitions of custom +functions are given and discussed below. This example is just one of many +possible definitions. + + +\begin{Verbatim}[numbers=left,xleftmargin=20pt,fontsize=\small] +\begin{insDLJS}{dd}{Custom Notifications} +var oAlertTitle=new Object(); +oAlertTitle["Presidents"] = "The Presidents of the United States"; +function ddCustomCorrectAction(event,ddName) { + app.alert({cMsg: "That's right! Out of sight! ("+ddStats.nCorrect + +" out of "+ddStats.nTries+")", + nIcon: 3, cTitle: "AeB Drag and Drop: " + +oAlertTitle[ddName]}); +} +function ddCustomWrongAction(event,ddName) { + app.alert({cMsg: "Ding, Dong, that is Wrong! ("+ddStats.nCorrect + +" out of "+ddStats.nTries+")", + nIcon: 0, cTitle: "AeB Drag and Drop: " + +oAlertTitle[ddName]}); +} +\end{Verbatim} + +\begin{itemize} + \item Lines~(2) \&~(3) show how to get a custom title on the alert + box, optional, just an idea. + \item Lines~(4)--(14) is the custom handler when the user has a + correct matching. + \begin{itemize} + \item There is a built in counter that tracks the number correct + and the number of attempts. The counter array is shown in + lines~(6) \&~(7). The first one, line~(6), keeps track of the + number correct, and the other one, line~(7), is the total + attempts. + + The reset button \cs{ddReset} resets the counters to zero again. + + \item Lines~(10)--(13) is a custom alert box, that would + say, for example, ``That's Right! Out of sight! (2 out of 5)''. + \end{itemize} + \item Lines~(15)--(24) show the definition of + \texttt{ddCustomWrongAction()}. It has a similar structure, but does + not increment the number correct. +\end{itemize} +There are other ideas that come to mind. You can create a text field, and +define your custom functions to write the score to it. Within the reset +JavaScript function \texttt{resetDDM()}, a check is made for the presence +of a function named \texttt{ddCustomResetAction()}; if it exists, it is +executed as \texttt{ddCustomResetAction(page,ddName)}, where \texttt{page} +is the page number on which the game resides, and \texttt{ddName} is the +title of the game. You can use, for example, to then reset any text field +you define to hold the score. + +\subsection{Additional Examples} + +Additional examples are posted on the +\href{http://blog.acrotex.net}{\AcroTeX{} Blog Site}, these can be conveniently found +under the tag +\href{http://www.acrotex.net/blog/?tag=mkstmpdad}{\emph{mkstmpdad}}. + +\bigskip\noindent +Now, I simply must get back to my retirement. \dps + +\end{document} diff --git a/texmf-dist/source/latex/mkstmpdad/aeb_dad.dtx b/texmf-dist/source/latex/mkstmpdad/aeb_dad.dtx new file mode 100644 index 00000000..1cc8231c --- /dev/null +++ b/texmf-dist/source/latex/mkstmpdad/aeb_dad.dtx @@ -0,0 +1,600 @@ +% \iffalse +% makeindex -s gglo.ist -o aeb_dad.gls aeb_dad.glo +% makeindex -s gind.ist -o aeb_dad.ind aeb_dad.idx +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% aeb_dad package %% +%% Copyright (C) 2012--2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{aeb_dad} +% [2016/10/26 v1.2b Drag and drop stamps matching game (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false]{hyperref}[2012/10/12] % to support calculate for pdfyrc +\pdfstringdefDisableCommands{\let\\\textbackslash} +\OnlyDescription +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\def\ltag{<}\def\rtag{>} +\InputIfFileExists{aebdocfmt.def}{\PackageInfo{aeb_dad}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro} \let\setupFullwidth\relax + \PackageInfo{aeb_dad}{aebdocfmt.def cannot be found}} +\begin{document} + \GetFileInfo{aeb_dad.sty} + \title{\textsf{aeb\_dad}: Drag and drop stamps in a game or learning setting} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{aeb_dad.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute + \texttt{makeindex -s gind.ist -o aeb\_dad.ind aeb\_dad.idx} on the command line and recompile + \texttt{aeb\_dad.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute + \texttt{makeindex -s gglo.ist -o aeb\_dad.gls aeb\_dad.glo} on the command line and recompile + \texttt{aeb\_dad.dtx}.} +\end{document} +% +% \fi +% +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{aeb_dad}{Inputting aebdonotindex.def}} +% {\PackageInfo{aeb_dad}{aebdonotindex.def cannot be found}} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \paragraph*{Description.} +% The \textsf{aeb\_dad} package consists of {\LaTeX} commands and JavaScript for creating a +% \underbar{d}rag \underbar{a}nd \underbar{d}rop ``game'' of matching. The +% user drags and drops an icon image and drops it into a target region (a +% push button), then clicks on the button. If the placement is correct, the +% image centers itself in the target region and the border changes color. +% If the user drops the image in the wrong region, the icon is returned to +% its initial position. In each case an alert message appears and announces +% ``Right'' or ``Wrong''. +% +% Generally, \textsf{AA} and \textsf{AR} do not support drag and +% drop. In version 11 (XI) of \textsf{AR}, you can move a stamp around on a page. +% This opens a number of possibilities. \textsf{aeb\_dad} uses a (rubber) +% stamp as the icons that can be move around in \textsf{ARXI} (and +% \textsf{AAXI}). You cannot attach JS to a stamp, however, that is why the +% target of the drop is a push button. The user drops the stamp on a target +% and presses the underlying button. The JS associated with the button then +% determines whether the stamp that is within its bounding rectangle is the +% correct one. +% +% \paragraph*{Documentation and Code.}\strut\par\medskip\noindent +% The \textsf{eforms} package is also required, but it is not listed here. Include +% \textsf{eforms} prior to this package. The \textsf{web} package is encourage, but +% not required. +% \begin{macrocode} +\RequirePackage{annot_pro}[2012/11/10] +\RequirePackage{xkeyval} +\RequirePackage{calc} +\RequirePackage{refcount} +\newcounter{aebdadcnt} +\edef\dad@subCat{\the\catcode`\_} +\def\dd@csarg#1#2{\expandafter#1\csname#2\endcsname} +\@makeother\_ +% \end{macrocode} +% \DescribeMacro{\ddDimens} is a macro to set the dimensions of +% the stamp icons and the push buttons. +% \begin{macrocode} +\newcommand{\ddDimens}[1]{\setkeys{ddm}{#1}} +% \end{macrocode} +% The width of the icon stamp. (Height appropriately scaled) +% \begin{macrocode} +\define@key{ddm}{iconwidthTo}[]{{% + \def\ddm@argi{#1}\ifx\ddm@argi\@empty + \global\let\ddm@iconwidthTo\@empty + \else + \setlength{\dimen@}{#1}% + \xdef\ddm@iconwidthTo{\the\dimen@}% + \fi +}} +\define@key{ddm}{iconwidth}[\defaultStampWidth]{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@iconwidth{\the\dimen@}% +}} +\define@key{ddm}{iconheight}[\defaultStampHeight]{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@iconheight{\the\dimen@}% +}} +% \end{macrocode} +% The width of the target button. +% \begin{macrocode} +\define@key{ddm}{targetwidth}{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@targetwidth{\the\dimen@}% +}} +% \end{macrocode} +% The height of the target button. +% \begin{macrocode} +\define@key{ddm}{targetheight}{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@targetheight{\the\dimen@}% +}} +% \end{macrocode} +% We set some reasonable defaults for \cs{ddDimens}. +% \begin{macrocode} +\ddDimens{iconwidth,iconheight,iconwidthTo,% + targetwidth=1.25in,targetheight=1.25in} +% \end{macrocode} +% \DescribeMacro{\ddGameIcon} is a convenience command for placing +% the icon stamps. The one required argument is the name associated +% with the stamp. +% \begin{macrocode} +\newcommand{\ddGameIcon}[1]{% + \expandafter\if\csname\thisDDNAME-init\endcsname0\relax + \refstepcounter{aebdadcnt}\phantomsection + \edef\@currentlabelname{Beginning of DAD Game: \thisDDNAME}% + \label{aebdadcnt\theaebdadcnt}% + \dd@EmitPageAction + \global\dd@csarg\let{\thisDDNAME-init}=1\relax + \fi + \ifx\ddm@iconwidthTo\@empty + \def\ddGameIconArgs{type=stamp,name=\##1,% + width=\ddm@iconwidth,% + height=\ddm@iconheight}% + \else + \def\ddGameIconArgs{type=stamp,name=\##1,% + width=\ddm@iconwidth,% + height=\ddm@iconheight, + widthTo=\ddm@iconwidthTo}% + \fi +% \end{macrocode} +% Finally we use \cs{annotpro} to create the stamp. +% \begin{macrocode} + \expandafter\annotpro\expandafter[\ddGameIconArgs]{}% +} +% \end{macrocode} +% \DescribeMacro{\ddBtnAppr} is the preset button appearance for the +% target buttons. +% \begin{macrocode} +\newcommand{\ddBtnAppr}{\S{S}\BG{} + \AA{\AAMouseEnter{% + \JS{btnMouseUpAction(event,this.pageNum,"\thisDDNAME");}}}% +} +% \end{macrocode} +% \DescribeMacro{\ddTargetOfIcon} is a convenience command for placing +% a push button. The two are arguments, the first is the name of the stamp +% associated with this target, the second is the caption that is to go beneath +% the button. +% \begin{macrocode} +\newcommand{\ddTargetOfIcon}[2]{% + \expandafter\if\csname\thisDDNAME-init\endcsname0\relax + \refstepcounter{aebdadcnt}\phantomsection + \edef\@currentlabelname{Beginning of DAD Game: \thisDDNAME}% + \label{aebdadcnt\theaebdadcnt}% + \dd@EmitPageAction + \global\dd@csarg\let{\thisDDNAME-init}=1\relax + \fi + \parbox[t]{\ddm@targetwidth} + {\kern0pt\pushButton[\presets{\ddBtnAppr} + ]{\thisDDNAME @\##1}{\ddm@targetwidth}{\ddm@targetheight}% + \ddTargetCaption{#2}}% +} +\newcommand{\ddTargetFmt}[1]{\def\ddm@targetfmt{#1}} +\ddTargetFmt{} +\newcommand{\ddTargetCaption}[1]{\\[3pt]% + \parbox[t]{\linewidth}{\centering\ddm@targetfmt#1}} +% \end{macrocode} +% \paragraph*{Page and Document JavaScript}\strut\par\medskip\noindent +% As of this writing, only one drag and drop stamp game per page. The +% \DescribeMacro{\initDDGame}\cs{initDDGame} macro should appear on that page. +% \begin{macrocode} +\newcommand{\thisDDName}[1]{% + \setAnnotOptions{subject={#1}}% + \gdef\thisDDNAME{#1}% +} +\newcount\dd@GameCnt \dd@GameCnt=0 +\newcommand{\initDDGame}[1]{\thisDDName{#1}% + \global\advance\dd@GameCnt1\relax + \global\dd@csarg\let{#1-init}0\relax +} +% \end{macrocode} +% \changes{v1.2b}{2016/10/26}{Removed \string\cs{thisPageAction} in favor of a push button action} +% Removed \cs{thisPageAction} in favor of a page open action of a push button. This is to +% cover the case where the begins on the first page. +% \begin{macrocode} +\def\dd@EmitPageAction{% + \@ifundefined{ddEmitOnPage\getpagerefnumber{aebdadcnt\theaebdadcnt}} + {\global\dd@csarg + \let{ddEmitOnPage\getpagerefnumber{aebdadcnt\theaebdadcnt}}\@empty + \pushButton[\F{\FHidden}\BG{}\BC{}\S{S} + \AApageopen{ddPageOpen(this.pageNum);} + ]{btnEmitPA-\theaebdadcnt}{0bp}{0bp}% + }{}% +} +% \end{macrocode} +% \DescribeMacro{\ddReset} is the reset button for the drag and drop matching game. +% +% It is recommended that the reset button be between the icons and the +% target buttons. The game executes a \texttt{Field.setFocus()} method to take the focus +% off of the stamps when they are dropped. The focus goes on the reset button. +% If the reset button is out of the user's sight, AA or AR will scroll the page +% to place the reset button in the (middle of the) viewing area +% \begin{macrocode} +\newcommand{\ddReset}[1][]{\def\dd@arg{#1}% + \ifx\dd@arg\@empty\else\thisDDName{#1}\fi + \mbox{\makebox[0pt][l]{% + \pushButton[\W0\BC{}\BG{}\S{S}]{ddHReset\thisDDNAME}{0bp}{0bp}}% + \pushButton[\CA{Reset}\A{\JS{% + resetDDM(this.pageNum,"\thisDDNAME");}} + \AA{\AAOnFocus{\JS{% + this.getField("ddHReset\thisDDNAME").setFocus(); + }}}]{ddReset\thisDDNAME}{}{11bp}}% +} +% \end{macrocode} +% Open action, to warn user that XI is required for reader. +% \begin{macrocode} +\OpenAction{\JS{ddOpenDocAction();}} +% \end{macrocode} +% \paragraph*{Document JavaScript.} +% The JavaScript function called by the target push buttons. +% \begin{macrocode} +\newcommand{\ddRightMsg}{"Right!"} +\newcommand{\ddWrongMsg}{"Wrong!"} +\newcommand{\ddDragOnlyOne}{"Drag one icon at a time"} +\newcommand{\ddExternalMsg}{"Drag and Drop of icons does not work " + + "in a browser. Save this file to your computer and view it in " + + "Adobe Reader XI or later, or in the Acrobat application."} +\newcommand{\ddBadAppMsg}{"Any version of Adobe Acrobat, " + +"or Adobe Reader XI is required!"} +% \end{macrocode} +% \cmd\ddTrueName\DescribeMacro{\ddTrueName} is a convenience command for referencing +% the \texttt{ddTrueName} JavaScript function, defined below. There must be no spurious spaces +% in the argument of \cs{ddTrueNaqme}. The first argument is the name of the DD Game as set in the document +% by \cs{initDDGame}; the second argument is a name of a stamp (excluding \texttt{\#}). +% \changes{v1.2}{2016/08/22}{Added \string\cs{ddTrueName}} +% \begin{macrocode} +\def\ddTrueName(#1,#2){ddTrueName("#1","#2")} +% \end{macrocode} +% Now for the document JavaScript. +% \begin{macrocode} +\begin{insDLJS}{dadjs}{AcroTeX Stamp Game JavaScript} +var oDADStamp=new Object(); +var oDADCnt=new Object(); +var aDDPageCtrl=new Array(this.numPages); +var oDADAlerts=new Object(); +var ddTO; +% \end{macrocode} +% \texttt{activeStampName} holds the name of the stamp that is being moved around. +% \changes{v1.2}{2016/08/22}{Added JS variable activeStampName} +% \begin{macrocode} +var activeStampName=""; +% \end{macrocode} +% \texttt{ddTrueName} is a JS function that returns the ``true'' (internal) name of the game/stamp +% combination. +% \changes{v1.2}{2016/08/22}{Added JS function ddTrueName} +% \begin{macrocode} +function ddTrueName (ddName,stampName) { + return ddName+"@#"+stampName; +} +function btnMouseUpAction(event,page,ddName) +{ + var stamps; + var aBtnRect=event.target.rect; + var cBtnName=event.target.name; + var l = cBtnName.indexOf("@#"); + cBtnName = cBtnName.substring(1+l); + // convert to rotated user coordinates + var mxToDefault=(new Matrix2D()).fromRotated(this,page); + var mxToRotated=mxToDefault.invert(); + var aBtnRectRot=mxToRotated.transform(aBtnRect); +% \end{macrocode} +% Format for Default User Space: \texttt{[left,bottom,right,top]} +% \begin{macrocode} + var btnWidth=aBtnRect[2]-aBtnRect[0]; + var btnHeight=aBtnRect[3]-aBtnRect[1]; +% \end{macrocode} +% Originally, we gathered all annots on this page, +%\begin{verbatim} +% stamps=this.getAnnots(page); +%\end{verbatim} +% Now we gather the selected annots (throughout the entire document) +% \begin{macrocode} + stamps=this.selectedAnnots; + if (typeof stamps == "undefined") return; + if (stamps.length>1) { + app.alert({cMsg: \ddDragOnlyOne, + nIcon: 3, cTitle: "AcroTeX Drag and Drop"}); + for (var i=0; i= aBtnRectRot[0] )% +&&(nHorzCenter<=aBtnRectRot[2]) ) { + if ( (nVertCenter>=aBtnRectRot[3])% +&& (nVertCenter<=aBtnRectRot[1]) ) { +% \end{macrocode} +% Now see if it is the correct one, and center the stamp inside the rectangle. +% \begin{macrocode} + if (( (cBtnName==stamps[i].AP)% +&& (stamps[i].subject==ddName))% +&& (!oDADStamp[index][stamps[i].AP][1]) ) { +% \end{macrocode} +% center stamp on button face\\ +% Field: \texttt{[left,bottom,right,top]}\\ +% Annot: \texttt{[left,top,right,bottom]}\\ +% We get the original rectangle, and use it to calculate the width and height. +% \begin{macrocode} + activeStampName=stamps[i].AP.substring(1); + var aStmpRect=oDADStamp[index][stamps[i].AP][0]; + var stmpWidth=aStmpRect[2]-aStmpRect[0]; + var stmpHeight=aStmpRect[3]-aStmpRect[1]; + oDADStamp[index][stamps[i].AP][1]=true; + var deltaX=(btnWidth-stmpWidth)/2; + var deltaY=(btnHeight-stmpHeight)/2; +% \end{macrocode} +% We calculate the dimensions of the centered icon. If the user rescaled the icon +% it will be locked in at its original scale. +% \begin{macrocode} + aCenterStamp=[ + aBtnRectRot[0]+deltaX, + aBtnRectRot[3]-deltaY, + aBtnRectRot[0]+deltaX+stmpWidth, + aBtnRectRot[3]-deltaY-stmpHeight]; + ddCorrectAction(event,ddName); + event.target.strokeColor=color.green; +% \end{macrocode} +% Correct stamp in the correct target field. We want to center the stamp, make sure +% the user did not rotate it, or resize it. +% \begin{macrocode} + stamps[i].setProps({rotate:0}); + stamps[i].rect=aCenterStamp; + event.target.readonly=true; + resetFocus("ddReset"+ddName); + break; + } else { +% \end{macrocode} +% Attach the stamp name to the \texttt{stampName} property of \texttt{ddWrongAction} so we can +% conveniently reference it when using custom a wrong actions. +% \begin{macrocode} +% ddWrongAction.stampName=stamps[i].AP; + activeStampName=stamps[i].AP.substring(1); + ddWrongAction(event,ddName); + if (!oDADAlerts[ddName].oAlrtChk.bAfterValue) + ddReturnStamp(page,ddName,stamps[i]); + else { + ddReturnStamp.o=stamps[i]; + ddTO=app.setTimeOut("ddReturnStamp(" + +page+",\""+ddName + +"\",ddReturnStamp.o);",250); + } + break; + } + } else { + // too high or two low. + if(!oDADStamp[index][stamps[i].AP][1]) + ddReturnStamp(page,ddName,stamps[i]); + } + } else { + // outside left or right of button + if(!oDADStamp[index][stamps[i].AP][1]) + ddReturnStamp(page,ddName,stamps[i]); + } + } + this.dirty=false; +} +function ddReturnStamp(page,ddName,oStamp) { + var index=oStamp.subject+page; + oStamp.setProps({rotate:0}) + oStamp.rect=oDADStamp[index][oStamp.AP][0]; + resetFocus("ddReset"+ddName); +} +function resetDDM(page,ddName) { + var stamps=this.getAnnots(page); + for (var i=0; i}, a particular stamp +% is referenced by its \texttt{AP} name. We save the original rectangle +% and a boolean \texttt{false}. When the stamp is placed correctly, we +% change this to \texttt{true}. +% \begin{macrocode} + oDADStamp[index][si.AP]=[si.rect, false]; + } + } + } else console.println("Bypassing ddPageOpen for page "+page); +} +function resetFocus(fname) { + this.getField(fname).setFocus(); +} +var gDDStats=new Object(); +var ddStats=new Object(); +function ddCorrectAction(event,ddName) { + var page = event.target.page; + oDADCnt[ddName+page][0] += 1; + oDADCnt[ddName+page][1] += 1; + gDDStats[ddName]={nCorrect: oDADCnt[ddName+page][0], + nTries: oDADCnt[ddName+page][1]}; + ddStats=gDDStats[ddName]; + if (typeof ddCustomCorrectAction == "function") +% \end{macrocode} +% Customization: If \texttt{ddCustomCorrectAction()} is defined, we use it. +% \begin{macrocode} + ddCustomCorrectAction(event,ddName); + else + ddCorrectActionDef(event,ddName); +} +% \end{macrocode} +% Added JavaScript functions \texttt{ddCorrectActionDef()} and +% \texttt{ddWrongActionDef()}, these are used to create both custom and default response actions. +% \changes{v1.2}{2016/08/22}{Added ddCorrectActionDef and +% ddWrongActionDef} +% \begin{macrocode} +function ddCorrectActionDef(event,ddName) { + if (!oDADAlerts[ddName].oAlrtChk.bAfterValue) + app.alert({cMsg: \ddRightMsg, nIcon: 3, + cTitle: "AeB DAD Matching", + oCheckbox:oDADAlerts[ddName].oAlrtChk}); +} +function ddWrongAction(event,ddName) { + var page = event.target.page; + oDADCnt[ddName+page][1] += 1; + gDDStats[ddName]={nCorrect: oDADCnt[ddName+page][0], + nTries: oDADCnt[ddName+page][1]}; + ddStats=gDDStats[ddName]; + if (typeof ddCustomWrongAction == "function") +% \end{macrocode} +% Customization: If \texttt{ddCustomWrongAction()} is defined, we use it. +% \begin{macrocode} + ddCustomWrongAction(event,ddName); + else + ddWrongActionDef(event,ddName); +} +function ddWrongActionDef(event,ddName) { + if (!oDADAlerts[ddName].oAlrtChk.bAfterValue) + app.alert({cMsg: \ddWrongMsg, nIcon:0, + cTitle: "AeB DAD Matching", + oCheckbox:oDADAlerts[ddName].oAlrtChk}); + else + app.beep(4); +} +\end{insDLJS} +% \end{macrocode} +% \begin{macrocode} +\catcode`\_=\dad@subCat +% +% \end{macrocode} +%\Finale diff --git a/texmf-dist/source/latex/mkstmpdad/aeb_dad.ins b/texmf-dist/source/latex/mkstmpdad/aeb_dad.ins new file mode 100644 index 00000000..9e5337e0 --- /dev/null +++ b/texmf-dist/source/latex/mkstmpdad/aeb_dad.ins @@ -0,0 +1,63 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2006 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2008/04/22} +\def\batchfile{aeb_dad.ins} +% +% If you can assume that the target audience for the document all have +% Acrobat Reader 5.0 or later, then chance the following switch to true, +% else, leave it as false. + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.dtx b/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.dtx new file mode 100644 index 00000000..bcffd9cb --- /dev/null +++ b/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.dtx @@ -0,0 +1,167 @@ +% \iffalse +% makeindex -s gglo.ist -o mkstmp_pro.gls mkstmp_pro.glo +% makeindex -s gind.ist -o mkstmp_pro.ind mkstmp_pro.idx +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% mkstmp_pro package %% +%% Copyright (C) 2012-2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{mkstmp_pro} +% [2016/08/21 v1.1 Make Stamps for stamp annotations (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false]{hyperref}[2012/10/12] % to support calculate for pdfyrc +\pdfstringdefDisableCommands{\let\\\textbackslash} +\OnlyDescription +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\def\ltag{<}\def\rtag{>} +\InputIfFileExists{aebdocfmt.def}{\PackageInfo{mkstmp_pro}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro} \let\setupFullwidth\relax + \PackageInfo{mkstmp_pro}{aebdocfmt.def cannot be found}} +\begin{document} + \GetFileInfo{mkstmp_pro.sty} + \title{\textsf{mkstmp\_pro}: Create stamps for \textsf{AA/AAR}} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{mkstmp_pro.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute + \texttt{makeindex -s gind.ist -o mkstmp\_pro.ind mkstmp\_pro.idx} on the command line and recompile + \texttt{mkstmp\_pro.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute + \texttt{makeindex -s gglo.ist -o mkstmp\_pro.gls mkstmp\_pro.glo} on the command line and recompile + \texttt{mkstmp\_pro.dtx}.} +\end{document} +% +% \fi +% +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{mkstmp_pro}{Inputting aebdonotindex.def}} +% {\PackageInfo{mkstmp_pro}{aebdonotindex.def cannot be found}} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \paragraph*{Description.} +% \textsf{mkstmp\_pro} is a package for making a (rubber) stamp file. +% A person using this package requires \textsf{aeb\_pro} and \textsf{Adobe Acrobat} (\texttt{AA}). +% After you create a stamp file, move it to the user stamp folder of your \textsf{Acrobat} +% distribution and the stamps will be available for use. +% +% \paragraph*{Documentation and Code.}\strut\par\medskip\noindent +% We require the \textsf{aeb\_pro} and \textsf{xkeyval} packages. +% \begin{macrocode} +\RequirePackage{aeb_pro}[2012/11/09] +\RequirePackage{xkeyval} +% \end{macrocode} +% A command taken from \textsf{eforms} that can be used to define +% \cs{setStampPath}. +% \begin{macrocode} +\providecommand{\definePath}[1]{\def\ef@ctrlName{#1}% + \hyper@normalise\ef@definePath} +\def\ef@definePath#1{\expandafter\xdef\ef@ctrlName{#1}} +% \end{macrocode} +% \DescribeMacro{\setStampPath} is used to define the path to the icon +% file. It is a declaration that uses \cs{definePath} to define the +% macro \cs{stampPath}. If used, then the \texttt{path} key is not used (defined below). +% \begin{macrocode} +\newcommand{\setStampPath}[1]{\definePath{\msp@stampPath}{#1}} +% \end{macrocode} +% Key value pairs for the \texttt{makeStamp} family.\par\medskip\noindent +% \DescribeMacro{name} is the name you are giving the stamp. +% \begin{macrocode} +\define@key{makeStamp}{name}[]{\def\makeStamp@name{\##1}} +\let\msp@stampPath\@empty +% \end{macrocode} +% \DescribeMacro{path} is the path to the PDF file containing the image +% to be used for a stamp. The default is \cs{msp@stampPath}, defined separately +% using \cs{setStampPath}. +% \begin{macrocode} +\define@key{makeStamp}{path}[\msp@stampPath]{\edef\makeStamp@path{#1}} +% \end{macrocode} +% \DescribeMacro{page} is the page in the PDF file that corresponds to the +% image you want to use as a stamp. +% \begin{macrocode} +\define@key{makeStamp}{page}[0]{\def\aeb@stamp@page{#1}} +% \end{macrocode} +% \DescribeMacro{\makeStamps} is the only command of this package. Its only +% argument is a list of tokens. +%\begin{verbatim} +% \setStampPath{C:/Users/Public/Documents/% +% My TeX Files/tex/latex/aeb/aebpro/aeb_dad/images/juergen.pdf} +% \makeStamps{% +% {name=Touches Hat,page=0} +% {name=Doffs Hat,page=1} +% {name=Movie Star,page=2} +% {name=Running Man,page=3} +% } +% \begin{docassembly} +% \insertPreDocAssembly +% \end{docassembly} +% \begin{document} +% ... +%\end{verbatim} +% There are three key-value pairs. name, path, and page. The path key is not really +% needed if the command \cs{setStampPath} is used. +% \begin{macrocode} +\newcommand{\makeStamps}[1]{% + \edef\@tforExp{\noexpand\@tfor\noexpand\msp@Args:=#1}% + \@tforExp\do{\expandafter\ms@makeStamp + \expandafter{\msp@Args}% + }% +} +% \end{macrocode} +% \cs{makeStamp} is a loop that calls \cs{ms@makeStamp}. A typical call +% is +%\begin{verbatim} +% \ms@makeStamp{name=Touches Hat,page=0} +%\end{verbatim} +% \begin{macrocode} +\newcommand{\ms@makeStamp}[1]{% + \setkeys{makeStamp}{name,path,page,#1}% + \ifx\make@Stamps@name\@empty + \PackageError{mkstmp_pro}{The `name' key is required} + {Please give the path of the stamp image.}\fi + \ifx\makeStamp@path\@empty + \PackageError{mkstmp_pro}{The `path' key is required} + {Please give the path of the stamp image, or \MessageBreak + use \string\setStampPath.}\fi +% \end{macrocode} +% We work things so that the pages are added in the same order that they +% are listed in the arguments of \cs{makeStamp}. +% +% We create a command \cs{predocassemJS} that is designed for use in the +% \texttt{docassembly} environment of \textsf{aeb\_pro}. +% \begin{macrocode} + \xdef\predocassemJS{% + var retn=\insertPages({nPage:0, cPath:"\makeStamp@path",% + nStart:\aeb@stamp@page});^^J% + if ( retn==-1 ) console.println("The file + \string\"\makeStamp@path\string\" could not be opened.");^^J% + if ( retn==-2 ) console.println("Selected page + (page=\aeb@stamp@page) for \string\"\makeStamp@path\string\" + is invalid.");^^J% + \createTemplate({cName:"\makeStamp@name",nPage:1});^^J% + \predocassemJS% + }% +} +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +%\Finale diff --git a/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.ins b/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.ins new file mode 100644 index 00000000..cf9326f3 --- /dev/null +++ b/texmf-dist/source/latex/mkstmpdad/mkstmp_pro.ins @@ -0,0 +1,63 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2006 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2008/04/22} +\def\batchfile{mkstmp_pro.ins} +% +% If you can assume that the target audience for the document all have +% Acrobat Reader 5.0 or later, then chance the following switch to true, +% else, leave it as false. + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/texmf-dist/tex/latex/mkstmpdad/aeb_dad.sty b/texmf-dist/tex/latex/mkstmpdad/aeb_dad.sty new file mode 100644 index 00000000..e08a8ea3 --- /dev/null +++ b/texmf-dist/tex/latex/mkstmpdad/aeb_dad.sty @@ -0,0 +1,364 @@ +%% +%% This is file `aeb_dad.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% aeb_dad.dtx (with options: `copyright,package') +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% aeb_dad package %% +%% Copyright (C) 2012--2016 D. P. Story %% +%% dpstory@uakron.edu %% +%% %% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{aeb_dad} + [2016/10/26 v1.2b Drag and drop stamps matching game (dps)] +\RequirePackage{annot_pro}[2012/11/10] +\RequirePackage{xkeyval} +\RequirePackage{calc} +\RequirePackage{refcount} +\newcounter{aebdadcnt} +\edef\dad@subCat{\the\catcode`\_} +\def\dd@csarg#1#2{\expandafter#1\csname#2\endcsname} +\@makeother\_ +\newcommand{\ddDimens}[1]{\setkeys{ddm}{#1}} +\define@key{ddm}{iconwidthTo}[]{{% + \def\ddm@argi{#1}\ifx\ddm@argi\@empty + \global\let\ddm@iconwidthTo\@empty + \else + \setlength{\dimen@}{#1}% + \xdef\ddm@iconwidthTo{\the\dimen@}% + \fi +}} +\define@key{ddm}{iconwidth}[\defaultStampWidth]{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@iconwidth{\the\dimen@}% +}} +\define@key{ddm}{iconheight}[\defaultStampHeight]{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@iconheight{\the\dimen@}% +}} +\define@key{ddm}{targetwidth}{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@targetwidth{\the\dimen@}% +}} +\define@key{ddm}{targetheight}{{% + \setlength{\dimen@}{#1}% + \xdef\ddm@targetheight{\the\dimen@}% +}} +\ddDimens{iconwidth,iconheight,iconwidthTo,% + targetwidth=1.25in,targetheight=1.25in} +\newcommand{\ddGameIcon}[1]{% + \expandafter\if\csname\thisDDNAME-init\endcsname0\relax + \refstepcounter{aebdadcnt}\phantomsection + \edef\@currentlabelname{Beginning of DAD Game: \thisDDNAME}% + \label{aebdadcnt\theaebdadcnt}% + \dd@EmitPageAction + \global\dd@csarg\let{\thisDDNAME-init}=1\relax + \fi + \ifx\ddm@iconwidthTo\@empty + \def\ddGameIconArgs{type=stamp,name=\##1,% + width=\ddm@iconwidth,% + height=\ddm@iconheight}% + \else + \def\ddGameIconArgs{type=stamp,name=\##1,% + width=\ddm@iconwidth,% + height=\ddm@iconheight, + widthTo=\ddm@iconwidthTo}% + \fi + \expandafter\annotpro\expandafter[\ddGameIconArgs]{}% +} +\newcommand{\ddBtnAppr}{\S{S}\BG{} + \AA{\AAMouseEnter{% + \JS{btnMouseUpAction(event,this.pageNum,"\thisDDNAME");}}}% +} +\newcommand{\ddTargetOfIcon}[2]{% + \expandafter\if\csname\thisDDNAME-init\endcsname0\relax + \refstepcounter{aebdadcnt}\phantomsection + \edef\@currentlabelname{Beginning of DAD Game: \thisDDNAME}% + \label{aebdadcnt\theaebdadcnt}% + \dd@EmitPageAction + \global\dd@csarg\let{\thisDDNAME-init}=1\relax + \fi + \parbox[t]{\ddm@targetwidth} + {\kern0pt\pushButton[\presets{\ddBtnAppr} + ]{\thisDDNAME @\##1}{\ddm@targetwidth}{\ddm@targetheight}% + \ddTargetCaption{#2}}% +} +\newcommand{\ddTargetFmt}[1]{\def\ddm@targetfmt{#1}} +\ddTargetFmt{} +\newcommand{\ddTargetCaption}[1]{\\[3pt]% + \parbox[t]{\linewidth}{\centering\ddm@targetfmt#1}} +\newcommand{\thisDDName}[1]{% + \setAnnotOptions{subject={#1}}% + \gdef\thisDDNAME{#1}% +} +\newcount\dd@GameCnt \dd@GameCnt=0 +\newcommand{\initDDGame}[1]{\thisDDName{#1}% + \global\advance\dd@GameCnt1\relax + \global\dd@csarg\let{#1-init}0\relax +} +\def\dd@EmitPageAction{% + \@ifundefined{ddEmitOnPage\getpagerefnumber{aebdadcnt\theaebdadcnt}} + {\global\dd@csarg + \let{ddEmitOnPage\getpagerefnumber{aebdadcnt\theaebdadcnt}}\@empty + \pushButton[\F{\FHidden}\BG{}\BC{}\S{S} + \AApageopen{ddPageOpen(this.pageNum);} + ]{btnEmitPA-\theaebdadcnt}{0bp}{0bp}% + }{}% +} +\newcommand{\ddReset}[1][]{\def\dd@arg{#1}% + \ifx\dd@arg\@empty\else\thisDDName{#1}\fi + \mbox{\makebox[0pt][l]{% + \pushButton[\W0\BC{}\BG{}\S{S}]{ddHReset\thisDDNAME}{0bp}{0bp}}% + \pushButton[\CA{Reset}\A{\JS{% + resetDDM(this.pageNum,"\thisDDNAME");}} + \AA{\AAOnFocus{\JS{% + this.getField("ddHReset\thisDDNAME").setFocus(); + }}}]{ddReset\thisDDNAME}{}{11bp}}% +} +\OpenAction{\JS{ddOpenDocAction();}} +\newcommand{\ddRightMsg}{"Right!"} +\newcommand{\ddWrongMsg}{"Wrong!"} +\newcommand{\ddDragOnlyOne}{"Drag one icon at a time"} +\newcommand{\ddExternalMsg}{"Drag and Drop of icons does not work " + + "in a browser. Save this file to your computer and view it in " + + "Adobe Reader XI or later, or in the Acrobat application."} +\newcommand{\ddBadAppMsg}{"Any version of Adobe Acrobat, " + +"or Adobe Reader XI is required!"} +\def\ddTrueName(#1,#2){ddTrueName("#1","#2")} +\begin{insDLJS}{dadjs}{AcroTeX Stamp Game JavaScript} +var oDADStamp=new Object(); +var oDADCnt=new Object(); +var aDDPageCtrl=new Array(this.numPages); +var oDADAlerts=new Object(); +var ddTO; +var activeStampName=""; +function ddTrueName (ddName,stampName) { + return ddName+"@#"+stampName; +} +function btnMouseUpAction(event,page,ddName) +{ + var stamps; + var aBtnRect=event.target.rect; + var cBtnName=event.target.name; + var l = cBtnName.indexOf("@#"); + cBtnName = cBtnName.substring(1+l); + // convert to rotated user coordinates + var mxToDefault=(new Matrix2D()).fromRotated(this,page); + var mxToRotated=mxToDefault.invert(); + var aBtnRectRot=mxToRotated.transform(aBtnRect); + var btnWidth=aBtnRect[2]-aBtnRect[0]; + var btnHeight=aBtnRect[3]-aBtnRect[1]; + stamps=this.selectedAnnots; + if (typeof stamps == "undefined") return; + if (stamps.length>1) { + app.alert({cMsg: \ddDragOnlyOne, + nIcon: 3, cTitle: "AcroTeX Drag and Drop"}); + for (var i=0; i= aBtnRectRot[0] )% +&&(nHorzCenter<=aBtnRectRot[2]) ) { + if ( (nVertCenter>=aBtnRectRot[3])% +&& (nVertCenter<=aBtnRectRot[1]) ) { + if (( (cBtnName==stamps[i].AP)% +&& (stamps[i].subject==ddName))% +&& (!oDADStamp[index][stamps[i].AP][1]) ) { + activeStampName=stamps[i].AP.substring(1); + var aStmpRect=oDADStamp[index][stamps[i].AP][0]; + var stmpWidth=aStmpRect[2]-aStmpRect[0]; + var stmpHeight=aStmpRect[3]-aStmpRect[1]; + oDADStamp[index][stamps[i].AP][1]=true; + var deltaX=(btnWidth-stmpWidth)/2; + var deltaY=(btnHeight-stmpHeight)/2; + aCenterStamp=[ + aBtnRectRot[0]+deltaX, + aBtnRectRot[3]-deltaY, + aBtnRectRot[0]+deltaX+stmpWidth, + aBtnRectRot[3]-deltaY-stmpHeight]; + ddCorrectAction(event,ddName); + event.target.strokeColor=color.green; + stamps[i].setProps({rotate:0}); + stamps[i].rect=aCenterStamp; + event.target.readonly=true; + resetFocus("ddReset"+ddName); + break; + } else { + activeStampName=stamps[i].AP.substring(1); + ddWrongAction(event,ddName); + if (!oDADAlerts[ddName].oAlrtChk.bAfterValue) + ddReturnStamp(page,ddName,stamps[i]); + else { + ddReturnStamp.o=stamps[i]; + ddTO=app.setTimeOut("ddReturnStamp(" + +page+",\""+ddName + +"\",ddReturnStamp.o);",250); + } + break; + } + } else { + // too high or two low. + if(!oDADStamp[index][stamps[i].AP][1]) + ddReturnStamp(page,ddName,stamps[i]); + } + } else { + // outside left or right of button + if(!oDADStamp[index][stamps[i].AP][1]) + ddReturnStamp(page,ddName,stamps[i]); + } + } + this.dirty=false; +} +function ddReturnStamp(page,ddName,oStamp) { + var index=oStamp.subject+page; + oStamp.setProps({rotate:0}) + oStamp.rect=oDADStamp[index][oStamp.AP][0]; + resetFocus("ddReset"+ddName); +} +function resetDDM(page,ddName) { + var stamps=this.getAnnots(page); + for (var i=0; i