%D \module
%D   [      file=x-fig-11,
%D        version=2003.02.08,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Resource Reporting (3),
%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[res-00]

\defineXMLenvironment [rl:library] 
  {\starttext 
   \doiffileelse{\outputfilename.zip}{\setups[rl:attach]}{}
   \disablemode[rl:used]}
  {\doifnotmode{rl:used}{No images processed.}
   \page
   \stoptext}

\defineXMLenvironment [rl:usage] 
  {\bgroup} 
  {\doifnot{\XMLflush{rl:file}}{dummy}
     {\setups[rl:usage]
      \enablemode[rl:used]}
   \egroup}

\defineXMLsave [rl:base]    % base
\defineXMLsave [rl:type]    % figure
\defineXMLsave [rl:state]   % found|missing
\defineXMLsave [rl:label]   % label
\defineXMLsave [rl:file]    % filename
\defineXMLsave [rl:suffix]  % filesuffix
\defineXMLsave [rl:comment] % text 
\defineXMLsave [rl:width]   % width in pt
\defineXMLsave [rl:height]  % height in pt
\defineXMLsave [rl:page]    % page from file 

\def\XMLbpentry#1%
  {\PointsToWholeBigPoints{\XMLflush{#1}}\temp\temp bp}

\def\XMLrlentry#1#2#3%
  {\tableiftextelse{\XMLflush{#2}}
     {\NC\bf#1\NC\XMLflush{#2}\doif{#3}{1}{ (\XMLbpentry{#2})}\NC\NR}{}}

\unprotect 

\setuplayout[\v!middle]

\startsetups[rl:figure]

  \externalfigure[\XMLflush{rl:file}][\c!width=4cm]
 
\stopsetups

\startsetups[rl:table]

% by using a dedicated tabulation, we permit usage in dutch interface

\definetabulate[XMLRLG][|lw(4.5em)|p|]

\startXMLRLG
  \XMLrlentry {base}   {rl:base}   {0}
  \XMLrlentry {type}   {rl:type}   {0}
  \XMLrlentry {state}  {rl:state}  {0}
  \XMLrlentry {file}   {rl:file}   {0}
  \XMLrlentry {label}  {rl:label}  {0}
  \XMLrlentry {suffix} {rl:suffix} {0}
  \XMLrlentry {page}   {rl:page}   {0}
  \XMLrlentry {width}  {rl:width}  {1}
  \XMLrlentry {height} {rl:height} {1}
  \XMLrlentry {comment}{rl:comment}{0}
\stopXMLRLG

\stopsetups 

\startsetups[rl:usage]

  \startfiguretext {\v!none} {\setups[rl:figure]}
    \setups[rl:table]
  \stopfiguretext 

\stopsetups 

\startsetups[rl:attach]

  \useMPlibrary[nav]

  \setupcolors[\c!state=\v!start]

  \setupinteraction[\c!state=\v!start]

  \useattachment[whatever][\outputfilename.zip]

  \startlocalsetups[rl:attach:button]

    \inframed
      [\c!offset=\v!overlay,\c!frame=\v!off]
      {\attachment[whatever]}

  \stoplocalsetups
 
  \setupfootertexts[archive with dummies: \setups{rl:attach:button}] 

\stopsetups

\protect \endinput 
