diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
commit | 824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch) | |
tree | abfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/grph-fig.mkiv | |
parent | 689aefb0727676ed3cddf331337b4be226495e72 (diff) |
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/grph-fig.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/grph-fig.mkiv | 729 |
1 files changed, 280 insertions, 449 deletions
diff --git a/Master/texmf-dist/tex/context/base/grph-fig.mkiv b/Master/texmf-dist/tex/context/base/grph-fig.mkiv index 1908e644522..80b8e35d932 100644 --- a/Master/texmf-dist/tex/context/base/grph-fig.mkiv +++ b/Master/texmf-dist/tex/context/base/grph-fig.mkiv @@ -11,351 +11,198 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% ex => ef with proper parent - -\writestatus{loading}{ConTeXt Graphic Macros / Figure Handling} - \unprotect -\unexpanded\def\setupexternalfigures - {\dosingleempty\dosetupexternalfigures} - -\def\dosetupexternalfigures[#1]% - {\getparameters[\??ef][#1]% local settings - \getparameters[\??ex][#1]% global settings - \setfigurepathlist} % the path may be used elsewhere too (as in x-res-04) - -\presetlocalframed[\??ef] - -\newconditional\externalfigurelevel % true=background false=normal -\newconditional\externalfigureflush % true=place false=ignore +%D Used in the styledesign manual: +% +% beware in mkiv we don't have the typeset- prefix +% +% \setbuffer[typeset-b]\endbuffer +% \setbuffer[typeset-a]\endbuffer +% +% todo: +% +% \appendtoks \setbuffer[typeset-b]\endbuffer\to \everystarttext +% \appendtoks \setbuffer[typeset-a]\endbuffer\to \everystarttext -\setfalse\externalfigurelevel -\settrue \externalfigureflush +\newcount\c_grph_buffers_n -\installcorenamespace{externalfigures} +\let\m_grph_buffers_filename\empty -\def\doplaceexternalfigure[#1][#2][#3][#4][#5]% - {\doifsomething{#2}% catches \defineexternalfigure dummies - {\ifcsname\??externalfigures#2\endcsname - \doifelse{#1}{#2} - {\dodoplaceexternalfigure[#1][#2][#3][#4][#5]} - {\getvalue{\??externalfigures#2}[#5]}% - \else - \dodoplaceexternalfigure[#1][#2][#3][#4][#5]% - \fi}} +\unexpanded\def\typesetbuffer + {\dodoubleempty\grph_buffers_typeset} -\ifdefined\dotagfigure \else \let\dotagfigure\relax \fi +\def\grph_buffers_typeset[#1][#2]% beware: this will mix up the mp graphics + {\ifsecondargument + \grph_buffers_typeset_indeed[#1][#2]% + \else\iffirstargument + \doifassignmentelse{#1} + {\grph_buffers_typeset_indeed[\jobname][#1]}% + {\grph_buffers_typeset_indeed[#1][]}% + \else + \grph_buffers_typeset_indeed[\jobname][] + \fi\fi} -\def\dodoplaceexternalfigure[#1][#2][#3][#4][#5]% +\def\grph_buffers_typeset_indeed[#1][#2]% we could use the via files {\bgroup - \dostarttagged\t!image\empty - \let\textunderscore\letterunderscore % {\string _} % space needed as _ is now letter in unprotected mode - \calculateexternalfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp - \dotagfigure - \naturalvbox attr \imageattribute 2 {\box\foundexternalfigure}% - \dostoptagged + \global\advance\c_grph_buffers_n\plusone + \edef\m_grph_buffers_filename{\jobname-buffer-\the\c_grph_buffers_n}% + \ctxcommand{runbuffer("\m_grph_buffers_filename.tmp","#1",true)}% + \externalfigure[\m_grph_buffers_filename.pdf][#2]% \egroup} -\def\externalfigurereplacement#1#2#3% - {\normalexpanded{\localframed - [\??ef] - [\c!width=\figurewidth, - \c!height=\figureheight, - \c!background=\v!color, - \c!backgroundcolor=missingfigurecolor, - \c!frame=\@@efframe]}% we need to expand this in order to prevent a loop - {\tt\tfxx \nohyphens - name: \expanded{\verbatimstring{#1}}\\% - file: \expanded{\verbatimstring{#2}}\\% - state: \expanded{\verbatimstring{#3}}}} - -\definecolor[missingfigurecolor][s=.8] - -\def\externalfigureplaceholder#1#2#3% - {\localframed - [\??ef] - [\c!width=#2, - \c!height=#3, - \c!frame=\v!on]% - {\tt\tfxx \nohyphens - name: \expanded{\verbatimstring{#1}}\\% - state: \expanded{\verbatimstring{placeholder}}}} - -% new: more convenient/efficient than -% -% \use..[a][a][setting] \externalfigure[b][a] -% -% is equivalent to: +% For manuals and such: % -% \def..[a][setting] \externalfigure[b][a] -% -% see x-res modules for usage: +% \definetypesetting [name] [options] [settings-a] % -% \defineexternalfigure[name][settings] - -\unexpanded\def\defineexternalfigure - {\dodoubleargument\dodefineexternalfigure} - -\def\dodefineexternalfigure[#1][#2]% - {\setvalue{\??externalfigures#1}{\doplaceexternalfigure[#1][][][#2]}} - -% \useexternalfigure[alpha][koe] -% \useexternalfigure[beta] [koe] [breedte=1cm] -% \useexternalfigure[gamma][koe][alpha] -% \useexternalfigure[delta][koe][alpha][breedte=2cm] +% \typesetfile [name] [file] [settings-b] +% \typesetfile [file] [options] [settings-b] +% \typesetfile [file] [settings-b] +% \typesetfile [file] % -% volle breedte: \externalfigure[koe] \par -% 3cm breed: \externalfigure[koe] [breedte=3cm] \par -% volle breedte: \externalfigure[alpha] \par -% 1cm breed: \externalfigure[beta] \par -% volle breedte: \externalfigure[gamma] \par -% 2cm breed: \externalfigure[delta] \par -% 4cm breed: \externalfigure[beta] [breedte=4cm] \par -% 5cm breed: \externalfigure[gamma][breedte=5cm] \par - -% \defineexternalfigure[a][width=10cm] -% \defineexternalfigure[b][width=5cm] -% \externalfigure[cow][a] -% \externalfigure[cow][b][height=8cm] - -% \useexternalfigure[x][cow][width=10cm,height=1cm] -% \externalfigure[x] -% \externalfigure[x][width=3cm] - -\def\useexternalfigure - {\doquadrupleempty\douseexternalfigure} - -% [label] [filename] -% [label] [filename] [parent] -% [label] [filename] [parent] [settings] -% [label] [filename] [settings] - -\def\useexternalfigure - {\doquadrupleempty\douseexternalfigure} - -\def\douseexternalfigure[#1][#2][#3][#4]% - {\doifelsenothing{#1} - {\doifsomething{#2} - {\doifassignmentelse{#3} - {\dodouseexternalfigure{#2}{#2}{#3}{#4}} - {\dodouseexternalfigure{#2}{#2}{}{#4}}}} - {\doifelsenothing{#2} - {\doifassignmentelse{#3} - {\dodouseexternalfigure{#1}{#1}{}{#3}} - {\dodouseexternalfigure{#1}{#1}{#3}{#4}}} - {\doifassignmentelse{#3} - {\dodouseexternalfigure{#1}{#2}{}{#3}} - {\dodouseexternalfigure{#1}{#2}{#3}{#4}}}}} - -\def\dodouseexternalfigure#1#2#3#4% - {\setvalue{\??externalfigures#1}{\doplaceexternalfigure[#1][#2][#3][#4]}% - \doanalyzeexternalfigurecollection[#2][#4]} - -\newconditional\inexternalfigurecollection -\newdimen\xexternalfigurecollectionminwidth -\newdimen\xexternalfigurecollectionmaxwidth -\newdimen\xexternalfigurecollectionminheight -\newdimen\xexternalfigurecollectionmaxheight - -\def\doanalyzeexternalfigurecollection[#1][#2]% - {\ifconditional\inexternalfigurecollection - \setfalse\inexternalfigurecollection - \getfiguredimensions[#1][#2]% - \settrue\inexternalfigurecollection - \scratchdimen\naturalfigurewidth - \ifdim\scratchdimen>\xexternalfigurecollectionmaxwidth \xexternalfigurecollectionmaxwidth \scratchdimen \fi - \ifdim\scratchdimen<\xexternalfigurecollectionminwidth \xexternalfigurecollectionminwidth \scratchdimen \fi - \scratchdimen\naturalfigureheight - \ifdim\scratchdimen>\xexternalfigurecollectionmaxheight \xexternalfigurecollectionmaxheight\scratchdimen \fi - \ifdim\scratchdimen<\xexternalfigurecollectionminheight \xexternalfigurecollectionminheight\scratchdimen \fi - \fi} - -\unexpanded\def\startexternalfigurecollection[#1]% - {\begingroup - \def\currentexternalfigurecollection{#1}% - \settrue\inexternalfigurecollection - \xexternalfigurecollectionminwidth \maxdimen - \xexternalfigurecollectionmaxwidth \zeropoint - \xexternalfigurecollectionminheight\maxdimen - \xexternalfigurecollectionmaxheight\zeropoint} - -\unexpanded\def\stopexternalfigurecollection - {\setxvalue{\??ef:c:\currentexternalfigurecollection:\c!minwidth }{\the\xexternalfigurecollectionminwidth }% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!maxwidth }{\the\xexternalfigurecollectionmaxwidth }% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!minheight}{\the\xexternalfigurecollectionminheight}% - \setxvalue{\??ef:c:\currentexternalfigurecollection:\c!maxheight}{\the\xexternalfigurecollectionmaxheight}% - \endgroup} - -\def\externalfigurecollectionparameter#1#2% - {\csname\ifcsname\??ef:c:#1:#2\endcsname\??ef:c:#1:#2\else\s!empty\fi\endcsname} - -\def\externalfigurecollectionminwidth #1{\externalfigurecollectionparameter{#1}\c!minwidth } -\def\externalfigurecollectionmaxwidth #1{\externalfigurecollectionparameter{#1}\c!maxwidth } -\def\externalfigurecollectionminheight#1{\externalfigurecollectionparameter{#1}\c!minheight} -\def\externalfigurecollectionmaxheight#1{\externalfigurecollectionparameter{#1}\c!maxheight} - -\let\efcparameter\externalfigurecollectionparameter -\let\efcminwidth \externalfigurecollectionminwidth -\let\efcmaxwidth \externalfigurecollectionmaxwidth -\let\efcminheight\externalfigurecollectionminheight -\let\efcmaxheight\externalfigurecollectionmaxheight - -% \startexternalfigurecollection[name] -% \useexternalfigure[cow] [cow.pdf] -% \useexternalfigure[mill][mill.png] -% \stopexternalfigurecollection +% \enabletrackers[files.run] % \starttext -% \bTABLE -% \bTR -% \bTD \externalfigure[cow] [height=\externalfigurecollectionmaxheight{name}] \eTD -% \bTD \externalfigure[mill][height=\externalfigurecollectionmaxheight{name}] \eTD -% \eTR -% \eTABLE +% \typesetfile[oepsoeps.tex][width=10cm,frame=on] % \stoptext -\def\dosetefparameters#1#2#3% parent_id use_settings current_settings - {\doifelsenothing{#1} % inherit from parent - {\getparameters[\??ef][#2,#3]} - {\ifcsname\??externalfigures#1\endcsname - \pushmacro\doplaceexternalfigure - \def\doplaceexternalfigure[##1][##2][##3][##4]{\getparameters[\??ef][##4,#2,#3]}% - \getvalue{\??externalfigures#1}% - \popmacro\doplaceexternalfigure - \else - \getparameters[\??ef][#2,#3]% - \fi}} - -\unexpanded\def\externalfigure - {\dotripleempty\doexternalfigure} - -% \def\doexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings] -% {\bgroup -% \doifelsenothing{#1} -% {\framed[\c!width=\defaultfigurewidth,\c!height=\defaultfigureheight]{external\\figure\\no name}} -% {\ifcsname\??externalfigures#1\endcsname -% \doifassignmentelse{#2} -% {\getvalue{\??externalfigures#1}[#2]}% -% {\getvalue{\??externalfigures#1}[#3]}% -% \else -% \useexternalfigure[\s!dummy][#1][#2][#3]% -% \getvalue{\??externalfigures\s!dummy}[]% [] is dummy arg 5 -% \fi}% -% \globallet\currentresourcecomment\empty -% \egroup} - -\def\doexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings] - {\bgroup % also catched #1 == empty ... scales nicer now - \ifcsname\??externalfigures#1\endcsname - \doifassignmentelse{#2} - {\getvalue{\??externalfigures#1}[#2]}% - {\getvalue{\??externalfigures#1}[#3]}% - \else - \useexternalfigure[\s!dummy][#1][#2][#3]% - \getvalue{\??externalfigures\s!dummy}[]% [] is dummy arg 5 - \fi - \globallet\currentresourcecomment\empty - \egroup} - -\def\resourcecomment#1% - {\gdef\currentresourcecomment{#1}} +\installcorenamespace{typesettingfile} -\unexpanded\def\startresourcecomment#1\stopresourcecomment - {\gdef\currentresourcecomment{#1}} +\unexpanded\def\definetypesetting{\dotripleempty\grph_typesetting_define} +\unexpanded\def\typesetfile {\dotripleempty\grph_typesetting_process} -\let\currentresourcecomment\empty +\def\grph_typesetting_define[#1][#2][#3]% <name> options settings-a + {\doifsomething{#1}{\setuvalue{\??typesettingfile#1}{\grph_typesetting_process_indeed{#2}{#3}}}} -\unexpanded\def\showexternalfigures % maybe run time command is better, but no core-run, unless figs-run ... - {%\writestatus\m!system{for \string\showexternalfigures\space see \truefilename{x-res-20}.tex} - \usemodule[res-20]% - \showexternalfigures} % so for the moment we do it this way +\def\grph_typesetting_process[#1][#2][#3]% <name> filename settings-b | filename options settings + {\ifcsname\??typesettingfile#1\endcsname + \csname\??typesettingfile#1\endcsname{#2}{#3}% + \else\ifthirdargument % filename options settings + \grph_typesetting_process_indeed{#2}{#3}{#1}{}% + \else\ifsecondargument % filename settings + \grph_typesetting_process_indeed{}{#2}{#1}{}% + \fi\fi\fi} -\unexpanded\def\overlayfigure#1% - {\externalfigure[#1][\c!width=\overlaywidth,\c!height=\overlayheight]} +\def\grph_typesetting_process_indeed#1#2#3#4% options settings-a filename settings-b + {\begingroup + \edef\m_typesetting_name{\cldcontext{job.files.context("#3","#1")}}% + \ifx\m_typesetting_name\empty \else + \expanded{\externalfigure[\m_typesetting_name]}[#2,#4]% + \fi + \endgroup} -%D Whatever +%D Whatever ... hardly used ... but historic ... needs checking ... +%D will probably become m-fig-nn.mkiv .. or I will extend it cq. clean +%D it up when I needed it. After all, it's documented in old manuals. -\newbox\colorbarbox +\newcount\c_grph_steps_reference +\newdimen\d_grph_steps_x +\newdimen\d_grph_steps_y +\newbox \b_grph_steps_colorbar -\unexpanded\def\makecolorbar[#1]% - {\def\docommand##1% - {\color[##1] - {\blackrule - [\c!width=2em, - \c!height=1ex, - \c!depth=\!!zeropoint]}% - \endgraf}% - \global\setbox\colorbarbox\vbox - {\forgetall - \processcommalist[#1]\docommand}% - \global\setbox\colorbarbox\vbox - {\hskip2em\box\colorbarbox}% - \wd\colorbarbox\zeropoint} +\let\placestopfigure\relax \unexpanded\def\placestartfigure[#1][#2][#3]#4\placestopfigure[#5]% {\hbox - {\setbox0\hbox + {\setbox\scratchbox\hbox {\useexternalfigure[\s!dummy][#2][#3,#5]% \externalfigure[\s!dummy]}% - \calculateefsteps + \grph_steps_calculate \startpositioning - \def\referring(##1,##2)##3(##4,##5)##6[##7]% - {\position(##1,##2){\efgoto(##4,##5){\@@exframes}[##7]}}% - \def\marking(##1,##2)##3(##4,##5)##6[##7]% - {\position(##1,##2){\efthisis(##4,##5){\@@exframes}[##7]}}% - \def\remark{\efnocomment}% - \def\colorbar##1[##2]{}% - \position(0,0){\box0}% + \let\referring\grph_steps_one_referring + \let\marking \grph_steps_one_marking + \let\remark \grph_steps_one_remark + \let\colorbar \grph_steps_one_colorbar + \position(0,0){\box\scratchbox}% \linewidth\onepoint \setuppositioning [\c!unit=pt, - \c!xscale=\withoutpt\the\efxsteps, - \c!yscale=\withoutpt\the\efysteps, + \c!xscale=\withoutpt\the\d_grph_steps_x, + \c!yscale=\withoutpt\the\d_grph_steps_y, \c!factor=1]% \ignorespaces#4% - \def\referring(##1,##2)##3(##4,##5)##6[##7]% - {}% - \let\marking\referring - \def\remark{\efcomment\v!no}% - \def\colorbar##1[##2]{\makecolorbar[##2]}% + \let\referring\grph_steps_two_referring + \let\marking \grph_steps_two_marking + \let\remark \grph_steps_two_remark + \let\colorbar \grph_steps_two_colorbar \ignorespaces#4% \stoppositioning - \box\colorbarbox}} + \ifvoid\b_grph_steps_colorbar\else\box\b_grph_steps_colorbar\fi}} % not really needed + +\unexpanded\def\grph_steps_one_referring(#1,#2)#3(#4,#5)#6[#7]% + {\position(#1,#2){\grph_steps_goto(#4,#5){\externalfigureparameter\c!frames}[#7]}} + +\unexpanded\def\grph_steps_one_marking(#1,#2)#3(#4,#5)#6[#7]% + {\position(#1,#2){\grph_steps_this_is(#4,#5){\externalfigureparameter\c!frames}[#7]}} + +\unexpanded\def\grph_steps_one_remark(#1,#2)#3(#4,#5)% (x,y)(h,b)[...]{tekst} + {\def\grph_steps_no_comment_indeed[##1]##2{}% + \dosingleempty\grph_steps_no_comment_indeed} + +\unexpanded\def\grph_steps_one_colorbar#1[#2]% + {} + +\unexpanded\def\grph_steps_two_referring(#1,#2)#3(#4,#5)#6[#7]% + {} + +\let\grph_steps_two_marking\grph_steps_two_referring + +\unexpanded\def\grph_steps_two_remark + {\grph_steps_comment\v!no} + +\unexpanded\def\grph_steps_two_colorbar#1[#2] + {\begingroup + \global\setbox\b_grph_steps_colorbar\vbox + {\forgetall + \processcommalist[#2]\grph_colorbar_make_step}% + \global\setbox\b_grph_steps_colorbar\vbox + {\hskip2\emwidth\box\b_grph_steps_colorbar}% + \global\wd\b_grph_steps_colorbar\zeropoint + \endgroup} -\def\dodostartfigure[#1][#2][#3]#4\stopfigure - {\doifelse\v!test\@@exoption +\unexpanded\def\grph_colorbar_make_step#1% + {\blackrule[\c!color=#1,\c!width=2\emwidth,\c!height=\exheight,\c!depth=\zeropoint]% + \endgraf} + +\unexpanded\def\startfigure % could be done nicer + {\grabuntil{\e!stop\v!figure}\grph_steps_figure_process} + +\let\stopfigure\relax + +\def\grph_steps_figure_process#1% + {\dotripleargument\grph_steps_figure_process_indeed#1\stopfigure} + +\def\grph_steps_figure_process_indeed[#1][#2][#3]#4\stopfigure + {\doifelse{\externalfigureparameter\c!option}\v!test {\teststartfigure[#1][#2][#3]#4\teststopfigure - \let\@@exframes\v!on} - {\let\@@exframes\v!off}% - \setvalue{\??externalfigures#1}% - {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}% - }% no longer \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} + \letexternalfigureparameter\c!frames\v!on} + {\letexternalfigureparameter\c!frames\v!off}% + \setvalue{\??externalfigureinstance#1}% + {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}} -% De onderstaande macro mag niet zondermeer worden aangepast -% en is afgestemd op gebruik in de handleiding. +\let\teststopfigure\relax -\def\teststartfigure[#1][#2][#3]#4\teststopfigure% +\unexpanded\def\teststartfigure[#1][#2][#3]#4\teststopfigure {\begingroup - \setbox0\hbox + \setbox\scratchbox\hbox {\useexternalfigure[\s!dummy][#2][\c!wfactor=\v!max]% \externalfigure[\s!dummy]}% - \def\referring{\efmark}% - \def\marking{\efmark}% - \def\remark{\efcomment\v!yes}% - \def\colorbar##1[##2]{}% - \efreference\zerocount + \let\referring\grph_steps_three_referring + \let\marking \grph_steps_three_marking + \let\remark \grph_steps_three_remark + \let\colorbar \grph_steps_three_colorbar + \c_grph_steps_reference\zerocount \setbox0\vbox - {\hsize240pt + {\hsize240\points \startpositioning - \calculateefsteps + \grph_steps_calculate \position(0,0) - {\box0}% + {\box\scratchbox}% \position(0,0) {\basegrid - [\c!nx=\@@exxmax, - \c!dx=\withoutpt\the\efxsteps, - \c!ny=\@@exymax, - \c!dy=\withoutpt\the\efysteps, + [\c!nx=\externalfigureparameter\c!xmax, + \c!dx=\withoutpt\the\d_grph_steps_x, + \c!ny=\externalfigureparameter\c!ymax, + \c!dy=\withoutpt\the\d_grph_steps_y, \c!xstep=1, \c!ystep=1, \c!scale=1, @@ -363,18 +210,18 @@ \c!unit=pt]}% \setuppositioning [\c!unit=pt, - \c!xscale=\withoutpt\the\efxsteps, - \c!yscale=\withoutpt\the\efysteps, + \c!xscale=\withoutpt\the\d_grph_steps_x, + \c!yscale=\withoutpt\the\d_grph_steps_y, \c!factor=1]% \linewidth\onepoint \ignorespaces#4\relax \stoppositioning \vfill}% - \efreference\zerocount - \def\referring{\eftext{$\rightarrow$}}% - \def\marking{\eftext{$\leftarrow$}}% - \def\remark{\efnocomment}% - \def\colorbar##1[##2]{}% + \c_grph_steps_reference\zerocount + \let\referring\grph_steps_four_referring + \let\marking \grph_steps_four_marking + \let\remark \grph_steps_four_remark + \let\colorbar \grph_steps_four_colorbar \setbox2\vbox {{\tfa\doifelsenothing{#1}{#2}{#1}} \blank @@ -386,165 +233,149 @@ \ht0\ht2 \fi \hbox - {\hskip3em - \vtop{\vskip12pt\box0\vskip6pt}% - \vtop{\vskip12pt\box2\vskip6pt}}% + {\hskip3\emwidth + \vtop{\vskip12\points\box0\vskip6\points}% + \vtop{\vskip12\points\box2\vskip6\points}}% \endgroup} -\def\dodostartfigure[#1][#2][#3]#4\stopfigure - {\doifelse\v!test\@@exoption - {\teststartfigure[#1][#2][#3]#4\teststopfigure - \let\@@exframe\v!on} - {\let\@@exframe\v!off}% - \setvalue{\??externalfigures#1}% - {\def\next{\placestartfigure[#1][#2][#3]#4\placestopfigure}% - \dosingleempty\next}% - }% no longer: \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} +\unexpanded\def\grph_steps_three_referring(#1,#2)#3(#4,#5)#6[#7]% + {\advance\c_grph_steps_reference\plusone + \position(#1,#2) + {\hbox{\the\c_grph_steps_reference}}% + \position(#1,#2) + {\gotosomeinternal\s!vwb{#7}\realfolio + {\grph_steps_marker(#4,#5)\v!on{\thisissomeinternal\s!vwa{#7}}}}} -\long\def\dostartfigure#1% - {\dotripleargument\dodostartfigure#1\stopfigure} +\unexpanded\def\grph_steps_three_remark + {\grph_steps_comment\v!yes} -\unexpanded\def\startfigure - {\grabuntil{\e!stop\v!figure}\dostartfigure} - -%D NEW: used in styledesign manual +\let\grph_steps_three_marking \grph_steps_three_referring +\let\grph_steps_three_colorbar\grph_steps_one_colorbar -% beware in mkiv we don't have the typeset- prefix -% -% \setbuffer[typeset-b]\endbuffer -% \setbuffer[typeset-a]\endbuffer -% -% todo: -% -% \appendtoks \setbuffer[typeset-b]\endbuffer\to \everystarttext -% \appendtoks \setbuffer[typeset-a]\endbuffer\to \everystarttext +\unexpanded\def\grph_steps_four_referring + {\grph_steps_text{$\rightarrow$}} -\newcount\noftypesetbuffers +\unexpanded\def\grph_steps_four_marking + {\grph_steps_text{$\leftarrow$}} -\def\typesetbuffer - {\dodoubleempty\dotypesetbuffer} +\let\grph_steps_four_remark \grph_steps_one_remark +\let\grph_steps_four_colorbar\grph_steps_one_colorbar -\def\dotypesetbuffer[#1][#2]% beware: this will mix up the mp graphics - {\ifsecondargument - \dodotypesetbuffer[#1][#2]% - \else\iffirstargument - \doifassignmentelse{#1} - {\dodotypesetbuffer[\jobname][#1]}% - {\dodotypesetbuffer[#1][]}% +% Helpers: + +\def\grph_steps_calculate + {\ifnum0\externalfigureparameter\c!xmax=\zerocount + \ifnum0\externalfigureparameter\c!ymax=\zerocount + \setexternalfigureparameter\c!ymax{24}% + \fi + \d_grph_steps_y\figureheight + \divide\d_grph_steps_y \externalfigureparameter\c!ymax + \d_grph_steps_x\d_grph_steps_y + \scratchdimen\figurewidth + \advance\scratchdimen\d_grph_steps_y + \divide \scratchdimen\d_grph_steps_y + \setexternalfigureparameter\c!xmax{\number\scratchdimen}% \else - \dodotypesetbuffer[\jobname][] - \fi\fi} + \d_grph_steps_x\figurewidth \divide\d_grph_steps_x \externalfigureparameter\c!xmax\relax + \d_grph_steps_y\figureheight \divide\d_grph_steps_y \externalfigureparameter\c!ymax\relax + \fi} -\def\dodotypesetbuffer[#1][#2]% +\def\grph_steps_comment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst} + {\def\grph_steps_comment_indeed[##1]##2% + {\position(#2,#3)% + {\setnostrut + \framed + [\c!width=#5\d_grph_steps_x, + \c!height=#6\d_grph_steps_y, + \c!offset=\v!none, + \c!frame=#1, + ##1]% + {##2}}}% + \dosingleempty\grph_steps_comment_indeed} + +% \def\grph_steps_figure#1% +% {\position(0,0){\getvalue{#1}}} + +\def\grph_steps_goto(#1,#2)#3[#4]% (h,b)kader[ref] + {\gotobox{\vbox{\grph_steps_area(#1,#2)#3{}}}[#4]} + +\def\grph_steps_text#1(#2,#3)#4(#5,#6)#7[#8]% + {\advance\c_grph_steps_reference\plusone + \hbox + {\quad + \thisissomeinternal\s!vwb + {#8}% + \gotosomeinternal\s!vwa{#8}\realfolio + {\hbox to 1.5em{\the\c_grph_steps_reference\presetgoto\hfill}}% + \quad#1 (#2,#3) (#5,#6) [#8]\hfill}% + \endgraf} + +\def\grph_steps_this_is(#1,#2)#3[#4]% + {\grph_steps_area(#1,#2){#3}{\dosetdirectpagereference{#4}}} + +\def\grph_steps_area(#1,#2)#3#4% (h,b){kader}{tekst} {\bgroup - \global\advance\noftypesetbuffers\plusone - \edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}% - \ctxcommand{runbuffer("\bufferfilename.tmp","#1",true)}% - \externalfigure[\bufferfilename.pdf][#2]% + \setnostrut + \framed + [\c!width=#1\d_grph_steps_x, + \c!height=#2\d_grph_steps_y, + \c!offset=\zeropoint, + \c!frame=#3] + {#4}% \egroup} -\def\dodotypesetbufferindeed#1% - {} +\def\grph_steps_marker(#1,#2)#3#4% (h,b){kader}{tekst} + {\framed + [\c!width=#1\d_grph_steps_x, + \c!height=#2\d_grph_steps_y, + \c!offset=\v!none, + \c!frame=#3]% + {#4}} -% for me only (manuals and such) +\protect \endinput + +% \startbuffer +% \definecolor [blue] [c=1,m=.38,y=0,k=.64] +% \definecolor [yellow] [c=0,m=.28,y=1,k=.06] % -% \definetypesetting [name] [options] [settings-a] +% \definespotcolor [blue-100] [blue] [p=1] +% \definespotcolor [yellow-100] [yellow] [p=1] % -% \typesetfile [name] [file] [settings-b] -% \typesetfile [file] [options] [settings-b] -% \typesetfile [file] [settings-b] -% \typesetfile [file] +% \definemultitonecolor [combicolor] [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1] % -% \enabletrackers[files.run] -% \starttext -% \typesetfile[oepsoeps.tex][width=10cm,frame=on] -% \stoptext - -\installcorenamespace{typesettingfile} - -\unexpanded\def\definetypesetting{\dotripleempty\dodefinetypesetting} -\unexpanded\def\typesetfile {\dotripleempty\dotypesetfile} - -\def\dodefinetypesetting[#1][#2][#3]% <name> options settings-a - {\doifsomething{#1}{\setvalue{\??typesettingfile#1}{\dodotypesetfile{#2}{#3}}}} - -\def\dotypesetfile[#1][#2][#3]% <name> filename settings-b | filename options settings - {\ifcsname\??typesettingfile#1\endcsname - \csname\??typesettingfile#1\endcsname{#2}{#3}% - \else\ifthirdargument % filename options settings - \dodotypesetfile{#2}{#3}{#1}{}% - \else\ifsecondargument % filename settings - \dodotypesetfile{}{#2}{#1}{}% - \fi\fi\fi} - -\def\dodotypesetfile#1#2#3#4% options settings-a filename settings-b - {\edef\typesetfilename{\ctxlua{tex.write(job.files.context("#3","#1"))}}% - \expanded{\externalfigure[\typesetfilename]}[#2,#4]} - -\setupexternalfigures - [\c!option=, - \c!object=\v!yes, % we only check for no - \c!reset=\v!no, - \c!interaction=\v!none, - \c!maxwidth=\@@efwidth, - \c!maxheight=\@@efheight, - \c!bodyfont=\bodyfontsize, - \c!directory=, - \c!radius=.5\bodyfontsize, - \c!corner=\v!rectangular, - \c!frame=\v!off, - \c!background=, % new - \c!splitcolor=\s!white, - \c!conversion=, - \c!resolution=, - \c!prefix=, - \c!cache=, -% \c!grid=, - \c!equalwidth=, - \c!equalheight=, - \c!location={\v!local,\v!global}] - -\setupexternalfigures - [\c!frames=\v!off, - \c!ymax=24, - \c!xmax=] - -\useexternalfigure - [buffer] [\jobname.buffer] [\c!object=\v!no] - -\protect \endinput - -% alternative for positioning - -% \definelayer[figure][width=\overlaywidth,height=\overlayheight] -% \defineoverlay[figure][{\directsetup{figure}\tightlayer[figure]}] - -% \setupcolors[state=start] - -% \starttext - -% \startsetups figure -% \setlayerframed[figure][preset=rightbottom,x=.25\layerwidth,y=.25\layerheight]{HERE} -% \setlayerframed[figure][preset=leftbottom, x=.15\layerwidth,y=.35\layerheight]{THERE} -% \stopsetups - -% \externalfigure[cow][background={foreground,figure},width=4cm,height=8cm] - -% \startsetups figure -% \setlayerframed[figure][preset=righttop,x=.25\layerwidth,y=.25\layerheight]{MORE} -% \setlayerframed[figure][preset=middle,foregroundcolor=green]{EVEN MORE} -% \stopsetups - -% \externalfigure[cow][background={foreground,figure},width=14cm,height=2cm] - -% \defineexternalfigure[whatever][background={foreground,figure}] - -% \startsetups figure -% \setlayerframed[figure][preset=righttop,x=.25\layerwidth,y=.25\layerheight]{\red MORE} -% \setlayerframed[figure][preset=middle,foregroundcolor=green]{EVEN MORE} -% \stopsetups - -% \externalfigure[cow][whatever][width=14cm,height=4cm] - -% \stoptext - +% \definemultitonecolor [combicolor-b] [blue=1] [c=1,m=.38,y=0,k=.64] % force multitone +% \definemultitonecolor [combicolor-y] [yellow=1] [c=0,m=.28,y=1,k=.06] % force multitone +% +% \useexternalfigure[demo-a][mill.png] [object=no,width=.2\textwidth] +% \useexternalfigure[demo-b][hacker-bw.jpg][object=no,width=.2\textwidth] +% +% \startbaselinecorrection \startcombination[4*1] +% {\externalfigure[demo-a]} {no color} +% {\externalfigure[demo-a][color=combicolor]} {indexed duotone} +% {\externalfigure[demo-a][color=combicolor-b]} {spot color} +% {\externalfigure[demo-a][color=combicolor-y]} {spot color} +% \stopcombination \stopbaselinecorrection +% +% \startbaselinecorrection \startcombination[4*1] +% {\externalfigure[demo-b]} {no color} +% {\externalfigure[demo-b][color=combicolor]} {indexed duotone} +% {\externalfigure[demo-b][color=combicolor-b]} {spot color} +% {\externalfigure[demo-b][color=combicolor-y]} {spot color} +% \stopcombination \stopbaselinecorrection +% +% \startbaselinecorrection \startcombination[4*1] +% {\externalfigure[demo-a]} {no color} +% {\externalfigure[demo-a][color=combicolor]} {indexed duotone} +% {\externalfigure[demo-a][color=blue-100]} {spot color} +% {\externalfigure[demo-a][color=yellow-100]} {spot color} +% \stopcombination \stopbaselinecorrection +% +% \startbaselinecorrection \startcombination[4*1] +% {\externalfigure[demo-b]} {no color} +% {\externalfigure[demo-b][color=combicolor]} {indexed duotone} +% {\externalfigure[demo-b][color=blue-100]} {spot color} +% {\externalfigure[demo-b][color=yellow-100]} {spot color} +% \stopcombination \stopbaselinecorrection +% \stopbuffer +% +% \getbuffer \typebuffer |