1
2
3
4
5
6
7
8
9
10
11
12
13
14if known context_apos : endinput ; fi ;
15
16boolean context_apos ; context_apos := true ;
17
18path posboxes[],
19 posregions[] ;
20
21numeric multipages[],
22 nofposboxes ;
23
24nofposboxes := 0 ;
25
26def boxlineoptions = withcolor .8blue enddef ;
27def boxfilloptions = withcolor .8white enddef ;
28
29def connect_positions =
30 if nofposboxes = 2 :
31 pickup pencircle scaled boxlinewidth ;
32 path pa ; pa := posboxes[1] enlarged boxlineoffset ;
33 path pb ; pb := posboxes[2] enlarged boxlineoffset ;
34 if pospages[1] = pospages[2] :
35 draw posboxes[1] boxlineoptions ;
36 path pc ; pc := center pa {up} .. {down} center pb ;
37 pair cc ; cc := (pc intersection_point pa) ;
38 if intersection_found :
39 pc := pc cutbefore cc ;
40 cc := (pc intersection_point pb) ;
41 if intersection_found :
42 pc := pc cutafter cc ;
43 drawarrow pc boxlineoptions ;
44 drawarrow reverse pc boxlineoptions ;
45 fi ;
46 fi ;
47 elseif pospages[1] == RealPageNumber :
48 draw posboxes[1] boxlineoptions ;
49 path pc ; pc := center pa {up} ... {right} urcorner (posregions[1] enlarged (20pt,20pt)) ;
50 pair cc ; cc := (pc intersection_point pa) ;
51 if intersection_found :
52 pc := pc cutbefore cc ;
53 drawarrow pc boxlineoptions ;
54 fi ;
55 elseif pospages[2] == RealPageNumber :
56 draw posboxes[2] boxlineoptions ;
57 path pc ; pc := ulcorner (posregions[2] enlarged (20pt,20pt)) {right} ... {down} center pb ;
58 pair cc ; cc := (pc intersection_point pb) ;
59 if intersection_found :
60 pc := pc cutafter cc ;
61 drawarrow pc boxlineoptions ;
62 fi ;
63 fi ;
64 fi ;
65enddef ;
66
67
68
69def anch_sidebars_draw (expr p_b_self, p_e_self, y_b_self, y_e_self, h_b_self, d_e_self,
70 x, y, w, h, alternative, distance, linewidth, linecolor, topoffset, bottomoffset) =
71
72 begingroup ;
73 if alternative = 1 :
74 interim linecap := rounded ;
75 else :
76 interim linecap := butt ;
77 fi ;
78 save a, b ; pair a, b ;
79 if p_b_self = p_e_self :
80 a := (distance,y_b_selfh_b_selfy) ;
81 b := (distance,y_e_selfd_e_selfy) ;
82 elseif RealPageNumber = p_b_self :
83 a := (distance,y_b_selfh_b_selfy) ;
84 b := (distance,0) ;
85 elseif RealPageNumber = p_e_self :
86 a := (distance,h) ;
87 b := (distance,y_e_selfd_e_selfy) ;
88 else :
89 a := (distance,h) ;
90 b := (distance,0) ;
91 fi ;
92 a := (xpart a, min(ypart a topoffset, h)) ;
93 b := (xpart b, max(ypart b bottomoffset,0)) ;
94 draw
95 a -- b
96 if alternative = 1 :
97 dashed (withdots scaled (linewidth2))
98 fi
99 withpen pencircle scaled linewidth
100 withcolor linecolor ;
101 endgroup ;
102enddef ;
103 |