From 3aee0622602b4a2f8ac12f99e4bbc1ef61d7f8bc Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Thu, 31 Oct 2013 16:24:58 -0400 Subject: [PATCH] Add new underline shape --- doc/info/shapes.html | 32 ++++++++++++++++------------ doc/info/underline.gif | Bin 0 -> 849 bytes doc/infosrc/Makefile.old | 2 +- doc/infosrc/mkshapes.sh | 2 +- doc/infosrc/shapelist | 1 + lib/common/const.h | 1 + lib/common/shapes.c | 44 +++++++++++++++++++++++---------------- 7 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 doc/info/underline.gif diff --git a/doc/info/shapes.html b/doc/info/shapes.html index 92728e7cb..637bceb46 100644 --- a/doc/info/shapes.html +++ b/doc/info/shapes.html @@ -120,84 +120,90 @@ The possible polygon-based shapes are displayed below. - + square star none - note + underline + - + note tab folder box3d - component + - + component promoter cds terminator - utr + - + utr primersite restrictionsite fivepoverhang - threepoverhang + - + threepoverhang noverhang assembly signature - insulator + - + insulator ribosite rnastab proteasesite - proteinstab + - + proteinstab rpromoter rarrow larrow + + + + + lpromoter diff --git a/doc/info/underline.gif b/doc/info/underline.gif new file mode 100644 index 0000000000000000000000000000000000000000..cee9640588f06ee9cc10ad6f73de7e0be33555b9 GIT binary patch literal 849 zcmV-X1Frl>Nk%w1VPyb20M!5h1Ofzvf`r7v#6(6!000L5K%H<%EEJ}?cu=~y66$Oiz)CN2=N!jO;xsuUDZA>;r65kgu3urY98 zDA0A2!NzYROP>4^aR~m!Apro85YmBx4iB7$4AX&u#f7IM3iQ(P0ss+#Ix-j( z5_G7JqC%QJy%2S3m!3j?aurI{Xbb?4QmVRf(@52;FSBmd(Y37*x@FK#tjL$`SEE5~ zrL3Ui0R#<4?he7KRc7DALL5UL)52(4!k59?0FZC74g&yk385iVvJlF9LwiQ8S_kVd zI9jQ|!GQsd%m8u-8399wh6*qQ=pexYMgkQaKtxDkp@D+G0DcP*ks2m|0KkRoATC5h z^y$^Fdr`0fKm{8!24oUY0Kf?nCSZKmkYfda0xe9i0}3jnPyzt%$shy{ECA2|H4+Q} zzydBvP*4pn&}Sch`fvpRnSlsapkNrL=s=Pa6p*CeEpdH8K#QluDC3MY)@b96IOeG1 zjy(404SZ1l^mRxq}<(FUrpjeS) bmT4v$FQ%#Hnryb|=9_TFDd(JV1_1y&U6Nc} literal 0 HcmV?d00001 diff --git a/doc/infosrc/Makefile.old b/doc/infosrc/Makefile.old index 8fda4f31e..5564d4fa4 100644 --- a/doc/infosrc/Makefile.old +++ b/doc/infosrc/Makefile.old @@ -49,7 +49,7 @@ MPNG = plugins.png sdlshapes.png $(GRADPNG) $(STYLEPNG) $(TAPERPNG) $(SPLINEPNG) SGIF = Mcircle.gif Mdiamond.gif Msquare.gif box.gif \ circle.gif diamond.gif doublecircle.gif \ doubleoctagon.gif egg.gif ellipse.gif hexagon.gif house.gif \ - invhouse.gif invtrapezium.gif invtriangle.gif none.gif \ + invhouse.gif invtrapezium.gif invtriangle.gif none.gif underline.gif \ octagon.gif oval.gif parallelogram.gif plaintext.gif \ point.gif polygon.gif trapezium.gif triangle.gif \ tripleoctagon.gif pentagon.gif septagon.gif rect.gif \ diff --git a/doc/infosrc/mkshapes.sh b/doc/infosrc/mkshapes.sh index 8804e51f6..69bbd5984 100755 --- a/doc/infosrc/mkshapes.sh +++ b/doc/infosrc/mkshapes.sh @@ -7,7 +7,7 @@ do F=$s.dot exec 3> $F echo "digraph G {" >&3 - if [[ $s == "plaintext" || $s == "none" ]] + if [[ $s == "plaintext" || $s == "none" || $s == "underline" ]] then echo " node [shape=$s];" >&3 else diff --git a/doc/infosrc/shapelist b/doc/infosrc/shapelist index 4957ce678..54a62f433 100644 --- a/doc/infosrc/shapelist +++ b/doc/infosrc/shapelist @@ -29,6 +29,7 @@ rectangle square star none +underline note tab folder diff --git a/lib/common/const.h b/lib/common/const.h index 62a8eeb58..e3d59c31b 100644 --- a/lib/common/const.h +++ b/lib/common/const.h @@ -212,6 +212,7 @@ #define DOTTED (1 << 7) #define DASHED (1 << 8) #define WEDGED (1 << 9) +#define UNDERLINE (1 << 10) #define SHAPE_MASK (127 << 24) diff --git a/lib/common/shapes.c b/lib/common/shapes.c index b59e2b7cf..c3fdfc86e 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -96,6 +96,7 @@ static polygon_t p_tab = { FALSE, 1, 4, 0., 0., 0., TAB }; static polygon_t p_folder = { FALSE, 1, 4, 0., 0., 0., FOLDER }; static polygon_t p_box3d = { FALSE, 1, 4, 0., 0., 0., BOX3D }; static polygon_t p_component = { FALSE, 1, 4, 0., 0., 0., COMPONENT }; +static polygon_t p_underline = { FALSE, 1, 4, 0., 0., 0., UNDERLINE }; /* redundant and undocumented builtin polygons */ static polygon_t p_doublecircle = { TRUE, 2, 1, 0., 0., 0. }; @@ -242,6 +243,7 @@ static shape_desc Shapes[] = { /* first entry is default for no such shape */ {"invtriangle", &poly_fns, &p_invtriangle}, {"invtrapezium", &poly_fns, &p_invtrapezium}, {"invhouse", &poly_fns, &p_invhouse}, + {"underline", &poly_fns, &p_underline}, {"Mdiamond", &poly_fns, &p_Mdiamond}, {"Msquare", &poly_fns, &p_Msquare}, {"Mcircle", &poly_fns, &p_Mcircle}, @@ -307,15 +309,15 @@ static int same_side(pointf p0, pointf p1, pointf L0, pointf L1) } static -void pencolor(GVJ_t * job, node_t * n) +char* penColor(GVJ_t * job, node_t * n) { char *color; color = late_nnstring(n, N_color, ""); - if (color[0]) - gvrender_set_pencolor(job, color); - else - gvrender_set_pencolor(job, DEFAULT_COLOR); + if (!color[0]) + color = DEFAULT_COLOR; + gvrender_set_pencolor(job, color); + return color; } static @@ -2710,6 +2712,7 @@ static void poly_gencode(GVJ_t * job, node_t * n) char *color, *name; int doMap = (obj->url || obj->explicit_tooltip); char* fillcolor; + char* pencolor; char* clrs[2]; if (doMap && !(job->flags & EMIT_CLUSTERS_LAST)) @@ -2736,33 +2739,33 @@ static void poly_gencode(GVJ_t * job, node_t * n) clrs[0] = NULL; if (ND_gui_state(n) & GUI_STATE_ACTIVE) { - color = late_nnstring(n, N_activepencolor, DEFAULT_ACTIVEPENCOLOR); - gvrender_set_pencolor(job, color); + pencolor = late_nnstring(n, N_activepencolor, DEFAULT_ACTIVEPENCOLOR); + gvrender_set_pencolor(job, pencolor); color = late_nnstring(n, N_activefillcolor, DEFAULT_ACTIVEFILLCOLOR); gvrender_set_fillcolor(job, color); filled = FILL; } else if (ND_gui_state(n) & GUI_STATE_SELECTED) { - color = + pencolor = late_nnstring(n, N_selectedpencolor, DEFAULT_SELECTEDPENCOLOR); - gvrender_set_pencolor(job, color); + gvrender_set_pencolor(job, pencolor); color = late_nnstring(n, N_selectedfillcolor, DEFAULT_SELECTEDFILLCOLOR); gvrender_set_fillcolor(job, color); filled = FILL; } else if (ND_gui_state(n) & GUI_STATE_DELETED) { - color = + pencolor = late_nnstring(n, N_deletedpencolor, DEFAULT_DELETEDPENCOLOR); - gvrender_set_pencolor(job, color); + gvrender_set_pencolor(job, pencolor); color = late_nnstring(n, N_deletedfillcolor, DEFAULT_DELETEDFILLCOLOR); gvrender_set_fillcolor(job, color); filled = FILL; } else if (ND_gui_state(n) & GUI_STATE_VISITED) { - color = + pencolor = late_nnstring(n, N_visitedpencolor, DEFAULT_VISITEDPENCOLOR); - gvrender_set_pencolor(job, color); + gvrender_set_pencolor(job, pencolor); color = late_nnstring(n, N_visitedfillcolor, DEFAULT_VISITEDFILLCOLOR); gvrender_set_fillcolor(job, color); @@ -2795,7 +2798,7 @@ static void poly_gencode(GVJ_t * job, node_t * n) else { filled = FALSE; } - pencolor(job, n); /* emit pen color */ + pencolor = penColor(job, n); /* emit pen color */ } pfilled = !ND_shape(n)->usershape || streq(ND_shape(n)->name, "custom"); @@ -2831,10 +2834,15 @@ static void poly_gencode(GVJ_t * job, node_t * n) agerr (AGPREV, "in node %s\n", agnameof(n)); } gvrender_polygon(job, AF, sides, 0); + } else if (style & UNDERLINE) { + gvrender_set_pencolor(job, "transparent"); + gvrender_polygon(job, AF, sides, filled); + gvrender_set_pencolor(job, pencolor); + gvrender_polyline(job, AF+2, 2); } else if (SPECIAL_CORNERS(style)) { round_corners(job, AF, sides, style, filled); } else { - gvrender_polygon(job, AF, sides, filled); + gvrender_polygon(job, AF, sides, filled); } /* fill innermost periphery only */ filled = FALSE; @@ -3062,7 +3070,7 @@ static void point_gencode(GVJ_t * job, node_t * n) } else { color = findFillDflt(n, "black"); gvrender_set_fillcolor(job, color); /* emit fill color */ - pencolor(job, n); /* emit pen color */ + penColor(job, n); /* emit pen color */ } filled = TRUE; @@ -3602,7 +3610,7 @@ static void gen_fields(GVJ_t * job, node_t * n, field_t * f) if (f->lp) { f->lp->pos = add_pointf(mid_pointf(f->b.LL, f->b.UR), ND_coord(n)); emit_label(job, EMIT_NLABEL, f->lp); - pencolor(job, n); + penColor(job, n); } coord = ND_coord(n); @@ -3648,7 +3656,7 @@ static void record_gencode(GVJ_t * job, node_t * n) obj->url, obj->tooltip, obj->target, obj->id); style = stylenode(job, n); - pencolor(job, n); + penColor(job, n); if (style & FILLED) { char* fillcolor = findFill (n); float frac; -- 2.40.0