summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-28 00:42:32 +0000
committerKarl Berry <karl@freefriends.org>2010-03-28 00:42:32 +0000
commit5547e5de3f2519e7f54bb3007c9a5b75e81b57b5 (patch)
treeca2d3c4379322e749f4a27e903845d673b4d78ad /Master/texmf-dist/source
parent6173c05a5e76ce42b153a2e7664ad2ddba566112 (diff)
new latex package fc_arith 0.1a (27mar10)
git-svn-id: svn://tug.org/texlive/trunk@17581 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/fc_arith/fc_arith.drv42
-rw-r--r--Master/texmf-dist/source/latex/fc_arith/fc_arith.dtx1802
-rw-r--r--Master/texmf-dist/source/latex/fc_arith/fc_arith.ins62
3 files changed, 1906 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/fc_arith/fc_arith.drv b/Master/texmf-dist/source/latex/fc_arith/fc_arith.drv
new file mode 100644
index 00000000000..43343d9df7a
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fc_arith/fc_arith.drv
@@ -0,0 +1,42 @@
+%%
+%% This is file `fc_arith.drv',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% fc_arith.dtx (with options: `copyright,driver')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% fc_arith.sty package, 2010-3-17 %%
+%% Copyright (C) 1999-2002 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% History: Noel Vaillant began developing a better fc_arith.sty
+%% based on my earlier published fc_arith.sty. Many thanks
+%% to him for starting me off.
+%%---------------------------------------------------------
+\documentclass{ltxdoc}
+\usepackage[colorlinks,hyperindex]{hyperref}
+\begin{document}
+\def\CMD#1{\textbackslash#1}
+ \GetFileInfo{fc_arith.sty}
+ \title{fc\_arith: Flash Cards for Arithmetic}
+ \author{D. P. Story\\
+ Email: \texttt{dpstory@uakron.edu}}
+ \date{processed \today}
+ \maketitle
+ \tableofcontents
+ \let\Email\texttt
+ \DocInput{fc_arith.dtx}
+ \PrintIndex
+\end{document}
+\endinput
+%%
+%% End of file `fc_arith.drv'.
diff --git a/Master/texmf-dist/source/latex/fc_arith/fc_arith.dtx b/Master/texmf-dist/source/latex/fc_arith/fc_arith.dtx
new file mode 100644
index 00000000000..c7f604e56c2
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fc_arith/fc_arith.dtx
@@ -0,0 +1,1802 @@
+%\iffalse
+%<*copyright>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% fc_arith.sty package, 2010-3-17 %%
+%% Copyright (C) 1999-2002 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% History: Noel Vaillant began developing a better fc_arith.sty
+%% based on my earlier published fc_arith.sty. Many thanks
+%% to him for starting me off.
+%%---------------------------------------------------------
+%</copyright>
+%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+%<package>\ProvidesPackage{fc_arith}
+%<package> [2010/03/17 v0.1a fc_arith: PDF flash cards for arithmetic drill (dps)]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[colorlinks,hyperindex]{hyperref}
+%\pdfstringdefDisableCommands{\let\\\textbackslash}
+%\EnableCrossrefs \CodelineIndex
+\begin{document}
+\def\CMD#1{\textbackslash#1}
+ \GetFileInfo{fc_arith.sty}
+ \title{fc\_arith: Flash Cards for Arithmetic}
+ \author{D. P. Story\\
+ Email: \texttt{dpstory@uakron.edu}}
+ \date{processed \today}
+ \maketitle
+ \tableofcontents
+ \let\Email\texttt
+ \DocInput{fc_arith.dtx}
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+% \MakeShortVerb{|}
+% \StopEventually{}
+%
+% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let}
+% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi}
+% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup}
+% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand}
+% \DoNotIndex{\space,\@empty,\special}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%\section{Package Options}
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+\RequirePackage{calc}
+% \end{macrocode}
+% \begin{macro}{allownegsub}
+% The original arithmetic flash cards did not allow a negative difference,
+% if this option is used, the differences are allowed to be negative.
+% \begin{macrocode}
+\DeclareOptionX{allownegsub}{\def\fcAllowSub{true}}\def\fcAllowSub{false}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{nomenu}
+% The menu allows to user to change the range of the numbers, using this
+% option removes the menu.
+% \begin{macrocode}
+\DeclareOptionX{nomenu}{\let\fc@usemenu=n}\let\fc@usemenu=y
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{operations}
+% Give the ability to declare what operations FC should show. Supported operations
+% are add, sub, mul, div. The default is all operations.
+% \begin{macrocode}
+\DeclareOptionX{operations}[add,sub,mul,div]{\def\fc@operations{#1}}
+\def\fc@operations{add,sub,mul,div}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{showkeypadlink}
+% If the \texttt{nomenu} option is taken, you can select the \texttt{showkepadlink} so the
+% user can toggle the keypad.
+% \begin{macrocode}
+\DeclareOptionX{showkeypadlink}{\let\fc@keypadlink=y}
+\let\fc@keypadlink=n
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{notimedscores}
+% Do not tally timed scores. Some may not want the pressure!
+% \begin{macrocode}
+\DeclareOptionX{notimedscores}{%
+ \def\fcTimedScores{false}
+ \let\fc@timedscores=n
+}
+\def\fcTimedScores{true}
+\let\fc@timedscores=y
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\ProcessOptionsX
+\RequirePackage{eforms}[2010/03/21]
+\RequirePackage{popupmenu}
+% \end{macrocode}
+%\section{Main Code}
+% \begin{macrocode}
+\newdimen\fcWidth
+% \end{macrocode}
+% The keys for the \texttt{fcopera} family are defined here. These are % used with the \texttt{operations} option. These define the \texttt{add}, % \texttt{sub}, \texttt{mul}, and \texttt{div} operations.
+% \begin{macrocode}
+\define@boolkey{fcopera}{add}[true]{}
+\define@boolkey{fcopera}{sub}[true]{}
+\define@boolkey{fcopera}{mul}[true]{}
+\define@boolkey{fcopera}{div}[true]{}
+% \end{macrocode}
+% We take the macro \cs{fc@operations} defined by the \texttt{operations} option, set
+% the corresponding keys for the \texttt{fcopera} family.
+% \begin{macrocode}
+\edef\fc@expand{\noexpand\setkeys{fcopera}{\fc@operations}}\fc@expand
+% \end{macrocode}
+% \begin{macro}{\DeclareArithParams}
+% The builder of this arithmetic flash cards can hard-wire the ranges. Here is an
+% example of usage:
+%\begin{verbatim}
+%\DeclareArithParams
+%{%
+% addT={[2,20]},addB={[5,30]},
+% addDecT=none,addDecB=2,
+% subT={[1,5]},subB={[5,10]},
+% subDecT=1,subDecB=2,
+% mulT={[1,12]},mulB={[1,10]},
+% mulDecT=1,mulDecB=2,
+% divQ={[1,4]},divB={[1,10]},
+% divDecQ=1,divDecB=2
+%}
+%\end{verbatim}
+% Below are defined the keys used by \cs{DeclareArithParams}.
+% \begin{macrocode}
+\define@key{fcarithparams}{addT}[{[0,100]}]{\def\fcAddTParams{#1}}
+\define@key{fcarithparams}{addB}[{[0,100]}]{\def\fcAddBParams{#1}}
+\define@choicekey{fcarithparams}{addDecT}[\val\nr]{none,1,2}[none]{%
+ \edef\fcaddDecT{\nr}}{}
+\define@choicekey{fcarithparams}{addDecB}[\val\nr]{none,1,2}[none]{%
+ \edef\fcaddDecB{\nr}}{}
+\define@key{fcarithparams}{subT}[{[0,100]}]{\def\fcSubTParams{#1}}
+\define@key{fcarithparams}{subB}[{[0,100]}]{\def\fcSubBParams{#1}}
+\define@choicekey{fcarithparams}{subDecT}[\val\nr]{none,1,2}[none]{%
+ \edef\fcsubDecT{\nr}}{}
+\define@choicekey{fcarithparams}{subDecB}[\val\nr]{none,1,2}[none]{%
+ \edef\fcsubDecB{\nr}}{}
+\define@key{fcarithparams}{mulT}[{[0,100]}]{\def\fcMulTParams{#1}}
+\define@key{fcarithparams}{mulB}[{[0,10]}]{\def\fcMulBParams{#1}}
+\define@choicekey{fcarithparams}{mulDecT}[\val\nr]{none,1,2}[none]{%
+ \edef\fcmulDecT{\nr}}{}
+\define@choicekey{fcarithparams}{mulDecB}[\val\nr]{none,1,2}[none]{%
+ \edef\fcmulDecB{\nr}}{}
+\define@key{fcarithparams}{divQ}[{[0,10]}]{\def\fcDivQParams{#1}}
+\define@key{fcarithparams}{divB}[{[0,10]}]{\def\fcDivBParams{#1}}
+\define@choicekey{fcarithparams}{divDecQ}[\val\nr]{none,1,2}[none]{%
+ \edef\fcdivDecQ{\nr}}{}
+\define@choicekey{fcarithparams}{divDecB}[\val\nr]{none,1,2}[none]{%
+ \edef\fcdivDecB{\nr}}{}
+% \end{macrocode}
+% We set the defaults for these keys.
+% \begin{macrocode}
+\setkeys{fcarithparams}{addT,addB,subT,subB,mulT,mulB,divQ,divB,%
+ addDecT,addDecB,subDecT,subDecB,mulDecT,mulDecB,divDecQ,divDecB}
+\newcommand{\DeclareArithParams}[1]{\setkeys{fcarithparams}{#1}}
+\@onlypreamble\DeclareArithParams
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\timeUpMsg}
+% \begin{macro}{\rightMsg}
+% \begin{macro}{\wrongMsg}
+% \begin{macro}{\startAgainMsg}
+% \begin{macro}{\newCardMsg}
+% Strings that can be redefined; the meanings are obvious.
+% \begin{macrocode}
+\newcommand{\timeUpMsg}{Your Time is UP!}
+\newcommand{\rightMsg}{Right!}
+\newcommand{\wrongMsg}{Wrong!}
+\newcommand{\startAgainMsg}{Start Again}
+\newcommand{\newCardMsg}{New Card}
+\newcommand{\toggleKeypad}{Toggle Keypad}
+\newcommand{\operation}{Operation}
+\newcommand{\numCorrect}{Number Correct}
+\newcommand{\numAttempted}{Number Attempted}
+\newcommand{\percentCorrect}{Percentage Correct}
+\newcommand{\timedScores}{Timed Scores}
+\newcommand{\fmtAnswer}{Answer:}
+\newcommand{\kpDec}{.}
+\newcommand{\kpMinus}{-}
+\newcommand{\kpBack}{Back}
+\newcommand{\kpEnter}{Enter}
+\newcommand{\fcNoTiming}{No Timing}
+\newcommand{\fcAddition}{Addition}
+\newcommand{\fcSubtraction}{Subtraction}
+\newcommand{\fcMultiplication}{Multiplication}
+\newcommand{\fcDivision}{Division}
+\newcommand{\fcSettings}{Settings}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\FCMenu}
+% This is the menu system, it is normally placed in the running header
+% on the left, though this can be changed.
+% \begin{macrocode}
+\newcommand{\fcSettingsColor}{black}
+\newcommand{\FCMenu}{\mbox{\setLinkText[\linktxtcolor{\fcSettingsColor}
+ \A{\JS{processFcMenu();}}]{\fcSettings}}}
+\if\fc@usemenu y\lheader{\FCMenu}\rheader{}\else
+\lheader{}\rheader{}\fi
+% \end{macrocode}
+% \end{macro}
+% \subsection{The form fields}
+% \begin{macro}{\tBGNoBorder}
+% \begin{macro}{\tBGNoBorderI}
+% \begin{macro}{\cBGNoBorder}
+% \begin{macro}{\cBGBorder}
+% \begin{macro}{\myNumPad}
+% Some preset formatting for the various fields. May be redefined.
+% \begin{macrocode}
+\newcommand{\tBGNoBorder}{\BC{}\BG{}\autoCenter{n}\textSize{0}
+ \textColor{1 0 0}\Ff\FfReadOnly}
+\newcommand{\tBGNoBorderI}{\BC{}\BG{}\autoCenter{n}\textSize{0}
+ \textColor{0 0 0}}
+\newcommand{\cBGNoBorder}{\Q{1}\BC{}\BG{}\autoCenter{n}\textSize{0}
+ \textColor{0 0 0}\BG{.75 .75 .75}\Ff\FfReadOnly}
+\newcommand{\cBGBorder}{\BC{0 0 0}\BG{.75 .75 .75}\autoCenter{n}
+ \textSize{0}\textColor{0 0 0}}
+\newcommand{\myNumPadI}{\F\FHidden\autoCenter{n}\textSize{8}
+ \textFont{\fieldFont}\S{S}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\setDimOf}
+% \begin{macro}{\monoSpaceFont}
+% \begin{macro}{\fieldFont}
+% The following are some customization commands, used for setting field properties that
+% are not included in the presets.
+% \begin{macrocode}
+\newcommand{\setDimOf}[3]{\@namedef{widthOf#1}{#2}%
+ \@namedef{heightOf#1}{#3}}
+\newcommand{\monoSpaceFont}{CoBo}
+\newcommand{\fieldFont}{Helv}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\arithProb}
+% \cs{arithProb} consists of three fields: \texttt{top}, \texttt{operation}, and \texttt{bottom},
+% these three fields are bundled together as a single unit. We use \textbf{courier-bold} for the \texttt{top} and \texttt{bottom}
+% so we can align the decimal points, if there are any.
+% \begin{macrocode}
+\setDimOf{top}{1in}{0.62in}
+\setDimOf{operation}{.38in}{.62in}
+\setDimOf{bottom}{1in}{0.62in}
+\newcommand{\arithProb}{\mbox{\vbox{\offinterlineskip
+ \hbox{\hspace*{\@nameuse{widthOfoperation}}%
+ \textField[\presets{\tBGNoBorder}
+ \textFont{\monoSpaceFont}\Q{2}]{top}%
+ {\@nameuse{widthOf\Fld@name}}{\@nameuse{heightOf\Fld@name}}%
+ }%
+ \hbox{%
+ \textField[\presets{\tBGNoBorder}
+ \textSize{25}\Q{1}]{operation}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}%
+ \textField[\presets{\tBGNoBorder}
+ \textFont{\monoSpaceFont}\Q{2}]{bottom}%
+ {\@nameuse{widthOf\Fld@name}}{\@nameuse{heightOf\Fld@name}}%
+ }}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\alertbox}
+% \begin{macro}{\startAgain}
+% \begin{macro}{\inputRegion}
+% \begin{macro}{\newCard}
+% More components of these flash cards: \cs{alertbox} displays the ``Right/Wrong'' message;
+% \cs{startAgain} is a button for starting all over again, it takes an icon;
+% \cs{inputRegion} is where the user inputs his/her answer;
+% \cs{newCard} a push button for randomly geneating a new problem. These different elements
+% can be placed anywhere.
+% \begin{macrocode}
+\setDimOf{alertbox}{.88in}{.62in}
+\setDimOf{StartAgain}{0.88in}{0.62in}
+\setDimOf{result}{1.38in}{0.62in}
+\setDimOf{NewProblem}{0.88in}{0.62in}
+\newcommand{\alertbox}[1][]{\hbox{\textField[\presets{\tBGNoBorder}
+ \textSize{0}#1]{alertbox}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}}}
+\edef\distillOpts{\ifnum\eq@drivernum=1 \else\noexpand\FB{false}
+ \noexpand\I{null}\noexpand\TP{2}\fi}
+\newcommand{\startAgain}[1][]{\hbox{\expandafter\pushButton\expandafter[\distillOpts
+ \presets{\tBGNoBorderI}\textFont{\fieldFont}\S{S}
+ \textSize{12}\CA{\startAgainMsg}\AC{\startAgainMsg}#1
+ \A{\JS{startAgain();}}]{StartAgain}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}}}
+\newcommand{\inputRegion}[1][]{\hbox{\textField[\presets{\cBGNoBorder}
+ \Ff{-\FfReadOnly}\Q{2}#1\AA{\AAValidate{validateResult();}
+ \AAKeystroke{myNumber_Keystroke(numDecimals,1,0,0,"",true);}
+ \AAFormat{try{%
+ myNumber_Format(numDecimals,1,0,0,"",true);}catch(e){}}}
+ ]{result}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}}}
+\newcommand{\newCard}[1][]{\hbox{\expandafter\pushButton\expandafter[\distillOpts
+ \presets{\tBGNoBorderI}\textFont{\fieldFont}\S{S}
+ \CA{\newCardMsg}\AC{\newCardMsg}#1\A{\JS{newCard();}}
+ ]{NewProblem}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\cbTiming}
+% \begin{macro}{\ansField}
+% \begin{macro}{\cbOperation}
+% \cs{cbTiming} is a dropdown menu for timing; \cs{ansField} is a text field where
+% the correct answers are written; \cs{cbOperation} is a dropdown menu of operations.
+% \begin{macrocode}
+% {\@nameuse{widthOf\Fld@name}}{\@nameuse{heightOf\Fld@name}}
+\setDimOf{TimeDelay}{0.9in}{0.24in}
+\setDimOf{ansregion}{.87in+10bp}{.24in}
+\setDimOf{ChooseOperation}{1.38in-10bp}{0.24in}
+\edef\isReadOnlyTiming{\if\fc@timedscores n\noexpand\Ff{\FfReadOnly}\fi}
+\newcommand{\cbTiming}[1][]{\hbox{%
+ \expandafter\comboBox\expandafter[\isReadOnlyTiming\presets{\cBGBorder}
+ \textFont{\fieldFont}\V{600000}\DV{600000}#1
+ \AA{\AAKeystroke{%
+ if (!event.willCommit) timelimit=event.changeEx;}}
+ ]{TimeDelay}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}{%
+ [(600000)(\fcNoTiming)][(30)(30 sec)][(25)(25 sec)][(20)(20 sec)]%
+ [(15)(15 sec)][(10)(10 sec)][(5)(\space 5 sec)]}}%
+}
+\newcommand{\ansField}[1][]{\hbox{\textField[\presets{\cBGNoBorder}\Q{2}
+ #1\AA{\AAFormat{%
+ if (event.value!="") {\r
+ try{myNumber_Format(numDecimals,1,0,0,"",true);\r
+ event.value="\fmtAnswer\space" + event.value;}catch(e){};}}}
+ ]{ansregion}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}}%
+}
+\newcommand{\cbOperation}[1][]{\hbox{%
+ \comboBox[\presets{\cBGBorder}\textFont{\fieldFont}#1
+ \V{a}\DV{a}]{ChooseOperation}{\@nameuse{widthOf\Fld@name}}%
+ {\@nameuse{heightOf\Fld@name}}{%
+ \ifKV@fcopera@add[(a)(\fcAddition)]\fi%
+ \ifKV@fcopera@sub[(s)(\fcSubtraction)]\fi%
+ \ifKV@fcopera@mul[(m)(\fcMultiplication)]\fi%
+ \ifKV@fcopera@div[(d)(\fcDivision)]\fi}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \cs{szNum} is the width and height of a keypad button.
+% \begin{macrocode}
+\newcommand{\szNum}{14bp}
+% \end{macrocode}
+% \begin{macro}{\Keypad}
+% A keypad for the user to enter responses using the mouse only. Cool!
+% \begin{macrocode}
+\newcommand{\Keypad}{%
+ \vbox{\offinterlineskip\if\fc@keypadlink y
+ \setlength{\fcWidth}{\szNum*4}%
+ \hbox to\fcWidth{\small\hfill\setLink[\linktxtcolor{blue}
+ \A{\JS{ToggleKeyPad()}}]{\toggleKeypad}\hfill}\vskip4bp\fi
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{7}
+ \A{\JS{addDigit(7)}}]{num7}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{8}
+ \A{\JS{addDigit(8)}}]{num8}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{9}
+ \A{\JS{addDigit(9)}}]{num9}{\szNum}{\szNum}}%
+ \vskip1bp
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{4}
+ \A{\JS{addDigit(4)}}]{num4}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{5}
+ \A{\JS{addDigit(5)}}]{num5}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{6}
+ \A{\JS{addDigit(6)}}]{num6}{\szNum}{\szNum}}%
+ \vskip1bp
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{1}
+ \A{\JS{addDigit(1)}}]{num1}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{2}
+ \A{\JS{addDigit(2)}}]{num2}{\szNum}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{3}
+ \A{\JS{addDigit(3)}}]{num3}{\szNum}{\szNum}}%
+ \vskip1bp
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{0}
+ \A{\JS{addDigit(0)}}]{num0}{1bp+\szNum*2}{\szNum}%
+ \kern1bp\pushButton[\presets{\myNumPadI}\CA{\kpDec}
+ \A{\JS{addDigit("Dec")}}
+ ]{Dec}{\szNum}{\szNum}\kern1bp
+ \smash{\vbox{%
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{\kpMinus}
+ \A{\JS{addDigit("Minus")}}
+ ]{Minus}{\szNum}{\szNum}}\kern1bp
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{\kpBack}
+ \textSize{0}\A{\JS{addDigit("Back")}}
+ ]{Back}{\szNum}{\szNum}}\kern1bp
+ \hbox{\pushButton[\presets{\myNumPadI}\CA{\kpEnter}
+ \textSize{0}\A{\JS{addDigit("Enter")}}
+ ]{Enter}{\szNum}{1bp+\szNum*2}}%
+ }}}}%
+}
+% \end{macrocode}
+% \end{macro}
+% \cs{fcSep} is a standard separation between elements.
+% \begin{macrocode}
+\def\fcSep{\quad}
+% \end{macrocode}
+% \begin{macro}{\statsFields}
+% A collection of fields that summarize the attempts at responding to the arithmetic
+% problem.
+% \begin{macrocode}
+\setDimOf{fcSF}{0.37in}{0.25in}
+\newcommand{\statsFieldOpColor}{1 0 0}
+\newcommand{\statsFieldColor}{blue}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\statsFields}{%
+% \end{macrocode}
+% The Addition column
+% \begin{macrocode}
+\ifKV@fcopera@add
+ \vbox{\offinterlineskip
+ \hbox{\textField[\presets{\cBGNoBorder}\textColor{\statsFieldOpColor}
+ \V{+}\DV{+}\Q{1}]{AddScore1}{\widthOffcSF}{\heightOffcSF}}%
+ \hbox{\textField[\presets{\cBGNoBorder}
+ ]{AddScore2}{\widthOffcSF}{\heightOffcSF}}%
+ \hbox{\textField[\presets{\cBGNoBorder}
+ ]{AddScore3}{\widthOffcSF}{\heightOffcSF}}%
+ \hbox{\textField[\presets{\cBGNoBorder}
+ ]{AddScore4}{\widthOffcSF}{\heightOffcSF}}%
+\if\fc@timedscores y
+ \hbox{\textField[\presets{\cBGNoBorder}
+ ]{AddScore5}{\widthOffcSF}{\heightOffcSF}}%
+\fi
+ }\fcSep
+\fi
+% \end{macrocode}
+% The Subtraction column
+% \begin{macrocode}
+\ifKV@fcopera@sub
+\vbox{\offinterlineskip
+ \hbox{\textField[\presets{\cBGNoBorder}\textColor{\statsFieldOpColor}
+ \V{-}\DV{-}\Q{1}]{SubScore1}{\widthOffcSF}{\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{SubScore2}%
+ {\widthOffcSF}{\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{SubScore3}%
+ {\widthOffcSF}{\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{SubScore4}{\widthOffcSF}%
+ {\heightOffcSF}}
+\if\fc@timedscores y
+ \hbox{\textField[\presets{\cBGNoBorder}]{SubScore5}{\widthOffcSF}%
+ {\heightOffcSF}}
+\fi
+ }\fcSep
+\fi
+% \end{macrocode}
+% The Multiplication column
+% \begin{macrocode}
+\ifKV@fcopera@mul
+\vbox{\offinterlineskip
+ \hbox{\textField[\presets{\cBGNoBorder}\textColor{\statsFieldOpColor}
+ \V{x}\DV{x}\Q{1}]{MulScore1}{\widthOffcSF}{\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{MulScore2}{\widthOffcSF}%
+ {\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{MulScore3}{\widthOffcSF}%
+ {\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{MulScore4}{\widthOffcSF}%
+ {\heightOffcSF}}
+\if\fc@timedscores y
+ \hbox{\textField[\presets{\cBGNoBorder}]{MulScore5}{\widthOffcSF}%
+ {\heightOffcSF}}
+\fi
+ }\fcSep
+\fi
+% \end{macrocode}
+% The Division column
+% \begin{macrocode}
+\ifKV@fcopera@div
+\vbox{\offinterlineskip
+ \hbox{\textField[\presets{\cBGNoBorder}\textColor{\statsFieldOpColor}
+ \V{\string\367}\DV{\string\367}\Q{1}]{DivScore1}{\widthOffcSF}%
+ {\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{DivScore2}{\widthOffcSF}%
+ {\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{DivScore3}{\widthOffcSF}%
+ {\heightOffcSF}}
+ \hbox{\textField[\presets{\cBGNoBorder}]{DivScore4}{\widthOffcSF}%
+ {\heightOffcSF}}
+\if\fc@timedscores y
+ \hbox{\textField[\presets{\cBGNoBorder}]{DivScore5}{\widthOffcSF}%
+ {\heightOffcSF}}
+\fi
+ }\fcSep
+\fi
+% \end{macrocode}
+% Description column
+% \begin{macrocode}
+\vbox{\offinterlineskip
+ \hbox{\parbox[b][.25in][c]{.75in}{%
+ \textcolor{blue}{\operation}\hfill}}
+ \hbox{\parbox[b][.25in][c]{1.25in}{%
+ \textcolor{blue}{\numCorrect}\hfill}}
+ \hbox{\parbox[b][.25in][c]{1.25in}{%
+ \textcolor{blue}{\numAttempted}\hfill}}
+ \hbox{\parbox[b][.25in][c]{1.25in}{%
+ \textcolor{blue}{\percentCorrect}\hfill}}
+\if\fc@timedscores y
+ \hbox{\textField[\presets{\cBGNoBorder}\textColor{\statsFieldOpColor}
+ ]{ScoreTotal}{.51in}{.25in}\kern1bp
+ \makebox[0pt][l]{\pushButton[\presets{\tBGNoBorder}
+ \Ff{-\FfReadOnly}\S{S}\H{I}\textSize{10}
+ \A{\JS{docTimeScores();}}]{Descrip5}{1in}{.25in}}%
+ \parbox[b][.25in][c]{1in}{%
+ \centering\textcolor{blue}{\timedScores}}}%
+\fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%\section{JavaScript Code}
+% \begin{macrocode}
+\edef\bFCa{/\ifKV@fcopera@add/\else*\fi}
+\edef\eFCa{\ifKV@fcopera@add/\else*\fi/}
+\edef\bFCs{/\ifKV@fcopera@sub/\else*\fi}
+\edef\eFCs{\ifKV@fcopera@sub/\else*\fi/}
+\edef\bFCm{/\ifKV@fcopera@mul/\else*\fi}
+\edef\eFCm{\ifKV@fcopera@mul/\else*\fi/}
+\edef\bFCd{/\ifKV@fcopera@div/\else*\fi}
+\edef\eFCd{\ifKV@fcopera@div/\else*\fi/}
+\begin{insDLJS*}[_loadfcjs]{fcjs}
+\begin{newsegment}{data}
+var _loadfcjs=true;
+var t, b, o, r, c, oAlert;
+function getFieldObjects()
+{
+ t=this.getField("top");
+ b=this.getField("bottom");
+ o=this.getField("operation");
+ r=this.getField("result");
+ c=this.getField("ChooseOperation");
+ oAlert=this.getField("alertbox");
+ useKeyPad = (this.getField("Enter").display==display.visible);
+}
+var turnoff=false;
+var timedScores=\fcTimedScores;
+var useKeyPad = false;
+var decimalPressed = false;
+var keypadInput=false;
+var operand='a';
+var NumAddCorr=0;
+var NumAddTried=0;
+var NumSubCorr=0;
+var NumSubTried=0;
+var NumMulCorr=0;
+var NumMulTried=0;
+var NumDivCorr=0;
+var NumDivTried=0;
+timelimit=600000;
+mybegin="";
+getFieldObjects();
+var numDecimals=0;
+var addDecT = \fcaddDecT, addDecB = \fcaddDecB;
+var addT_a = Number(\fcAddTParams[0]);
+var addT_b = Number(\fcAddTParams[1]);
+var addB_a = Number(\fcAddBParams[0]);
+var addB_b = Number(\fcAddBParams[1]);
+var subDecT = \fcsubDecT, subDecB = \fcsubDecB;
+var subT_a = Number(\fcSubTParams[0]);
+var subT_b = Number(\fcSubTParams[1]);
+var subB_a = Number(\fcMulBParams[0]);
+var subB_b = Number(\fcMulBParams[1]);
+var mulDecT = \fcmulDecT, mulDecB = \fcmulDecB;
+var mulT_a = Number(\fcMulTParams[0]);
+var mulT_b = Number(\fcMulTParams[1]);
+var mulB_a = Number(\fcMulBParams[0]);
+var mulB_b = Number(\fcMulBParams[1]);
+% \end{macrocode}
+% Here, Q corresponds to the quotient, and B corresponds to the divisor
+% \begin{macrocode}
+var divDecQ = \fcdivDecQ, divDecB = \fcdivDecB;
+var divQ_a = Number(\fcDivQParams[0]);
+var divQ_b = Number(\fcDivQParams[1]);
+var divB_a = Number(\fcDivBParams[0]);
+var divB_b = Number(\fcDivBParams[1]);
+\end{newsegment}
+\begin{newsegment}{updatescore}
+function updatescore(f,t) {
+ // console.println(t);
+ var points;
+ if(t<=5) points=6;
+ if((t>5)&&(t<=10)) points=5;
+ if((t>10)&&(t<=15)) points=4;
+ if((t>15)&&(t<=20)) points=3;
+ if((t>20)&&(t<=25)) points=2;
+ if(t>=25) points=1;
+ var oField=this.getField(f);
+ if ( oField != null ) {
+ oField.value+=points;
+ this.getField("ScoreTotal").value+=points;
+ }
+}
+function docTimeScores() {
+ app.execDialog(fcTimedScoresDialog);
+}
+var fcTimedScoresDialog =
+{
+ // set a default value for radio button field
+ initialize: function(dialog) {
+ },
+ // when user presses "Ok", this handler will execute first
+ commit: function(dialog) {
+ },
+ // The Dialog Description
+ description:
+ {
+ name: "PDF Flash Cards - Timed Scores",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "instr",
+ name: "Points are awarded, based on time, "
+ +"for successfully solving a problem:"
+ }
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "hr01",
+ char_width: 22,
+ font: "dialog",
+ bold: true,
+ name: "Time elapsed"
+ },
+ {
+ type: "static_text",
+ item_id: "hr02",
+ font: "dialog",
+ bold: true,
+ name: "Points"
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st11",
+ char_width: 22,
+ name: "Less then 5 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st12",
+ name: " 6"
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st21",
+ char_width: 22,
+ name: "Between 5 and 10 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st22",
+ name: " 5"
+ },
+ ]
+ },
+//---
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st31",
+ char_width: 22,
+ name: "Between 10 and 15 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st32",
+ name: " 4"
+ },
+ ]
+ },
+//---
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st41",
+ char_width: 22,
+ name: "Between 10 and 20 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st42",
+ name: " 3"
+ },
+ ]
+ },
+ ]
+ },
+//---
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st51",
+ char_width: 22,
+ name: "Between 20 and 25 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st52",
+ name: " 2"
+ },
+ ]
+ },
+//---
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "gap",
+ width: 10
+ },
+ {
+ type: "static_text",
+ item_id: "st61",
+ char_width: 22,
+ name: "Greater than 25 sec"
+ },
+ {
+ type: "static_text",
+ item_id: "st62",
+ name: " 1"
+ },
+ ]
+ },
+//---
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ alignment: "align_right",
+ type: "ok",
+ }
+ ]
+ }
+ ]
+ }
+}
+function validateResult()
+{
+ var oField;
+ if (!turnoff && !keypadInput) {
+% event.target.readonly=true;
+ MsgFlag=false;
+ delay=true;
+ timenow=new Date();
+ mynow=util.printd("mmm d, yyyy, H:M:s",timenow);
+ elapsedtime = (Date.parse(mynow)-Date.parse(mybegin))/1000;
+ timeelapsed = (elapsedtime>timelimit);
+ switch (operand) {
+ case 'a':
+ oField = this.getField("AddScore2");
+ calculation=Number(t.value)+Number(b.value);
+ if(timeelapsed) {
+ if (timedScores) app.alert("\timeUpMsg",3);
+ if ( oField != null ) oField.value=NumAddCorr;
+ } else {
+ if(Number(event.value)==calculation) {
+ MsgFlag=true;
+ if ( oField != null ) {
+ oField.value=++NumAddCorr;
+ updatescore("AddScore5",elapsedtime);
+ }
+ }
+ else
+ if ( oField != null ) oField.value=NumAddCorr;
+ }
+ oField = this.getField("AddScore3");
+ if (oField != null ) oField.value=++NumAddTried;
+ oField = this.getField("AddScore4");
+ if (oField != null ) oField.value = util.printf("\%.0f",
+ (NumAddCorr/NumAddTried)*100);
+ break;
+ case 's':
+ oField=this.getField("SubScore2");
+ calculation=Number(t.value)-Number(b.value);
+ if(timeelapsed) {
+ if (timedScores) app.alert("\timeUpMsg",3);
+ oField.value=NumSubCorr;
+ } else {
+ if(Number(event.value)==calculation) {
+ MsgFlag=true;
+ if ( oField != null ) {
+ oField.value=++NumSubCorr;
+ updatescore("SubScore5",elapsedtime);
+ }
+ } else
+ if ( oField != null ) oField.value=NumSubCorr;
+ }
+ oField=this.getField("SubScore3");
+ if (oField != null) oField.value=++NumSubTried;
+ oField=this.getField("SubScore4");
+ if (oField != null) oField.value=util.printf("\%.0f",
+ (NumSubCorr/NumSubTried)*100);
+ break;
+ case 'm':
+ oField=this.getField("MulScore2");
+ calculation=util.printf("\%."+numDecimals+"f",
+ (t.value*b.value));
+ if(timeelapsed) {
+ if (timedScores) app.alert("\timeUpMsg",3);
+ if (oField != null) oField.value=NumSubCorr;
+ } else {
+ if(Number(event.value)==Number(calculation)) {
+ MsgFlag=true;
+ if (oField != null) {
+ oField.value=++NumMulCorr;
+ updatescore("MulScore5",elapsedtime);
+ }
+ } else
+ if (oField != null) oField.value=NumMulCorr;
+ }
+ oField=this.getField("MulScore3");
+ if (oField != null) oField.value=++NumMulTried;
+ oField=this.getField("MulScore4");
+ if (oField != null) oField.value=util.printf("\%.0f",
+ (NumMulCorr/NumMulTried)*100);
+ break;
+ case 'd':
+ oField=this.getField("DivScore2");
+% calculation=t.value/b.value;
+ calculation=util.printf("\%."+numDecimals+"f",
+ t.value/b.value);
+ if(timeelapsed) {
+ if (timedScores) app.alert("\timeUpMsg",3);
+ if (oField != null) oField.value=NumDivCorr;
+ } else {
+ if(Number(event.value)==Number(calculation)) {
+ MsgFlag=true;
+ if (oField != null) {
+ oField.value=++NumDivCorr;
+ updatescore("DivScore5",elapsedtime);
+ }
+ } else
+ if ( oField != null ) oField.value=NumDivCorr;
+ }
+ oField = this.getField("DivScore3");
+ if (oField != null) oField.value=++NumDivTried;
+ oField = this.getField("DivScore4");
+ if (oField != null) oField.value=util.printf("\%.0f",
+ (NumDivCorr/NumDivTried)*100);
+ break;
+ }
+ if(!timeelapsed) {
+ if(MsgFlag) {
+ oAlert.textColor=color.blue;
+ oAlert.value="\rightMsg";
+ } else {
+ oAlert.textColor=color.red;
+ oAlert.value="\wrongMsg";
+ }
+ }
+ this.getField("ansregion").value=calculation;
+ this.getField("NewProblem").setFocus() ;
+ delay=false;
+ }
+}
+function startAgain() {
+ getFieldObjects();
+ turnoff=true;
+ event.rc=false;
+ this.resetForm();
+ operand='+';
+ NumAddCorr=0;
+ NumAddTried=0;
+ NumSubCorr=0;
+ NumSubTried=0;
+ NumMulCorr=0;
+ umMulTried=0;
+ NumDivCorr=0;
+ NumDivTried=0;
+}
+function newCard() {
+ turnoff=true;
+ this.resetForm(["result","top","bottom","ansregion","alertbox"]);
+ operand = c.value;
+ switch (operand)
+ {
+ case 'a':
+ {
+ o.value='+'; // addDecT
+ numDecimals = Math.max(addDecT,addDecB);
+ var topTemplate = "\%."+addDecT+"f";
+ var botTemplate = "\%."+addDecB+"f";
+ var matchTemplate = "\%."+ numDecimals +"f";
+ var m=util.printf(topTemplate,
+ (addT_b-addT_a)*Math.random()+addT_a);
+ var n=util.printf(botTemplate,
+ (addB_b-addB_a)*Math.random()+addB_a);
+ m=util.printf(matchTemplate,m);
+ n=util.printf(matchTemplate,n);
+ var nWidth=(m.length < n.length) ? n.length : m.length;
+ var commonTemplate = "\%"+nWidth+"."+numDecimals+"f";
+ t.value=util.printf(commonTemplate,m);
+ b.value=util.printf(commonTemplate,n);
+ break;
+ }
+ case 's':
+ {
+ o.value="-";
+ numDecimals = Math.max(subDecT,subDecB);
+ var topTemplate = "\%."+subDecT+"f";
+ var botTemplate = "\%."+subDecB+"f";
+ var matchTemplate = "\%."+ numDecimals +"f";
+ var m=util.printf(topTemplate,
+ (subT_b-subT_a)*Math.random()+subT_a);
+ var n=util.printf(botTemplate,
+ (subB_b-subB_a)*Math.random()+subB_a);
+ m=util.printf(matchTemplate,m);
+ n=util.printf(matchTemplate,n);
+ var nWidth=(m.length < n.length) ? n.length : m.length;
+ var commonTemplate = "\%"+nWidth+"."+numDecimals+"f";
+ t.value=util.printf(commonTemplate,m);
+ b.value=util.printf(commonTemplate,n);
+ if(!\fcAllowSub\space && (b.value>t.value))
+ {
+ var tmp = b.value;
+ b.value = t.value;
+ t.value = tmp;
+ }
+ break;
+ }
+ case 'm':
+ {
+ o.value='x';
+ numDecimals=Math.max(mulDecT,mulDecB);
+ var topTemplate = "\%."+mulDecT+"f";
+ var botTemplate = "\%."+mulDecB+"f";
+ var matchTemplate = "\%."+ numDecimals +"f";
+ var m=util.printf(topTemplate,
+ (mulT_b-mulT_a)*Math.random()+mulT_a);
+ var n=util.printf(botTemplate,
+ (mulB_b-mulB_a)*Math.random()+mulB_a);
+ m=util.printf(matchTemplate,m);
+ n=util.printf(matchTemplate,n);
+ var nWidth=(m.length < n.length) ? n.length : m.length;
+ var commonTemplate = "\%"+nWidth+"."+numDecimals+"f";
+ t.value=util.printf(commonTemplate,m);
+ b.value=util.printf(commonTemplate,n);
+ numDecimals = mulDecT + mulDecB;
+ break;
+ }
+ case 'd':
+ {
+% o.value='/';
+ o.value='\string\367'
+ numDecimals=divDecQ+divDecB;
+% numDecimals=Math.max(divDecQ,divDecB);
+ var topTemplate = "\%."+divDecQ+"f";
+ var botTemplate = "\%."+divDecB+"f";
+ var matchTemplate = "\%."+ numDecimals +"f";
+ var n,m;
+ var quotient=util.printf(topTemplate,
+ divQ_a + (divQ_b-divQ_a)*Math.random());
+ for(n=util.printf(botTemplate,
+ divB_a + (divB_b-divB_a)*Math.random());
+ n==0; n=util.printf("\%.0f",
+ divB_a + (divB_b-divB_a)*Math.random()));
+ m=util.printf(matchTemplate,quotient*n);
+ n=util.printf(matchTemplate,n);
+ var nWidth=(m.length < n.length) ? n.length : m.length;
+ var commonTemplate = "\%"+nWidth+"."+numDecimals+"f";
+ t.value=util.printf(commonTemplate,m);
+ b.value=util.printf(commonTemplate,n);
+ numDecimals = divDecQ;
+ break;
+ }
+ }
+ // console.println("operation = " + o.value);
+ turnoff=false;
+ if (!useKeyPad) r.readonly=false;
+ timebegin = new Date();
+ mybegin = util.printd("mmm d, yyyy, H:M:s",timebegin);
+ r.setFocus();
+}
+function addDigit(n) {
+ if (oAlert.value != "") return;
+ switch (n) {
+ case "Enter":
+ var tmp_value=r.valueAsString;
+ this.resetForm(["result"]);
+ keypadInput=false;
+ r.value = tmp_value;
+ break;
+ case "Back":
+ keypadInput=true;
+ var tmp_value=r.valueAsString;
+ if (tmp_value != "")
+ r.value = tmp_value.substring(0,tmp_value.length-1);
+ break;
+ case "Dec":
+ keypadInput=true;
+ var v=r.valueAsString;
+ v = v + ".";
+ r.value = v
+ break;
+ case "Minus":
+ keypadInput=true;
+ var v=r.valueAsString;
+ if (r.value < 0 ) {
+ v = String(Math.abs(v));
+ } else v = "-" + v;
+ r.value = v;
+ break;
+ default:
+ keypadInput=true;
+ v=r.valueAsString
+ v = v + String(n);
+ r.value = v
+ }
+}
+function ToggleKeyPad() {
+ useKeyPad = !useKeyPad;
+ this.delay=true;
+ if (useKeyPad) {
+ for (var i=0; i<= 9; i++)
+ this.getField("num"+i).display=display.visible;
+ this.getField("Back").display=display.visible;
+ this.getField("Enter").display=display.visible;
+ this.getField("Dec").display=display.visible;
+ this.getField("Minus").display=display.visible;
+ this.getField("result").readonly=true;
+ } else {
+ for (var i=0; i<= 9; i++)
+ this.getField("num"+i).display=display.hidden;
+ this.getField("Back").display=display.hidden;
+ this.getField("Enter").display=display.hidden;
+ this.getField("Dec").display=display.hidden;
+ this.getField("Minus").display=display.hidden;
+ this.getField("result").readonly=false;
+ }
+ this.delay=false;
+}
+\end{newsegment}
+\begin{newsegment}{Custom Keystroke for Numbers}
+function myNumber_Keystroke(nDec,sepStyle,negStyle,currStyle,
+ strCurrency,bCurrencyPrepend) {
+ var v = t.valueAsString;
+ if ( v == "")
+ { event.rc=false; this.resetForm(["result"]); }
+ else
+ if ( event.value != "-" && event.value != ".")
+ AFNumber_Keystroke(nDec,sepStyle,negStyle,currStyle,
+ strCurrency,bCurrencyPrepend);
+}
+function myNumber_Format(nDec,sepStyle,negStyle,currStyle,
+ strCurrency,bCurrencyPrepend) {
+ if ( !useKeyPad && event.value != "-" && event.value != ".")
+ AFNumber_Format(nDec,sepStyle,negStyle,currStyle,
+ strCurrency,bCurrencyPrepend);
+}
+\end{newsegment}
+\begin{newsegment}{Option Dialog Box}
+var fcDialog =
+{
+ // set a default value for radio button field
+ initialize: function(dialog) {
+ var addDT="AT0" + String(addDecT);
+ var addDB="AB0" + String(addDecB);
+ var subDT="ST0" + String(subDecT);
+ var subDB="SB0" + String(subDecB);
+ var mulDT="MT0" + String(mulDecT);
+ var mulDB="MB0" + String(mulDecB);
+ var divDQ="DQ0" + String(divDecQ);
+ var divDB="DB0" + String(divDecB);
+ var radioString = addDT +": true, " + addDB +": true, "
+ + subDT + ": true, " + subDB + ": true, "
+ + mulDT + ": true, " + mulDB + ": true, "
+ + divDQ + ": true, " + divDB + ": true "
+//console.println("radioString="+radioString);
+ eval("dialog.load({" + radioString + "})");
+ dialog.load({
+ // Populate the addition first
+ "aT_a": util.printf("\%.0f",addT_a),
+ "aT_b": util.printf("\%.0f",addT_b),
+ "aB_a": util.printf("\%.0f",addB_a),
+ "aB_b": util.printf("\%.0f",addB_b),
+ // subtraction
+ "sT_a": util.printf("\%.0f",subT_a),
+ "sT_b": util.printf("\%.0f",subT_b),
+ "sB_a": util.printf("\%.0f",subB_a),
+ "sB_b": util.printf("\%.0f",subB_b),
+ // multiplication
+ "mT_a": util.printf("\%.0f",mulT_a),
+ "mT_b": util.printf("\%.0f",mulT_b),
+ "mB_a": util.printf("\%.0f",mulB_a),
+ "mB_b": util.printf("\%.0f",mulB_b),
+ // division
+ "dQ_a": util.printf("\%.0f",divQ_a),
+ "dQ_b": util.printf("\%.0f",divQ_b),
+ "dB_a": util.printf("\%.0f",divB_a),
+ "dB_b": util.printf("\%.0f",divB_b)
+ });
+ },
+ // when user presses "Ok", this handler will execute first
+ commit: function(dialog) {
+ var results = dialog.store();
+ addT_a = Math.round(results["aT_a"]);
+ addT_b = Math.round(results["aT_b"]);
+ addB_a = Math.round(results["aB_a"]);
+ addB_b = Math.round(results["aB_b"]);
+ for (var i=0; i < 3; i++)
+ if (results["AT0"+i]) { addDecT = i; break; }
+ for (var i=0; i < 3; i++)
+ if (results["AB0"+i]) { addDecB = i; break; }
+ // subtraction
+ subT_a = Math.round(results["sT_a"]);
+ subT_b = Math.round(results["sT_b"]);
+ subB_a = Math.round(results["sB_a"]);
+ subB_b = Math.round(results["sB_b"]);
+ for (var i=0; i < 3; i++)
+ if (results["ST0"+i]) { subDecT = i; break; }
+ for (var i=0; i < 3; i++)
+ if (results["SB0"+i]) { subDecB = i; break; }
+ // multiplication
+ mulT_a = Math.round(results["mT_a"]);
+ mulT_b = Math.round(results["mT_b"]);
+ mulB_a = Math.round(results["mB_a"]);
+ mulB_b = Math.round(results["mB_b"]);
+ for (var i=0; i < 3; i++)
+ if (results["MT0"+i]) { mulDecT = i; break; }
+ for (var i=0; i < 3; i++)
+ if (results["MB0"+i]) { mulDecB = i; break; }
+ // division
+ divQ_a = Math.round(results["dQ_a"]);
+ divQ_b = Math.round(results["dQ_b"]);
+ divB_a = Math.round(results["dB_a"]);
+ divB_b = Math.round(results["dB_b"]);
+ for (var i=0; i < 3; i++)
+ if (results["DQ0"+i]) { divDecQ = i; break; }
+ for (var i=0; i < 3; i++)
+ if (results["DB0"+i]) { divDecB = i; break; }
+ },
+ // The Dialog Description
+ description:
+ {
+ name: "PDF Flash Cards - Options",
+ align_children: "align_left",
+ elements:
+ [
+\bFCa
+ { // The Addition Cluster
+ type: "cluster",
+ name: "Addition",
+ item_id: "add",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "addRngT",
+ name: "Range Top "
+ },
+ {
+ item_id: "aT_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "addRngToT",
+ name: " to "
+ },
+ {
+ item_id: "aT_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "aDcT",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "AT00",
+ group_id: "AddT",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "AT01",
+ group_id: "AddT",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "AT02",
+ group_id: "AddT",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "addRngB",
+ name: "Range Bottom"
+ },
+ {
+ item_id: "aB_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "addRngToB",
+ name: " to "
+ },
+ {
+ item_id: "aB_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "aDcB",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "AB00",
+ group_id: "AddB",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "AB01",
+ group_id: "AddB",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "AB02",
+ group_id: "AddB",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ }
+ ]
+ }, // End Addition Cluster
+\eFCa
+\bFCs
+ { // The Subtraction Cluster
+ type: "cluster",
+ name: "Subtraction",
+ item_id: "sub",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "subRngT",
+ name: "Range Top "
+ },
+ {
+ item_id: "sT_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "subRngToT",
+ name: " to "
+ },
+ {
+ item_id: "sT_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "sDT",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "ST00",
+ group_id: "SubT",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "ST01",
+ group_id: "SubT",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "ST02",
+ group_id: "SubT",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "subRngB",
+ name: "Range Bottom"
+ },
+ {
+ item_id: "sB_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "subRngToB",
+ name: " to "
+ },
+ {
+ item_id: "sB_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "sDcB",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "SB00",
+ group_id: "SubB",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "SB01",
+ group_id: "SubB",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "SB02",
+ group_id: "SubB",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ }
+ ]
+ }, // End Subtraction Cluster
+\eFCs
+\bFCm
+ { // The Multiplication Cluster
+ type: "cluster",
+ name: "Multiplication",
+ item_id: "mul",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "mulRngT",
+ name: "Range Top "
+ },
+ {
+ item_id: "mT_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "mulRngToT",
+ name: " to "
+ },
+ {
+ item_id: "mT_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "mDcT",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "MT00",
+ group_id: "MulT",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "MT01",
+ group_id: "MulT",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "MT02",
+ group_id: "MulT",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "mulRngB",
+ name: "Range Bottom"
+ },
+ {
+ item_id: "mB_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "mulRngToB",
+ name: " to "
+ },
+ {
+ item_id: "mB_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "mDcB",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "MB00",
+ group_id: "MulB",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "MB01",
+ group_id: "MulB",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "MB02",
+ group_id: "MulB",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ }
+ ]
+ }, // End Multiplication Cluster
+\eFCm
+\bFCd
+ { // The Division Cluster
+ type: "cluster",
+ name: "Division",
+ item_id: "div",
+ align_children: "align_left",
+ elements:
+ [
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "divRngQ",
+ name: "Range Quotient"
+ },
+ {
+ item_id: "dQ_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "divRngToT",
+ name: " to "
+ },
+ {
+ item_id: "dQ_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "dDcQ",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "DQ00",
+ group_id: "DivQ",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "DQ01",
+ group_id: "DivQ",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "DQ02",
+ group_id: "DivQ",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ },
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "divRngB",
+ name: "Range Divisor "
+ },
+ {
+ item_id: "dB_a",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "static_text",
+ item_id: "divRngToB",
+ name: " to "
+ },
+ {
+ item_id: "dB_b",
+ type: "edit_text",
+ alignment: "align_fill",
+ width: 40,
+ height: 20
+ },
+ {
+ type: "view",
+ align_children: "align_distribute",
+ elements:
+ [
+ {
+ type: "static_text",
+ item_id: "dDcB",
+ name: "Decimals:"
+ },
+ {
+ type: "radio",
+ item_id: "DB00",
+ group_id: "DivB",
+ name: "none"
+ },
+ {
+ type: "radio",
+ item_id: "DB01",
+ group_id: "DivB",
+ name: "1",
+ },
+ {
+ type: "radio",
+ item_id: "DB02",
+ group_id: "DivB",
+ name: "2",
+ },
+ ]
+ },
+ ]
+ }
+ ]
+ }, // End Division Cluster
+\eFCd
+ {
+ type: "view",
+ align_children: "align_row",
+ elements:
+ [
+ {
+ alignment: "align_right",
+ type: "ok_cancel",
+ }
+ ]
+ }
+ ]
+ }
+}
+\end{newsegment}
+\end{insDLJS*}
+\begin{insDLJS}[fcMenu]{fcmd}{Menu Data}
+\fcMenu
+function processFcMenu() {
+ var cChoice = \popUpMenu(fcMenu);
+ if ( cChoice != null ) {
+ switch(cChoice) {
+ case "0": app.execDialog(fcDialog);
+ break;
+ case "1": ToggleKeyPad();
+ break
+ case "2": app.execMenuItem("GeneralInfo");
+ }
+ }
+}
+\end{insDLJS}
+% \end{macrocode}
+% \begin{macrocode}
+\InputIfFileExists{fc_custom.def}{}{}
+% \end{macrocode}
+
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/fc_arith/fc_arith.ins b/Master/texmf-dist/source/latex/fc_arith/fc_arith.ins
new file mode 100644
index 00000000000..dcf5c0c2fa5
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fc_arith/fc_arith.ins
@@ -0,0 +1,62 @@
+%%
+%% 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{2010/03/17}
+\def\batchfile{fc_arith.ins}
+\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
+%\askonceonly
+%\usedir{tex/latex/hyperref}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+
+\generate{%
+ \file{fc_arith.sty}{\from{fc_arith.dtx}{copyright,package}}
+ \file{fc_arith.drv}{\from{fc_arith.dtx}{copyright,driver}}
+}
+
+\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