summaryrefslogtreecommitdiff
path: root/tex/context/base/node-bck.mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-11-17 13:27:00 +0100
committerHans Hagen <pragma@wxs.nl>2010-11-17 13:27:00 +0100
commit96bea07ac35ee9463fe89985c4b887a55579a4c9 (patch)
tree746b4509a8ef9049f311e331285434089e4a1a8a /tex/context/base/node-bck.mkiv
parent953cd0a613be25ad37baaa745758862262e46395 (diff)
downloadcontext-96bea07ac35ee9463fe89985c4b887a55579a4c9.tar.gz
beta 2010.11.17 13:27
Diffstat (limited to 'tex/context/base/node-bck.mkiv')
-rw-r--r--tex/context/base/node-bck.mkiv107
1 files changed, 10 insertions, 97 deletions
diff --git a/tex/context/base/node-bck.mkiv b/tex/context/base/node-bck.mkiv
index 18149ef4d..88fb390a9 100644
--- a/tex/context/base/node-bck.mkiv
+++ b/tex/context/base/node-bck.mkiv
@@ -20,10 +20,19 @@
\registerctxluafile{node-bck}{1.001}
+\def\doinitializeboxbackgrounds
+ {\ctxlua{nodes.tasks.enableaction("shipouts","nodes.handlers.backgrounds")}%
+ \glet\doinitializeboxbackgrounds\donothing}
+
%D Box helpers:
+% \backgroundvbox[green] {\input tufte } \par
+% \backgroundvbox[blue] {\input ward } \par
+% \backgroundvbox[red] {\input knuth } \par
+% \backgroundhbox[yellow]{\rotate[rotation=45]{hello world}} \par
+
\def\doaddbackgroundtobox#1[#2]%
- {\begingroup\faststartcolor[#2]%
+ {\begingroup\doinitializeboxbackgrounds\faststartcolor[#2]%
\normalexpanded{\noexpand\faststopcolor\endgroup#1
attr \backgroundattribute \plusone
attr \colormodelattribute \the\attribute\colormodelattribute
@@ -63,100 +72,4 @@
% \def\backgroundvtop[#1]{\vtop \backgroundcolorattr{#1}}
% \def\backgroundhbox[#1]{\hbox \backgroundcolorattr{#1}}
-%D tabulate:
-
-\def\tabulatenormalcolumn#1%
- {\doiffastoptionalcheckelse{\tabulatenormalcolumnyes#1}{\tabulatenormalcolumnnop#1}}
-
-\def\tabulatenormalcolumnnop#1% overloads anch-pgr
- {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\tabulatetype#1&}
-
-\def\tabulatenormalcolumnyes#1[#2]%
- {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\tabulatetype#1&%
- \iftrialtypesetting\else\settabulatecolor{#2}\fi\ignorespaces}
-
-\newcount\maxtabularcolorcolumn
-
-\def\settabulatecolor#1% we could store the attributes at the cost of a lua call
- {\begingroup
- \global\settrue\tabulatehascolors
- \ifnum\tabulatecolumn>\maxtabularcolorcolumn
- \global\maxtabularcolorcolumn\tabulatecolumn
- \fi
- \setxvalue{\??tt:c:\the\tabulatecolumn}{#1}%
- \attribute\backgroundattribute\plusone
- \faststartcolor[#1]\strut\char0\faststopcolor
- \endgroup}
-
-\def\repeatsettabulatecolor
- {\begingroup
- \ifcsname\??tt:c:\the\tabulatecolumn\endcsname
- \attribute\backgroundattribute\plusone
- \faststartcolor[\csname\??tt:c:\the\tabulatecolumn\endcsname]\strut\char0\faststopcolor
- \fi
- \endgroup}
-
-\def\resettabulatecolors
- {\ifcase\maxtabularcolorcolumn\else
- \doresettabulatecolors
- \fi}
-
-\def\doresettabulatecolors
- {\dorecurse\maxtabularcolorcolumn{\letgvalue{\??tt:c:\recurselevel}\undefined}} % slow
-
-\appendtoks
- \resettabulatecolors
-\to \everyaftertabulaterow
-
-\def\splitofftabulatebox % overloads in anch-pgr
- {\dontcomplain
- \global\setbox\tabulatebox % % % global ? % % %
- \vsplit\tablebox\tabulatecolumn to \lineheight
- \setbox\tabulatebox\normalvbox
- {\unvbox\tabulatebox}%
- \setbox\tabulatebox\hbox to \wd\tabulatebox
- {\iftrialtypesetting\else\ifconditional\tabulatehascolors\repeatsettabulatecolor\fi\fi
- \hss\dotabulatehook{\box\tabulatebox}\hss}%
- \donormalizetabulatesplitline
- \box\tabulatebox
- \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi}
-
-\appendtoks
- \global\setfalse\tabulatehascolors
-\to \everytabulate
-
\protect \endinput
-
-% test
-
-\starttext
-
-\backgroundvbox[green] {\input tufte } \par
-\backgroundvbox[blue] {\input ward } \par
-\backgroundvbox[red] {\input knuth } \par
-\backgroundhbox[yellow]{\rotate[rotation=45]{hello world}} \par
-
-\starttabulate[||p||]
-\NC test \NC test \NC test \NC \NR
-\NC test \NC[green] \input tufte \NC[yellow] test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC[blue] test \NC[red] test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC[gray] test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC[blue] test \NC test \NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC test \NC[magenta] test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC[cyan] \dorecurse{10}{\input ward }\NC test \NC \NR
-\NC test \NC test \NC test \NC \NR
-\NC test \NC[yellow] test \NC test \NC \NR
-\stoptabulate
-
-\stoptext