%D \module
%D   [      file=x-e-2001,
%D        version=2002.12.01,
%D          title=\EXAMPLE\ GUI Files, 
%D       subtitle=Listings, 
%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. 

\usemodule[e-0000]

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

\setuplayout
  [width=middle,
   height=middle]

\setupheadertexts
  [pagenumber]

\setupfootertexts
  [\mainEXAfilename] % \inputfilename

\setuptolerance
  [verytolerant]

\setupalign
  [broad,right]

\startsetups [pretty file]

  \setupsystem[inputfile=\mainEXAfilename]

  \startmode[*suffix-xml]
    \setupXMLfile[level=2]
  \stopmode 

  \startmode[*suffix-rng]
    \setupXMLfile[level=2]
    \showXMLlin[value]
  \stopmode

  \startmode[*suffix-rlg]
    \setupXMLfile[level=2]
    \showXMLlin
      [rl:type,rl:state,rl:name,rl:suffix,rl:label,rl:file,rl:original, 
       rl:width,rl:height,rl:base,rl:page]
  \stopmode

  \startmode[*suffix-exa]
    \setupXMLfile[level=2]
    \showXMLlin
      [exa:resolve,exa:include]
  \stopmode

  \setuptyping[option=tex]

  \doifmodeelse{*suffix-xml,*suffix-rng,*suffix-rlg,*suffix-exa}
    {\showXMLfile{\mainEXAfilename}}
    {\typefile{\mainEXAfilename}}

\stopsetups

\startsetups [normal file]

  \typefile{\mainEXAfilename}

\stopsetups

\startsetups [no file]
  You forgot to select a file.
\stopsetups 

\starttext

\doifelsenothing{\mainEXAfilename}
  {\setups[no file]}
  {\doifmodeelse{pretty-yes}
     {\setups[pretty file]}
     {\setups[normal file]}}

\stoptext
