From 790a9c21511ed643daa75f30e45c0d18a5beef38 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 11 May 2012 13:40:14 +0300 Subject: beta 2012.05.11 12:15 --- metapost/context/base/mp-apos.mpiv | 57 +++++++++++++------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) (limited to 'metapost') 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 ; -- cgit v1.2.3