%D \module %D [ file=m-visual, %D version=2000.01.10, %D title=\CONTEXT\ Extra Modules, %D subtitle=Visualization and Faking, %D author={Hans Hagen \& Ton Otten}, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \unprotect %D This module collect a few more visual debugger features. I %D needed them for manuals and styles. The macros are documented %D in a my way document. \definecolor[fakerulecolor] [black] \definecolor[fakebaselinecolor] [green] \definecolor[fakeparindentcolor][blue] \newif\iffakebaseline \fakebaselinetrue \unexpanded\def\fakerule#1% {\strut \begingroup \directcolored[fakerulecolor]% \iffakebaseline \vrule\!!height1.25ex\!!depth-.05ex\!!width#1% \kern-#1% \vrule\!!height-.05ex\!!depth .25ex\!!width#1% \else \vrule\!!height1.25ex\!!depth .25ex\!!width#1% \fi \endgroup \allowbreak} \unexpanded\def\dorandomrecurse#1% {\getrandomcount\scratchcounter{1}{#1}% \dorecurse\scratchcounter} % can be used in hbox, so %'s are really needed \unexpanded\def\fakelines#1#2% min max / 3 10 {\fakeparindent \scratchdimen\hsize \ifindentation \advance\scratchdimen -\parindent \fi \fakerule\scratchdimen\break \getrandomcount\scratchcounter{\ifcase0#1 3\else#1\fi}{\ifcase0#2 10\else#2\fi}% \dorecurse\scratchcounter{\fakerule\hsize}% \getrandomdimen\scratchdimen{.25\hsize}\hsize \fakerule\scratchdimen \par} % indeed \unexpanded\def\fakewords {\ifvmode\fakeparindent\fi\onlyfakewords} \definepalet [fakerule] [fr1c=darkred, fr2c=darkgreen, fr3c=darkblue, fr4c=darkyellow, fr5c=darkgray] \unexpanded\def\onlyfakewords#1#2% min max / 10 40 {\getrandomcount\scratchcounter{\ifcase0#1 10\else#1\fi}{\ifcase0#2 40\else#2\fi}% \dofakewords\scratchcounter } % no \par \unexpanded\def\fakenwords#1#2% words seed {\fakeparindent \getrandomseed\fakedwordseed \setrandomseed{\ifcase0#2 #1\else#2\fi}% \dofakewords{#1}% \setrandomseed\fakedwordseed } % no \par \def\dofakewords#1% {\bgroup \dorecurse{#1} {\getrandomcount\scratchcounter{1}{5}% \dorecurse\scratchcounter {\getrandomdimen\scratchdimen{.5em}{1.25em}% \fakerule\scratchdimen}% \space}% \removeunwantedspaces \egroup} \def\doshowfakewords#1% {\bgroup \setuppalet[fakerule]% \definecolor[fakerulecolor]% \dorecurse{#1} {\getrandomcount\scratchcounter{1}{5}% \dorecurse\scratchcounter {\getrandomdimen\scratchdimen{.5em}{1.25em}% \color[fr\recurselevel c]{\fakerule\scratchdimen}}% \space}% \removeunwantedspaces \egroup} \unexpanded\def\showfakewords {\let\dofakewords\doshowfakewords} \unexpanded\def\fakeword {\fakewords{1}{1}} % no \plusone \unexpanded\def\fakeparindent {\noindent \ifindentation \ifx\dofakedroppedcaps\relax {\fakeparindentcolor \vrule \!!height \strutheight % not longer .5ex \!!depth \strutdepth % not longer 0pt \!!width \parindent}% \else \dofakedroppedcaps \let\dofakedroppedcaps\relax \fi % \else % \dontleavehmode \fi} \let\dofakedroppedcaps\relax \unexpanded\def\fakedroppedcaps#1% {\ifnum#1>0 \def\dofakedroppedcaps {\setbox\scratchbox\hbox {\setbox\scratchbox\hbox{W}% \scratchdimen#1\lineheight \advance\scratchdimen -\lineheight \advance\scratchdimen \dp\strutbox \vrule \!!width#1\wd\scratchbox \!!height\ht\scratchbox \!!depth\scratchdimen}% \ht\scratchbox\ht\strutbox \dp\scratchbox\dp\strutbox \hangindent\wd\scratchbox \advance\hangindent .5em \wd\scratchbox\hangindent \hangafter-#1\noindent \llap{\fakeparindentcolor\box\scratchbox}}% \fi} \unexpanded\def\fakefigure {\dodoubleempty\dofakefigure} \def\dofakefigure[#1][#2]#3#4#5#6% [] [] minwidth maxwidth minheight maxheight {\getvalue{\e!place\v!figure} [#1][#2]% {\freezerandomseed \let\endstrut\relax \let\begstrut\relax \doifinsetelse{#1}{\v!left,\v!right} {\fakewords{2}{4}} {\fakewords{4}{10}}}% {\doifinset{#1}{\v!left,\v!right} {\dimen0=.75\dimen0 \ifdim\dimen0>.6\hsize \dimen0=.5\hsize\fi \ifdim\dimen0<.3\hsize \dimen0=.3\hsize\fi}% \framed [\c!width=\dimen0, \c!height=\dimen2, \c!frame=\v!off, \c!background=\v!color, \c!backgroundcolor=fakeparindentcolor] {\bf\white#1}}% \defrostrandomseed} \unexpanded\def\fakeimage#1#2#3#4% {\getrandomdimen{\dimen0}{#1}{#3}% \getrandomdimen{\dimen2}{#2}{#4}% \framed [\c!width=\dimen0, \c!height=\dimen2, \c!frame=\v!off, \c!background=\v!color, \c!backgroundcolor=fakeparindentcolor] {}} \unexpanded\def\fakeformula {\dimen0\zeropoint \getrandomcount\scratchcounter{3}{6}% \dorecurse\scratchcounter {\getrandomdimen\scratchdimen{1em}{3em}% \mathinner{\red\fakerule\scratchdimen}% \ifnum\recurselevel<\scratchcounter+\fi \advance\scratchdimen\dimen0}% =\mathinner{\red\fakerule\scratchdimen}} \unexpanded\def\fakespacingformula {\color[fakebaselinecolor]{\ruledbaseline}\fakeformula} %D test \type{\bodyfontgrid}\space test %D test \type{\emexgrid} \space test \unexpanded\def\smashedgrid {\dosingleempty\dosmashedgrid} \def\dosmashedgrid[#1]% {\hsmashed {\setbox\scratchbox=\hbox {\basegrid [\c!nx=10,\c!ny=10,\c!dx=1,\c!dy=1, \c!unit=\bodyfontsize,#1]}% \hbox to \zeropoint {\hss\lower.5\ht\scratchbox\box\scratchbox\hss}% \hbox to \zeropoint {\hss \black\vrule\!!width6\linewidth\!!height3\linewidth\!!depth3\linewidth \hss}}} \unexpanded\def\bodyfontgrid {\hbox {{\linewidth.1pt\yellow\smashedgrid[\c!nx=30,\c!ny=30,\c!scale=.3333]}% {\linewidth.2pt\green \smashedgrid[\c!nx=20,\c!ny=20,\c!scale=.5]}% {\linewidth.3pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!scale=1]}}} \unexpanded\def\emexgrid {\hbox {{\linewidth.15pt\green\smashedgrid[\c!nx=20,\c!ny=20,\c!unit=ex]}% {\linewidth.15pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!unit=em]}}} %D For Mojca: \unexpanded\def\simplethesis {\setupsystem[random=1234] \title{\fakewords{3}{4}} \placelist[chapter,section] \dorecurse{6} {\chapter{\fakewords{5}{10}} \dorecurse{5} {\section{\fakewords{2}{5}} \dorecurse{2} {\dorecurse{3}{\fakewords{100}{200}\endgraf} \placefigure{\fakewords{8}{15}}{\fakeimage{5cm}{3cm}{10cm}{5cm}} \dorecurse{2}{\fakewords{100}{200}\endgraf}}}}} \continueifinputfile{m-visual.mkiv} \starttext \simplethesis \stoptext \protect \endinput