%D \module
%D   [       file=t-fullpage,
%D        version=2008.12.23,
%D          title=\CONTEXT\ User Module,
%D       subtitle=Fullpage documents,
%D         author=Wolfgang Schuster,
%D           date=\currentdate,
%D      copyright=Wolfgang Schuster,
%D        license=Public Domain]

%D \subject{Documentation}
%D
%D This module tries to copy the behaviour of the \filename {fullpage} package
%D for \LaTeX, Mohamed Bana asked on the \ConTeXt\ mailing list if a module
%D with the same functions is available and this module was the result.
%D
%D To use this module load it with the \type {\usemodule} commmand and pass
%D a option with the \type {style} key in the optional argument.
%D
%D \starttyping
%D \usemodule[fullpage][style={cm,empty}]
%D
%D \starttext
%D \input knuth
%D \stoptext
%D \stoptyping
%D
%D The module provides the following styles:
%D
%D \starttable[|Bl|l|]
%D \HL
%D \NC in       \NC set the margins to 1in                 \NC\AR
%D \NC cm       \NC set the margins to 1.5cm               \NC\AR
%D \NC plain    \NC no header and narrow footer with 0.5cm \NC\AR
%D \NC headings \NC narrow header and footer with 0.5cm    \NC\AR
%D \NC empty    \NC no header and footer                   \NC\AR
%D \HL
%D \stoptable
%D
%D \subject{Implementation}

\unprotect

\startinterface all
  \setinterfacevariable {fullpage} {fullpage}
  \setinterfacevariable {in}       {in}
  \setinterfacevariable {cm}       {cm}
  \setinterfacevariable {plain}    {plain}
  \setinterfacevariable {headings} {headings}
\stopinterface

\startmodule[\v!fullpage]

\setupmodule
  [\c!style={\v!in,\v!plain}]

\startsetups[\v!fullpage:\v!in]

\setuplayout
  [\c!backspace=1in,
   \c!width=\v!middle,
   \c!topspace=1in,
   \c!height=\v!middle]

\stopsetups

\startsetups[\v!fullpage:\v!cm]

\setuplayout
  [\c!backspace=15mm,
   \c!width=\v!middle,
   \c!topspace=15mm,
   \c!height=\v!middle]

\stopsetups

\startsetups[\v!fullpage:\v!plain]

\setuplayout
  [\c!header=0pt,
   \c!footer=.5in]

\stopsetups

\startsetups[\v!fullpage:\v!empty]

\setuplayout
  [\c!header=0pt,
   \c!footer=0pt]

\stopsetups

\startsetups[\v!fullpage:\v!headings]

\setuplayout
  [\c!header=.5in,
   \c!footer=.5in]

\stopsetups

\def\dofullpagelayout#1%
  {\directsetup{\v!fullpage:#1}}

\processcommacommand[\currentmoduleparameter\c!style]\dofullpagelayout

\stopmodule

\protect \endinput
