%D \module
%D   [       file=page-run,
%D        version=2000.10.20,
%D          title=\CONTEXT\ Page Macros,
%D       subtitle=Runtime Macros, 
%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.

\writestatus{loading}{Context Page Macros / Runtime Macros} 

\unprotect 

\gdef\doshowprint[#1][#2][#3]%
  {\framed
     [\c!offset=\v!overlay,
      \c!strut=\v!nee]
     {\forgetall
      \mindermeldingen
      \globaldefs\minusone
      \dimen0\pagegoal
      \definepapersize[X][\c!breedte=4em, \c!hoogte=6em]%
      \definepapersize[Y][\c!breedte=12em,\c!hoogte=14em]%
      \setuppapersize[#1,X][#2,Y]%
      \setuplayout[#3]%
      \setbox0\vbox
        {\framed
          [\c!offset=\v!overlay,\c!strut=\v!nee,
           \c!breedte=\papierbreedte,\c!hoogte=\papierhoogte]
          {\ss ABC\par DEF}}%
      \dubbelzijdigfalse
      \def\cutmarklength{.5em}%
      \addpagecutmarks0%
      \replicatepagebox0%
      \scalepagebox0%
      \mirrorpaperbox0%
      \rotatepaperbox0%
      \centerpagebox0%
      \mirrorprintbox0%
      \rotateprintbox0%
      \offsetprintbox0%
      \pagegoal\dimen0
      \box0}}

\gdef\showprint
  {\dotripleempty\doshowprint}

% \switchnaarkorps[8pt]
%
% \startcombinatie[4*4]
%   {\toonprint}                                       {\strut}
%   {\toonprint[][][plaats=midden]}                    {\type{plaats=midden}}
%   {\toonprint[][][plaats=midden,markering=aan]}      {\type{markering=aan}\break
%                                                      \type{plaats=midden}}
%   {\toonprint[][][plaats=midden,markering=aan,nx=2]} {\type{markering=aan}\break
%                                                      \type{plaats=midden}\break
%                                                      \type{nx=2}}
%   {\toonprint[][][plaats=links]}                     {\type{plaats=links}}
%   {\toonprint[][][plaats=rechts]}                    {\type{plaats=rechts}}
%   {\toonprint[][][plaats={links,onder}]}             {\type{plaats={links,onder}}}
%   {\toonprint[][][plaats={rechts,onder}]}            {\type{plaats={rechts,onder}}}
%   {\toonprint[][][nx=2,ny=1]}                        {\type{nx=2,ny=1}}
%   {\toonprint[][][nx=1,ny=2]}                        {\type{nx=1,ny=2}}
%   {\toonprint[][][nx=2,ny=2]}                        {\type{nx=2,ny=2}}
%   {\toonprint[][][nx=2,ny=2,plaats=midden]}          {\type{nx=2,ny=2}\break
%                                                       \type{plaats=midden}}
%   {\toonprint[][][rugoffset=3pt]}                    {\type{rugoffset=.5cm}}
%   {\toonprint[][][kopoffset=3pt]}                    {\type{kopoffset=.5cm}}
%   {\toonprint[][][schaal=1.5]}                       {\type{schaal=1.5}}
%   {\toonprint[][][schaal=0.8]}                       {\type{schaal=0.8}}
% \stopcombinatie
%
% \startcombinatie[3*4]
%   {\toonprint[liggend][][plaats=midden]}              {\type{liggend}}
%   {\toonprint[][liggend][plaats=midden]}              {\strut\break\type{liggend}}
%   {\toonprint[liggend][liggend][plaats=midden]}       {\type{liggend}\break\type{liggend}}
%   {\toonprint[90][][plaats=midden]}                   {\type{90}}
%   {\toonprint[][90][plaats=midden]}                   {\strut\break\type{90}}
%   {\toonprint[90][90][plaats=midden]}                 {\type{90}\break\type{90}}
%   {\toonprint[180][][plaats=midden]}                  {\type{180}}
%   {\toonprint[][180][plaats=midden]}                  {\strut\break\type{180}}
%   {\toonprint[180][180][plaats=midden]}               {\type{180}\break\type{180}}
%   {\toonprint[gespiegeld][][plaats=midden]}           {\type{gespiegeld}}
%   {\toonprint[][gespiegeld][plaats=midden]}           {\strut\break\type{gespiegeld}}
%   {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}}
% \stopcombinatie

\gdef\doshowframe[#1][#2]%
  {\ifsecondargument
     \setupbackgrounds
       [\v!pagina]
       [\c!kader=\v!aan,
        \c!hoek=\v!recht,
        \c!kaderoffset=\!!zeropoint,
        \c!kaderdiepte=\!!zeropoint,
        \c!kaderkleur=green]
     \setupbackgrounds
       [#1][#2]
       [\c!achtergrond=,
        \c!kader=\v!aan,
        \c!hoek=\v!recht,
        \c!kaderoffset=\!!zeropoint,
        \c!kaderdiepte=\!!zeropoint,
        \c!kaderkleur=]
   \else\iffirstargument
     \showframe
       [\v!hoofd,\v!tekst,\v!voet]
       [#1]
   \else
     \showframe
       [\v!hoofd,\v!tekst,\v!voet]
       [\v!linkerrand,\v!linkermarge,
        \v!tekst,
        \v!rechtermarge,\v!rechterrand]
   \fi\fi
   \setupbackgrounds
     [\c!status=\v!herhaal]}

\gdef\showframe{\dodoubleempty\doshowframe}

\gdef\showsetupA#1#2%
  {#1&\PtToCm{\the#2}&\the#2&\tttf\string#2\cr}

\gdef\showsetupB#1#2#3%
  {#1&&#2#3&\tttf\string#3\cr}

\iffixedlayoutdimensions 

  \global\let\showsetupC=\showsetupA

\else % we could have used \@the

  \gdef\showsetupC#1#2% \relax is really needed here ! 
    {#1&\scratchdimen#2\PtToCm{\the\scratchdimen}&%
     \scratchdimen#2\relax\the\scratchdimen&\tttf\string#2\cr}

\fi

% \startinterface english % english is fallback 

\gdef\showsetups
  {\noindent
   \vbox
     {\forgetall
      \mindermeldingen
      \switchtobodyfont[\v!klein]
      \tabskip\zeropoint
      \halign
        {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
         \showsetupA{paperheight}        \paperheight
         \showsetupA{paperwidth}         \paperwidth
         \showsetupA{printpaperheight}   \printpaperheight
         \showsetupA{printpaperwidth}    \printpaperwidth
         \showsetupA{topspace}           \topspace
         \showsetupA{backspace}          \backspace
         \showsetupA{height}             \makeupheight
         \showsetupA{width}              \makeupwidth
         \showsetupA{top}                \topheight
         \showsetupC{topdistance}        \topdistance
         \showsetupA{header}             \headerheight
         \showsetupC{headerdistance}     \headerdistance
         \showsetupA{textheight}         \textheight
         \showsetupC{footerdistance}     \footerdistance
         \showsetupA{footer}             \footerheight
         \showsetupC{bottomdistance}     \bottomdistance
         \showsetupA{bottom}             \bottomheight
         \showsetupA{leftedge}           \leftedgewidth
         \showsetupC{leftedgedistance}   \leftedgedistance
         \showsetupA{leftmargin}         \leftmarginwidth
         \showsetupC{leftmargindistance} \leftmargindistance
         \showsetupA{textwidth}          \textwidth
         \showsetupC{rightmargindistance}\rightmargindistance
         \showsetupA{rightmargin}        \rightmarginwidth
         \showsetupC{rightedgedistance}  \rightedgedistance
         \showsetupA{rightedge}          \rightedgewidth
         \showsetupB{bodyfontsize}       \the   \globalbodyfontsize
         \showsetupB{line}               \relax \normallineheight
         \showsetupB{height}             \relax \strutheightfactor
         \showsetupB{depth}              \relax \strutdepthfactor
         \showsetupB{topskip}            \relax \topskipfactor
         \showsetupB{maxdepth}           \relax \maxdepthfactor}}}

% \stopinterface 

\startinterface dutch

\gdef\showsetups
  {\noindent
   \vbox
     {\forgetall
      \mindermeldingen
      \switchtobodyfont[\v!klein]
      \tabskip\zeropoint
      \halign
        {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
         \showsetupA{papierhoogte}       \papierhoogte
         \showsetupA{papierbreedte}      \papierbreedte
         \showsetupA{printpapierhoogte}  \printpapierhoogte
         \showsetupA{printpapierbreedte} \printpapierbreedte
         \showsetupA{kopwit}             \kopwit
         \showsetupA{rugwit}             \rugwit
         \showsetupA{snijwit}            \snijwit
         \showsetupA{hoogte}             \zethoogte
         \showsetupA{breedte}            \zetbreedte
         \showsetupA{boven}              \bovenhoogte
         \showsetupC{bovenafstand}       \bovenafstand
         \showsetupA{hoofd}              \hoofdhoogte
         \showsetupC{hoofdafstand}       \hoofdafstand
         \showsetupA{teksthoogte}        \teksthoogte
         \showsetupC{voetafstand}        \voetafstand
         \showsetupA{voet}               \voethoogte
         \showsetupC{onderafstand}       \onderafstand
         \showsetupA{onder}              \onderhoogte
         \showsetupA{linkerrand}         \linkerrandbreedte
         \showsetupC{linkerrandafstand}  \linkerrandafstand
         \showsetupA{linkermarge}        \linkermargebreedte
         \showsetupC{linkermargeafstand} \linkermargeafstand
         \showsetupA{tekstbreedte}       \tekstbreedte
         \showsetupC{rechtermargeafstand}\rechtermargeafstand
         \showsetupA{rechtermarge}       \rechtermargebreedte
         \showsetupC{rechterrandafstand} \rechterrandafstand
         \showsetupA{rechterrand}        \rechterrandbreedte
         \showsetupB{korps}              \the   \globalbodyfontsize
         \showsetupB{regel}              \relax \normallineheight
         \showsetupB{hoogte}             \relax \strutheightfactor
         \showsetupB{diepte}             \relax \strutdepthfactor
         \showsetupB{boven}              \relax \topskipfactor
         \showsetupB{onder}              \relax \maxdepthfactor}}}

\stopinterface

% todo: \showsetupA{rugwit} \rugwit

\startinterface german

\gdef\showsetups%
  {\noindent
   \vbox
     {\forgetall
      \mindermeldingen
      \switchtobodyfont[\v!klein]
      \tabskip\zeropoint
      \halign
        {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
         \showsetupA{papierhoehe}          \papierhoehe
         \showsetupA{papierbreite}         \papierbreite
         \showsetupA{printpapierhoehe}     \printpapierhoehe
         \showsetupA{printpapierbreite}    \printpapierbreite
         \showsetupA{kopfweite}            \kopfweite
         \showsetupA{rumpfweite}           \rumpfweite
         \showsetupA{hoehe}                \satzhoehe
         \showsetupA{breite}               \satzbreite
         \showsetupA{oben}                 \hoeheoben
         \showsetupC{abstandoben}          \abstandoben
         \showsetupA{kopfzeile}            \kopfzeilenhoehe
         \showsetupC{kopfzeilenabstand}    \kopfzeilenabstand
         \showsetupA{texthoehe}            \texthoehe
         \showsetupC{fusszeileabstand}     \fusszeileabstand
         \showsetupA{fusszeilen}           \fusszeilenhoehe
         \showsetupC{abstandunten}         \abstandunten
         \showsetupA{hoeheunten}           \hoeheunten
         \showsetupA{linkerrand}           \breitelinkerrand
         \showsetupC{abstandlinkerrand}    \abstandlinkerrand
         \showsetupA{linkemarginal}        \linkemarginalbreite
         \showsetupC{linkemarginalafstand} \linkemarginalafstand
         \showsetupA{textbreite}           \textbreite
         \showsetupC{rechtemarginalafstand}\rechtemarginalafstand
         \showsetupA{rechtemarginal}       \rechtemarginalbreite
         \showsetupC{abstandrechterrand}   \abstandrechterrand
         \showsetupA{rechterrand}          \breiterechterrand
         \showsetupB{fliesstext}           \the   \globalbodyfontsize
         \showsetupB{linie}                \relax \normallineheight
         \showsetupB{hoehe}                \relax \strutheightfactor
         \showsetupB{tiefe}                \relax \strutdepthfactor
         \showsetupB{topskip}              \relax \topskipfactor
         \showsetupB{maxdepth}             \relax \maxdepthfactor}}}

\stopinterface

\startinterface czech

\gdef\showsetups% 
  {\noindent
   \vbox
     {\forgetall
      \mindermeldingen
      \switchtobodyfont[\v!klein]
      \tabskip\zeropoint
      \halign
        {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
         \showsetupA{vyskapapiru}              \vyskapapiru
         \showsetupA{sirkapapiru}              \sirkapapiru
         \showsetupA{vyskatiskpapiru}          \vyskatiskpapiru
         \showsetupA{sirkatiskpapiru}          \sirkatiskpapiru
         \showsetupA{hornimezera}              \hornimezera
         \showsetupA{spodnimezera}             \spodnimezera
         \showsetupA{vyska}                    \vyskasazby
         \showsetupA{breite}                   \sirkasazby
         \showsetupA{vyskatextu}               \vyskatextu
         \showsetupA{sirkatextu}               \sirkatextu
         \showsetupA{horejsek}                 \vyskahorejsku
         \showsetupC{vzdalenosthorejsku}       \vzdalenosthorejsku
         \showsetupA{zahlavi}                  \vyskazahlavi
         \showsetupC{vzdalenostzahlavi}        \vzdalenostzahlavi
         \showsetupC{fusszeileabstand}         \vzdalenostupati
         \showsetupA{upati}                    \vyskaupati
         \showsetupC{vzdalenostspodku}         \vzdalenostspodku
         \showsetupA{spodek}                   \vyakaspodku
         \showsetupA{levyokraj}                \sirkalevehookraje
         \showsetupC{vzdalenostlevehookraje}   \vzdalenostlevehookraje
         \showsetupA{levamarginalie}           \sirkalevemarginalie
         \showsetupC{vzdalenostlevemarginalie} \vzdalenostlevemarginalie
         \showsetupC{vzdalenostpravemarginalie}\vzdalenostpravemarginalie
         \showsetupA{pravamarginalie}          \sirkapravemarginalie
         \showsetupC{vzdalenostpravehookraje}  \vzdalenostpravehookraje
         \showsetupA{pravyokraj}               \sirkapravehookraje
         \showsetupB{zakladnivelikost}         \the   \globalbodyfontsize
         \showsetupB{linka}                    \relax \normallineheight
         \showsetupB{vyska}                    \relax \strutheightfactor
         \showsetupB{hloubka}                  \relax \strutdepthfactor
         \showsetupB{topskip}                  \relax \topskipfactor
         \showsetupB{maxdepth}                 \relax \maxdepthfactor}}}

\stopinterface

\startinterface romanian

\gdef\showsetups%
  {\noindent
   \vbox
     {\forgetall
      \mindermeldingen
      \switchtobodyfont[\v!klein]
      \tabskip\zeropoint
      \halign
        {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
         \showsetupA{paperheight}        \paperheight
         \showsetupA{paperwidth}         \paperwidth
         \showsetupA{printpaperheight}   \printpaperheight
         \showsetupA{printpaperwidth}    \printpaperwidth
         \showsetupA{topspace}           \topspace
         \showsetupA{backspace}          \backspace
         \showsetupA{height}             \makeupheight
         \showsetupA{width}              \makeupwidth
         \showsetupA{top}                \topheight
         \showsetupC{topdistance}        \topdistance
         \showsetupA{header}             \headerheight
         \showsetupC{headerdistance}     \headerdistance
         \showsetupA{textheight}         \textheight
         \showsetupC{footerdistance}     \footerdistance
         \showsetupA{footer}             \footerheight
         \showsetupC{bottomdistance}     \bottomdistance
         \showsetupA{bottom}             \bottomheight
         \showsetupA{leftedge}           \leftedgewidth
         \showsetupC{leftedgedistance}   \leftedgedistance
         \showsetupA{leftmargin}         \leftmarginwidth
         \showsetupC{leftmargindistance} \leftmargindistance
         \showsetupA{textwidth}          \textwidth
         \showsetupC{rightmargindistance}\rightmargindistance
         \showsetupA{rightmargin}        \rightmarginwidth
         \showsetupC{rightedgedistance}  \rightedgedistance
         \showsetupA{rightedge}          \rightedgewidth
         \showsetupB{bodyfontsize}       \the   \globalbodyfontsize
         \showsetupB{line}               \relax \normallineheight
         \showsetupB{height}             \relax \strutheightfactor
         \showsetupB{depth}              \relax \strutdepthfactor
         \showsetupB{topskip}            \relax \topskipfactor
         \showsetupB{maxdepth}           \relax \maxdepthfactor}}}

\stopinterface

\gdef\showlayout % interfereert lelijk met een \typefile er na
  {\bgroup
   \pagina
   \showframe
   \setuplayout[\c!markering=\v!aan]
   \dorecurse{4}{\showsetups\pagina}
   \egroup}

\gdef\showmargins
  {\starttabulate
   \NC asynchrone   \NC \doifoddpageelse     {odd}   {even} \NC \NR
   \NC synchrone    \NC \doifrightpageelse   {right} {left} \NC \NR
   \NC right margin \NC \the\rightmarginwidth               \NC \NR
   \NC left margin  \NC \the\leftmarginwidth                \NC \NR
   \NC outer margin \NC \the\outermarginwidth               \NC \NR
   \NC inner margin \NC \the\innermarginwidth               \NC \NR
   \stoptabulate}

\protect \endinput 
