From: ellson Date: Thu, 1 Dec 2005 04:43:39 +0000 (+0000) Subject: new feature: simulated duplex edges using parallel edges. X-Git-Tag: LAST_LIBGRAPH~32^2~6934 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47f048f3683d80232947c2b1955800369a49bbbe;p=graphviz new feature: simulated duplex edges using parallel edges. - head arrow takes first color, tail arrow takes second color --- diff --git a/lib/common/emit.c b/lib/common/emit.c index baa0b9c6e..266e6e0a3 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -739,6 +739,7 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e) { int i, j, cnum, numc = 0; char *color, *pencolor, *fillcolor, *style; + char *headcolor, *tailcolor, *lastcolor; char *colors = NULL; char **styles = 0; char **sp; @@ -847,18 +848,23 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e) tmplist[j].x = pf3.x - numc2 * offlist[j].x; tmplist[j].y = pf3.y - numc2 * offlist[j].y; } + lastcolor = headcolor = tailcolor = color; colors = strdup(color); for (cnum = 0, color = strtok(colors, ":"); color; - cnum++, color = strtok(0, ":")) { - if (! (ED_gui_state(e) & (GUI_STATE_ACTIVE | GUI_STATE_SELECTED))) { - if (color[0]) { + cnum++, color = strtok(0, ":")) { + if (!color[0]) + color = DEFAULT_COLOR; + if (color != lastcolor) { + if (! (ED_gui_state(e) & (GUI_STATE_ACTIVE | GUI_STATE_SELECTED))) { gvrender_set_pencolor(job, color); gvrender_set_fillcolor(job, color); - } else { - gvrender_set_pencolor(job, DEFAULT_COLOR); - gvrender_set_fillcolor(job, DEFAULT_COLOR); } + lastcolor = color; } + if (cnum == 0) + headcolor = tailcolor = color; + if (cnum == 1) + tailcolor = color; for (i = 0; i < tmpspl.size; i++) { tmplist = tmpspl.list[i].list; offlist = offspl.list[i].list; @@ -871,10 +877,24 @@ void emit_edge_graphics(GVJ_t * job, edge_t * e) } } if (bz.sflag) { + if (color != tailcolor) { + color = tailcolor; + if (! (ED_gui_state(e) & (GUI_STATE_ACTIVE | GUI_STATE_SELECTED))) { + gvrender_set_pencolor(job, color); + gvrender_set_fillcolor(job, color); + } + } arrow_gen(job, EMIT_TDRAW, bz.sp, bz.list[0], scale, bz.sflag); } if (bz.eflag) { + if (color != headcolor) { + color = headcolor; + if (! (ED_gui_state(e) & (GUI_STATE_ACTIVE | GUI_STATE_SELECTED))) { + gvrender_set_pencolor(job, color); + gvrender_set_fillcolor(job, color); + } + } arrow_gen(job, EMIT_HDRAW, bz.ep, bz.list[bz.size - 1], scale, bz.eflag); }