diff options
author | Marius <mariausol@gmail.com> | 2012-05-11 13:40:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-05-11 13:40:14 +0300 |
commit | 790a9c21511ed643daa75f30e45c0d18a5beef38 (patch) | |
tree | c10adfc074a5655719062664c069b5d58bf30f35 /metapost | |
parent | 534678440306d394a947b5941211c308eee1846f (diff) | |
download | context-790a9c21511ed643daa75f30e45c0d18a5beef38.tar.gz |
beta 2012.05.11 12:15
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-apos.mpiv | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/metapost/context/base/mp-apos.mpiv b/metapost/context/base/mp-apos.mpiv index 5f394e468..34dd57576 100644 --- a/metapost/context/base/mp-apos.mpiv +++ b/metapost/context/base/mp-apos.mpiv @@ -66,53 +66,36 @@ enddef ; % anch-bar: -% def anch_sidebars_draw(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 ; - def anch_sidebars_draw (expr p_b_self, p_e_self, y_b_self, y_e_self, h_b_self, d_e_self, - x, y, w, h, alternative, distance, linewidth, linecolor) = + x, y, w, h, alternative, distance, linewidth, linecolor, topoffset, bottomoffset) = begingroup ; if alternative = 1 : - % nothing + interim linecap := rounded ; else : interim linecap := butt ; fi ; + save a, b ; pair a, b ; + if p_b_self = p_e_self : + a := (-distance,y_b_self+h_b_self-y) ; + b := (-distance,y_e_self-d_e_self-y) ; + elseif RealPageNumber = p_b_self : + a := (-distance,y_b_self+h_b_self-y) ; + b := (-distance,0) ; + elseif RealPageNumber = p_e_self : + a := (-distance,h) ; + b := (-distance,y_e_self-d_e_self-y) ; + else : + a := (-distance,h) ; + b := (-distance,0) ; + fi ; + a := (xpart a, min(ypart a + topoffset, y+h)) ; + b := (xpart b, max(ypart b - bottomoffset,y )) ; draw - if p_b_self=p_e_self : - (-distance,y_b_self+h_b_self-y) -- (-distance,y_e_self-d_e_self-y) - elseif RealPageNumber=p_b_self : - (-distance,y_b_self+h_b_self-y) -- (-distance,0) ; - elseif RealPageNumber=p_e_self : - (-distance,h) -- (-distance,y_e_self-d_e_self-y) - else : - (-distance,h) -- (-distance,0) - fi + a -- b if alternative = 1 : dashed (withdots scaled (linewidth/2)) - else : - withpen pencircle scaled linewidth fi + withpen pencircle scaled linewidth withcolor linecolor ; endgroup ; enddef ; |