mp-cont.mpiv /size: 10 Kb    last modification: 2021-10-28 13:50
1
%D \module
2
%D [ file=mp-cont.mpiv,
3
%D version=1999.03.10,
4
%D title=\CONTEXT\ \METAPOST\ graphics,
5
%D subtitle=Interfaces,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
%D This module is rather preliminary and subjected to changes.
15 16
if
known
context_cont
:
endinput
;
fi
;
17 18
boolean
context_cont
;
context_cont
:
=
true
;
19 20
string
CurrentLayout
;
CurrentLayout
:
=
"
default
"
;
21 22
boolean
mfun_swapped
;
23 24
def
SwapPageState
=
25
mfun_swapped
:
=
true
;
% eventually this will go !
26
enddef
;
27 28
extra_beginfig
:
=
extra_beginfig
&
"
mfun_swapped := false ;
"
;
29 30
% runscript("mp.PaperHeight()") is much faster than lua.mp.PaperHeight() so we use that now:
31 32
vardef
PaperHeight
=
runscript
(
"
mp.PaperHeight()
"
)
enddef
;
33
vardef
PaperWidth
=
runscript
(
"
mp.PaperWidth()
"
)
enddef
;
34
vardef
PrintPaperHeight
=
runscript
(
"
mp.PrintPaperHeight()
"
)
enddef
;
35
vardef
PrintPaperWidth
=
runscript
(
"
mp.PrintPaperWidth()
"
)
enddef
;
36
vardef
TopSpace
=
runscript
(
"
mp.TopSpace()
"
)
enddef
;
37
vardef
BottomSpace
=
runscript
(
"
mp.BottomSpace()
"
)
enddef
;
38
vardef
BackSpace
=
runscript
(
"
mp.BackSpace()
"
)
enddef
;
39
vardef
CutSpace
=
runscript
(
"
mp.CutSpace()
"
)
enddef
;
40
vardef
MakeupHeight
=
runscript
(
"
mp.MakeupHeight()
"
)
enddef
;
41
vardef
MakeupWidth
=
runscript
(
"
mp.MakeupWidth()
"
)
enddef
;
42
vardef
TopHeight
=
runscript
(
"
mp.TopHeight()
"
)
enddef
;
43
vardef
TopDistance
=
runscript
(
"
mp.TopDistance()
"
)
enddef
;
44
vardef
HeaderHeight
=
runscript
(
"
mp.HeaderHeight()
"
)
enddef
;
45
vardef
HeaderDistance
=
runscript
(
"
mp.HeaderDistance()
"
)
enddef
;
46
vardef
TextHeight
=
runscript
(
"
mp.TextHeight()
"
)
enddef
;
47
vardef
FooterDistance
=
runscript
(
"
mp.FooterDistance()
"
)
enddef
;
48
vardef
FooterHeight
=
runscript
(
"
mp.FooterHeight()
"
)
enddef
;
49
vardef
BottomDistance
=
runscript
(
"
mp.BottomDistance()
"
)
enddef
;
50
vardef
BottomHeight
=
runscript
(
"
mp.BottomHeight()
"
)
enddef
;
51
vardef
LeftEdgeWidth
=
runscript
(
"
mp.LeftEdgeWidth()
"
)
enddef
;
52
vardef
LeftEdgeDistance
=
runscript
(
"
mp.LeftEdgeDistance()
"
)
enddef
;
53
vardef
LeftMarginWidth
=
runscript
(
"
mp.LeftMarginWidth()
"
)
enddef
;
54
vardef
LeftMarginDistance
=
runscript
(
"
mp.LeftMarginDistance()
"
)
enddef
;
55
vardef
TextWidth
=
runscript
(
"
mp.TextWidth()
"
)
enddef
;
56
vardef
RightMarginDistance
=
runscript
(
"
mp.RightMarginDistance()
"
)
enddef
;
57
vardef
RightMarginWidth
=
runscript
(
"
mp.RightMarginWidth()
"
)
enddef
;
58
vardef
RightEdgeDistance
=
runscript
(
"
mp.RightEdgeDistance()
"
)
enddef
;
59
vardef
RightEdgeWidth
=
runscript
(
"
mp.RightEdgeWidth()
"
)
enddef
;
60
vardef
InnerMarginDistance
=
runscript
(
"
mp.InnerMarginDistance()
"
)
enddef
;
61
vardef
InnerMarginWidth
=
runscript
(
"
mp.InnerMarginWidth()
"
)
enddef
;
62
vardef
OuterMarginDistance
=
runscript
(
"
mp.OuterMarginDistance()
"
)
enddef
;
63
vardef
OuterMarginWidth
=
runscript
(
"
mp.OuterMarginWidth()
"
)
enddef
;
64
vardef
InnerEdgeDistance
=
runscript
(
"
mp.InnerEdgeDistance()
"
)
enddef
;
65
vardef
InnerEdgeWidth
=
runscript
(
"
mp.InnerEdgeWidth()
"
)
enddef
;
66
vardef
OuterEdgeDistance
=
runscript
(
"
mp.OuterEdgeDistance()
"
)
enddef
;
67
vardef
OuterEdgeWidth
=
runscript
(
"
mp.OuterEdgeWidth()
"
)
enddef
;
68
vardef
PageOffset
=
runscript
(
"
mp.PageOffset()
"
)
enddef
;
69
vardef
PageDepth
=
runscript
(
"
mp.PageDepth()
"
)
enddef
;
70
vardef
LayoutColumns
=
runscript
(
"
mp.LayoutColumns()
"
)
enddef
;
71
vardef
LayoutColumnDistance
=
runscript
(
"
mp.LayoutColumnDistance()
"
)
enddef
;
72
vardef
LayoutColumnWidth
=
runscript
(
"
mp.LayoutColumnWidth()
"
)
enddef
;
73 74
vardef
OnRightPage
=
runscript
(
"
mp.OnRightPage()
"
)
enddef
;
75
vardef
OnOddPage
=
runscript
(
"
mp.OnOddPage()
"
)
enddef
;
76
vardef
InPageBody
=
runscript
(
"
mp.InPageBody()
"
)
enddef
;
77 78
vardef
RealPageNumber
=
runscript
(
"
mp.RealPageNumber()
"
)
enddef
;
79
vardef
LastPageNumber
=
runscript
(
"
mp.LastPageNumber()
"
)
enddef
;
% duplicates
80 81
vardef
PageNumber
=
runscript
(
"
mp.PageNumber()
"
)
enddef
;
82
vardef
NOfPages
=
runscript
(
"
mp.NOfPages()
"
)
enddef
;
83 84
vardef
SubPageNumber
=
runscript
(
"
mp.SubPageNumber()
"
)
enddef
;
85
vardef
NOfSubPages
=
runscript
(
"
mp.NOfSubPages()
"
)
enddef
;
86 87
vardef
CurrentColumn
=
runscript
(
"
mp.CurrentColumn()
"
)
enddef
;
88
vardef
NOfColumns
=
runscript
(
"
mp.NOfColumns()
"
)
enddef
;
89 90
vardef
BaseLineSkip
=
runscript
(
"
mp.BaseLineSkip()
"
)
enddef
;
91
vardef
LineHeight
=
runscript
(
"
mp.LineHeight()
"
)
enddef
;
92
vardef
BodyFontSize
=
runscript
(
"
mp.BodyFontSize()
"
)
enddef
;
93 94
vardef
TopSkip
=
runscript
(
"
mp.TopSkip()
"
)
enddef
;
95
vardef
StrutHeight
=
runscript
(
"
mp.StrutHeight()
"
)
enddef
;
96
vardef
StrutDepth
=
runscript
(
"
mp.StrutDepth()
"
)
enddef
;
97 98
vardef
CurrentWidth
=
runscript
(
"
mp.CurrentWidth()
"
)
enddef
;
99
vardef
CurrentHeight
=
runscript
(
"
mp.CurrentHeight()
"
)
enddef
;
100 101
vardef
HSize
=
runscript
(
"
mp.HSize()
"
)
enddef
;
% duplicates
102
vardef
VSize
=
runscript
(
"
mp.VSize()
"
)
enddef
;
% duplicates
103 104
vardef
EmWidth
=
runscript
(
"
mp.EmWidth()
"
)
enddef
;
105
vardef
ExHeight
=
runscript
(
"
mp.ExHeight()
"
)
enddef
;
106 107
vardef
PageFraction
=
runscript
(
"
mp.PageFraction()
"
)
enddef
;
108 109
vardef
SpineWidth
=
runscript
(
"
mp.SpineWidth()
"
)
enddef
;
110
vardef
PaperBleed
=
runscript
(
"
mp.PaperBleed()
"
)
enddef
;
111 112
% CurrentLayout = runscript("mp.CurrentLayout()") enddef ;
113
vardef
OverlayWidth
=
runscript
(
"
mp.OverlayWidth()
"
)
enddef
;
114
vardef
OverlayHeight
=
runscript
(
"
mp.OverlayHeight()
"
)
enddef
;
115
vardef
OverlayDepth
=
runscript
(
"
mp.OverlayDepth()
"
)
enddef
;
116
vardef
OverlayLineWidth
=
runscript
(
"
mp.OverlayLineWidth()
"
)
enddef
;
117
vardef
OverlayOffset
=
runscript
(
"
mp.OverlayOffset()
"
)
enddef
;
118
vardef
OverlayRegion
=
runscript
(
"
mp.OverlayRegion()
"
)
enddef
;
119
% OverlayLineColor = runscript("mp.OverlayLineColor()") enddef ;
120
% OverlayColor = runscript("mp.OverlayColor()") enddef ;
121 122
vardef
defaultcolormodel
=
runscript
(
"
mp.defaultcolormodel()
"
)
enddef
;
123 124
vardef
LeftMarginWidth
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.RightMarginWidth()
"
)
else
:
runscript
(
"
mp.LeftMarginWidth()
"
)
fi
enddef
;
125
vardef
RightMarginWidth
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.LeftMarginWidth()
"
)
else
:
runscript
(
"
mp.RightMarginWidth()
"
)
fi
enddef
;
126
vardef
LeftMarginDistance
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.RightMarginDistance()
"
)
else
:
runscript
(
"
mp.LeftMarginDistance()
"
)
fi
enddef
;
127
vardef
RightMarginDistance
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.LeftMarginDistance()
"
)
else
:
runscript
(
"
mp.RightMarginDistance()
"
)
fi
enddef
;
128 129
vardef
LeftEdgeWidth
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.RightEdgeWidth()
"
)
else
:
runscript
(
"
mp.LeftEdgeWidth()
"
)
fi
enddef
;
130
vardef
RightEdgeWidth
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.LeftEdgeWidth()
"
)
else
:
runscript
(
"
mp.RightEdgeWidth()
"
)
fi
enddef
;
131
vardef
LeftEdgeDistance
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.RightEdgeDistance()
"
)
else
:
runscript
(
"
mp.LeftEdgeDistance()
"
)
fi
enddef
;
132
vardef
RightEdgeDistance
=
if
mfun_swapped
and
not
OnRightPage
:
runscript
(
"
mp.LeftEdgeDistance()
"
)
else
:
runscript
(
"
mp.RightEdgeDistance()
"
)
fi
enddef
;
133 134
vardef
BackSpace
=
if
mfun_swapped
and
not
OnRightPage
:
PaperWidth
-
MakeupWidth
-
fi
runscript
(
"
mp.BackSpace()
"
)
enddef
;
135
vardef
CutSpace
=
if
mfun_swapped
and
not
OnRightPage
:
PaperWidth
-
MakeupWidth
-
fi
runscript
(
"
mp.CutSpace()
"
)
enddef
;
136 137
% better use:
138 139
vardef
OuterMarginWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.LeftMarginWidth()
"
)
else
:
runscript
(
"
mp.RightMarginWidth()
"
)
fi
enddef
;
140
vardef
InnerMarginWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.RightMarginWidth()
"
)
else
:
runscript
(
"
mp.LeftMarginWidth()
"
)
fi
enddef
;
141
vardef
OuterMarginDistance
=
if
not
OnRightPage
:
runscript
(
"
mp.LeftMarginDistance()
"
)
else
:
runscript
(
"
mp.RightMarginDistance()
"
)
fi
enddef
;
142
vardef
InnerMarginDistance
=
if
not
OnRightPage
:
runscript
(
"
mp.RightMarginDistance()
"
)
else
:
runscript
(
"
mp.LeftMarginDistance()
"
)
fi
enddef
;
143 144
vardef
OuterEdgeWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.LeftEdgeWidth()
"
)
else
:
runscript
(
"
mp.RightEdgeWidth()
"
)
fi
enddef
;
145
vardef
InnerEdgeWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.RightEdgeWidth()
"
)
else
:
runscript
(
"
mp.LeftEdgeWidth()
"
)
fi
enddef
;
146
vardef
OuterEdgeDistance
=
if
not
OnRightPage
:
runscript
(
"
mp.LeftEdgeDistance()
"
)
else
:
runscript
(
"
mp.RightEdgeDistance()
"
)
fi
enddef
;
147
vardef
InnerEdgeDistance
=
if
not
OnRightPage
:
runscript
(
"
mp.RightEdgeDistance()
"
)
else
:
runscript
(
"
mp.LeftEdgeDistance()
"
)
fi
enddef
;
148 149
vardef
OuterSpaceWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.BackSpace()
"
)
else
:
runscript
(
"
mp.CutSpace()
"
)
fi
enddef
;
150
vardef
InnerSpaceWidth
=
if
not
OnRightPage
:
runscript
(
"
mp.CutSpace()
"
)
else
:
runscript
(
"
mp.BackSpace()
"
)
fi
enddef
;
151 152
% indices
153 154
vardef
OuterMargin
=
if
not
OnRightPage
:
LeftMargin
else
:
RightMargin
fi
enddef
;
155
vardef
InnerMargin
=
if
not
OnRightPage
:
RightMargin
else
:
LeftMargin
fi
enddef
;
156 157
vardef
OuterEdge
=
if
not
OnRightPage
:
LeftEdge
else
:
RightEdge
fi
enddef
;
158
vardef
InnerEdge
=
if
not
OnRightPage
:
RightEdge
else
:
LeftEdge
fi
enddef
;
159