diff options
author | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2008-01-18 09:47:22 +0000 |
---|---|---|
committer | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2008-01-18 09:47:22 +0000 |
commit | 48daa9a11253bee8c2eeebf2c1d56daab08b3da5 (patch) | |
tree | 59a66cd5a149f0f20136c1b8823980d7d20e1cef | |
parent | 1d094c799a492a2a2ddd64102b360955845cf7f0 (diff) | |
download | dzen-48daa9a11253bee8c2eeebf2c1d56daab08b3da5.tar.gz dzen-48daa9a11253bee8c2eeebf2c1d56daab08b3da5.zip |
^r(WxH+X+Y) positions relativly to the current pos
git-svn-id: http://dzen.googlecode.com/svn/trunk@207 f2baff5b-bf2c-0410-a398-912abdc3d8b2
-rw-r--r-- | draw.c | 37 |
1 files changed, 30 insertions, 7 deletions
@@ -453,9 +453,16 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { case rect: get_rect_vals(tval, &rectw, &recth, &rectx, &recty); recth = recth > dzen.line_height ? dzen.line_height : recth; - recty = recty == 0 ? (dzen.line_height - recth)/2 : recty; + if(set_posy) + py += recty; + recty = recty == 0 ? (dzen.line_height - recth)/2 : + (dzen.line_height - recth)/2 + recty; px = rectx == 0 ? px : rectx+px; setcolor(pm, px, rectw, lastfg, lastbg, reverse, nobg); + /*printf("R2: px=%d py=%d rectw=%d recth=%d\n", px, + set_posy ? py : ((int)recty<0 ? dzen.line_height + recty : recty), + rectw, recth); + */ XFillRectangle(dzen.dpy, *pm, dzen.tgc, px, set_posy ? py : ((int)recty < 0 ? dzen.line_height + recty : recty), @@ -469,13 +476,17 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { if (!rectw) break; recth = recth > dzen.line_height ? dzen.line_height-2 : recth-1; - recty = recty == 0 ? (dzen.line_height - recth)/2 : recty; + if(set_posy) + py += recty; + recty = recty == 0 ? (dzen.line_height - recth)/2 : + (dzen.line_height - recth)/2 + recty; px = (rectx == 0) ? px : rectx+px; /* prevent from stairs effect when rounding recty */ if (!((dzen.line_height - recth) % 2)) recty--; setcolor(pm, px, rectw, lastfg, lastbg, reverse, nobg); XDrawRectangle(dzen.dpy, *pm, dzen.tgc, px, - set_posy ? py : ((int)recty<0 ? dzen.line_height + recty : recty), rectw-1, recth); + set_posy ? py : + ((int)recty<0 ? dzen.line_height + recty : recty), rectw-1, recth); px += rectw; break; @@ -647,11 +658,19 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { case rect: get_rect_vals(tval, &rectw, &recth, &rectx, &recty); recth = recth > dzen.line_height ? dzen.line_height : recth; - recty = (recty == 0) ? (dzen.line_height - recth)/2 : recty; + if(set_posy) + py += recty; + recty = (recty == 0) ? (dzen.line_height - recth)/2 : + (dzen.line_height - recth)/2 + recty; px = (rectx == 0) ? px : rectx+px; setcolor(pm, px, rectw, lastfg, lastbg, reverse, nobg); + /*printf("R2: px=%d py=%d rectw=%d recth=%d\n", px, + set_posy ? py : ((int)recty<0 ? dzen.line_height + recty : recty), + rectw, recth); + */ XFillRectangle(dzen.dpy, *pm, dzen.tgc, px, - set_posy ? py : ((int)recty<0 ? dzen.line_height + recty : recty), rectw, recth); + set_posy ? py : + ((int)recty<0 ? dzen.line_height + recty : recty), rectw, recth); px += rectw; break; @@ -661,13 +680,17 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { if (!rectw) break; recth = recth > dzen.line_height ? dzen.line_height-2 : recth-1; - recty = recty == 0 ? (dzen.line_height - recth)/2 : recty; + if(set_posy) + py += recty; + recty = recty == 0 ? (dzen.line_height - recth)/2 : + (dzen.line_height - recth)/2 + recty; px = (rectx == 0) ? px : rectx+px; /* prevent from stairs effect when rounding recty */ if (!((dzen.line_height - recth) % 2)) recty--; setcolor(pm, px, rectw, lastfg, lastbg, reverse, nobg); XDrawRectangle(dzen.dpy, *pm, dzen.tgc, px, - set_posy ? py : ((int)recty<0 ? dzen.line_height + recty : recty), rectw-1, recth); + set_posy ? py : + ((int)recty<0 ? dzen.line_height + recty : recty), rectw-1, recth); px += rectw; break; |