%D \module
%D   [       file=core-mak,
%D        version=1997.10.05,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=General Makeup Commands,
%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 Core Macros / General Makeup Commands}

\unprotect

% \definieerplaats[naam][instellingen]
% \stelplaatsin[naam][instellingen]
% \plaats<naam>[[instellingen]]
% 
% - still undocumented and also not in setupb yet
% - kan ook intern/direct (scheelt duplicatie), zie \framedtext

\def\dodefineplacement[#1][#2]%
  {\getparameters 
     [\??pl#1]
     [\c!links=\hss,
      \c!rechts=\hss,
      \c!regelcorrectie=\v!uit,
      \c!dieptecorrectie=\v!uit,
      \c!marge=\v!standaard,
      \c!grid=\v!midden,
      %\c!voor=,
      %\c!na=, 
      #2]%
   \setvalue{\e!plaats#1}{\doplacement[\??pl#1]}}

\def\defineplacement
  {\dodoubleempty\dodefineplacement}

\def\setupplacement
  {\dodoubleempty\dosetupplacement}

\def\dosetupplacement[#1]%
  {\dodoubleempty\getparameters[\??pl#1]}

\def\doplacement
  {\dodoubleempty\dodoplacement}

% \def\dodoplacement[#1][#2]% correctie moet mooier 
%   {\bgroup 
%    \dowithnextbox
%      {\setlocalhsize
%       \getparameters[#1][#2]%
%       \getvalue{#1\c!voor}%
%       \doifvalue{#1\c!regelcorrectie}\v!aan \startbaselinecorrection
%       \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent
%       \hbox to \localhsize
%         {\getvalue{#1\c!links}%
%          \flushnextbox
%          \getvalue{#1\c!rechts}}%
%       \doifvalue{#1\c!dieptecorrectie}\v!aan\baselinecorrection
%       \doifvalue{#1\c!regelcorrectie }\v!aan\stopbaselinecorrection
%       \getvalue{#1\c!na}%
%       \egroup}
%    \vbox}

\def\dodoplacement[#1][#2]% correctie moet mooier 
  {\bgroup 
   \dowithnextboxcontent
     {\forgetall}
     {\setlocalhsize
      \getparameters[#1][#2]%
      \getvalue{#1\c!voor}%
      \begingroup
      \positioningparfalse
      \setbox\nextbox\hbox to \localhsize
        {\getvalue{#1\c!links}%
         \flushnextbox
         \getvalue{#1\c!rechts}}%
      \ifinsidefloat \else
        \addlocalbackgroundtobox\nextbox
      \fi 
      \ifgridsnapping 
        \doifundefined{#1\c!grid}{\letvalue{#1\c!grid}\v!midden}%
        % unchecked 
        \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent
        \snaptogrid[\getvalue{#1\c!grid}]\hbox{\flushnextbox}%
      \else
        \doifvalue{#1\c!regelcorrectie}\v!aan \startbaselinecorrection
        \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent
        \flushnextbox
        \doifvalue{#1\c!dieptecorrectie}\v!aan\baselinecorrection
        \doifvalue{#1\c!regelcorrectie }\v!aan\stopbaselinecorrection
      \fi 
      \endgroup
      \getvalue{#1\c!na}%
      \egroup}
   \vbox}

\protect \endinput
