diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-22 22:14:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-22 22:14:39 +0000 |
commit | fc4466b32ed330a956ac603b00fd145524cff49a (patch) | |
tree | 2c50e2b8de13aa9233b2c76dffe201558f169e86 /Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv | |
parent | 50e2368597d5f6fe2057195d0ae6a9f2044923e4 (diff) |
context (22apr16)
git-svn-id: svn://tug.org/texlive/trunk@40691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv | 255 |
1 files changed, 255 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv b/Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv new file mode 100644 index 00000000000..37a9de19017 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkiv/colo-run.mkiv @@ -0,0 +1,255 @@ +%D \module +%D [ file=colo-run, +%D version=1997.04.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Runtime loaded commands, +%D author=Hans Hagen, +%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. + +\registerctxluafile{colo-run}{1.000} + +\unprotect + +%D Colors + +% These are nicer in \LUA\ code than in \TEX\ code but not more +% efficient. + +\unexpanded\gdef\showcolorbar[#1]% + {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} + +\unexpanded\gdef\showcolor {\dosingleempty\colo_basics_show} +\unexpanded\gdef\showcolorset {\dosingleempty\colo_basics_show_set} +\unexpanded\gdef\showcolorcomponents{\dosingleempty\colo_basics_show_components} + +\gdef\colo_basics_show_set [#1]{\ctxcommand{showcolorset("#1")}} +\gdef\colo_basics_show_components[#1]{\ctxcommand{showcolorcomponents("#1")}} + +\gdef\colo_basics_show[#1]% % we do this at the tex end as loading happens + {\usecolors [#1]% % delayed and we can only ask for the set if + \showcolorset[#1]} % loading has happened + +% The rest might also be done in \LUA\ although there is not much +% beauty to gain here (too much typesetting specific). Also, these +% macros are pretty old and hardly used so best keep them as they +% are. + +%D Palets + +\unexpanded\gdef\showpalet + {\dodoubleargument\colo_show_palet} + +\gdef\colo_show_palet[#1][#2]% + {\doifelsecolorpalet{#1} + {\doifelseinset\v!vertical{#2} \colo_palets_show_vertical \colo_palets_show_horizontal {#1}{#2}}% + {}} + +\gdef\colo_palets_show_vertical#1#2% + {\begingroup + \forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \def\colo_palets_show_palet##1% + {\doifelseinset\v!number{#2}{##1\hskip.5\emwidth}{}% + \aligntab + \color [##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{##1}}% + \crcr} + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\cr + \colo_palets_process[#1]\colo_palets_show_palet\crcr}% + \endgroup} + +\gdef\colo_palets_show_horizontal#1#2% todo: bTABLE etc + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \scratchwidth\zeropoint + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1% + {\setbox\scratchbox\hbox{##1}% + \ifdim\scratchwidth<\wd\scratchbox + \scratchwidth\wd\scratchbox + \fi}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \advance\scratchwidth\emwidth + \ifdim\scratchwidth<5\emwidth + \scratchwidth5\emwidth + \fi + \halign + {\alignmark\alignmark\aligntab\aligntab\hbox to \scratchwidth{\hss\alignmark\alignmark\hss}\cr + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1{\aligntab\strut##1}% + \colo_palets_process[#1]\colo_palets_show_palet}\cr + \doifinset\v!name{#2}{#1\hskip.5\emwidth}% + \def\colo_palets_show_palet##1% + {\aligntab\strut\color[##1]{\vrule\s!width\scratchwidth\s!height\strutht\s!depth\zeropoint}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \noalign{\vskip-\strutdepth}% + \def\colo_palets_show_palet##1% + {\aligntab\graycolor[##1]{\vrule\s!width\scratchwidth\s!height\zeropoint\s!depth\strutdp}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \doifinset\v!value{#2} + {\def\colo_palets_show_palet##1% + {\aligntab\vbox + {\hsize\scratchwidth + \vskip.25\exheight + \everypar{\strut} + \veryraggedcenter + \let\colorformatseparator\endgraf + \colorvalue{##1}}}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \crcr}}} + +\gdef\colo_palets_process[#1]% + {\getpaletlist[#1]% + \normalexpanded{\globalprocesscommalist[\paletlist]}} + +\unexpanded\gdef\comparepalet + {\dosingleargument\colo_palets_compare} + +\gdef\colo_palets_compare[#1]% + {\doifelsecolorpalet{#1}% + {\hbox + {\colo_palets_compare_indeed\color{#1}% + \quad + \colo_palets_compare_indeed\graycolor{#1}}}% + {}} + +\gdef\colo_palets_compare_indeed#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#2] + \getpaletsize[#2]% + \getpaletlist[#2]% + \scratchwidth2\emwidth\relax + \hsize\paletsize\scratchwidth + \def\colo_palets_compare##1% + {\hbox + {\setbox0\hbox + {#1[##1]{\vrule\s!width\hsize\s!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\def\colo_palets_compare####1% + {\hbox to \scratchwidth + {\hss#1[####1]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}\hss}}% + \processcommacommand[\paletlist]\colo_palets_compare}} + \endgraf} + \processcommacommand[\paletlist]\colo_palets_compare}} + +%D Groups + +\unexpanded\gdef\showcolorgroup + {\dodoubleargument\colo_groups_show} + +\gdef\colo_groups_show[#1][#2]% + {\doifcolor{#1:1} + {\doifelseinset\v!vertical{#2} + \colo_groups_show_vertical + \colo_groups_show_horizontal + [#1][#2]}} + +\gdef\colo_groups_show_horizontal[#1][#2]% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colorformatseparator{\strut\cr} + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1}{\vbox + {\halign + {\hss\alignmark\alignmark\alignmark\alignmark\hss\cr + \doifinset\v!number{#2}{\strut##1}\cr + \color [#1:##1]{\vrule\s!width4\emwidth\s!height\strutht \s!depth\zeropoint}\cr + \graycolor[#1:##1]{\vrule\s!width4\emwidth\s!height\zeropoint\s!depth\strutdp }\cr + \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}}}}% + \hbox + {\doifinset\v!name{#2} + {\strut + \doifelseinset\v!value{#2} + {\raise3\lineheight\hbox{#1\hskip.5\emwidth}} + {#1}% + \hskip.5\emwidth}% + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\gdef\colo_groups_show_vertical[#1][#2]% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1} + {\doifinset\v!number{#2} + {##1\hskip.5\emwidth}% + \aligntab + \color [#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp} + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{#1:##1}}% + \crcr}}% + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\hss\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\crcr + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\unexpanded\gdef\comparecolorgroup + {\dosingleargument\colo_groups_compare} + +\gdef\colo_groups_compare[#1]% + {\doifcolor{#1:1} + {\hbox + {\colo_groups_compare_indeed\color [#1]\quad + \colo_groups_compare_indeed\graycolor[#1]}}} + +\gdef\colo_groups_compare_indeed#1[#2]% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \scratchcounter\zerocount + \dorecurse{15}{\doifcolor{#2:\recurselevel}{\advance\scratchcounter\plusone}} + \scratchwidth2\emwidth\relax + \hsize\scratchcounter\scratchwidth + \dorecurse\scratchcounter{\colo_groups_compare_step{#1}{#2}\recurselevel}}} + +\def\colo_groups_compare_step#1#2#3% + {\hbox to \hsize + {\setbox\scratchbox\hbox + {#1[#2:#3]{\vrule\s!width\hsize\s!height3\exheight}}% + \wd\scratchbox\zeropoint + \box\scratchbox + \hbox to \hsize + {\hss + \dorecurse\scratchcounter + {#1[#2:\recurselevel]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}% + \hss}}} + \endgraf} + +\protect \endinput |