From ffc3169460da157c21d0c2b000da936c3aed738a Mon Sep 17 00:00:00 2001 From: ellson Date: Tue, 1 Feb 2005 17:48:59 +0000 Subject: [PATCH] eliminate BaseLineStyle global. keep default linestyle in gvc. --- lib/common/arrows.c | 2 +- lib/common/emit.c | 7 +++++-- lib/common/globals.h | 1 - lib/common/htmltable.c | 2 +- lib/gvc/gvcint.h | 3 +++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 7528a4ef8..3268bd914 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -516,7 +516,7 @@ void arrow_newgen(GVC_t * gvc, pointf p, pointf u, double scale, int flag) /* Dotted and dashed styles on the arrowhead are ugly (dds) */ /* linewidth needs to be reset */ gvrender_begin_context(gvc); - gvrender_set_style(gvc, BaseLineStyle); + gvrender_set_style(gvc, gvc->defaultlinestyle); /* generate arrowhead vector */ u.x -= p.x; diff --git a/lib/common/emit.c b/lib/common/emit.c index 88b269214..239a3b151 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -31,7 +31,7 @@ #define MAX_CODEGENS 100 -char *BaseLineStyle[3] = { "solid\0", "setlinewidth\0001\0", 0 }; +static char *defaultlinestyle[3] = { "solid\0", "setlinewidth\0001\0", 0 }; int Obj; static attrsym_t *G_peripheries; @@ -659,7 +659,7 @@ void emit_attachment(GVC_t * gvc, textlabel_t * lp, splines * spl) A[1] = pointof(A[0].x - sz.x, A[0].y); A[2] = dotneato_closest(spl, lp->p); /* Don't use edge style to draw attachment */ - gvrender_set_style(gvc, BaseLineStyle); + gvrender_set_style(gvc, gvc->defaultlinestyle); /* Use font color to draw attachment - need something unambiguous in case of multicolored parallel edges - defaults to black for html-like labels @@ -1015,6 +1015,9 @@ static void init_gvc_from_graph(GVC_t * gvc, graph_t * g) gvc->defaultfontsize = late_double(g->proto->n, N_fontsize, DEFAULT_FONTSIZE, MIN_FONTSIZE); + /* default line style */ + gvc->defaultlinestyle = defaultlinestyle; + gvc->graphname = g->name; gvc->lib = Lib; } diff --git a/lib/common/globals.h b/lib/common/globals.h index 022eaef87..c8b7d1a64 100644 --- a/lib/common/globals.h +++ b/lib/common/globals.h @@ -102,7 +102,6 @@ extern "C" { EXTERN double yf_off; /* y_off in inches */ EXTERN attrsym_t *g_draw; EXTERN attrsym_t *g_l_draw; - external char *BaseLineStyle[]; /* solid, width = 1 */ EXTERN attrsym_t * N_height, *N_width, *N_shape, *N_color, *N_fillcolor, diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index 1c4db36e5..b9c442292 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -376,7 +376,7 @@ emit_html_label(GVC_t * gvc, htmllabel_t * lp, textlabel_t * tp, void *obj) /* set basic graphics context */ gvrender_begin_context(gvc); /* Need to override line style set by node. */ - gvrender_set_style(gvc, BaseLineStyle); + gvrender_set_style(gvc, gvc->defaultlinestyle); if (tbl->data.pencolor) gvrender_set_pencolor(gvc, tbl->data.pencolor); else diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 6f2e1778f..2aa538945 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -180,6 +180,9 @@ extern "C" { char *defaultfontname; double defaultfontsize; + /* default line style */ + char **defaultlinestyle; + gvstyle_t styles[MAXNEST]; /* style stack - reused by each job */ int SP; -- 2.40.0