typedef struct arrowtype_t {
int type;
double lenfact; /* ratio of length of this arrow type to standards arrow */
- void (*gen) (GVC_t * gvc, pointf p, pointf u, int flag); /* generator function for type */
+ void (*gen) (GVJ_t * job, pointf p, pointf u, int flag); /* generator function for type */
} arrowtype_t;
/* forward declaration of functions used in Arrowtypes[] */
-static void arrow_type_normal(GVC_t * gvc, pointf p, pointf u, int flag);
-static void arrow_type_crow(GVC_t * gvc, pointf p, pointf u, int flag);
-static void arrow_type_tee(GVC_t * gvc, pointf p, pointf u, int flag);
-static void arrow_type_box(GVC_t * gvc, pointf p, pointf u, int flag);
-static void arrow_type_diamond(GVC_t * gvc, pointf p, pointf u, int flag);
-static void arrow_type_dot(GVC_t * gvc, pointf p, pointf u, int flag);
+static void arrow_type_normal(GVJ_t * job, pointf p, pointf u, int flag);
+static void arrow_type_crow(GVJ_t * job, pointf p, pointf u, int flag);
+static void arrow_type_tee(GVJ_t * job, pointf p, pointf u, int flag);
+static void arrow_type_box(GVJ_t * job, pointf p, pointf u, int flag);
+static void arrow_type_diamond(GVJ_t * job, pointf p, pointf u, int flag);
+static void arrow_type_dot(GVJ_t * job, pointf p, pointf u, int flag);
static arrowtype_t Arrowtypes[] = {
{ARR_TYPE_NORM, 1.0, arrow_type_normal},
}
/* FIXME - codegens should accept floats directly */
-static void arrow_codegen_polygon(GVC_t * gvc, pointf p[], int np,
+static void arrow_codegen_polygon(GVJ_t * job, pointf p[], int np,
int fill)
{
point P[16]; /* ugly - but this should be enough for arrows */
int i;
for (i = 0; i < np; i++)
PF2P(p[i], P[i]);
- gvrender_polygon(gvc, P, np, fill);
+ gvrender_polygon(job, P, np, fill);
}
/* FIXME - codegens should accept floats directly */
-static void arrow_codegen_polyline(GVC_t * gvc, pointf p[], int np)
+static void arrow_codegen_polyline(GVJ_t * job, pointf p[], int np)
{
point P[16]; /* ugly - but this should be enough for arrows */
int i;
for (i = 0; i < np; i++)
PF2P(p[i], P[i]);
- gvrender_polyline(gvc, P, np);
+ gvrender_polyline(job, P, np);
}
/* FIXME - codegens should accept floats directly */
-static void arrow_codegen_ellipse(GVC_t * gvc, pointf p, pointf r,
+static void arrow_codegen_ellipse(GVJ_t * job, pointf p, pointf r,
int fill)
{
point P, R;
PF2P(p, P);
PF2P(r, R);
- gvrender_ellipse(gvc, P, R.x, R.y, fill);
+ gvrender_ellipse(job, P, R.x, R.y, fill);
}
-static void arrow_type_normal(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_normal(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf q, v, a[5];
a[3].y = q.y + v.y;
}
if (flag & ARR_MOD_LEFT)
- arrow_codegen_polygon(gvc, a, 3, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, a, 3, !(flag & ARR_MOD_OPEN));
else if (flag & ARR_MOD_RIGHT)
- arrow_codegen_polygon(gvc, &a[2], 3, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, &a[2], 3, !(flag & ARR_MOD_OPEN));
else
- arrow_codegen_polygon(gvc, &a[1], 3, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, &a[1], 3, !(flag & ARR_MOD_OPEN));
}
-static void arrow_type_crow(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_crow(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf m, n, q, v, a[7];
a[5].y = p.y + v.y;
}
if (flag & ARR_MOD_LEFT)
- arrow_codegen_polygon(gvc, a, 5, 1);
+ arrow_codegen_polygon(job, a, 5, 1);
else if (flag & ARR_MOD_RIGHT)
- arrow_codegen_polygon(gvc, &a[2], 5, 1);
+ arrow_codegen_polygon(job, &a[2], 5, 1);
else
- arrow_codegen_polygon(gvc, a, 7, 1);
+ arrow_codegen_polygon(job, a, 7, 1);
}
-static void arrow_type_tee(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_tee(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf m, n, q, v, a[4];
a[1] = m;
a[2] = n;
}
- arrow_codegen_polygon(gvc, a, 4, 1);
+ arrow_codegen_polygon(job, a, 4, 1);
a[0] = p;
a[1] = q;
- arrow_codegen_polyline(gvc, a, 2);
+ arrow_codegen_polyline(job, a, 2);
}
-static void arrow_type_box(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_box(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf m, q, v, a[4];
a[1] = p;
a[2] = m;
}
- arrow_codegen_polygon(gvc, a, 4, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, a, 4, !(flag & ARR_MOD_OPEN));
a[0] = m;
a[1] = q;
- arrow_codegen_polyline(gvc, a, 2);
+ arrow_codegen_polyline(job, a, 2);
}
-static void arrow_type_diamond(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_diamond(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf q, r, v, a[5];
a[3].x = r.x - v.x;
a[3].y = r.y - v.y;
if (flag & ARR_MOD_LEFT)
- arrow_codegen_polygon(gvc, &a[2], 3, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, &a[2], 3, !(flag & ARR_MOD_OPEN));
else if (flag & ARR_MOD_RIGHT)
- arrow_codegen_polygon(gvc, a, 3, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, a, 3, !(flag & ARR_MOD_OPEN));
else
- arrow_codegen_polygon(gvc, a, 4, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_polygon(job, a, 4, !(flag & ARR_MOD_OPEN));
}
-static void arrow_type_dot(GVC_t * gvc, pointf p, pointf u, int flag)
+static void arrow_type_dot(GVJ_t * job, pointf p, pointf u, int flag)
{
pointf r;
r.x = r.y = sqrt(u.x * u.x + u.y * u.y) / 2.;
p.x += u.x / 2.;
p.y += u.y / 2.;
- arrow_codegen_ellipse(gvc, p, r, !(flag & ARR_MOD_OPEN));
+ arrow_codegen_ellipse(job, p, r, !(flag & ARR_MOD_OPEN));
}
-static pointf arrow_gen_type(GVC_t * gvc, pointf p, pointf u, int flag)
+static pointf arrow_gen_type(GVJ_t * job, pointf p, pointf u, int flag)
{
int f;
arrowtype_t *arrowtype;
if (f == arrowtype->type) {
u.x *= arrowtype->lenfact;
u.y *= arrowtype->lenfact;
- (arrowtype->gen) (gvc, p, u, flag);
+ (arrowtype->gen) (job, p, u, flag);
p.x = p.x + u.x;
p.y = p.y + u.y;
break;
return p;
}
-void arrow_newgen(GVC_t * gvc, pointf p, pointf u, double scale, int flag)
+void arrow_newgen(GVJ_t * job, pointf p, pointf u, double scale, int flag)
{
double s;
int f;
/* Dotted and dashed styles on the arrowhead are ugly (dds) */
/* linewidth needs to be reset */
- gvrender_begin_context(gvc);
- gvrender_set_style(gvc, gvc->defaultlinestyle);
+ gvrender_begin_context(job);
+ gvrender_set_style(job, job->gvc->defaultlinestyle);
/* generate arrowhead vector */
u.x -= p.x;
/* arrow head closest to node */
f = flag & ((1 << 16) - 1);
- p = arrow_gen_type(gvc, p, u, f);
+ p = arrow_gen_type(job, p, u, f);
/* arrow head furthest from node */
/* start where first one ended */
f = (flag >> 16) & ((1 << 16) - 1);
- arrow_gen_type(gvc, p, u, f);
+ arrow_gen_type(job, p, u, f);
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
/* FIXME emit.c and output.c require wrapper for int point coords */
-void arrow_gen(GVC_t * gvc, point p, point u, double scale, int flag)
+void arrow_gen(GVJ_t * job, point p, point u, double scale, int flag)
{
pointf P, U;
P2PF(p, P);
P2PF(u, U);
- arrow_newgen(gvc, P, U, scale, flag);
+ arrow_newgen(job, P, U, scale, flag);
}
return 0;
}
-static void init_job_flags(gvrender_job_t * job, graph_t * g)
+static void init_job_flags(GVJ_t * job, graph_t * g)
{
switch (job->output_lang) {
case GVRENDER_PLUGIN:
static void init_layering(GVC_t * gvc, graph_t * g)
{
+ GVJ_t *job = gvc->job;
char *str;
/* free layer strings and pointers from previous graph */
free(gvc->layerIDs);
if ((str = agget(g, "layers")) != 0) {
- if (gvrender_features(gvc) & GVRENDER_DOES_LAYERS) {
+ if (gvrender_features(job) & GVRENDER_DOES_LAYERS) {
gvc->numLayers = parse_layers(gvc, g, str);
}
else {
agerr(AGWARN, "layers not supported in %s output\n",
- gvc->job->output_langname);
+ job->output_langname);
gvc->numLayers = 1;
}
} else {
gvc->layerNum++;
}
-static point pagecode(gvrender_job_t *job, char c)
+static point pagecode(GVJ_t *job, char c)
{
point rv;
rv.x = rv.y = 0;
static void set_pagedir(GVC_t *gvc, graph_t * g)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
char *str;
job->pagesArrayMajor.x = job->pagesArrayMajor.y
static void init_job_pagination(GVC_t * gvc, graph_t * g)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
pointf pageSizeCenteredLessMargins; /* page for centering less margins - graph units*/
pointf deviceSize; /* device size for a page of the graph - graph units */
pointf extra, size;
static void firstpage(GVC_t *gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
job->pagesArrayElem = job->pagesArrayFirst;
}
static boolean validpage(GVC_t *gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
return ((job->pagesArrayElem.x >= 0)
&& (job->pagesArrayElem.x < job->pagesArraySize.x)
static void nextpage(GVC_t *gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
job->pagesArrayElem = add_points(job->pagesArrayElem, job->pagesArrayMinor);
if (validpage(gvc) == FALSE) {
return TRUE;
}
-void emit_background(GVC_t * gvc, graph_t *g)
+void emit_background(GVJ_t * job, graph_t *g)
{
- gvrender_job_t * job = gvc->job;
char *str;
pointf AF[4];
point A[4];
for (i = 0; i < 4; i++) {
PF2P(AF[i],A[i]);
}
- gvrender_set_fillcolor(gvc, str);
- gvrender_set_pencolor(gvc, str);
- gvrender_polygon(gvc, A, 4, TRUE); /* filled */
+ gvrender_set_fillcolor(job, str);
+ gvrender_set_pencolor(job, str);
+ gvrender_polygon(job, A, 4, TRUE); /* filled */
}
}
static void emit_defaults(GVC_t * gvc)
{
- gvrender_set_pencolor(gvc, DEFAULT_COLOR);
- gvrender_set_font(gvc, gvc->defaultfontname, gvc->defaultfontsize);
+ GVJ_t * job = gvc->job;
+
+ gvrender_set_pencolor(job, DEFAULT_COLOR);
+ gvrender_set_font(job, gvc->defaultfontname, gvc->defaultfontsize);
}
/* even if this makes you cringe, at least it's short */
static void setup_page(GVC_t * gvc, graph_t * g)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
/* establish current box in graph coordinates */
job->pageBox.LL.x = job->pagesArrayElem.x * job->pageSize.x;
job->pageOffset.x, job->pageOffset.y);
#endif
- gvrender_begin_page(gvc);
- emit_background(gvc, g);
+ gvrender_begin_page(job);
+ emit_background(job, g);
emit_defaults(gvc);
}
static boolean node_in_pageBox(GVC_t *gvc, node_t * n)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
boxf nb;
#if 0
return FALSE;
}
-static void emit_node(GVC_t * gvc, node_t * n)
+static void emit_node(GVJ_t * job, node_t * n)
{
+ GVC_t *gvc = job->gvc;
char *s, *url = NULL, *tooltip = NULL, *target = NULL;
if (ND_shape(n) == NULL)
&& node_in_pageBox(gvc, n)
&& (ND_state(n) != gvc->pageNum)) {
- gvrender_comment(gvc, n->name);
+ gvrender_comment(job, n->name);
s = late_string(n, N_comment, "");
if (s[0])
- gvrender_comment(gvc, s);
+ gvrender_comment(job, s);
- gvrender_begin_node(gvc, n);
+ gvrender_begin_node(job, n);
if (((s = agget(n, "href")) && s[0])
|| ((s = agget(n, "URL")) && s[0])) {
url = strdup_and_subst_node(s, n);
tooltip = strdup_and_subst_node(ND_label(n)->text, n);
if ((s = agget(n, "target")) && s[0])
target = strdup_and_subst_node(s, n);
- gvrender_begin_anchor(gvc, url, tooltip, target);
+ gvrender_begin_anchor(job, url, tooltip, target);
}
- gvrender_begin_context(gvc);
- ND_shape(n)->fns->codefn(gvc, n);
+ gvrender_begin_context(job);
+ ND_shape(n)->fns->codefn(job, n);
ND_state(n) = gvc->pageNum;
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
if (url) {
- gvrender_end_anchor(gvc);
+ gvrender_end_anchor(job);
free(url);
if (tooltip)
free(tooltip);
if (target)
free(target);
}
- gvrender_end_node(gvc);
+ gvrender_end_node(job);
}
}
return res;
}
-void emit_attachment(GVC_t * gvc, textlabel_t * lp, splines * spl)
+static void emit_attachment(GVJ_t * job, textlabel_t * lp, splines * spl)
{
point sz, A[3];
unsigned char *s;
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, gvc->defaultlinestyle);
+ gvrender_set_style(job, job->gvc->defaultlinestyle);
/* Use font color to draw attachment
- need something unambiguous in case of multicolored parallel edges
- defaults to black for html-like labels
*/
- gvrender_set_pencolor(gvc, lp->fontcolor);
- gvrender_polyline(gvc, A, 3);
+ gvrender_set_pencolor(job, lp->fontcolor);
+ gvrender_polyline(job, A, 3);
}
static boolean edge_in_pageBox(GVC_t *gvc, edge_t * e)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
int i, j, np;
bezier bz;
point *p;
return boxf_overlap(job->pageBox, b);
}
-void emit_edge_graphics(GVC_t * gvc, edge_t * e)
+void emit_edge_graphics(GVJ_t * job, edge_t * e)
{
int i, j, cnum, numc = 0;
char *color, *style;
sp = styles;
while ((p = *sp++)) {
if (streq(p, "invis")) {
- gvrender_end_edge(gvc);
+ gvrender_end_edge(job);
return;
}
}
color = late_string(e, E_color, "");
if (color[0] || styles) {
- gvrender_begin_context(gvc);
+ gvrender_begin_context(job);
if (styles)
- gvrender_set_style(gvc, styles);
+ gvrender_set_style(job, styles);
saved = TRUE;
}
/* need to know how many colors separated by ':' */
for (cnum = 0, color = strtok(colors, ":"); color;
cnum++, color = strtok(0, ":")) {
if (color[0]) {
- gvrender_set_pencolor(gvc, color);
- gvrender_set_fillcolor(gvc, color);
+ gvrender_set_pencolor(job, color);
+ gvrender_set_fillcolor(job, color);
} else {
- gvrender_set_fillcolor(gvc, DEFAULT_COLOR);
+ gvrender_set_fillcolor(job, DEFAULT_COLOR);
}
for (i = 0; i < tmpspl.size; i++) {
tmplist = tmpspl.list[i].list;
tmplist[j].x += offlist[j].x;
tmplist[j].y += offlist[j].y;
}
- gvrender_beziercurve(gvc, tmplist, tmpspl.list[i].size,
+ gvrender_beziercurve(job, tmplist, tmpspl.list[i].size,
FALSE, FALSE, FALSE);
}
}
xdemitState = EMIT_TDRAW;
if (bz.sflag)
- arrow_gen(gvc, bz.sp, bz.list[0], scale, bz.sflag);
+ arrow_gen(job, bz.sp, bz.list[0], scale, bz.sflag);
xdemitState = EMIT_HDRAW;
if (bz.eflag)
- arrow_gen(gvc, bz.ep, bz.list[bz.size - 1], scale,
+ arrow_gen(job, bz.ep, bz.list[bz.size - 1], scale,
bz.eflag);
free(colors);
for (i = 0; i < offspl.size; i++) {
free(tmpspl.list);
} else {
if (color[0]) {
- gvrender_set_pencolor(gvc, color);
- gvrender_set_fillcolor(gvc, color);
+ gvrender_set_pencolor(job, color);
+ gvrender_set_fillcolor(job, color);
} else {
- gvrender_set_fillcolor(gvc, DEFAULT_COLOR);
+ gvrender_set_fillcolor(job, DEFAULT_COLOR);
}
for (i = 0; i < ED_spl(e)->size; i++) {
bz = ED_spl(e)->list[i];
bzf.list = malloc(sizeof(pointf) * bzf.size);
for (j = 0; j < bz.size; j++)
P2PF(bz.list[j], bzf.list[j]);
- if (gvrender_features(gvc) & GVRENDER_DOES_ARROWS) {
- gvrender_beziercurve(gvc, bzf.list, bz.size, bz.sflag,
+ if (gvrender_features(job) & GVRENDER_DOES_ARROWS) {
+ gvrender_beziercurve(job, bzf.list, bz.size, bz.sflag,
bz.eflag, FALSE);
} else {
- gvrender_beziercurve(gvc, bzf.list, bz.size, FALSE,
+ gvrender_beziercurve(job, bzf.list, bz.size, FALSE,
FALSE, FALSE);
xdemitState = EMIT_TDRAW;
if (bz.sflag)
- arrow_gen(gvc, bz.sp, bz.list[0], scale, bz.sflag);
+ arrow_gen(job, bz.sp, bz.list[0], scale, bz.sflag);
xdemitState = EMIT_HDRAW;
if (bz.eflag)
- arrow_gen(gvc, bz.ep, bz.list[bz.size - 1], scale,
+ arrow_gen(job, bz.ep, bz.list[bz.size - 1], scale,
bz.eflag);
}
free(bzf.list);
}
xdemitState = EMIT_LABEL;
if (ED_label(e)) {
- emit_label(gvc, ED_label(e), (void *) e);
+ emit_label(job, ED_label(e), (void *) e);
if (mapbool(late_string(e, E_decorate, "false")) && ED_spl(e))
- emit_attachment(gvc, ED_label(e), ED_spl(e));
+ emit_attachment(job, ED_label(e), ED_spl(e));
}
xdemitState = EMIT_HLABEL;
if (ED_head_label(e))
- emit_label(gvc, ED_head_label(e), (void *) e); /* vladimir */
+ emit_label(job, ED_head_label(e), (void *) e); /* vladimir */
xdemitState = EMIT_TLABEL;
if (ED_tail_label(e))
- emit_label(gvc, ED_tail_label(e), (void *) e); /* vladimir */
+ emit_label(job, ED_tail_label(e), (void *) e); /* vladimir */
if (saved)
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
-static void emit_edge(GVC_t * gvc, edge_t * e)
+static void emit_edge(GVJ_t * job, edge_t * e)
{
+ GVC_t *gvc = job->gvc;
char *s, *url = NULL, *label = NULL, *tooltip = NULL, *target = NULL;
textlabel_t *lab = NULL;
else
strcat(s,"--");
strcat(s,e->head->name);
- gvrender_comment(gvc, s);
+ gvrender_comment(job, s);
free(s);
s = late_string(e, E_comment, "");
if (s[0])
- gvrender_comment(gvc, s);
+ gvrender_comment(job, s);
- gvrender_begin_edge(gvc, e);
+ gvrender_begin_edge(job, e);
if (((s = agget(e, "href")) && s[0])
|| ((s = agget(e, "URL")) && s[0])) {
url = strdup_and_subst_edge(s, e);
tooltip = strdup_and_subst_edge(label, e);
if ((s = agget(e, "target")) && s[0])
target = strdup_and_subst_edge(s, e);
- gvrender_begin_anchor(gvc, url, tooltip, target);
+ gvrender_begin_anchor(job, url, tooltip, target);
}
- emit_edge_graphics (gvc, e);
+ emit_edge_graphics (job, e);
if (url) {
- gvrender_end_anchor(gvc);
+ gvrender_end_anchor(job);
free(url);
if (tooltip)
free(tooltip);
if (target)
free(target);
}
- gvrender_end_edge(gvc);
+ gvrender_end_edge(job);
}
static void init_gvc_from_graph(GVC_t * gvc, graph_t * g)
static void init_job_margin(GVC_t *gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
if (gvc->graph_sets_margin) {
job->margin = gvc->margin;
static void init_job_dpi(GVC_t *gvc, graph_t *g)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
job->dpi = GD_drawing(g)->dpi;
if (job->dpi == 0) {
static void init_job_viewport(GVC_t * gvc, graph_t * g)
{
- gvrender_job_t * job = gvc->job;
+ GVJ_t * job = gvc->job;
pointf UR, size;
char *str;
double X, Y, Z, x, y;
job->rotation = gvc->rotation;
}
-void emit_graph(GVC_t * gvc, graph_t * g)
+void emit_graph(GVJ_t * job, graph_t * g)
{
+ GVC_t * gvc = job->gvc;
graph_t *sg;
node_t *n;
edge_t *e;
int c;
char *str, *colors;
char *s, *url = NULL, *tooltip = NULL, *target = NULL;
- int flags = gvc->job->flags;
+ int flags = job->flags;
s = late_string(g, agfindattr(g, "comment"), "");
- gvrender_comment(gvc, s);
+ gvrender_comment(job, s);
- gvrender_begin_graph(gvc, g);
+ gvrender_begin_graph(job, g);
if (flags & EMIT_COLORS) {
- gvrender_set_fillcolor(gvc, DEFAULT_FILL);
+ gvrender_set_fillcolor(job, DEFAULT_FILL);
if (((str = agget(g, "bgcolor")) != 0) && str[0])
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
if (((str = agget(g, "fontcolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
for (c = 1; c <= GD_n_cluster(g); c++) {
sg = GD_clust(g)[c];
if (((str = agget(sg, "color")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
if (((str = agget(sg, "fillcolor")) != 0) && str[0])
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
if (((str = agget(sg, "fontcolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
}
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (((str = agget(n, "color")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
if (((str = agget(n, "fillcolor")) != 0) && str[0])
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
if (((str = agget(n, "fontcolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
if (((str = agget(e, "color")) != 0) && str[0]) {
if (strchr(str, ':')) {
for (str = strtok(colors, ":"); str;
str = strtok(0, ":")) {
if (str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
}
free(colors);
} else
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
}
if (((str = agget(e, "fontcolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
}
}
}
/* iterate layers */
for (firstlayer(gvc); validlayer(gvc); nextlayer(gvc)) {
if (gvc->numLayers > 1)
- gvrender_begin_layer(gvc);
+ gvrender_begin_layer(job);
/* iterate pages */
for (firstpage(gvc); validpage(gvc); nextpage(gvc)) {
tooltip = strdup_and_subst_graph(s, g);
else if (GD_label(g))
tooltip = strdup_and_subst_graph(GD_label(g)->text, g);
- gvrender_begin_anchor(gvc, url, tooltip, target);
+ gvrender_begin_anchor(job, url, tooltip, target);
}
if (GD_label(g))
- emit_label(gvc, GD_label(g), (void *) g);
+ emit_label(job, GD_label(g), (void *) g);
Obj = CLST;
/* when drawing, lay clusters down before nodes and edges */
if (!(flags & EMIT_CLUSTERS_LAST)) {
- emit_clusters(gvc, g, flags);
+ emit_clusters(job, g, flags);
}
if (flags & EMIT_SORTED) {
/* output all nodes, then all edges */
Obj = NODE;
- gvrender_begin_nodes(gvc);
+ gvrender_begin_nodes(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- emit_node(gvc, n);
+ emit_node(job, n);
}
- gvrender_end_nodes(gvc);
+ gvrender_end_nodes(job);
Obj = EDGE;
- gvrender_begin_edges(gvc);
+ gvrender_begin_edges(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- emit_edge(gvc, e);
+ emit_edge(job, e);
}
}
- gvrender_end_edges(gvc);
+ gvrender_end_edges(job);
} else if (flags & EMIT_EDGE_SORTED) {
/* output all edges, then all nodes */
Obj = EDGE;
- gvrender_begin_edges(gvc);
+ gvrender_begin_edges(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- emit_edge(gvc, e);
+ emit_edge(job, e);
}
}
- gvrender_end_edges(gvc);
+ gvrender_end_edges(job);
Obj = NODE;
- gvrender_begin_nodes(gvc);
+ gvrender_begin_nodes(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- emit_node(gvc, n);
+ emit_node(job, n);
}
- gvrender_end_nodes(gvc);
+ gvrender_end_nodes(job);
} else if (flags & EMIT_PREORDER) {
Obj = NODE;
- gvrender_begin_nodes(gvc);
+ gvrender_begin_nodes(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (write_node_test(g, n))
- emit_node(gvc, n);
+ emit_node(job, n);
}
- gvrender_end_nodes(gvc);
+ gvrender_end_nodes(job);
Obj = EDGE;
- gvrender_begin_edges(gvc);
+ gvrender_begin_edges(job);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
if (write_edge_test(g, e))
- emit_edge(gvc, e);
+ emit_edge(job, e);
}
}
- gvrender_end_edges(gvc);
+ gvrender_end_edges(job);
} else {
/* output in breadth first graph walk order */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
Obj = NODE;
- emit_node(gvc, n);
+ emit_node(job, n);
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
Obj = NODE;
- emit_node(gvc, e->head);
+ emit_node(job, e->head);
Obj = EDGE;
- emit_edge(gvc, e);
+ emit_edge(job, e);
}
}
}
/* when mapping, detect events on clusters after nodes and edges */
if (flags & EMIT_CLUSTERS_LAST) {
- emit_clusters(gvc, g, flags);
+ emit_clusters(job, g, flags);
}
Obj = NONE;
if (url) {
- gvrender_end_anchor(gvc);
+ gvrender_end_anchor(job);
free(url);
url = NULL;
if (tooltip) {
target = NULL;
}
}
- gvrender_end_page(gvc);
+ gvrender_end_page(job);
} /* pages */
if (gvc->numLayers > 1)
- gvrender_end_layer(gvc);
+ gvrender_end_layer(job);
} /* layers */
- gvrender_end_graph(gvc);
+ gvrender_end_graph(job);
}
/* support for stderr_once */
void emit_jobs_eof(GVC_t * gvc)
{
- gvrender_job_t *job;
+ GVJ_t *job;
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
if (job->output_file) {
if (gvc->pageNum > 0) {
- gvrender_end_job(gvc);
+ gvrender_end_job(job);
emit_once_reset();
gvc->pageNum = 0;
}
}
}
-void emit_clusters(GVC_t * gvc, Agraph_t * g, int flags)
+void emit_clusters(GVJ_t * job, Agraph_t * g, int flags)
{
int i, c, filled;
graph_t *sg;
for (c = 1; c <= GD_n_cluster(g); c++) {
sg = GD_clust(g)[c];
- if (clust_in_layer(gvc, sg) == FALSE)
+ if (clust_in_layer(job->gvc, sg) == FALSE)
continue;
/* when mapping, detect events on clusters after sub_clusters */
if (flags & EMIT_CLUSTERS_LAST) {
- emit_clusters(gvc, sg, flags);
+ emit_clusters(job, sg, flags);
}
Obj = CLST;
- gvrender_begin_cluster(gvc, sg);
+ gvrender_begin_cluster(job, sg);
if (((s = agget(sg, "href")) && s[0])
|| ((s = agget(sg, "URL")) && s[0])) {
url = strdup_and_subst_graph(s, sg);
tooltip = strdup_and_subst_graph(s, sg);
else
tooltip = strdup_and_subst_graph(GD_label(sg)->text, sg);
- gvrender_begin_anchor(gvc, url, tooltip, target);
+ gvrender_begin_anchor(job, url, tooltip, target);
}
- gvrender_begin_context(gvc);
+ gvrender_begin_context(job);
filled = FALSE;
xdemitState = EMIT_DRAW;
if (((str = agget(sg, "style")) != 0) && str[0]) {
- gvrender_set_style(gvc, (style = parse_style(str)));
+ gvrender_set_style(job, (style = parse_style(str)));
for (i = 0; style[i]; i++)
if (strcmp(style[i], "filled") == 0) {
filled = TRUE;
}
}
if (((str = agget(sg, "pencolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
else if (((str = agget(sg, "color")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
/* bgcolor is supported for backward compatability */
else if (((str = agget(sg, "bgcolor")) != 0) && str[0])
- gvrender_set_pencolor(gvc, str);
+ gvrender_set_pencolor(job, str);
str = 0;
if (((str = agget(sg, "fillcolor")) != 0) && str[0])
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
else if (((str = agget(sg, "color")) != 0) && str[0])
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
/* bgcolor is supported for backward compatability */
else if (((str = agget(sg, "bgcolor")) != 0) && str[0]) {
filled = TRUE;
- gvrender_set_fillcolor(gvc, str);
+ gvrender_set_fillcolor(job, str);
}
A[0] = GD_bb(sg).LL;
A[2] = GD_bb(sg).UR;
A[3].x = A[0].x;
A[3].y = A[2].y;
if (late_int(sg, G_peripheries, 1, 0)) {
- gvrender_polygon(gvc, A, 4, filled);
+ gvrender_polygon(job, A, 4, filled);
} else if (filled) {
- gvrender_set_pencolor(gvc, str);
- gvrender_polygon(gvc, A, 4, filled);
+ gvrender_set_pencolor(job, str);
+ gvrender_polygon(job, A, 4, filled);
}
xdemitState = EMIT_DRAW;
if (GD_label(sg))
- emit_label(gvc, GD_label(sg), (void *) sg);
+ emit_label(job, GD_label(sg), (void *) sg);
if (flags & EMIT_PREORDER) {
for (n = agfstnode(sg); n; n = agnxtnode(sg, n)) {
Obj = NODE;
- emit_node(gvc, n);
+ emit_node(job, n);
for (e = agfstout(sg, n); e; e = agnxtout(sg, e)) {
Obj = EDGE;
- emit_edge(gvc, e);
+ emit_edge(job, e);
}
}
Obj = NONE;
}
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
if (url) {
- gvrender_end_anchor(gvc);
+ gvrender_end_anchor(job);
free(url);
url = NULL;
if (tooltip) {
target = NULL;
}
}
- gvrender_end_cluster(gvc);
+ gvrender_end_cluster(job);
/* when drawing, lay down clusters before sub_clusters */
if (!(flags & EMIT_CLUSTERS_LAST)) {
- emit_clusters(gvc, sg, flags);
+ emit_clusters(job, sg, flags);
}
}
}
}
}
-static void emit_job(GVC_t * gvc, graph_t * g)
+static void emit_job(GVJ_t * job, graph_t * g)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t *gvc = job->gvc;
if (!GD_drawing(g)) {
fprintf (stderr,"layout was not done\n");
init_gvc_from_graph(gvc, g);
init_layering(gvc, g);
- init_job_flags(gvc->job, g);
+ init_job_flags(job, g);
init_job_margin(gvc);
init_job_dpi(gvc, g);
init_job_viewport(gvc, g);
init_job_pagination(gvc, g);
- gvrender_begin_job(gvc);
+ gvrender_begin_job(job);
- switch (gvc->job->output_lang) {
+ switch (job->output_lang) {
case EXTENDED_DOT:
- write_extended_dot(gvc, g, gvc->job->output_file);
+ write_extended_dot(gvc, g, job->output_file);
break;
case ATTRIBUTED_DOT:
- write_attributed_dot(g, gvc->job->output_file);
+ write_attributed_dot(g, job->output_file);
break;
case CANONICAL_DOT:
- write_canonical_dot(g, gvc->job->output_file);
+ write_canonical_dot(g, job->output_file);
break;
case PLAIN:
- write_plain(gvc, g, gvc->job->output_file);
+ write_plain(gvc, g, job->output_file);
break;
case PLAIN_EXT:
- write_plain_ext(gvc, g, gvc->job->output_file);
+ write_plain_ext(gvc, g, job->output_file);
break;
default:
if (! (job->flags & GVRENDER_X11_EVENTS))
- emit_graph(gvc, g);
+ emit_graph(job, g);
break;
}
/* Flush is necessary because we may be writing to a pipe. */
- if (! gvc->job->external_surface && gvc->job->output_lang != TK)
- fflush(gvc->job->output_file);
+ if (! job->external_surface && job->output_lang != TK)
+ fflush(job->output_file);
}
static FILE *file_select(char *str)
void emit_jobs (GVC_t * gvc, graph_t * g)
{
- gvrender_job_t *job;
+ GVJ_t *job;
char *prev_langname = "";
gvc->active_jobs = NULL;
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
+ job->gvc = gvc;
+ job->g = g;
+
if (!job->output_file) { /* if not yet opened */
if (job->output_filename == NULL) {
job->output_file = stdout;
job->output_file = file_select(job->output_filename);
}
}
- job->output_lang = gvrender_select(gvc, job->output_langname);
+ job->output_lang = gvrender_select(job, job->output_langname);
if (job->output_lang == NO_SUPPORT) {
fprintf(stderr,"renderer for %s is unavailable\n", job->output_langname);
return;
}
- job->gvc = gvc;
- job->g = g;
-
/* insert job in active list */
job->next_active = gvc->active_jobs;
gvc->active_jobs = job;
gvrender_initialize(gvc);
}
- emit_job(gvc, g);
+ emit_job(job, g);
if (!job->next || strcmp(job->next->output_langname,prev_langname) != 0) {
gvrender_finalize(gvc);
}
static void
-emit_html_txt(GVC_t * gvc, htmltxt_t * tp, htmlenv_t * env, void *obj)
+emit_html_txt(GVJ_t * job, htmltxt_t * tp, htmlenv_t * env, void *obj)
{
int i, linespacing;
double left_x, center_x, right_x;
p.y = env->p.y + (tp->box.UR.y + tp->box.LL.y) / 2 + (linespacing * (tp->nlines - 1) / 2) /* cl of topline */
-fsize / 3.0; /* cl to baseline */
- gvrender_begin_context(gvc);
- gvrender_set_pencolor(gvc, fcolor);
- gvrender_set_font(gvc, fname, fsize);
+ gvrender_begin_context(job);
+ gvrender_set_pencolor(job, fcolor);
+ gvrender_set_font(job, fname, fsize);
for (i = 0; i < tp->nlines; i++) {
switch (tp->line[i].just) {
p.x = center_x;
break;
}
- gvrender_textline(gvc, p, &(tp->line[i]));
+ gvrender_textline(job, p, &(tp->line[i]));
/* position for next line */
p.y -= linespacing;
}
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
-static void doSide(GVC_t * gvc, point p, int wd, int ht)
+static void doSide(GVJ_t * job, point p, int wd, int ht)
{
point A[4];
A[2].x = p.x + wd;
A[3].x = A[2].x;
A[3].y = p.y;
- gvrender_polygon(gvc, A, 4, 1);
+ gvrender_polygon(job, A, 4, 1);
}
/* doBorder:
* from x to x+border will all pixels from x to x+border, and thus have
* width border+1.
*/
-static void doBorder(GVC_t * gvc, char *color, int border, box pts)
+static void doBorder(GVJ_t * job, char *color, int border, box pts)
{
point pt;
int wd, ht;
- gvrender_begin_context(gvc);
+ gvrender_begin_context(job);
if (!color)
color = "black";
- gvrender_set_fillcolor(gvc, color);
- gvrender_set_pencolor(gvc, color);
+ gvrender_set_fillcolor(job, color);
+ gvrender_set_pencolor(job, color);
if (border == 1) {
point A[4];
A[1].y = A[2].y;
A[3].x = A[2].x;
A[3].y = A[0].y;
- gvrender_polygon(gvc, A, 4, 0);
+ gvrender_polygon(job, A, 4, 0);
} else {
border--;
ht = pts.UR.y - pts.LL.y;
wd = pts.UR.x - pts.LL.x;
- doSide(gvc, pts.LL, border, ht);
+ doSide(job, pts.LL, border, ht);
pt.x = pts.LL.x;
pt.y = pts.UR.y;
- doSide(gvc, pt, wd, -border);
- doSide(gvc, pts.UR, -border, -ht);
+ doSide(job, pt, wd, -border);
+ doSide(job, pts.UR, -border, -ht);
pt.x = pts.UR.x;
pt.y = pts.LL.y;
- doSide(gvc, pt, -wd, border);
+ doSide(job, pt, -wd, border);
}
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
-static void doFill(GVC_t * gvc, char *color, box pts)
+static void doFill(GVJ_t * job, char *color, box pts)
{
point A[4];
- gvrender_set_fillcolor(gvc, color);
- gvrender_set_pencolor(gvc, color);
+ gvrender_set_fillcolor(job, color);
+ gvrender_set_pencolor(job, color);
A[0] = pts.LL;
A[1].x = pts.LL.x;
A[1].y = pts.UR.y;
A[2] = pts.UR;
A[3].x = pts.UR.x;
A[3].y = pts.LL.y;
- gvrender_polygon(gvc, A, 4, 1);
+ gvrender_polygon(job, A, 4, 1);
}
-static void doAnchorStart(GVC_t * gvc, htmldata_t * data, void *obj)
+static void doAnchorStart(GVJ_t * job, htmldata_t * data, void *obj)
{
- gvrender_begin_anchor(gvc, data->href, data->title, data->target);
+ gvrender_begin_anchor(job, data->href, data->title, data->target);
}
-static void doAnchorEnd(GVC_t * gvc)
+static void doAnchorEnd(GVJ_t * job)
{
- gvrender_end_anchor(gvc);
+ gvrender_end_anchor(job);
}
/* forward declaration */
-static void emit_html_cell(GVC_t * gvc, htmlcell_t * cp, htmlenv_t * env,
- void *obj);
+static void emit_html_cell(GVJ_t * job, htmlcell_t * cp,
+ htmlenv_t * env, void *obj);
static void
-emit_html_tbl(GVC_t * gvc, htmltbl_t * tbl, htmlenv_t * env, void *obj)
+emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env, void *obj)
{
box pts = tbl->data.box;
point p = env->p;
pts.LL.y += p.y;
pts.UR.y += p.y;
- /* gvrender_begin_context(gvc); */
+ /* gvrender_begin_context(job); */
if (tbl->data.href)
- doAnchorStart(gvc, &tbl->data, obj);
+ doAnchorStart(job, &tbl->data, obj);
if (tbl->data.bgcolor)
- doFill(gvc, tbl->data.bgcolor, pts);
+ doFill(job, tbl->data.bgcolor, pts);
while (*cells) {
- emit_html_cell(gvc, *cells, env, obj);
+ emit_html_cell(job, *cells, env, obj);
cells++;
}
if (tbl->data.border)
- doBorder(gvc, NULL, tbl->data.border, pts);
+ doBorder(job, NULL, tbl->data.border, pts);
if (tbl->data.href)
- doAnchorEnd(gvc);
+ doAnchorEnd(job);
- /* gvrender_end_context(gvc); */
+ /* gvrender_end_context(job); */
if (tbl->font)
popFontInfo(env, &savef);
}
static void
-emit_html_img(GVC_t * gvc, htmlimg_t * cp, htmlenv_t * env, void *obj)
+emit_html_img(GVJ_t * job, htmlimg_t * cp, htmlenv_t * env, void *obj)
{
point A[4];
box bb = cp->box;
A[3].x = bb.UR.x;
A[3].y = bb.LL.y;
- gvrender_user_shape(gvc, cp->src, A, 4, 1);
+ gvrender_user_shape(job, cp->src, A, 4, 1);
}
static void
-emit_html_cell(GVC_t * gvc, htmlcell_t * cp, htmlenv_t * env, void *obj)
+emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env, void *obj)
{
box pts = cp->data.box;
point p = env->p;
/* gvrender_begin_context(); */
if (cp->data.href)
- doAnchorStart(gvc, &cp->data, obj);
+ doAnchorStart(job, &cp->data, obj);
if (cp->data.bgcolor)
- doFill(gvc, cp->data.bgcolor, pts);
+ doFill(job, cp->data.bgcolor, pts);
if (cp->child.kind == HTML_TBL)
- emit_html_tbl(gvc, cp->child.u.tbl, env, obj);
+ emit_html_tbl(job, cp->child.u.tbl, env, obj);
else if (cp->child.kind == HTML_IMAGE)
- emit_html_img(gvc, cp->child.u.img, env, obj);
+ emit_html_img(job, cp->child.u.img, env, obj);
else
- emit_html_txt(gvc, cp->child.u.txt, env, obj);
+ emit_html_txt(job, cp->child.u.txt, env, obj);
if (cp->data.border)
- doBorder(gvc, NULL, cp->data.border, pts);
+ doBorder(job, NULL, cp->data.border, pts);
if (cp->data.href)
- doAnchorEnd(gvc);
+ doAnchorEnd(job);
/* gvrender_end_context(); */
}
/* emit_html_label:
*/
void
-emit_html_label(GVC_t * gvc, htmllabel_t * lp, textlabel_t * tp, void *obj)
+emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t * tp, void *obj)
{
htmlenv_t env;
htmltbl_t *tbl = lp->u.tbl;
/* set basic graphics context */
- gvrender_begin_context(gvc);
+ gvrender_begin_context(job);
/* Need to override line style set by node. */
- gvrender_set_style(gvc, gvc->defaultlinestyle);
+ gvrender_set_style(job, job->gvc->defaultlinestyle);
if (tbl->data.pencolor)
- gvrender_set_pencolor(gvc, tbl->data.pencolor);
+ gvrender_set_pencolor(job, tbl->data.pencolor);
else
- gvrender_set_pencolor(gvc, DEFAULT_COLOR);
- emit_html_tbl(gvc, tbl, &env, obj);
- gvrender_end_context(gvc);
+ gvrender_set_pencolor(job, DEFAULT_COLOR);
+ emit_html_tbl(job, tbl, &env, obj);
+ gvrender_end_context(job);
} else {
- emit_html_txt(gvc, lp->u.txt, &env, obj);
+ emit_html_txt(job, lp->u.txt, &env, obj);
}
}
extern htmllabel_t *simpleHTML(char *);
extern int make_html_label(textlabel_t * lp, void *obj);
- extern void emit_html_label(GVC_t * gvc, htmllabel_t * lp,
+ extern void emit_html_label(GVJ_t * job, htmllabel_t * lp,
textlabel_t *, void *obj);
extern void free_html_label(htmllabel_t *, int);
}
}
-void emit_label(GVC_t * gvc, textlabel_t * lp, void *obj)
+void emit_label(GVJ_t * job, textlabel_t * lp, void *obj)
{
int i, linespacing;
double left_x, center_x, right_x, halfwidth_x;
pointf p;
if (lp->html) {
- emit_html_label(gvc, lp->u.html, lp, obj);
+ emit_html_label(job, lp->u.html, lp, obj);
return;
}
p.y = lp->p.y + (linespacing * (lp->u.txt.nlines - 1) / 2) /* cl of topline */
-lp->fontsize / 3.0; /* cl to baseline */
- gvrender_begin_context(gvc);
- gvrender_set_pencolor(gvc, lp->fontcolor);
- gvrender_set_font(gvc, lp->fontname, lp->fontsize);
+ gvrender_begin_context(job);
+ gvrender_set_pencolor(job, lp->fontcolor);
+ gvrender_set_font(job, lp->fontname, lp->fontsize);
for (i = 0; i < lp->u.txt.nlines; i++) {
switch (lp->u.txt.line[i].just) {
p.x = center_x;
break;
}
- gvrender_textline(gvc, p, &(lp->u.txt.line[i]));
+ gvrender_textline(job, p, &(lp->u.txt.line[i]));
/* position for next line */
p.y -= linespacing;
}
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
void write_extended_dot(GVC_t *gvc, graph_t *g, FILE *f)
{
attach_attrs(g);
- extend_attrs(gvc, g, s_arrows, e_arrows);
+ extend_attrs(gvc->job, g, s_arrows, e_arrows);
agwrite(g, f);
}
extern point add_points(point, point);
extern pointf add_pointfs(pointf, pointf);
extern void arrow_flags(Agedge_t * e, int *sflag, int *eflag);
- extern void arrow_gen(GVC_t * gvc, point p, point u, double scale,
+ extern void arrow_gen(GVJ_t * job, point p, point u, double scale,
int flag);
extern double arrow_length(edge_t * e, int flag);
extern int arrowEndClip(edge_t*, point*, int, int , bezier*, int eflag);
extern double elapsed_sec(void);
extern void enqueue(nodequeue *, Agnode_t *);
extern void enqueue_neighbors(nodequeue *, Agnode_t *, int);
- extern void emit_attachment(GVC_t * gvc, textlabel_t *, splines *);
- extern void emit_background(GVC_t * gvc, graph_t *g);
- extern void emit_clusters(GVC_t * gvc, Agraph_t * g, int flags);
- extern void emit_edge_graphics(GVC_t * gvc, edge_t * e);
- extern void emit_graph(GVC_t * gvc, graph_t * g);
- extern void emit_label(GVC_t * gvc, textlabel_t *, void *obj);
+ extern void emit_background(GVJ_t * job, graph_t *g);
+ extern void emit_clusters(GVJ_t * job, Agraph_t * g, int flags);
+ extern void emit_edge_graphics(GVJ_t * job, edge_t * e);
+ extern void emit_graph(GVJ_t * job, graph_t * g);
+ extern void emit_label(GVJ_t * job, textlabel_t *, void *obj);
extern int emit_once(char *message);
extern void emit_jobs(GVC_t * gvc, graph_t *g);
extern void emit_jobs_eof(GVC_t * gvc);
extern void endpath(path *, Agedge_t *, int, pathend_t *, boolean);
extern void epsf_init(node_t * n);
extern void epsf_free(node_t * n);
- extern void epsf_gencode(GVC_t * gvc, node_t * n);
extern point exch_xy(point p);
extern pointf exch_xyf(pointf p);
- extern void extend_attrs(GVC_t *, graph_t*, int, int);
+ extern void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows);
extern shape_desc *find_user_shape(char *);
extern box flip_rec_box(box b, point p);
extern point flip_pt(point p, int rankdir);
static port poly_port(node_t * n, char *portname, char *);
static boolean poly_inside(inside_t * inside_context, pointf p);
static int poly_path(node_t* n, port* p, int side, box rv[], int *kptr);
-static void poly_gencode(GVC_t * gvc, node_t * n);
+static void poly_gencode(GVJ_t * job, node_t * n);
static void record_init(node_t * n);
static void record_free(node_t * n);
static port record_port(node_t * n, char *portname, char *);
static boolean record_inside(inside_t * inside_context, pointf p);
static int record_path(node_t* n, port* p, int side, box rv[], int *kptr);
-static void record_gencode(GVC_t * gvc, node_t * n);
+static void record_gencode(GVJ_t * job, node_t * n);
static void point_init(node_t * n);
static boolean epsf_inside(inside_t * inside_context, pointf p);
+static void epsf_gencode(GVJ_t * job, node_t * n);
/* polygon descriptions. "polygon" with 0 sides takes all user control */
* int SHAPE_path(node *n, edge_t *e, int pt, box path[], int *nbox)
* create a path for the port of e that touches n,
* return side
- * void SHAPE_gencode(GVC_t *gvc, node_t *n)
+ * void SHAPE_gencode(GVJ_t *job, node_t *n)
* generate graphics code for a node.
*
* some shapes, polygons in particular, use additional shape control data *
}
static
-void pencolor(GVC_t * gvc, node_t * n)
+void pencolor(GVJ_t * job, node_t * n)
{
char *color;
color = late_nnstring(n, N_color, "");
if (color[0])
- gvrender_set_pencolor(gvc, color);
+ gvrender_set_pencolor(job, color);
}
static
return color;
}
-static
-void fillcolor(GVC_t * gvc, node_t * n)
+static void fillcolor(GVJ_t * job, node_t * n)
{
- gvrender_set_fillcolor(gvc, findFill(n));
+ gvrender_set_fillcolor(job, findFill(n));
}
static char **checkStyle(node_t * n, int *flagp)
return pstyle;
}
-static
-int stylenode(GVC_t * gvc, node_t * n)
+static int stylenode(GVJ_t * job, node_t * n)
{
char **pstyle;
int istyle;
if ((pstyle = checkStyle(n, &istyle)))
- gvrender_set_style(gvc, pstyle);
+ gvrender_set_style(job, pstyle);
return istyle;
}
-static void Mcircle_hack(GVC_t * gvc, node_t * n)
+static void Mcircle_hack(GVJ_t * job, node_t * n)
{
double x, y;
point A[2], p;
A[0] = add_points(p, ND_coord_i(n));
A[1].y = A[0].y;
A[1].x = A[0].x - 2 * p.x;
- gvrender_polyline(gvc, A, 2);
+ gvrender_polyline(job, A, 2);
A[0].y -= 2 * p.y;
A[1].y = A[0].y;
- gvrender_polyline(gvc, A, 2);
+ gvrender_polyline(job, A, 2);
}
static point interpolate(double t, point p0, point p1)
return rv;
}
-static void round_corners(GVC_t * gvc, node_t * n, point * A, int sides,
+static void round_corners(GVJ_t * job, node_t * n, point * A, int sides,
int style)
{
point *B, C[2], p0, p1;
int j = 0;
char* fillc = findFill(n);
point* pts = N_GNEW(2*sides,point);
- gvrender_begin_context(gvc);
- gvrender_set_pencolor (gvc, fillc);
- gvrender_set_fillcolor (gvc, fillc);
+ gvrender_begin_context(job);
+ gvrender_set_pencolor (job, fillc);
+ gvrender_set_fillcolor (job, fillc);
for (seg = 0; seg < sides; seg++) {
pts[j++] = B[4 * seg + 1];
pts[j++] = B[4 * seg + 2];
}
- gvrender_polygon(gvc, pts, 2*sides, TRUE);
+ gvrender_polygon(job, pts, 2*sides, TRUE);
free (pts);
for (seg = 0; seg < sides; seg++) {
for (i = 0; i < 4; i++)
P2PF(B[4 * seg + 2 + i], BF[i]);
- gvrender_beziercurve(gvc, BF, 4, FALSE, FALSE, TRUE);
+ gvrender_beziercurve(job, BF, 4, FALSE, FALSE, TRUE);
}
- gvrender_end_context(gvc);
+ gvrender_end_context(job);
}
- pencolor(gvc, n);
+ pencolor(job, n);
for (seg = 0; seg < sides; seg++) {
- gvrender_polyline(gvc, B + 4 * seg + 1, 2);
+ gvrender_polyline(job, B + 4 * seg + 1, 2);
/* convert to floats for gvrender api */
for (i = 0; i < 4; i++)
P2PF(B[4 * seg + 2 + i], BF[i]);
- gvrender_beziercurve(gvc, BF, 4, FALSE, FALSE, FALSE);
+ gvrender_beziercurve(job, BF, 4, FALSE, FALSE, FALSE);
}
} else { /* diagonals are weird. rewrite someday. */
- pencolor(gvc, n);
+ pencolor(job, n);
if (style & FILLED)
- fillcolor(gvc, n); /* emit fill color */
- gvrender_polygon(gvc, A, sides, style & FILLED);
+ fillcolor(job, n); /* emit fill color */
+ gvrender_polygon(job, A, sides, style & FILLED);
for (seg = 0; seg < sides; seg++) {
#ifdef NOTDEF
C[0] = B[3 * seg];
C[1] = B[3 * seg + 3];
- gvrender_polyline(gvc, C, 2);
+ gvrender_polyline(job, C, 2);
#endif
C[0] = B[3 * seg + 2];
C[1] = B[3 * seg + 4];
- gvrender_polyline(gvc, C, 2);
+ gvrender_polyline(job, C, 2);
}
}
free(B);
}
/* generic polygon gencode routine */
-static void poly_gencode(GVC_t * gvc, node_t * n)
+static void poly_gencode(GVJ_t * job, node_t * n)
{
polygon_t *poly;
double xsize, ysize;
#if !defined(DISABLE_CODEGENS) && defined(HAVE_GD_PNG)
/* this is bad, but it's because of how the VRML driver works */
- if ((gvc->job->codegen == &VRML_CodeGen) && (peripheries == 0)) {
+ if ((job->codegen == &VRML_CodeGen) && (peripheries == 0)) {
peripheries = 1;
}
#endif
if (ND_shape(n) == point_desc) {
checkStyle(n, &style);
if (style & INVISIBLE)
- gvrender_set_style(gvc, point_style);
+ gvrender_set_style(job, point_style);
else
- gvrender_set_style(gvc, &point_style[1]);
+ gvrender_set_style(job, &point_style[1]);
style = FILLED;
} else {
- style = stylenode(gvc, n);
+ style = stylenode(job, n);
}
if (style & FILLED) {
- fillcolor(gvc, n); /* emit fill color */
+ fillcolor(job, n); /* emit fill color */
filled = 1;
} else {
filled = 0;
}
- pencolor(gvc, n); /* emit pen color */
+ pencolor(job, n); /* emit pen color */
if (ND_shape(n)->usershape) {
for (i = 0; i < sides; i++) {
A[i].y += ND_coord_i(n).y;
}
}
- gvrender_user_shape(gvc, ND_shape(n)->name, A, sides, filled);
+ gvrender_user_shape(job, ND_shape(n)->name, A, sides, filled);
filled = 0;
}
/* if no boundary but filled, set boundary color to fill color */
peripheries = 1;
color = findFill(n);
if (color[0])
- gvrender_set_pencolor(gvc, color);
+ gvrender_set_pencolor(job, color);
}
for (j = 0; j < peripheries; j++) {
for (i = 0; i < sides; i++) {
}
}
if (sides <= 2) {
- gvrender_ellipse(gvc, ND_coord_i(n), A[0].x, A[0].y, filled);
+ gvrender_ellipse(job, ND_coord_i(n), A[0].x, A[0].y, filled);
if (style & DIAGONALS) {
- Mcircle_hack(gvc, n);
+ Mcircle_hack(job, n);
}
} else if (style & (ROUNDED | DIAGONALS)) {
- round_corners(gvc, n, A, sides, style);
+ round_corners(job, n, A, sides, style);
} else {
- gvrender_polygon(gvc, A, sides, filled);
+ gvrender_polygon(job, A, sides, filled);
}
/* fill innermost periphery only */
filled = 0;
}
xdemitState = EMIT_LABEL;
- emit_label(gvc, ND_label(n), (void *) n);
+ emit_label(job, ND_label(n), (void *) n);
}
/*=======================end poly======================================*/
return side;
}
-static void gen_fields(GVC_t * gvc, node_t * n, field_t * f)
+static void gen_fields(GVJ_t * job, node_t * n, field_t * f)
{
int i;
double cx, cy;
cx = (f->b.LL.x + f->b.UR.x) / 2.0 + ND_coord_i(n).x;
cy = (f->b.LL.y + f->b.UR.y) / 2.0 + ND_coord_i(n).y;
f->lp->p = pointof((int) cx, (int) cy);
- emit_label(gvc, f->lp, (void *) n);
+ emit_label(job, f->lp, (void *) n);
}
for (i = 0; i < f->n_flds; i++) {
}
A[0] = add_points(A[0], ND_coord_i(n));
A[1] = add_points(A[1], ND_coord_i(n));
- gvrender_polyline(gvc, A, 2);
+ gvrender_polyline(job, A, 2);
}
- gen_fields(gvc, n, f->fld[i]);
+ gen_fields(job, n, f->fld[i]);
}
}
-static void record_gencode(GVC_t * gvc, node_t * n)
+static void record_gencode(GVJ_t * job, node_t * n)
{
point A[4];
int i, style;
A[3].y = A[2].y;
for (i = 0; i < 4; i++)
A[i] = add_points(A[i], ND_coord_i(n));
- style = stylenode(gvc, n);
- pencolor(gvc, n);
+ style = stylenode(job, n);
+ pencolor(job, n);
if (style & FILLED)
- fillcolor(gvc, n); /* emit fill color */
+ fillcolor(job, n); /* emit fill color */
if (streq(ND_shape(n)->name, "Mrecord"))
style |= ROUNDED;
if (style & (ROUNDED | DIAGONALS))
- round_corners(gvc, n, A, 4, ROUNDED);
+ round_corners(job, n, A, 4, ROUNDED);
else
- gvrender_polygon(gvc, A, 4, style & FILLED);
+ gvrender_polygon(job, A, 4, style & FILLED);
xdemitState = EMIT_LABEL;
- gen_fields(gvc, n, f);
+ gen_fields(job, n, f);
}
static shape_desc **UserShape;
&& (P.x <= ND_rw_i(n)));
}
-void epsf_gencode(GVC_t * gvc, node_t * n)
+static void epsf_gencode(GVJ_t * job, node_t * n)
{
epsf_t *desc;
desc = (epsf_t *) (ND_shape_info(n));
if (!desc)
return;
- gvrender_begin_context(gvc);
+ gvrender_begin_context(job);
if (desc)
- fprintf(gvc->job->output_file,
+ fprintf(job->output_file,
"%d %d translate newpath user_shape_%d\n",
ND_coord_i(n).x + desc->offset.x,
ND_coord_i(n).y + desc->offset.y, desc->macro_id);
ND_label(n)->p = ND_coord_i(n);
- gvrender_end_context(gvc);
- emit_label(gvc, ND_label(n), (void *) n);
+ gvrender_end_context(job);
+ emit_label(job, ND_label(n), (void *) n);
}
typedef struct Agsym_t attrsym_t;
typedef struct GVC_s GVC_t;
+ typedef struct GVJ_s GVJ_t;
typedef struct gvrender_engine_s gvrender_engine_t;
typedef struct gvlayout_engine_s gvlayout_engine_t;
typedef struct gvdisplay_engine_s gvdisplay_engine_t;
port(*portfn) (node_t *, char *, char *); /* finds aiming point and slope of port */
boolean(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */
int (*pboxfn)(node_t* n, port* p, int side, box rv[], int *kptr); /* finds box path to reach port */
- void (*codefn) (GVC_t * gvc, node_t * n); /* emits graphics code for node */
+ void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */
} shape_functions;
typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF,
* these would be the arrow/label positions to use if a user want to flip the
* direction of an edge (as sometimes is there want).
*/
-void extend_attrs(GVC_t * gvc, graph_t *g, int s_arrows, int e_arrows)
+void extend_attrs(GVJ_t * job, graph_t *g, int s_arrows, int e_arrows)
{
node_t *n;
edge_t *e;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (ND_shape(n) && !isInvis(late_string(n, N_style, ""))) {
- ND_shape(n)->fns->codefn(gvc, n);
+ ND_shape(n)->fns->codefn(job, n);
agxset(n, n_draw->index, agxbuse(xbufs[EMIT_DRAW]));
agxset(n, n_l_draw->index, agxbuse(xbufs[EMIT_LABEL]));
}
if (ED_spl(e) == NULL)
continue;
- emit_edge_graphics (gvc, e);
+ emit_edge_graphics (job, e);
agxset(e, e_draw->index, agxbuse(xbufs[EMIT_DRAW]));
if (t_draw) agxset(e, t_draw->index, agxbuse(xbufs[EMIT_TDRAW]));
if (h_draw) agxset(e, h_draw->index, agxbuse(xbufs[EMIT_HDRAW]));
}
xdemitState = EMIT_DRAW;
- emit_background(gvc, g);
+ emit_background(job, g);
if (agxblen(xbufs[EMIT_DRAW])) {
if (!g_draw)
g_draw = safe_dcl(g, g, "_draw_", "", agraphattr);
}
xdemitState = EMIT_LABEL;
if (GD_label(g)) {
- emit_label(gvc, GD_label(g), (void *) g);
+ emit_label(job, GD_label(g), (void *) g);
agxset(g, g_l_draw->index, agxbuse(xbufs[EMIT_LABEL]));
}
- emit_clusters(gvc, g, 0);
+ emit_clusters(job, g, 0);
agxbfree(&xbuf0);
agxbfree(&xbuf1);
agxbfree(&xbuf2);
static void
xd_set_style (char **s)
{
- char buf[BUFSIZ];
+ unsigned char buf[BUFSIZ];
agxbuf xbuf;
char* p;
int more;
extern void gvrender_output_filename_job(GVC_t * gvc, char *name);
extern boolean gvrender_output_langname_job(GVC_t * gvc, char *name);
- extern gvrender_job_t *gvrender_first_job(GVC_t * gvc);
- extern gvrender_job_t *gvrender_next_job(GVC_t * gvc);
+ extern GVJ_t *gvrender_first_job(GVC_t * gvc);
+ extern GVJ_t *gvrender_next_job(GVC_t * gvc);
extern void gvrender_delete_jobs(GVC_t * gvc);
/* emit */
/* render */
- extern int gvrender_select(GVC_t * gvc, char *lang);
- extern int gvrender_features(GVC_t * gvc);
extern void gvrender_initialize(GVC_t * gvc);
extern void gvrender_finalize(GVC_t * gvc);
- extern void gvrender_begin_job(GVC_t * gvc);
- extern void gvrender_end_job(GVC_t * gvc);
- extern void gvrender_begin_graph(GVC_t * gvc, graph_t * g);
- extern void gvrender_end_graph(GVC_t * gvc);
- extern void gvrender_begin_page(GVC_t * gvc);
- extern void gvrender_end_page(GVC_t * gvc);
- extern void gvrender_begin_layer(GVC_t * gvc);
- extern void gvrender_end_layer(GVC_t * gvc);
- extern void gvrender_begin_cluster(GVC_t * gvc, graph_t * sg);
- extern void gvrender_end_cluster(GVC_t * gvc);
- extern void gvrender_begin_nodes(GVC_t * gvc);
- extern void gvrender_end_nodes(GVC_t * gvc);
- extern void gvrender_begin_edges(GVC_t * gvc);
- extern void gvrender_end_edges(GVC_t * gvc);
- extern void gvrender_begin_node(GVC_t * gvc, node_t * n);
- extern void gvrender_end_node(GVC_t * gvc);
- extern void gvrender_begin_edge(GVC_t * gvc, edge_t * e);
- extern void gvrender_end_edge(GVC_t * gvc);
- extern void gvrender_begin_context(GVC_t * gvc);
- extern void gvrender_end_context(GVC_t * gvc);
- extern void gvrender_begin_anchor(GVC_t * gvc, char *href,
+
+ extern void gvrender_begin_job(GVJ_t * job);
+ extern void gvrender_end_job(GVJ_t * job);
+ extern int gvrender_select(GVJ_t * job, char *lang);
+ extern int gvrender_features(GVJ_t * job);
+ extern void gvrender_begin_graph(GVJ_t * job, graph_t * g);
+ extern void gvrender_end_graph(GVJ_t * job);
+ extern void gvrender_begin_page(GVJ_t * job);
+ extern void gvrender_end_page(GVJ_t * job);
+ extern void gvrender_begin_layer(GVJ_t * job);
+ extern void gvrender_end_layer(GVJ_t * job);
+ extern void gvrender_begin_cluster(GVJ_t * job, graph_t * sg);
+ extern void gvrender_end_cluster(GVJ_t * job);
+ extern void gvrender_begin_nodes(GVJ_t * job);
+ extern void gvrender_end_nodes(GVJ_t * job);
+ extern void gvrender_begin_edges(GVJ_t * job);
+ extern void gvrender_end_edges(GVJ_t * job);
+ extern void gvrender_begin_node(GVJ_t * job, node_t * n);
+ extern void gvrender_end_node(GVJ_t * job);
+ extern void gvrender_begin_edge(GVJ_t * job, edge_t * e);
+ extern void gvrender_end_edge(GVJ_t * job);
+ extern void gvrender_begin_context(GVJ_t * job);
+ extern void gvrender_end_context(GVJ_t * job);
+ extern void gvrender_begin_anchor(GVJ_t * job, char *href,
char *tooltip, char *target);
- extern void gvrender_end_anchor(GVC_t * gvc);
- extern void gvrender_set_font(GVC_t * gvc, char *fontname,
+ extern void gvrender_end_anchor(GVJ_t * job);
+ extern void gvrender_set_font(GVJ_t * job, char *fontname,
double fontsize);
- extern void gvrender_textline(GVC_t * gvc, pointf p, textline_t * str);
- extern void gvrender_set_pencolor(GVC_t * gvc, char *name);
- extern void gvrender_set_fillcolor(GVC_t * gvc, char *name);
- extern void gvrender_set_style(GVC_t * gvc, char **s);
- extern void gvrender_ellipse(GVC_t * gvc, point p, int rx, int ry,
+ extern void gvrender_textline(GVJ_t * job, pointf p, textline_t * str);
+ extern void gvrender_set_pencolor(GVJ_t * job, char *name);
+ extern void gvrender_set_fillcolor(GVJ_t * job, char *name);
+ extern void gvrender_set_style(GVJ_t * job, char **s);
+ extern void gvrender_ellipse(GVJ_t * job, point p, int rx, int ry,
int filled);
- extern void gvrender_polygon(GVC_t * gvc, point * A, int n,
+ extern void gvrender_polygon(GVJ_t * job, point * A, int n,
int filled);
- extern void gvrender_beziercurve(GVC_t * gvc, pointf * AF, int n,
+ extern void gvrender_beziercurve(GVJ_t * job, pointf * AF, int n,
int arrow_at_start, int arrow_at_end, int);
- extern void gvrender_polyline(GVC_t * gvc, point * A, int n);
- extern void gvrender_comment(GVC_t * gvc, char *str);
- extern void gvrender_user_shape(GVC_t * gvc, char *name, point * A,
+ extern void gvrender_polyline(GVJ_t * job, point * A, int n);
+ extern void gvrender_comment(GVJ_t * job, char *str);
+ extern void gvrender_user_shape(GVJ_t * job, char *name, point * A,
int sides, int filled);
/* layout */
color_type_t color_type;
} gvrender_features_t;
- typedef struct gvrender_job_s gvrender_job_t;
-
- struct gvrender_job_s {
- gvrender_job_t *next; /* linked list of jobs */
- gvrender_job_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
+ struct GVJ_s {
+ GVJ_t *next; /* linked list of jobs */
+ GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
char *output_filename;
char *output_langname;
FILE *output_file;
gvplugin_type_t *typeptr;
};
- typedef int (*gvevent_key_callback_t) (gvrender_job_t * job);
+ typedef int (*gvevent_key_callback_t) (GVJ_t * job);
typedef struct gvevent_key_binding_s {
char *keystring;
char **info;
/* gvrender_config() */
- gvrender_job_t *jobs; /* linked list of jobs */
- gvrender_job_t *job; /* current job */
+ GVJ_t *jobs; /* linked list of jobs */
+ GVJ_t *job; /* current job */
void (*errorfn) (char *fmt, ...);
/* plugins */
gvlayout_engine_t *layout_engine; /* current layout engine */
int layout_id; /* internal id of current layout */
char *graphname; /* name from graph */
- gvrender_job_t *active_jobs; /* linked list of active jobs */
+ GVJ_t *active_jobs; /* linked list of active jobs */
char **lib;
#define ZOOMFACTOR 1.1
#define EPSILON .0001
-void gvevent_refresh(gvrender_job_t * job)
+void gvevent_refresh(GVJ_t * job)
{
- emit_graph(job->gvc, job->g);
+ emit_graph(job, job->g);
}
-void gvevent_button_press(gvrender_job_t * job, int button, double x, double y)
+void gvevent_button_press(GVJ_t * job, int button, double x, double y)
{
switch (button) {
case 1: /* select / create in edit mode */
job->oldy = y;
}
-void gvevent_motion(gvrender_job_t * job, double x, double y)
+void gvevent_motion(GVJ_t * job, double x, double y)
{
double dx = x - job->oldx;
double dy = y - job->oldy;
job->oldy = y;
}
-void gvevent_button_release(gvrender_job_t *job, int button, double x, double y)
+void gvevent_button_release(GVJ_t *job, int button, double x, double y)
{
job->click = 0;
job->active = 0;
}
-static int quit_cb(gvrender_job_t * job)
+static int quit_cb(GVJ_t * job)
{
return 1;
}
-static int left_cb(gvrender_job_t * job)
+static int left_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->focus.x += PANFACTOR / job->zoom;
return 0;
}
-static int right_cb(gvrender_job_t * job)
+static int right_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->focus.x -= PANFACTOR / job->zoom;
return 0;
}
-static int up_cb(gvrender_job_t * job)
+static int up_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->focus.y += -(PANFACTOR / job->zoom);
return 0;
}
-static int down_cb(gvrender_job_t * job)
+static int down_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->focus.y -= -(PANFACTOR / job->zoom);
return 0;
}
-static int zoom_in_cb(gvrender_job_t * job)
+static int zoom_in_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->zoom *= ZOOMFACTOR;
return 0;
}
-static int zoom_out_cb(gvrender_job_t * job)
+static int zoom_out_cb(GVJ_t * job)
{
job->fit_mode = 0;
job->zoom /= ZOOMFACTOR;
return 0;
}
-static int toggle_fit_cb(gvrender_job_t * job)
+static int toggle_fit_cb(GVJ_t * job)
{
job->fit_mode = !job->fit_mode;
if (job->fit_mode) {
/* from common/utils.c */
extern void *zmalloc(size_t);
-static gvrender_job_t *output_filename_job;
-static gvrender_job_t *output_langname_job;
+static GVJ_t *output_filename_job;
+static GVJ_t *output_langname_job;
/*
* -T and -o can be specified in any order relative to the other, e.g.
{
if (!gvc->jobs) {
output_filename_job = gvc->job = gvc->jobs =
- zmalloc(sizeof(gvrender_job_t));
+ zmalloc(sizeof(GVJ_t));
} else {
if (!output_filename_job) {
output_filename_job = gvc->jobs;
} else {
if (!output_filename_job->next) {
output_filename_job->next =
- zmalloc(sizeof(gvrender_job_t));
+ zmalloc(sizeof(GVJ_t));
}
output_filename_job = output_filename_job->next;
}
{
if (!gvc->jobs) {
output_langname_job = gvc->job = gvc->jobs =
- zmalloc(sizeof(gvrender_job_t));
+ zmalloc(sizeof(GVJ_t));
} else {
if (!output_langname_job) {
output_langname_job = gvc->jobs;
} else {
if (!output_langname_job->next) {
output_langname_job->next =
- zmalloc(sizeof(gvrender_job_t));
+ zmalloc(sizeof(GVJ_t));
}
output_langname_job = output_langname_job->next;
}
}
#endif
-gvrender_job_t *gvrender_first_job(GVC_t * gvc)
+GVJ_t *gvrender_first_job(GVC_t * gvc)
{
return (gvc->job = gvc->jobs);
}
-gvrender_job_t *gvrender_next_job(GVC_t * gvc)
+GVJ_t *gvrender_next_job(GVC_t * gvc)
{
- gvrender_job_t *job = gvc->job->next;
+ GVJ_t *job = gvc->job->next;
if (job) {
/* if langname not specified, then repeat previous value */
void gvrender_delete_jobs(GVC_t * gvc)
{
- gvrender_job_t *job, *j;
+ GVJ_t *job, *j;
job = gvc->jobs;
while ((j = job)) {
struct gvrender_engine_s {
void (*initialize) (GVC_t * gvc, gvevent_key_binding_t *keys, int numkeys);
void (*finalize) (GVC_t * gvc);
- void (*begin_job) (gvrender_job_t * job);
- void (*end_job) (gvrender_job_t * job);
- void (*begin_graph) (gvrender_job_t * job, char *graphname);
- void (*end_graph) (gvrender_job_t * job);
- void (*begin_layer) (gvrender_job_t * job, char *layername,
+ void (*begin_job) (GVJ_t * job);
+ void (*end_job) (GVJ_t * job);
+ void (*begin_graph) (GVJ_t * job, char *graphname);
+ void (*end_graph) (GVJ_t * job);
+ void (*begin_layer) (GVJ_t * job, char *layername,
int layerNum, int numLayers);
- void (*end_layer) (gvrender_job_t * job);
- void (*begin_page) (gvrender_job_t * job);
- void (*end_page) (gvrender_job_t * job);
- void (*begin_cluster) (gvrender_job_t * job, char *clustername, long id);
- void (*end_cluster) (gvrender_job_t * job);
- void (*begin_nodes) (gvrender_job_t * job);
- void (*end_nodes) (gvrender_job_t * job);
- void (*begin_edges) (gvrender_job_t * job);
- void (*end_edges) (gvrender_job_t * job);
- void (*begin_node) (gvrender_job_t * job, char *nodename, long id);
- void (*end_node) (gvrender_job_t * job);
- void (*begin_edge) (gvrender_job_t * job, char *tailname, boolean directed,
+ void (*end_layer) (GVJ_t * job);
+ void (*begin_page) (GVJ_t * job);
+ void (*end_page) (GVJ_t * job);
+ void (*begin_cluster) (GVJ_t * job, char *clustername, long id);
+ void (*end_cluster) (GVJ_t * job);
+ void (*begin_nodes) (GVJ_t * job);
+ void (*end_nodes) (GVJ_t * job);
+ void (*begin_edges) (GVJ_t * job);
+ void (*end_edges) (GVJ_t * job);
+ void (*begin_node) (GVJ_t * job, char *nodename, long id);
+ void (*end_node) (GVJ_t * job);
+ void (*begin_edge) (GVJ_t * job, char *tailname, boolean directed,
char *headname, long id);
- void (*end_edge) (gvrender_job_t * job);
- void (*begin_anchor) (gvrender_job_t * job, char *href, char *tooltip,
+ void (*end_edge) (GVJ_t * job);
+ void (*begin_anchor) (GVJ_t * job, char *href, char *tooltip,
char *target);
- void (*end_anchor) (gvrender_job_t * job);
- void (*textline) (gvrender_job_t * job, pointf p, textline_t * str);
- void (*resolve_color) (gvrender_job_t * job, color_t * color);
- void (*ellipse) (gvrender_job_t * job, pointf * A, int filled);
- void (*polygon) (gvrender_job_t * job, pointf * A, int n, int filled);
- void (*beziercurve) (gvrender_job_t * job, pointf * A, int n,
+ void (*end_anchor) (GVJ_t * job);
+ void (*textline) (GVJ_t * job, pointf p, textline_t * str);
+ void (*resolve_color) (GVJ_t * job, color_t * color);
+ void (*ellipse) (GVJ_t * job, pointf * A, int filled);
+ void (*polygon) (GVJ_t * job, pointf * A, int n, int filled);
+ void (*beziercurve) (GVJ_t * job, pointf * A, int n,
int arrow_at_start, int arrow_at_end, int);
- void (*polyline) (gvrender_job_t * job, pointf * A, int n);
- void (*comment) (gvrender_job_t * job, char *comment);
- void (*user_shape) (gvrender_job_t * job, char *name, pointf * A, int sides,
+ void (*polyline) (GVJ_t * job, pointf * A, int n);
+ void (*comment) (GVJ_t * job, char *comment);
+ void (*user_shape) (GVJ_t * job, char *name, pointf * A, int sides,
int filled);
};
/* callbacks */
- extern void gvevent_refresh(gvrender_job_t * job);
- extern void gvevent_button_press(gvrender_job_t * job, int button, double x, double y);
- extern void gvevent_button_release(gvrender_job_t * job, int button, double x, double y);
- extern void gvevent_motion(gvrender_job_t * job, double x, double y);
+ extern void gvevent_refresh(GVJ_t * job);
+ extern void gvevent_button_press(GVJ_t * job, int button, double x, double y);
+ extern void gvevent_button_release(GVJ_t * job, int button, double x, double y);
+ extern void gvevent_motion(GVJ_t * job, double x, double y);
#ifdef __cplusplus
}
color_type_t target_type);
extern char *canontoken(char *str);
-int gvrender_select(GVC_t * gvc, char *str)
+int gvrender_select(GVJ_t * job, char *str)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t *gvc = job->gvc;
gv_plugin_t *plugin;
gvplugin_type_t *typeptr;
#ifndef DISABLE_CODEGENS
return NO_SUPPORT;
}
-int gvrender_features(GVC_t * gvc)
+int gvrender_features(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
int features = 0;
void gvrender_initialize(GVC_t * gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
void gvrender_finalize(GVC_t * gvc)
{
- gvrender_job_t *job = gvc->job;
+ GVJ_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
#endif
}
-void gvrender_begin_job(GVC_t * gvc)
+void gvrender_begin_job(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
codegen_t *cg = job->codegen;
if (cg && cg->begin_job)
- cg->begin_job(job->output_file, job->g, gvc->lib, gvc->user,
- gvc->info, job->pagesArraySize);
+ cg->begin_job(job->output_file, job->g, job->gvc->lib, job->gvc->user,
+ job->gvc->info, job->pagesArraySize);
}
#endif
}
-void gvrender_end_job(GVC_t * gvc)
+void gvrender_end_job(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_job)
cg->end_job();
}
#endif
- gvc->lib = NULL;
+ job->gvc->lib = NULL;
}
/* font modifiers */
#define BOLD 1
#define ITALIC 2
-static pointf gvrender_ptf(gvrender_job_t *job, pointf p)
+static pointf gvrender_ptf(GVJ_t *job, pointf p)
{
pointf rv;
return rv;
}
-static pointf gvrender_pt(gvrender_job_t *job, point p)
+static pointf gvrender_pt(GVJ_t *job, point p)
{
pointf rv;
}
}
-void gvrender_begin_graph(GVC_t * gvc, graph_t * g)
+void gvrender_begin_graph(GVJ_t * job, graph_t * g)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t *gvc = job->gvc;
gvrender_engine_t *gvre = job->render_engine;
char *str;
double sx, sy;
/* init stack */
gvc->SP = 0;
job->style = &(gvc->styles[0]);
- gvrender_set_pencolor(gvc, DEFAULT_COLOR);
- gvrender_set_fillcolor(gvc, DEFAULT_FILL);
+ gvrender_set_pencolor(job, DEFAULT_COLOR);
+ gvrender_set_fillcolor(job, DEFAULT_FILL);
job->style->fontfam = DEFAULT_FONTNAME;
job->style->fontsz = DEFAULT_FONTSIZE;
job->style->fontopt = FONT_REGULAR;
#endif
}
-void gvrender_end_graph(GVC_t * gvc)
+void gvrender_end_graph(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_graph)
#endif
}
-void gvrender_begin_page(GVC_t * gvc)
+void gvrender_begin_page(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_page)
#endif
}
-void gvrender_end_page(GVC_t * gvc)
+void gvrender_end_page(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_page)
#endif
}
-void gvrender_begin_layer(GVC_t * gvc)
+void gvrender_begin_layer(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t * gvc = job->gvc;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_layer)
#endif
}
-void gvrender_end_layer(GVC_t * gvc)
+void gvrender_end_layer(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_layer)
#endif
}
-void gvrender_begin_cluster(GVC_t * gvc, graph_t * sg)
+void gvrender_begin_cluster(GVJ_t * job, graph_t * sg)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_cluster)
#endif
}
-void gvrender_end_cluster(GVC_t * gvc)
+void gvrender_end_cluster(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_cluster)
#endif
}
-void gvrender_begin_nodes(GVC_t * gvc)
+void gvrender_begin_nodes(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_nodes)
#endif
}
-void gvrender_end_nodes(GVC_t * gvc)
+void gvrender_end_nodes(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_nodes)
#endif
}
-void gvrender_begin_edges(GVC_t * gvc)
+void gvrender_begin_edges(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_edges)
#endif
}
-void gvrender_end_edges(GVC_t * gvc)
+void gvrender_end_edges(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_edges)
#endif
}
-void gvrender_begin_node(GVC_t * gvc, node_t * n)
+void gvrender_begin_node(GVJ_t * job, node_t * n)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_node)
#endif
}
-void gvrender_end_node(GVC_t * gvc)
+void gvrender_end_node(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_node)
#endif
}
-void gvrender_begin_edge(GVC_t * gvc, edge_t * e)
+void gvrender_begin_edge(GVJ_t * job, edge_t * e)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_edge)
#endif
}
-void gvrender_end_edge(GVC_t * gvc)
+void gvrender_end_edge(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_edge)
#endif
}
-void gvrender_begin_context(GVC_t * gvc)
+void gvrender_begin_context(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t *gvc = job->gvc;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
#endif
}
-void gvrender_end_context(GVC_t * gvc)
+void gvrender_end_context(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
+ GVC_t *gvc = job->gvc;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
#endif
}
-void gvrender_begin_anchor(GVC_t * gvc, char *href, char *tooltip,
+void gvrender_begin_anchor(GVJ_t * job, char *href, char *tooltip,
char *target)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->begin_anchor)
#endif
}
-void gvrender_end_anchor(GVC_t * gvc)
+void gvrender_end_anchor(GVJ_t * job)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->end_anchor)
#endif
}
-void gvrender_set_font(GVC_t * gvc, char *fontname, double fontsize)
+void gvrender_set_font(GVJ_t * job, char *fontname, double fontsize)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre) {
#endif
}
-void gvrender_textline(GVC_t * gvc, pointf p, textline_t * line)
+void gvrender_textline(GVJ_t * job, pointf p, textline_t * line)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (line->str && line->str[0]) {
}
}
-void gvrender_set_pencolor(GVC_t * gvc, char *name)
+void gvrender_set_pencolor(GVJ_t * job, char *name)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
color_t *color = &(job->style->pencolor);
#endif
}
-void gvrender_set_fillcolor(GVC_t * gvc, char *name)
+void gvrender_set_fillcolor(GVJ_t * job, char *name)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
color_t *color = &(job->style->fillcolor);
#endif
}
-void gvrender_set_style(GVC_t * gvc, char **s)
+void gvrender_set_style(GVJ_t * job, char **s)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
char *line, *p;
gvstyle_t *style = job->style;
#endif
}
-void gvrender_ellipse(GVC_t * gvc, point p, int rx, int ry, int filled)
+void gvrender_ellipse(GVJ_t * job, point p, int rx, int ry, int filled)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->ellipse) {
#endif
}
-void gvrender_polygon(GVC_t * gvc, point * A, int n, int filled)
+void gvrender_polygon(GVJ_t * job, point * A, int n, int filled)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->polygon) {
#endif
}
-void gvrender_beziercurve(GVC_t * gvc, pointf * AF, int n,
+void gvrender_beziercurve(GVJ_t * job, pointf * AF, int n,
int arrow_at_start, int arrow_at_end, int filled)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->beziercurve) {
#endif
}
-void gvrender_polyline(GVC_t * gvc, point * A, int n)
+void gvrender_polyline(GVJ_t * job, point * A, int n)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (gvre && gvre->polyline) {
#endif
}
-void gvrender_comment(GVC_t * gvc, char *str)
+void gvrender_comment(GVJ_t * job, char *str)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
if (!str || !str[0])
#endif
}
-void gvrender_user_shape(GVC_t * gvc, char *name, point * A, int n,
+void gvrender_user_shape(GVJ_t * job, char *name, point * A, int n,
int filled)
{
- gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
/* temporary hack until client API is FP */
return;
}
- gvc->job->output_lang = gvrender_select(gvc, gvc->job->output_langname);
+ gvc->job->output_lang = gvrender_select(gvc->job, gvc->job->output_langname);
if (!GD_drawing(g) && gvc->job->output_lang != CANONICAL_DOT) {
fprintf(stderr, "Layout was not done\n");
return;
}
/* populate new job struct with output language and output file data */
gvc->job->output_lang =
- gvrender_select(gvc, gvc->job->output_langname);
+ gvrender_select(gvc->job, gvc->job->output_langname);
if (Tcl_GetOpenFile (interp, argv[2], 1, 1,
(ClientData *) &(gvc->job->output_file)) != TCL_OK)
}
static void
-tk_bezier(point * A, int n, int arrow_at_start, int arrow_at_end)
+tk_bezier(point * A, int n, int arrow_at_start, int arrow_at_end, int filled)
{
char buf[20];