summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-02-25 19:46:00 +0100
committerHans Hagen <pragma@wxs.nl>2010-02-25 19:46:00 +0100
commit8ce9c33634056a6c8b9673c7f14a27cef1f3348f (patch)
tree2cc2233e523548c9925349ff60b80a6ab5b2f3b1 /metapost
parent66aa7cfc8c9424ee0fe4e62a83b86dac39dc59a1 (diff)
downloadcontext-8ce9c33634056a6c8b9673c7f14a27cef1f3348f.tar.gz
beta 2010.02.25 19:46
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-back.mp232
-rw-r--r--metapost/context/base/mp-page.mp27
2 files changed, 143 insertions, 116 deletions
diff --git a/metapost/context/base/mp-back.mp b/metapost/context/base/mp-back.mp
index 99e88554b..f49474cf7 100644
--- a/metapost/context/base/mp-back.mp
+++ b/metapost/context/base/mp-back.mp
@@ -1,6 +1,6 @@
%D \module
%D [ file=mp-back.mp,
-%D version=2000.05.31,
+%D version=2000.05.31,
%D title=\CONTEXT\ \METAPOST\ graphics,
%D subtitle=backgrounds,
%D author=Hans Hagen,
@@ -8,199 +8,199 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
-if unknown context_tool : input mp-tool ; fi ;
-if known context_back : endinput ; fi ;
+if unknown context_tool : input mp-tool ; fi ;
+if known context_back : endinput ; fi ;
-boolean context_back ; context_back := true ;
+boolean context_back ; context_back := true ;
-def some_hash ( expr hash_width ,
- hash_height ,
- hash_linewidth ,
- hash_linecolor ,
- hash_angle ,
- hash_gap ) =
+def some_hash ( expr hash_width ,
+ hash_height ,
+ hash_linewidth ,
+ hash_linecolor ,
+ hash_angle ,
+ hash_gap ) =
stripe_gap := hash_gap ;
stripe_angle := hash_angle ;
- drawoptions (withpen pencircle scaled hash_linewidth
+ drawoptions (withpen pencircle scaled hash_linewidth
withcolor hash_linecolor) ;
path p ; p := unitsquare xscaled hash_width yscaled hash_height ;
stripe_path_a () (draw) p ; % next we move it all to quadrant 1
- currentpicture := currentpicture shifted urcorner currentpicture ;
+ currentpicture := currentpicture shifted urcorner currentpicture ;
-enddef ;
+enddef ;
-def some_double_back (expr back_type ,
+def some_double_back (expr back_type ,
back_width ,
back_height ,
- back_delta ,
- back_linewidth ,
- back_linecolor ,
- back_fillcolor ,
- back_topcolor ,
+ back_delta ,
+ back_linewidth ,
+ back_linecolor ,
+ back_fillcolor ,
+ back_topcolor ,
back_bottomcolor ,
- back_leftcolor ,
- back_rightcolor ) =
+ back_leftcolor ,
+ back_rightcolor ) =
- numeric ww ; ww := back_width ;
- numeric hh ; hh := back_height ;
- numeric dd ; dd := back_delta ;
+ numeric ww ; ww := back_width ;
+ numeric hh ; hh := back_height ;
+ numeric dd ; dd := back_delta ;
- color back_nillcolor ; back_nillcolor := back_topcolor ;
+ color back_nillcolor ; back_nillcolor := back_topcolor ;
- path p ; p := fullsquare xscaled ww yscaled hh ;
- path q ; q := fullsquare xscaled (ww-2dd) yscaled (hh-2dd) ;
- path r ; r := llcorner p --
- lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
- lrcorner p shifted (0, 3dd) --
- urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ path p ; p := fullsquare xscaled ww yscaled hh ;
+ path q ; q := fullsquare xscaled (ww-2dd) yscaled (hh-2dd) ;
+ path r ; r := llcorner p --
+ lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
+ lrcorner p shifted (0, 3dd) --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
urcorner p shifted (-3dd,0) --
ulcorner p -- cycle ;
path s ; s := r xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
- path t ; t := llcorner p --
- lrcorner p --
- urcorner p shifted (0,-3dd) .. controls urcorner p ..
- urcorner p shifted (-3dd,0) --
- ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
+ path t ; t := llcorner p --
+ lrcorner p --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ urcorner p shifted (-3dd,0) --
+ ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
ulcorner p shifted (0,-3dd) --
llcorner p -- cycle ;
path u ; u := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
- path v ; v := llcorner p shifted ( 3dd,0) --
- lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
- lrcorner p shifted (0, 3dd) --
- urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ path v ; v := llcorner p shifted ( 3dd,0) --
+ lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
+ lrcorner p shifted (0, 3dd) --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
urcorner p shifted (-3dd,0) --
- ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
+ ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
ulcorner p shifted (0,-3dd) ..
llcorner p shifted (0, 3dd) .. controls llcorner p .. cycle ; % {down} .. cycle ;
path w ; w := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
- path a ; a := llcorner p -- ulcorner p --
+ path a ; a := llcorner p -- ulcorner p --
ulcorner q -- llcorner q -- cycle ;
- path b ; b := llcorner p -- lrcorner p --
+ path b ; b := llcorner p -- lrcorner p --
lrcorner q -- llcorner q -- cycle ;
- path c ; c := lrcorner p -- urcorner p --
+ path c ; c := lrcorner p -- urcorner p --
urcorner q -- lrcorner q -- cycle ;
- path d ; d := ulcorner p -- urcorner p --
+ path d ; d := ulcorner p -- urcorner p --
urcorner q -- ulcorner q -- cycle ;
- path e ; e := llcorner p -- lrcorner p --
- urcorner p -- urcorner q --
+ path e ; e := llcorner p -- lrcorner p --
+ urcorner p -- urcorner q --
lrcorner q -- llcorner q -- cycle ;
- path f ; f := llcorner p -- ulcorner p --
- urcorner p -- urcorner q --
+ path f ; f := llcorner p -- ulcorner p --
+ urcorner p -- urcorner q --
ulcorner q -- llcorner q -- cycle ;
- linecap := butt ; pickup pencircle scaled back_linewidth ;
+ linecap := butt ; pickup pencircle scaled back_linewidth ;
- if back_type=1 :
+ if back_type=1 :
- fill p withcolor back_fillcolor ;
- fill a withcolor back_leftcolor ;
- fill b withcolor back_bottomcolor ;
- fill c withcolor back_rightcolor ;
- fill d withcolor back_topcolor ;
- draw a withcolor back_linecolor ;
- draw d withcolor back_linecolor ;
- draw b withcolor back_linecolor ;
- draw c withcolor back_linecolor ;
+ fill p withcolor back_fillcolor ;
+ fill a withcolor back_leftcolor ;
+ fill b withcolor back_bottomcolor ;
+ fill c withcolor back_rightcolor ;
+ fill d withcolor back_topcolor ;
+ draw a withcolor back_linecolor ;
+ draw d withcolor back_linecolor ;
+ draw b withcolor back_linecolor ;
+ draw c withcolor back_linecolor ;
- elseif back_type=2 :
+ elseif back_type=2 :
- fill p withcolor back_fillcolor ;
- fill e withcolor back_bottomcolor ;
- fill f withcolor back_topcolor ;
- draw e withcolor back_linecolor ;
- draw f withcolor back_linecolor ;
+ fill p withcolor back_fillcolor ;
+ fill e withcolor back_bottomcolor ;
+ fill f withcolor back_topcolor ;
+ draw e withcolor back_linecolor ;
+ draw f withcolor back_linecolor ;
- elseif back_type=3 :
+ elseif back_type=3 :
- fill v withcolor back_nillcolor ;
- fill w withcolor back_fillcolor ;
- draw v withcolor back_linecolor ;
- draw w withcolor back_linecolor ;
+ fill v withcolor back_nillcolor ;
+ fill w withcolor back_fillcolor ;
+ draw v withcolor back_linecolor ;
+ draw w withcolor back_linecolor ;
- elseif back_type=4 :
+ elseif back_type=4 :
- fill t withcolor back_nillcolor ;
- fill u withcolor back_fillcolor ;
- draw t withcolor back_linecolor ;
- draw u withcolor back_linecolor ;
+ fill t withcolor back_nillcolor ;
+ fill u withcolor back_fillcolor ;
+ draw t withcolor back_linecolor ;
+ draw u withcolor back_linecolor ;
- elseif back_type=5 :
+ elseif back_type=5 :
- t := t rotatedaround(center t,180) ;
- u := u rotatedaround(center u,180) ;
+ t := t rotatedaround(center t,180) ;
+ u := u rotatedaround(center u,180) ;
- fill t withcolor back_nillcolor ;
- fill u withcolor back_fillcolor ;
- draw t withcolor back_linecolor ;
- draw u withcolor back_linecolor ;
+ fill t withcolor back_nillcolor ;
+ fill u withcolor back_fillcolor ;
+ draw t withcolor back_linecolor ;
+ draw u withcolor back_linecolor ;
- elseif back_type=6 :
+ elseif back_type=6 :
- r := r rotatedaround(center r,180) ;
- s := s rotatedaround(center s,180) ;
+ r := r rotatedaround(center r,180) ;
+ s := s rotatedaround(center s,180) ;
- fill r withcolor back_nillcolor ;
- fill s withcolor back_fillcolor ;
- draw r withcolor back_linecolor ;
- draw s withcolor back_linecolor ;
+ fill r withcolor back_nillcolor ;
+ fill s withcolor back_fillcolor ;
+ draw r withcolor back_linecolor ;
+ draw s withcolor back_linecolor ;
- elseif back_type=7 :
+ elseif back_type=7 :
- fill r withcolor back_nillcolor ;
- fill s withcolor back_fillcolor ;
- draw r withcolor back_linecolor ;
- draw s withcolor back_linecolor ;
+ fill r withcolor back_nillcolor ;
+ fill s withcolor back_fillcolor ;
+ draw r withcolor back_linecolor ;
+ draw s withcolor back_linecolor ;
-fi ;
+fi ;
-enddef ;
+enddef ;
endinput ;
-beginfig (1) ;
+beginfig (1) ;
-some_double_back (1, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (1, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, .6white, .7white, .6white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (2, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (2, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, .6white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (3, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (3, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (4, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (4, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (5, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (5, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (6, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (6, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (7, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (7, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-currentpicture := currentpicture shifted (0,-3cm) ;
+currentpicture := currentpicture shifted (0,-3cm) ;
-some_double_back (8, 4.5cm, 1.5cm, .25cm, 1mm,
+some_double_back (8, 4.5cm, 1.5cm, .25cm, 1mm,
.5white, .8white, .7white, white, white, white)
-endfig ;
+endfig ;
end .
diff --git a/metapost/context/base/mp-page.mp b/metapost/context/base/mp-page.mp
index 71ca12aa0..60bfb1417 100644
--- a/metapost/context/base/mp-page.mp
+++ b/metapost/context/base/mp-page.mp
@@ -444,4 +444,31 @@ def Enlarged (expr p, d) =
ulEnlarged (p,d) -- cycle)
enddef ;
+% New:
+
+def position_anchor_bar(expr p_b_self, p_e_self, y_b_self, y_e_self, h_b_self, d_e_self,
+ distance, linewidth, linecolor) =
+ StartPage ;
+ path p ; p :=
+ if p_b_self=p_e_self :
+ (xpart ulcorner Field[Text][Text],y_b_self+h_b_self) --
+ (xpart llcorner Field[Text][Text],y_e_self-d_e_self) ;
+ elseif RealPageNumber=p_b_self :
+ (xpart ulcorner Field[Text][Text],y_b_self+h_b_self) --
+ (llcorner Field[Text][Text]) ;
+ elseif RealPageNumber=p_e_self :
+ (ulcorner Field[Text][Text]) --
+ (xpart llcorner Field[Text][Text],y_e_self-d_e_self) ;
+ else :
+ (ulcorner Field[Text][Text]) --
+ (llcorner Field[Text][Text]) ;
+ fi ;
+ p := p shifted (-llcorner Field[Text][Text]-(distance,0)) ;
+ interim linecap := butt ;
+ draw p
+ withpen pencircle scaled linewidth
+ withcolor linecolor ;
+ StopPage ;
+enddef ;
+
endinput ;