%D \module
%D   [      file=x-e-1004,
%D        version=2002.12.01,
%D          title=\EXAMPLE\ GUI Files,
%D       subtitle=Labels,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is experimental code. Don't change it, don't rely on
%D this interface remaining the same, don't use tricks used
%D here but not described in manuals, so: assume that this
%D file does not exists.

\usemodule[e-0000]

\usemodule[contml,mathml] \autoXMLnamespace[context]

\loadEXArequest{\inputfilename}
\loadEXAmodes  {examodes.tex}

\setupoutput
  [pdftex]

\setuplayout
  [location=middle]

\setuparranging
  [XY]

\setupcolors
  [state=start]

\setuppapersize
  [page=XY]

\setuplayout
  [width=middle,
   height=middle,
   margin=0pt,
   header=0pt,
   footer=0pt]

\dontcomplain

\setupmakeup
  [standard]
  [doublesided=no,
   pagestate=start]

\startsetups [fake]

  \dorecurse {\getvariable{fake}{n}}
    {\startstandardmakeup
       \centerbox{\bfd label \recurselevel}
     \stopstandardmakeup}

\stopsetups

\startsetups [make]

  \dorecurse {\getvariable{make}{n}}
    {\startstandardmakeup
       \getEXAcalcmath{text:content}
     \stopstandardmakeup}

\stopsetups

\startsetups [skip]

  \dorecurse {\getvariable{skip}{n}}
    {\startstandardmakeup
       \doifmode{process-test}{\centerbox{\bfd skipped \recurselevel}}
     \stopstandardmakeup}

\stopsetups

\startsetups [file]

  \dorecurse {\getvariable{make}{n}}
    {\startstandardmakeup
       \doifelsenothing{\mainEXAfilename}
         {\bfd no file given}
         {\processXMLfilegrouped{\mainEXAfilename}}
     \stopstandardmakeup}

\stopsetups

\startsetups [address]

  \usemodule[corres] \useXMLfilter[ent]

  \setvariables
    [contacts]
    [selection={\getvariable{selection}{label}}]

  \startlocalsetups[contact:handle]
    \startstandardmakeup
      \XMLflush{address}
    \stopstandardmakeup
  \stoplocalsetups

  \doifelsenothing{\mainEXAfilename}
    {\setups[file]}
    {\dorecurse {\getvariable{make}{n}}
       {\XMLprocesscontacts[\mainEXAfilename]}}

\stopsetups

\starttext

\startmode[process-test]

 \setupbackgrounds[text][background=screen,backgroundscreen=.8]
 \setupbackgrounds[page][background=screen,backgroundscreen=.6]

 \setups[skip]
 \setups[fake]

\stopmode

\startmode[process-content]

  \setups[skip]
  \setups[make]

\stopmode

\startmode[process-file]

  \setups[skip]
  \setups[file]

\stopmode

\startmode[process-address]

%   \doifmodeelse{atpragma}
%     {\setups[skip]\setups[address]}
%     {under (re)construction\endgraf
%      for the moment only\endgraf
%      available at pragma}

    \setups[skip]\setups[address]

\stopmode

\stoptext
