summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-run.mkiv
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/page-run.mkiv
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-run.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-run.mkiv232
1 files changed, 118 insertions, 114 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-run.mkiv b/Master/texmf-dist/tex/context/base/page-run.mkiv
index cce746c742f..62b1030ee11 100644
--- a/Master/texmf-dist/tex/context/base/page-run.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-run.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Runtime Macros,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%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
@@ -15,122 +15,125 @@
\unprotect
-\gdef\doshowprint[#1][#2][#3]%
- {\framed
- [\c!offset=\v!overlay,
- \c!strut=\v!no]
- {\forgetall
- \dontcomplain
- \globaldefs\minusone
- \dimen\zerocount\pagegoal
- \definepapersize[X][\c!width=4em, \c!height=6em]%
- \definepapersize[Y][\c!width=12em,\c!height=14em]%
- \setuppapersize[#1,X][#2,Y]%
- \setuplayout[#3]%
- \setbox\zerocount\vbox
- {\framed
+\gdef\showprint
+ {\dotripleempty\page_layouts_show_print}
+
+\gdef\page_layouts_show_print[#1][#2][#3]% only english
+ {\setbuffer[crap]%
+ \unprotect
+ \definepapersize[X][\c!width=4em, \c!height=6em]
+ \definepapersize[Y][\c!width=12em,\c!height=14em]
+ \setuppapersize[X,#1][Y,#2]
+ \setuplayout[#3]
+ \setuplayout[\v!page]
+ \framed
[\c!offset=\v!overlay,\c!strut=\v!no,
\c!width=\paperwidth,\c!height=\paperheight]
- {\ss ABC\par DEF}}%
- \doublesidedfalse
- \def\cutmarklength{.5em}%
- \addpagecutmarks \zerocount
- \replicatepagebox\zerocount
- \scalepagebox \zerocount
- \mirrorpaperbox \zerocount
- \orientpaperbox \zerocount
- \centerpagebox \zerocount
- \mirrorprintbox \zerocount
- \orientprintbox \zerocount
- \offsetprintbox \zerocount
- \pagegoal\dimen\zerocount
- \box0}}
-
-\gdef\showprint
- {\dotripleempty\doshowprint}
+ {\ss ABC\par DEF}%
+ \protect
+ \endbuffer
+ \framed[\c!offset=\v!overlay,\c!strut=\v!no]{\typesetbuffer[crap]}}
-% \switchnaarkorps[8pt]
+% \switchtobodyfont[8pt]
%
-% \startcombinatie[4*4]
-% {\toonprint} {\strut}
-% {\toonprint[][][plaats=midden]} {\type{plaats=midden}}
-% {\toonprint[][][plaats=midden,markering=aan]} {\type{markering=aan}\break
-% \type{plaats=midden}}
-% {\toonprint[][][plaats=midden,markering=aan,nx=2]} {\type{markering=aan}\break
-% \type{plaats=midden}\break
-% \type{nx=2}}
-% {\toonprint[][][plaats=links]} {\type{plaats=links}}
-% {\toonprint[][][plaats=rechts]} {\type{plaats=rechts}}
-% {\toonprint[][][plaats={links,onder}]} {\type{plaats={links,onder}}}
-% {\toonprint[][][plaats={rechts,onder}]} {\type{plaats={rechts,onder}}}
-% {\toonprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}}
-% {\toonprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}}
-% {\toonprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}}
-% {\toonprint[][][nx=2,ny=2,plaats=midden]} {\type{nx=2,ny=2}\break
-% \type{plaats=midden}}
-% {\toonprint[][][rugoffset=3pt]} {\type{rugoffset=.5cm}}
-% {\toonprint[][][kopoffset=3pt]} {\type{kopoffset=.5cm}}
-% {\toonprint[][][schaal=1.5]} {\type{schaal=1.5}}
-% {\toonprint[][][schaal=0.8]} {\type{schaal=0.8}}
-% \stopcombinatie
+% \startcombination[4*4]
+% {\showprint} {\strut}
+% {\showprint[][][location=middle]} {\type{location=middle}}
+% {\showprint[][][location=middle,marking=on]} {\type{markering=aan}\break\type{location=middle}}
+% {\showprint[][][location=middle,marking=on,nx=2]} {\type{markering=aan}\break\type{location=middle}\break\type{nx=2}}
+% {\showprint[][][location=left]} {\type{location=left}}
+% {\showprint[][][location=right]} {\type{location=right}}
+% {\showprint[][][location={left,bottom}]} {\type{location={left,bottom}}}
+% {\showprint[][][location={right,bottom}]} {\type{location={right,bottom}}}
+% {\showprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}}
+% {\showprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}}
+% {\showprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}}
+% {\showprint[][][nx=2,ny=2,location=middle]} {\type{nx=2,ny=2}\break\type{location=middle}}
+% {\showprint[][][backoffset=3pt]} {\type{rugoffset=.5cm}}
+% {\showprint[][][topoffset=3pt]} {\type{kopoffset=.5cm}}
+% {\showprint[][][scale=1.5]} {\type{schaal=1.5}}
+% {\showprint[][][scale=0.8]} {\type{schaal=0.8}}
+% \stopcombination
%
-% \startcombinatie[3*4]
-% {\toonprint[liggend][][plaats=midden]} {\type{liggend}}
-% {\toonprint[][liggend][plaats=midden]} {\strut\break\type{liggend}}
-% {\toonprint[liggend][liggend][plaats=midden]} {\type{liggend}\break\type{liggend}}
-% {\toonprint[90][][plaats=midden]} {\type{90}}
-% {\toonprint[][90][plaats=midden]} {\strut\break\type{90}}
-% {\toonprint[90][90][plaats=midden]} {\type{90}\break\type{90}}
-% {\toonprint[180][][plaats=midden]} {\type{180}}
-% {\toonprint[][180][plaats=midden]} {\strut\break\type{180}}
-% {\toonprint[180][180][plaats=midden]} {\type{180}\break\type{180}}
-% {\toonprint[gespiegeld][][plaats=midden]} {\type{gespiegeld}}
-% {\toonprint[][gespiegeld][plaats=midden]} {\strut\break\type{gespiegeld}}
-% {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}}
-% \stopcombinatie
+% \startcombination[3*4]
+% {\showprint[landscape][] [location=middle]} {\type{landscape}}
+% {\showprint[] [landscape][location=middle]} {\strut\break\type{landscape}}
+% {\showprint[landscape][landscape][location=middle]} {\type{landscape}\break\type{landscape}}
+% {\showprint[90] [] [location=middle]} {\type{90}}
+% {\showprint[] [90] [location=middle]} {\strut\break\type{90}}
+% {\showprint[90] [90] [location=middle]} {\type{90}\break\type{90}}
+% {\showprint[180] [] [location=middle]} {\type{180}}
+% {\showprint[] [180] [location=middle]} {\strut\break\type{180}}
+% {\showprint[180] [180] [location=middle]} {\type{180}\break\type{180}}
+% {\showprint[mirrored] [] [location=middle]} {\type{mirrored}}
+% {\showprint[] [mirrored] [location=middle]} {\strut\break\type{mirrored}}
+% {\showprint[mirrored] [mirrored] [location=middle]} {\type{mirrored}\break\type{mirrored}}
+% \stopcombination
% maybe we will have page-run.lua
\startluacode
+local format, concat = string.format, table.concat
+
local function todimen(name,unit,fmt)
return number.todimen(tex.dimen[name],unit,fmt)
end
-local function showdimension(name)
- context.NC()
- context.tex(interfaces.interfacedcommand(name))
- context.NC()
- context(todimen(name,"pt","%0.4fpt"))
- context.NC()
- context(todimen(name,"cm","%0.4fcm"))
- context.NC()
- context(todimen(name,"bp","%0.4fbp"))
- context.NC()
- context(todimen(name,"dd","%0.4fdd"))
- context.NC()
- context.NR()
-end
+function commands.showlayoutvariables(options)
-local function showmacro(name)
- context.NC()
- context.tex(interfaces.interfacedcommand(name))
- context.NC()
- context.getvalue(name)
- context.NC()
- context.NR()
-end
+ if options == "" then
+ options = "pt,cm"
+ end
-local function reportdimension(name)
- commands.writestatus("layout",string.format("%-24s %12s %12s %12s %12s",
- interfaces.interfacedcommand(name),
- todimen(name,"pt","%0.4fpt"),
- todimen(name,"cm","%0.4fcm"),
- todimen(name,"bp","%0.4fbp"),
- todimen(name,"dd","%0.4fdd")
- ))
-end
+ local options = utilities.parsers.settings_to_hash(options)
+
+ local dimensions = { "pt", "bp", "cm", "mm", "dd", "cc", "pc", "nd", "nc", "sp", "in" }
+
+ local n = 0
+ for i=1,#dimensions do
+ if options[dimensions[i]] then
+ n = n + 1
+ end
+ end
+
+ if n == 0 then
+ options.pt = true
+ n = 1
+ end
-function commands.showlayoutvariables()
+ local function showdimension(name)
+ context.NC()
+ context.tex(interfaces.interfacedcommand(name))
+ context.NC()
+ for i=1,#dimensions do
+ local d = dimensions[i]
+ if options[d] then
+ context("%s%s",todimen(name,d,"%0.4f"),d)
+ context.NC()
+ end
+ end
+ context.NR()
+ end
+
+ local function showmacro(name)
+ context.NC()
+ context.tex(interfaces.interfacedcommand(name))
+ context.NC()
+ context.getvalue(name)
+ context.NC()
+ context.NR()
+ end
+
+ local function reportdimension(name)
+ local result = { }
+ for i=1,#dimensions do
+ local d = dimensions[i]
+ if options[d] then
+ result[#result+1] = format("%12s%s",todimen(name,d,"%0.4f"),d)
+ end
+ end
+ commands.writestatus("layout",format("%-24s %s",interfaces.interfacedcommand(name),concat(result," ")))
+ end
if tex.count.textlevel == 0 then
@@ -167,7 +170,7 @@ function commands.showlayoutvariables()
else
- context.starttabulate { "|l|Tr|Tr|Tr|Tr|" }
+ context.starttabulate { "|l|" .. string.rep("Tr|",n) }
showdimension("paperheight")
showdimension("paperwidth")
@@ -210,11 +213,11 @@ function commands.showlayoutvariables()
end
-function commands.showlayout()
+function commands.showlayout(options)
if tex.count.textlevel == 0 then
- commands.showlayoutvariables()
+ commands.showlayoutvariables(options)
else
@@ -223,7 +226,7 @@ function commands.showlayout()
context.showframe()
context.setuplayout { marking = interfaces.variables.on }
for i=1,4 do
- commands.showlayoutvariables()
+ commands.showlayoutvariables(options)
context.page()
end
context.egroup()
@@ -233,7 +236,7 @@ function commands.showlayout()
end
\stopluacode
-\gdef\doshowframe[#1][#2]%
+\gdef\page_layouts_show_frame[#1][#2]%
{\ifsecondargument
\setupbackgrounds
[\v!page]
@@ -266,16 +269,17 @@ end
\setupbackgrounds
[\c!state=\v!repeat]}
-\gdef\showframe
- {\dodoubleempty\doshowframe}
+\gdef\page_layouts_show_setups[#1]%
+ {\ctxcommand{showlayoutvariables("#1")}}
-\gdef\showsetups
- {\ctxcommand{showlayoutvariables()}}
+\gdef\page_layouts_show_layout[#1]%
+ {\ctxcommand{showlayout("#1")}}
-\gdef\showlayout % interfereert lelijk met een \typefile er na
- {\ctxcommand{showlayout()}}
+\unexpanded\gdef\showframe {\dodoubleempty\page_layouts_show_frame }
+\unexpanded\gdef\showsetups{\dosingleempty\page_layouts_show_setups}
+\unexpanded\gdef\showlayout{\dosingleempty\page_layouts_show_layout}
-\gdef\showmargins
+\unexpanded\gdef\showmargins
{\starttabulate
\NC asynchrone \NC \doifoddpageelse {odd} {even} \NC \NR
\NC synchrone \NC \doifrightpageelse {right} {left} \NC \NR
@@ -284,5 +288,5 @@ end
\NC outer margin \NC \the\outermarginwidth \NC \NR
\NC inner margin \NC \the\innermarginwidth \NC \NR
\stoptabulate}
-
+
\protect \endinput