GVG_t is a new struct to support multiple different graphs open at the same time.
GVC_t contains the context for all graphs, e.g. plugins.
GVG_t contains the context for a single graph
GVJ_t contains teh context for a single rendering of a single graph
}
assert(0); /* should never exit loop */
} else {
- while ((G = next_input_graph())) {
+ while ((G = gvNextInputGraph(Gvc))) {
if (prev) {
gvFreeLayout(Gvc, prev);
agclose(prev);
int f;
int oldstate;
- oldstate = job->gvc->emit_state;
- job->gvc->emit_state = state;
+ oldstate = job->gvg->emit_state;
+ job->gvg->emit_state = state;
/* Dotted and dashed styles on the arrowhead are ugly (dds) */
/* linewidth needs to be reset */
gvrender_begin_context(job);
- gvrender_set_style(job, job->gvc->defaultlinestyle);
+ gvrender_set_style(job, job->gvg->defaultlinestyle);
/* generate arrowhead vector */
u.x -= p.x;
gvrender_end_context(job);
- job->gvc->emit_state = oldstate;
+ job->gvg->emit_state = oldstate;
}
/* FIXME emit.c and output.c require wrapper for int point coords */
{
}
-static void dia_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void dia_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
Rootgraph = g;
PB.LL.x = PB.LL.y = 0;
/* parse_layers:
* Split input string into tokens, with separators specified by
- * the layersep attribute. Store the values in the gvc->layerIDs array,
+ * the layersep attribute. Store the values in the gvg->layerIDs array,
* starting at index 1, and return the count.
* Free previously stored list. Note that there is no mechanism
* to free the memory before exit.
*/
-static int parse_layers(GVC_t *gvc, graph_t * g, char *p)
+static int parse_layers(GVG_t *gvg, graph_t * g, char *p)
{
int ntok;
char *tok;
int sz;
- gvc->layerDelims = agget(g, "layersep");
- if (!gvc->layerDelims)
- gvc->layerDelims = DEFAULT_LAYERSEP;
+ gvg->layerDelims = agget(g, "layersep");
+ if (!gvg->layerDelims)
+ gvg->layerDelims = DEFAULT_LAYERSEP;
ntok = 0;
sz = 0;
- gvc->layers = strdup(p);
+ gvg->layers = strdup(p);
- for (tok = strtok(gvc->layers, gvc->layerDelims); tok;
- tok = strtok(NULL, gvc->layerDelims)) {
+ for (tok = strtok(gvg->layers, gvg->layerDelims); tok;
+ tok = strtok(NULL, gvg->layerDelims)) {
ntok++;
if (ntok > sz) {
sz += SMALLBUF;
- gvc->layerIDs = ALLOC(sz, gvc->layerIDs, char *);
+ gvg->layerIDs = ALLOC(sz, gvg->layerIDs, char *);
}
- gvc->layerIDs[ntok] = tok;
+ gvg->layerIDs[ntok] = tok;
}
if (ntok) {
- gvc->layerIDs = RALLOC(ntok + 2, gvc->layerIDs, char *); /* shrink to minimum size */
- gvc->layerIDs[0] = NULL;
- gvc->layerIDs[ntok + 1] = NULL;
+ gvg->layerIDs = RALLOC(ntok + 2, gvg->layerIDs, char *); /* shrink to minimum size */
+ gvg->layerIDs[0] = NULL;
+ gvg->layerIDs[ntok + 1] = NULL;
}
return ntok;
}
}
-static void init_layering(GVC_t * gvc, graph_t * g)
+static void init_layering(GVG_t * gvg, graph_t * g)
{
char *str;
/* free layer strings and pointers from previous graph */
- if (gvc->layers)
- free(gvc->layers);
- if (gvc->layerIDs)
- free(gvc->layerIDs);
+ if (gvg->layers)
+ free(gvg->layers);
+ if (gvg->layerIDs)
+ free(gvg->layerIDs);
if ((str = agget(g, "layers")) != 0) {
- gvc->numLayers = parse_layers(gvc, g, str);
+ gvg->numLayers = parse_layers(gvg, g, str);
} else {
- gvc->layerIDs = NULL;
- gvc->numLayers = 1;
+ gvg->layerIDs = NULL;
+ gvg->numLayers = 1;
}
}
static void firstlayer(GVJ_t *job)
{
- job->numLayers = job->gvc->numLayers;
+ job->numLayers = job->gvg->numLayers;
if ((job->numLayers > 1)
&& (! (gvrender_features(job) & GVRENDER_DOES_LAYERS))) {
agerr(AGWARN, "layers not supported in %s output\n",
static void init_job_pagination(GVJ_t * job, graph_t *g)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
point pageSize; /* page size for the graph - device units */
point imageSize; /* image size on one page of the graph - device units */
point margin; /* margin for a page of the graph - device units */
imageSize = exch_xy(imageSize);
/* determine pagination */
- if (gvc->graph_sets_pageSize) {
+ if (gvg->graph_sets_pageSize) {
/* page was set by user */
- pageSize.x = ROUND(gvc->pageSize.x * job->dpi.x / POINTS_PER_INCH);
- pageSize.y = ROUND(gvc->pageSize.y * job->dpi.y / POINTS_PER_INCH);
+ pageSize.x = ROUND(gvg->pageSize.x * job->dpi.x / POINTS_PER_INCH);
+ pageSize.y = ROUND(gvg->pageSize.y * job->dpi.y / POINTS_PER_INCH);
/* we don't want graph page to exceed its bounding box */
pageSize.x = MIN(pageSize.x, imageSize.x);
job->pagesArrayMajor.x = job->pagesArrayMajor.y
= job->pagesArrayMinor.x = job->pagesArrayMinor.y = 0;
job->pagesArrayFirst.x = job->pagesArrayFirst.y = 0;
- job->pagesArrayMajor = pagecode(job, gvc->pagedir[0]);
- job->pagesArrayMinor = pagecode(job, gvc->pagedir[1]);
+ job->pagesArrayMajor = pagecode(job, gvg->pagedir[0]);
+ job->pagesArrayMinor = pagecode(job, gvg->pagedir[1]);
if ((abs(job->pagesArrayMajor.x + job->pagesArrayMinor.x) != 1)
|| (abs(job->pagesArrayMajor.y + job->pagesArrayMinor.y) != 1)) {
job->pagesArrayMajor = pagecode(job, 'B');
job->pagesArrayMinor = pagecode(job, 'L');
- agerr(AGWARN, "pagedir=%s ignored\n", gvc->pagedir);
+ agerr(AGWARN, "pagedir=%s ignored\n", gvg->pagedir);
}
#if 0
job->width,
job->height);
fprintf (stderr,"pagedir = %s, pagesArrayMajor = %d,%d pagesArrayMinor = %d,%d\n",
- gvc->pagedir,
+ gvg->pagedir,
job->pagesArrayMajor.x,
job->pagesArrayMajor.y,
job->pagesArrayMinor.x,
return TRUE;
}
-static int layer_index(GVC_t *gvc, char *str, int all)
+static int layer_index(GVG_t *gvg, char *str, int all)
{
- GVJ_t *job = gvc->job;
int i;
if (streq(str, "all"))
return all;
if (is_natural_number(str))
return atoi(str);
- if (gvc->layerIDs)
- for (i = 1; i <= job->numLayers; i++)
- if (streq(str, gvc->layerIDs[i]))
+ if (gvg->layerIDs)
+ for (i = 1; i <= gvg->numLayers; i++)
+ if (streq(str, gvg->layerIDs[i]))
return i;
return -1;
}
static bool selectedlayer(GVJ_t *job, char *spec)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
int n0, n1;
unsigned char buf[SMALLBUF];
char *w0, *w1;
agxbinit(&xb, SMALLBUF, buf);
agxbput(&xb, spec);
- w1 = w0 = strtok(agxbuse(&xb), gvc->layerDelims);
+ w1 = w0 = strtok(agxbuse(&xb), gvg->layerDelims);
if (w0)
- w1 = strtok(NULL, gvc->layerDelims);
+ w1 = strtok(NULL, gvg->layerDelims);
switch ((w0 != NULL) + (w1 != NULL)) {
case 0:
rval = FALSE;
break;
case 1:
- n0 = layer_index(gvc, w0, job->layerNum);
+ n0 = layer_index(gvg, w0, job->layerNum);
rval = (n0 == job->layerNum);
break;
case 2:
- n0 = layer_index(gvc, w0, 0);
- n1 = layer_index(gvc, w1, job->numLayers);
+ n0 = layer_index(gvg, w0, 0);
+ n1 = layer_index(gvg, w1, job->numLayers);
if ((n0 < 0) || (n1 < 0))
rval = TRUE;
else if (n0 > n1) {
static void emit_node(GVJ_t * job, node_t * n)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
char *s, *url = NULL, *tooltip = NULL, *target = NULL;
int oldstate, explicit_tooltip = 0;
if (ND_shape(n) == NULL)
return;
- oldstate = gvc->emit_state;
- gvc->emit_state = EMIT_NDRAW;
+ oldstate = gvg->emit_state;
+ gvg->emit_state = EMIT_NDRAW;
if (node_in_layer(job, n->graph, n)
&& node_in_box(n, job->pageBoxClip)
- && (ND_state(n) != gvc->viewNum)) {
+ && (ND_state(n) != gvg->viewNum)) {
gvrender_comment(job, n->name);
setColorScheme (agget (n, "colorscheme"));
gvrender_begin_context(job);
ND_shape(n)->fns->codefn(job, n);
- ND_state(n) = gvc->viewNum;
+ ND_state(n) = gvg->viewNum;
gvrender_end_context(job);
if (url || explicit_tooltip)
free(target);
gvrender_end_node(job);
}
- gvc->emit_state = oldstate;
+ gvg->emit_state = oldstate;
}
#define EPSILON .0001
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(job, job->gvc->defaultlinestyle);
+ gvrender_set_style(job, job->gvg->defaultlinestyle);
/* Use font color to draw attachment
- need something unambiguous in case of multicolored parallel edges
- defaults to black for html-like labels
#define SEP 2.0
- oldstate = job->gvc->emit_state;
- job->gvc->emit_state = EMIT_EDRAW;
+ oldstate = job->gvg->emit_state;
+ job->gvg->emit_state = EMIT_EDRAW;
style = late_string(e, E_style, "");
/* We shortcircuit drawing an invisible edge because the arrowhead
* code resets the style to solid, and most of the code generators
if (saved)
gvrender_end_context(job);
- job->gvc->emit_state = oldstate;
+ job->gvg->emit_state = oldstate;
}
static bool edge_in_box(edge_t *e, boxf b)
if (! edge_in_box(e, job->pageBoxClip) || ! edge_in_layer(job, e->head->graph, e))
return;
- oldstate = job->gvc->emit_state;
- job->gvc->emit_state = EMIT_EDRAW;
+ oldstate = job->gvg->emit_state;
+ job->gvg->emit_state = EMIT_EDRAW;
s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
strcpy(s,e->tail->name);
if (AG_IS_DIRECTED(e->tail->graph))
free(tooltip);
free(target);
gvrender_end_edge(job);
- job->gvc->emit_state = oldstate;
+ job->gvg->emit_state = oldstate;
}
-static void init_gvc(GVC_t * gvc, graph_t * g)
+static void init_gvg(GVG_t * gvg, graph_t * g)
{
double xf, yf;
char *p;
int i;
-
- gvc->g = g;
+
+ gvg->g = g;
/* margins */
- gvc->graph_sets_margin = FALSE;
+ gvg->graph_sets_margin = FALSE;
if ((p = agget(g, "margin"))) {
i = sscanf(p, "%lf,%lf", &xf, &yf);
if (i > 0) {
- gvc->margin.x = gvc->margin.y = xf * POINTS_PER_INCH;
+ gvg->margin.x = gvg->margin.y = xf * POINTS_PER_INCH;
if (i > 1)
- gvc->margin.y = yf * POINTS_PER_INCH;
- gvc->graph_sets_margin = TRUE;
+ gvg->margin.y = yf * POINTS_PER_INCH;
+ gvg->graph_sets_margin = TRUE;
}
}
/* pagesize */
- gvc->graph_sets_pageSize = FALSE;
- P2PF(GD_drawing(g)->page, gvc->pageSize);
+ gvg->graph_sets_pageSize = FALSE;
+ P2PF(GD_drawing(g)->page, gvg->pageSize);
if ((GD_drawing(g)->page.x > 0) && (GD_drawing(g)->page.y > 0)) {
- gvc->graph_sets_pageSize = TRUE;
+ gvg->graph_sets_pageSize = TRUE;
}
/* rotation */
if (GD_drawing(g)->landscape) {
- gvc->rotation = 90;
+ gvg->rotation = 90;
/* we expect the user to have swapped x,y coords of pagesize and margin */
- gvc->pageSize = exch_xyf(gvc->pageSize);
- gvc->margin = exch_xyf(gvc->margin);
+ gvg->pageSize = exch_xyf(gvg->pageSize);
+ gvg->margin = exch_xyf(gvg->margin);
}
else {
- gvc->rotation = 0;
+ gvg->rotation = 0;
}
/* pagedir */
- gvc->pagedir = "BL";
+ gvg->pagedir = "BL";
if ((p = agget(g, "pagedir")) && p[0])
- gvc->pagedir = p;
+ gvg->pagedir = p;
/* bounding box */
- B2BF(GD_bb(g),gvc->bb);
+ B2BF(GD_bb(g),gvg->bb);
/* clusters have peripheries */
G_peripheries = agfindattr(g, "peripheries");
/* default font */
- gvc->defaultfontname = late_nnstring(g->proto->n,
+ gvg->defaultfontname = late_nnstring(g->proto->n,
N_fontname, DEFAULT_FONTNAME);
- gvc->defaultfontsize = late_double(g->proto->n,
+ gvg->defaultfontsize = late_double(g->proto->n,
N_fontsize, DEFAULT_FONTSIZE, MIN_FONTSIZE);
/* default line style */
- gvc->defaultlinestyle = defaultlinestyle;
+ gvg->defaultlinestyle = defaultlinestyle;
- gvc->graphname = g->name;
- gvc->lib = Lib;
+ gvg->graphname = g->name;
+ gvg->lib = Lib;
}
static void init_job_margin(GVJ_t *job)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
- if (gvc->graph_sets_margin) {
- job->margin = gvc->margin;
+ if (gvg->graph_sets_margin) {
+ job->margin = gvg->margin;
}
else {
/* set default margins depending on format */
job->zoom = Z; /* scaling factor */
job->focus.x = x; /* graph coord of focus - points */
job->focus.y = y;
- job->rotation = job->gvc->rotation;
+ job->rotation = job->gvg->rotation;
#if 0
fprintf(stderr,"bb = %d,%d %d,%d size %d,%d (graph units)\n",
void emit_view(GVJ_t * job, graph_t * g, int flags)
{
- GVC_t * gvc = job->gvc;
+ GVG_t * gvg = job->gvg;
node_t *n;
edge_t *e;
char *s, *url = NULL, *tooltip = NULL, *target = NULL;
int explicit_tooltip = 0;
- gvc->viewNum++;
+ gvg->viewNum++;
if (((s = agget(g, "href")) && s[0]) || ((s = agget(g, "URL")) && s[0]))
url = strdup_and_subst_graph(s, g);
if ((s = agget(g, "target")) && s[0])
node_t *n;
char *s;
int flags = job->flags;
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
s = late_string(g, agfindattr(g, "comment"), "");
gvrender_comment(job, s);
if (job->numLayers == 1)
emit_background(job, g);
gvrender_set_pencolor(job, DEFAULT_COLOR);
- gvrender_set_font(job, gvc->defaultfontname, gvc->defaultfontsize);
+ gvrender_set_font(job, gvg->defaultfontname, gvg->defaultfontsize);
if (boxf_overlap(job->clip, job->pageBox))
emit_view(job,g,flags);
}
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
if (job->output_file) {
- if (gvc->viewNum > 0) {
+ if (job->gvg->viewNum > 0) {
gvrender_end_job(job);
emit_once_reset();
- gvc->viewNum = 0;
+ job->gvg->viewNum = 0;
}
fclose(job->output_file);
job->output_file = NULL;
char *s, *url, *tooltip, *target;
int oldstate, explicit_tooltip;
- oldstate = job->gvc->emit_state;
- job->gvc->emit_state = EMIT_CDRAW;
+ oldstate = job->gvg->emit_state;
+ job->gvg->emit_state = EMIT_CDRAW;
for (c = 1; c <= GD_n_cluster(g); c++) {
sg = GD_clust(g)[c];
if (clust_in_layer(job, sg) == FALSE)
if (!(flags & EMIT_CLUSTERS_LAST))
emit_clusters(job, sg, flags);
}
- job->gvc->emit_state = oldstate;
+ job->gvg->emit_state = oldstate;
}
static bool is_style_delim(int c)
init_job_viewport(job, g);
init_job_pagination(job, g);
- job->gvc->emit_state = EMIT_GDRAW;
+ job->gvg->emit_state = EMIT_GDRAW;
gvrender_begin_job(job);
switch (job->output_lang) {
int gvRenderJobs (GVC_t * gvc, graph_t * g)
{
GVJ_t *job, *prev_job;
+ GVG_t *gvg = gvc->gvg;
if (!GD_drawing(g)) {
agerr (AGERR, "Layout was not done. Missing layout plugins? \n");
}
init_bb(g);
- init_gvc(gvc, g);
- init_layering(gvc, g);
+ init_gvg(gvg, g);
+ init_layering(gvg, g);
gvc->keybindings = gvevent_key_binding;
gvc->numkeys = gvevent_key_binding_size;
- gvc->active_jobs = NULL; /* clear active list */
+ gvg->active_jobs = NULL; /* clear active list */
prev_job = NULL;
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
if (!job->output_file) { /* if not yet opened */
}
/* if we already have an active job list to a different output device */
- if (gvc->active_jobs
- && strcmp(job->output_langname,gvc->active_jobs->output_langname) != 0) {
+ if (gvg->active_jobs
+ && strcmp(job->output_langname,gvg->active_jobs->output_langname) != 0) {
gvdevice_finalize(gvc); /* finalize previous jobs */
- gvc->active_jobs = NULL; /* clear active list */
+ gvg->active_jobs = NULL; /* clear active list */
prev_job = NULL;
}
if (prev_job)
prev_job->next_active = job; /* insert job in active list */
else
- gvc->active_jobs = job; /* first job of new list */
+ gvg->active_jobs = job; /* first job of new list */
job->next_active = NULL; /* terminate active list */
prev_job = job;
fprintf(Output_file, "# end of FIG file\n");
}
-static void fig_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void fig_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
PB = bb;
if (onetime) {
#endif
}
-static void init1_gd(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void init1_gd(GVG_t * gvg, graph_t * g, box bb, point pb)
{
Dpi = GD_drawing(g)->dpi;
if (Dpi < 1.0)
Dpi = DEFAULT_DPI;
DevScale = Dpi / POINTS_PER_INCH;
- Viewport.x = gvc->job->width;
- Viewport.y = gvc->job->height;
+ Viewport.x = gvg->job->width;
+ Viewport.y = gvg->job->height;
#if 0
if (Viewport.x) {
- Zoom = gvc->job->zoom;
- GraphFocus = gvc->job->focus;
+ Zoom = gvg->job->zoom;
+ GraphFocus = gvg->job->focus;
} else {
Viewport.x =
(bb.UR.x - bb.LL.x + 2 * GD_drawing(g)->margin.x) * DevScale + 2;
Zoom = 1.0;
}
#else
- Zoom = gvc->job->zoom;
- GraphFocus = gvc->job->focus;
+ Zoom = gvg->job->zoom;
+ GraphFocus = gvg->job->focus;
#endif
CompScale = Zoom * DevScale;
}
return rv;
}
-static void gd_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void gd_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
char *bgcolor_str = NULL;
char *truecolor_str;
bool truecolor_p = FALSE; /* try to use cheaper paletted mode */
bool bg_transparent_p = FALSE;
int bgcolor;
+ GVG_t *gvg = job->gvg;
- external_surface = gvc->job->external_surface;
+ external_surface = gvg->job->external_surface;
- init1_gd(gvc, g, bb, pb);
+ init1_gd(gvg, g, bb, pb);
if (external_surface) {
- im = (gdImagePtr)gvc->job->surface;
+ im = (gdImagePtr)gvg->job->surface;
} else {
truecolor_str = agget(g, "truecolor"); /* allow user to force truecolor */
bgcolor_str = agget(g, "bgcolor");
N_pages = pages.x * pages.y;
}
-static void hpgl_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void hpgl_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
PB = bb;
PageWidth = pb.x;
/* set basic graphics context */
gvrender_begin_context(job);
/* Need to override line style set by node. */
- gvrender_set_style(job, job->gvc->defaultlinestyle);
+ gvrender_set_style(job, job->gvg->defaultlinestyle);
if (tbl->data.pencolor)
gvrender_set_pencolor(job, tbl->data.pencolor);
else
}
/* if no -Txxx, then set default format */
- if (!gvc->jobs || !gvc->jobs->output_langname) {
+ if (!gvc->gvg->jobs || !gvc->gvg->jobs->output_langname) {
v = gvrender_output_langname_job(gvc, "dot");
assert(v); /* "dot" should always be available as an output format */
}
#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
- Output_codegen = gvc->jobs->codegen;
+ Output_codegen = gvc->gvg->jobs->codegen;
#endif
/* set persistent attributes here (if not already set from command line options) */
}
}
+#if 0
static FILE *next_input_file(void)
{
static int ctr = 0;
}
return g;
}
+#endif
/* findCharset:
* Check if the charset attribute is defined for the graph and, if
pointf p;
int oldstate;
- oldstate = job->gvc->emit_state;
- job->gvc->emit_state = state;
+ oldstate = job->gvg->emit_state;
+ job->gvg->emit_state = state;
if (lp->html) {
emit_html_label(job, lp->u.html, lp, obj);
emit_textlines(job, lp->u.txt.nlines, lp->u.txt.line, p,
halfwidth_x, lp->fontname, lp->fontsize, lp->fontcolor);
- job->gvc->emit_state = oldstate;
+ job->gvg->emit_state = oldstate;
}
isLatin1 = (GD_charset(g) == CHAR_LATIN1);
}
-static void map_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void map_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
Dpi = GD_drawing(g)->dpi;
if (Dpi < 1.0)
Dpi = DEFAULT_DPI;
DevScale = Dpi / POINTS_PER_INCH;
- Viewport.x = gvc->job->width;
- Viewport.y = gvc->job->height;
+ Viewport.x = job->width;
+ Viewport.y = job->height;
if (Viewport.x) {
- Zoom = gvc->job->zoom;
- GraphFocus = gvc->job->focus;
+ Zoom = job->zoom;
+ GraphFocus = job->focus;
} else {
Viewport.x =
(bb.UR.x - bb.LL.x + 2 * GD_drawing(g)->margin.x) * DevScale +
fprintf(Output_file, "# end of MIFFile\n");
}
-static void mif_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void mif_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
PB = bb;
if (onetime) {
fprintf(Output_file, "%% %s\n", str);
}
-static void mp_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void mp_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
/* PB = bb; */
if (onetime) {
fprintf(Output_file, "%s Title: %s\n", EscComment, g->name);
}
-static void pic_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void pic_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
BB = bb;
fprintf(Output_file, "%% %s\n", str);
}
-static void ps_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void ps_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
char *s;
svg_fputs(") -->\n");
}
-static void svg_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void svg_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
- Viewport.x = gvc->job->width;
- Viewport.y = gvc->job->height;
- CompScale = gvc->job->compscale;
- Offset = gvc->job->offset;
+ Viewport.x = job->width;
+ Viewport.y = job->height;
+ CompScale = job->compscale;
+ Offset = job->offset;
if (onetime) {
init_svg();
svg_fputs("<!-- Title: ");
svg_fputs(xml_namestring(g->name));
svg_printf(" Pages: %d -->\n", N_pages);
- if (ROUND(gvc->job->dpi.x) == POINTS_PER_INCH && ROUND(gvc->job->dpi.y) == POINTS_PER_INCH)
+ if (ROUND(job->dpi.x) == POINTS_PER_INCH && ROUND(job->dpi.y) == POINTS_PER_INCH)
svg_printf("<svg width=\"%dpt\" height=\"%dpt\"\n",
Viewport.x, Viewport.y);
else
svg_printf("<svg width=\"%dpx\" height=\"%dpx\"\n",
- ROUND(gvc->job->dpi.x * Viewport.x / POINTS_PER_INCH),
- ROUND(gvc->job->dpi.y * Viewport.y / POINTS_PER_INCH));
+ ROUND(job->dpi.x * Viewport.x / POINTS_PER_INCH),
+ ROUND(job->dpi.y * Viewport.y / POINTS_PER_INCH));
/* establish absolute units in points */
svg_printf(" viewBox = \"%d %d %d %d\"\n", 0, 0, Viewport.x, Viewport.y);
/* namespace of svg */
void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
char *info[], point pages);
void (*end_job) (void);
- void (*begin_graph) (GVC_t * gvc, graph_t * g, box bb, point pb);
+ void (*begin_graph) (GVJ_t * job, graph_t * g, box bb, point pb);
void (*end_graph) (void);
void (*begin_page) (graph_t * g, point page, double scale, int rot,
point offset);
fprintf(Output_file, "#VRML V2.0 utf8\n");
}
-static void vrml_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void vrml_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
g = g;
free(date);
}
-static void vtx_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void vtx_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
/* PB = bb; */
if (onetime) {
#define XDOTVERSION "1.1"
-static GVC_t *gvc;
+static GVG_t *gvg;
static agxbuf xbuf0;
static agxbuf xbuf1;
static agxbuf xbuf2;
unsigned char buf4[BUFSIZ];
unsigned char buf5[BUFSIZ];
- gvc = job->gvc;
+ gvg = job->gvg;
agsafeset (g, "xdotversion", XDOTVERSION, "");
if (GD_has_labels(g) & GRAPH_LABEL)
char buf[BUFSIZ];
sprintf (buf, "%s%d -", pfx, (int)strlen(s));
- agxbput(xbufs[gvc->emit_state], buf);
- agxbput(xbufs[gvc->emit_state], s);
- agxbputc(xbufs[gvc->emit_state], ' ');
+ agxbput(xbufs[gvg->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], s);
+ agxbputc(xbufs[gvg->emit_state], ' ');
}
static void xd_textline(point p, textline_t * line)
break;
}
sprintf(buf, "T %d %d %d %d ", p.x, YDIR(p.y), j, (int) line->width);
- agxbput(xbufs[gvc->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], buf);
xd_str ("", line->str);
}
{
char buf[BUFSIZ];
- agxbputc(xbufs[gvc->emit_state], (filled ? 'E' : 'e'));
+ agxbputc(xbufs[gvg->emit_state], (filled ? 'E' : 'e'));
sprintf(buf, " %d %d %d %d ", p.x, YDIR(p.y), rx, ry);
- agxbput(xbufs[gvc->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], buf);
}
static void xd_points(char c, point * A, int n)
int i;
point p;
- agxbputc(xbufs[gvc->emit_state], c);
+ agxbputc(xbufs[gvg->emit_state], c);
sprintf(buf, " %d ", n);
- agxbput(xbufs[gvc->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], buf);
for (i = 0; i < n; i++) {
p = A[i];
sprintf(buf, "%d %d ", p.x, YDIR(p.y));
- agxbput(xbufs[gvc->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], buf);
}
}
char buf[BUFSIZ];
sprintf(buf, "F %f ", fontsize);
- agxbput(xbufs[gvc->emit_state], buf);
+ agxbput(xbufs[gvg->emit_state], buf);
xd_str ("", fontname);
}
LIBS = $(LIBLTDL) $(SOCKET_LIBS)
-pkginclude_HEADERS = gvc.h gvcext.h gvplugin.h gvcjob.h gvcint.h \
+pkginclude_HEADERS = gvc.h gvcext.h gvplugin.h gvj.h gvg.h gvcint.h \
gvplugin_render.h \
gvplugin_layout.h \
gvplugin_textlayout.h \
libgvc_builtins_la_SOURCES = gvrender.c gvlayout.c gvtextlayout.c gvdevice.c \
gvcontext.c gvjobs.c gvevent.c gvplugin.c gvconfig.c gvusershape.c \
- gvc.c
+ gvc.c gvgraphs.c
libgvc_la_SOURCES = ${libgvc_builtins_la_SOURCES} no_builtins.c
libgvc_builtins_la_LIBADD = \
return -1;
}
- job = gvc->job;
+ job = gvc->gvg->job;
job->output_lang = gvrender_select(job, job->output_langname);
if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
fprintf(stderr, "Layout was not done\n");
}
job->output_file = out;
gvRenderJobs(gvc, g);
- if (gvc->active_jobs)
+ if (gvc->gvg->active_jobs)
gvdevice_finalize(gvc);
gvrender_delete_jobs(gvc);
return -1;
}
- job = gvc->job;
+ job = gvc->gvg->job;
job->output_lang = gvrender_select(job, job->output_langname);
if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
fprintf(stderr, "Layout was not done\n");
}
gvrender_output_filename_job(gvc, filename);
gvRenderJobs(gvc, g);
- if (gvc->active_jobs)
+ if (gvc->gvg->active_jobs)
gvdevice_finalize(gvc);
gvrender_delete_jobs(gvc);
typedef struct codegen_info_s codegen_info_t;
#endif
- typedef struct GVJ_s GVJ_t;
typedef struct GVC_s GVC_t;
+ typedef struct GVG_s GVG_t;
+ typedef struct GVJ_s GVJ_t;
typedef struct {
const char *name;
extern "C" {
#endif
-#include "gvcjob.h"
+#include "gvg.h"
typedef struct {
int flags;
or NULL if not yet loaded */
};
-#define MAXNEST 4
-
struct GVC_s {
/* gvNEWcontext() */
char *user;
char **info;
+ void (*errorfn) (char *fmt, ...);
+
char *config_path;
bool config_found;
- /* gvrender_config() */
- GVJ_t *jobs; /* linked list of jobs */
- GVJ_t *job; /* current job */
- void (*errorfn) (char *fmt, ...);
-
- int emit_state; /* current emit_state */
- graph_t *g; /* current graph */
- graph_t *sg; /* current subgraph/cluster */
- node_t *n; /* current node */
- edge_t *e; /* current edge */
-
/* plugins */
#define ELEM(x) +1
/* APIS expands to "+1 +1 ... +1" to give the number of APIs */
gvplugin_active_usershape_t usershape;
gvplugin_active_layout_t layout;
- char *graphname; /* name from graph */
- GVJ_t *active_jobs; /* linked list of active jobs */
-
- char **lib;
-
- /* pagination */
- char *pagedir; /* pagination order */
- pointf margin; /* margins in graph units */
- pointf pageSize; /* pageSize in graph units, not including margins */
- point pb; /* page size - including margins (inches) */
- boxf bb; /* graph bb in graph units, not including margins */
- int rotation; /* rotation - 0 = portrait, 90 = landscape */
- bool graph_sets_margin, graph_sets_pageSize, graph_sets_rotation;
-
- /* layers */
- char *layerDelims; /* delimiters in layer names */
- char *layers; /* null delimited list of layer names */
- char **layerIDs; /* array of layer names */
- int numLayers; /* number of layers */
-
- int viewNum; /* current view - 1 based count of views,
- all pages in all layers */
- /* default font */
- char *defaultfontname;
- double defaultfontsize;
-
- /* default line style */
- char **defaultlinestyle;
-
- gvstyle_t styles[MAXNEST]; /* style stack - reused by each job */
- int SP;
-
- /* render defaults set from graph */
- gvcolor_t bgcolor; /* background color */
-
/* keybindings for keyboard events */
gvevent_key_binding_t *keybindings;
int numkeys;
void *keycodes;
+
+ /* gvrender_config() */
+ GVG_t *gvg;
};
#ifdef __cplusplus
/*
A gvcontext is a single instance of a GVC_t data structure providing
for a set of plugins for processing one graph at a time, and a job
- description provividing for a sequence of graph jobs.
+ description providing for a sequence of graph jobs.
Sometime in the future it may become the basis for a thread.
*/
gvc->info = info;
gvc->user = user;
gvc->errorfn = agerrorf;
+ gvc->gvg = zmalloc(sizeof(GVG_t)); /* FIXME - this will be allocated by the args parser */
+ gvc->gvg->gvc = gvc; /* link back to parent */
}
return gvc;
}
int gvFreeContext(GVC_t * gvc)
{
- if (gvc->active_jobs)
+ if (gvc->gvg->active_jobs)
gvdevice_finalize(gvc);
emit_jobs_eof(gvc);
gvrender_delete_jobs(gvc);
if (gvc->config_path)
free(gvc->config_path);
+ if (gvc->gvg) /* FIXME - this be be a list of gvg's eventually */
+ free(gvc->gvg);
free(gvc);
return (graphviz_errors + agerrors());
}
int gvdevice_select(GVJ_t * job, char *str)
{
- GVC_t *gvc = job->gvc;
+ GVC_t *gvc = job->gvg->gvc;
gvplugin_available_t *plugin;
gvplugin_installed_t *typeptr;
#ifndef DISABLE_CODEGENS
void gvdevice_finalize(GVC_t * gvc)
{
- GVJ_t *firstjob = gvc->active_jobs;
+ GVJ_t *firstjob = gvc->gvg->active_jobs;
gvdevice_engine_t *gvde = firstjob->device.engine;
if (gvde) {
static void gvevent_refresh(GVJ_t * job)
{
- graph_t *g = job->gvc->g;
+ graph_t *g = job->gvg->g;
if (!job->selected_obj) {
job->selected_obj = g;
b.LL.x = p.x - closeenough;
b.LL.y = p.y - closeenough;
- obj = gvevent_find_obj(job->gvc->g, b);
+ obj = gvevent_find_obj(job->gvg->g, b);
if (obj != job->current_obj) {
gvevent_leave_obj(job);
job->current_obj = obj;
static void gvevent_read (GVJ_t * job, char *filename, char *layout)
{
FILE *f;
- GVC_t *gvc;
gvlayout_engine_t *gvle;
+ GVG_t *gvg = job->gvg;
+ GVC_t *gvc = gvg->gvc;
- gvc = job->gvc;
- if (gvc->g) {
+ if (gvg->g) {
gvle = gvc->layout.engine;
if (gvle && gvle->cleanup)
- gvle->cleanup(gvc->g);
- graph_cleanup(gvc->g);
- agclose(gvc->g);
+ gvle->cleanup(gvg->g);
+ graph_cleanup(gvg->g);
+ agclose(gvg->g);
}
if (!filename) {
- gvc->g = agopen("G", AGDIGRAPH);
+ gvg->g = agopen("G", AGDIGRAPH);
job->output_filename = "new.dot";
}
else {
f = fopen(filename, "r");
if (!f)
return; /* FIXME - need some error handling */
- gvc->g = agread(f);
+ gvg->g = agread(f);
fclose(f);
}
- GD_gvc(gvc->g) = gvc;
- gvLayout(gvc, gvc->g, layout);
+ GD_gvc(gvg->g) = gvc;
+ gvLayout(gvc, gvg->g, layout);
job->selected_obj = NULL;
job->current_obj = NULL;
job->needs_refresh = 1;
static void gvevent_layout (GVJ_t * job, char *layout)
{
- gvLayout(job->gvc, job->gvc->g, layout);
+ gvLayout(job->gvg->gvc, job->gvg->g, layout);
}
static void gvevent_render (GVJ_t * job, char *format, char *filename)
{
- gvRenderFilename(job->gvc, job->gvc->g, format, filename);
+ gvRenderFilename(job->gvg->gvc, job->gvg->g, format, filename);
}
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+* This software is part of the graphviz package *
+* http://www.graphviz.org/ *
+* *
+* Copyright (c) 1994-2004 AT&T Corp. *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Corp. *
+* *
+* Information and Software Systems Research *
+* AT&T Research, Florham Park NJ *
+**********************************************************/
+
+/* per graph structure in gvc */
+
+#ifndef GVG_H
+#define GVG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "gvj.h"
+
+ struct GVG_s {
+
+ GVC_t *gvc; /* parent gvc */
+
+ GVJ_t *jobs; /* linked list of jobs on this graph */
+ GVJ_t *job; /* current job */
+ GVJ_t *active_jobs; /* linked list of active jobs
+ (e.g. multiple open windows on same graph) */
+
+ int emit_state; /* current emit_state */
+ graph_t *g; /* current graph */
+ graph_t *sg; /* current subgraph/cluster */
+ node_t *n; /* current node */
+ edge_t *e; /* current edge */
+
+ char *inputFilename; /* NULL if from stdin */
+ char *graphname; /* name from graph */
+
+ char **lib;
+
+ /* pagination */
+ char *pagedir; /* pagination order */
+ pointf margin; /* margins in graph units */
+ pointf pageSize; /* pageSize in graph units, not including margins */
+ point pb; /* page size - including margins (inches) */
+ boxf bb; /* graph bb in graph units, not including margins */
+ int rotation; /* rotation - 0 = portrait, 90 = landscape */
+ bool graph_sets_margin, graph_sets_pageSize, graph_sets_rotation;
+
+ /* layers */
+ char *layerDelims; /* delimiters in layer names */
+ char *layers; /* null delimited list of layer names */
+ char **layerIDs; /* array of layer names */
+ int numLayers; /* number of layers */
+
+ int viewNum; /* current view - 1 based count of views,
+ all pages in all layers */
+ /* default font */
+ char *defaultfontname;
+ double defaultfontsize;
+
+ /* default line style */
+ char **defaultlinestyle;
+
+#define MAXNEST 4
+
+ gvstyle_t styles[MAXNEST]; /* style stack - reused by each job */
+ int SP;
+
+ /* render defaults set from graph */
+ gvcolor_t bgcolor; /* background color */
+ };
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* GVG_H */
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+* This software is part of the graphviz package *
+* http://www.graphviz.org/ *
+* *
+* Copyright (c) 1994-2004 AT&T Corp. *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Corp. *
+* *
+* Information and Software Systems Research *
+* AT&T Research, Florham Park NJ *
+**********************************************************/
+
+/*
+ A gvgraph (GVG_t*) is a single graph within a gvcontext (GVC_t *)
+ which can support multiple graphs.
+
+ Each gvgraph (GVG_t *) may have multiple gvjobs (GVJ_t *) which correspond
+ to the renderings of that graph.
+ */
+
+#include "render.h"
+#include "gvcint.h"
+
+static FILE *gvNextInputFile(GVC_t *gvc)
+{
+ static int ctr = 0;
+ FILE *rv = NULL;
+
+ if (Files[0] == NULL) {
+ if (ctr++ == 0)
+ rv = stdin;
+ } else {
+ rv = NULL;
+ while (Files[ctr]) {
+ if ((rv = fopen(Files[ctr++], "r")))
+ break;
+ else {
+ agerr(AGERR, "%s: can't open %s\n", CmdName,
+ Files[ctr - 1]);
+ graphviz_errors++;
+ }
+ }
+ }
+ if (rv) {
+ agsetfile(Files[0] ? Files[ctr - 1] : "<stdin>");
+ if (Files[0])
+ gvc->gvg->inputFilename = Files[ctr - 1];
+ else
+ gvc->gvg->inputFilename = NULL;
+ }
+ return rv;
+}
+
+graph_t *gvNextInputGraph(GVC_t *gvc)
+{
+ graph_t *g;
+ static FILE *fp;
+
+ if (fp == NULL)
+ fp = gvNextInputFile(gvc);
+ g = NULL;
+
+ while (fp != NULL) {
+ if ((g = agread(fp)))
+ break;
+ fp = gvNextInputFile(gvc);
+ }
+ return g;
+}
+
/* Common header used by both clients and plugins */
-#ifndef GVCJOB_H
-#define GVCJOB_H
+#ifndef GVJ_H
+#define GVJ_H
#ifdef __cplusplus
extern "C" {
} gvevent_key_binding_t;
struct GVJ_s {
- GVC_t *gvc; /* parent gvc */
+ GVG_t *gvg; /* parent gvg */
GVJ_t *next; /* linked list of jobs */
GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
char *output_filename;
#ifdef __cplusplus
}
#endif
-#endif /* GVCJOB_H */
+#endif /* GVJ_H */
/* -o switches */
void gvrender_output_filename_job(GVC_t * gvc, char *name)
{
- if (!gvc->jobs) {
- output_filename_job = gvc->job = gvc->jobs =
+ GVG_t *gvg = gvc->gvg;
+
+ if (!gvg->jobs) {
+ output_filename_job = gvg->job = gvg->jobs =
zmalloc(sizeof(GVJ_t));
} else {
if (!output_filename_job) {
- output_filename_job = gvc->jobs;
+ output_filename_job = gvg->jobs;
} else {
if (!output_filename_job->next) {
output_filename_job->next =
}
}
output_filename_job->output_filename = name;
- output_filename_job->gvc = gvc;
+ output_filename_job->gvg = gvg;
}
/* -T switches */
bool gvrender_output_langname_job(GVC_t * gvc, char *name)
{
- if (!gvc->jobs) {
- output_langname_job = gvc->job = gvc->jobs =
+ GVG_t *gvg = gvc->gvg;
+
+ if (!gvg->jobs) {
+ output_langname_job = gvg->job = gvg->jobs =
zmalloc(sizeof(GVJ_t));
} else {
if (!output_langname_job) {
- output_langname_job = gvc->jobs;
+ output_langname_job = gvg->jobs;
} else {
if (!output_langname_job->next) {
output_langname_job->next =
}
}
output_langname_job->output_langname = name;
- output_langname_job->gvc = gvc;
+ output_langname_job->gvg = gvg;
/* load it now to check that it exists */
if (gvplugin_load(gvc, API_render, name))
GVJ_t *gvrender_first_job(GVC_t * gvc)
{
- return (gvc->job = gvc->jobs);
+ GVG_t *gvg = gvc->gvg;
+
+ return (gvg->job = gvg->jobs);
}
GVJ_t *gvrender_next_job(GVC_t * gvc)
{
- GVJ_t *job = gvc->job->next;
+ GVG_t *gvg = gvc->gvg;
+ GVJ_t *job = gvg->job->next;
if (job) {
/* if langname not specified, then repeat previous value */
if (!job->output_langname)
- job->output_langname = gvc->job->output_langname;
+ job->output_langname = gvg->job->output_langname;
/* if filename not specified, then leave NULL to indicate stdout */
}
- return (gvc->job = job);
+ return (gvg->job = job);
}
gv_argvlist_t *gvNEWargvlist(void)
void gvrender_delete_jobs(GVC_t * gvc)
{
GVJ_t *job, *j;
+ GVG_t *gvg = gvc->gvg;
- job = gvc->jobs;
+ job = gvg->jobs;
while ((j = job)) {
job = job->next;
gv_argvlist_reset(&(j->selected_obj_attributes));
free(j->selected_href);
free(j);
}
- gvc->jobs = gvc->job = gvc->active_jobs = output_filename_job = output_langname_job =
+ gvg->jobs = gvg->job = gvg->active_jobs = output_filename_job = output_langname_job =
NULL;
}
#define GVDEVICE_PLUGIN_H
#include "gvplugin.h"
-#include "gvcjob.h"
+#include "gvj.h"
#ifdef __cplusplus
extern "C" {
#define GVRENDER_PLUGIN_H
#include "gvplugin.h"
-#include "gvcjob.h"
+#include "gvj.h"
#ifdef __cplusplus
extern "C" {
int gvrender_select(GVJ_t * job, char *str)
{
- GVC_t *gvc = job->gvc;
+ GVC_t *gvc = job->gvg->gvc;
gvplugin_available_t *plugin;
gvplugin_installed_t *typeptr;
char *device;
void gvrender_begin_job(GVJ_t * job)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
+ GVC_t *gvc = gvg->gvc;
gvrender_engine_t *gvre = job->render.engine;
- job->bb = gvc->bb;
+ job->bb = gvg->bb;
if (gvre) {
if (gvre->begin_job)
gvre->begin_job(job);
codegen_t *cg = job->codegen;
if (cg && cg->begin_job)
- cg->begin_job(job->output_file, gvc->g, gvc->lib, gvc->user,
+ cg->begin_job(job->output_file, gvg->g, gvg->lib, gvc->user,
gvc->info, job->pagesArraySize);
}
#endif
cg->end_job();
}
#endif
- job->gvc->lib = NULL;
+ job->gvg->lib = NULL;
}
/* font modifiers */
void gvrender_begin_graph(GVJ_t * job, graph_t * g)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
gvrender_engine_t *gvre = job->render.engine;
char *str;
double sx, sy;
sx = job->width / (job->zoom * 2.);
sy = job->height / (job->zoom * 2.);
- gvc->sg = g; /* current subgraph/cluster */
+ gvg->sg = g; /* current subgraph/cluster */
job->compscale.x = job->zoom * job->dpi.x / POINTS_PER_INCH;
job->compscale.y = job->zoom * job->dpi.y / POINTS_PER_INCH;
job->compscale.y *= (job->flags & GVRENDER_Y_GOES_DOWN) ? -1. : 1.;
if (gvre) {
/* render specific init */
if (gvre->begin_graph)
- gvre->begin_graph(job, gvc->graphname);
+ gvre->begin_graph(job, gvg->graphname);
/* background color */
if (((str = agget(g, "bgcolor")) != 0) && str[0]) {
gvrender_resolve_color(job->render.features, str,
- &(gvc->bgcolor));
+ &(gvg->bgcolor));
if (gvre->resolve_color)
- gvre->resolve_color(job, &(gvc->bgcolor));
+ gvre->resolve_color(job, &(gvg->bgcolor));
}
/* init stack */
- gvc->SP = 0;
- job->style = &(gvc->styles[0]);
+ gvg->SP = 0;
+ job->style = &(gvg->styles[0]);
gvrender_set_pencolor(job, DEFAULT_COLOR);
gvrender_set_fillcolor(job, DEFAULT_FILL);
job->style->fontfam = DEFAULT_FONTNAME;
#endif
if (cg && cg->begin_graph)
- cg->begin_graph(gvc, g, job->boundingBox, gvc->pb);
+ cg->begin_graph(job, g, job->boundingBox, gvg->pb);
}
#endif
}
cg->end_graph();
}
#endif
- job->gvc->sg = NULL;
+ job->gvg->sg = NULL;
}
void gvrender_begin_page(GVJ_t * job)
PF2P(job->pageOffset, offset);
if (cg && cg->begin_page)
- cg->begin_page(job->gvc->g, job->pagesArrayElem,
+ cg->begin_page(job->gvg->g, job->pagesArrayElem,
job->zoom, job->rotation, offset);
}
#endif
gvrender_engine_t *gvre = job->render.engine;
if (gvre && gvre->begin_layer)
- gvre->begin_layer(job, job->gvc->layerIDs[job->layerNum], job->layerNum, job->numLayers);
+ gvre->begin_layer(job, job->gvg->layerIDs[job->layerNum], job->layerNum, job->numLayers);
#ifndef DISABLE_CODEGENS
else {
codegen_t *cg = job->codegen;
if (cg && cg->begin_layer)
- cg->begin_layer(job->gvc->layerIDs[job->layerNum], job->layerNum, job->numLayers);
+ cg->begin_layer(job->gvg->layerIDs[job->layerNum], job->layerNum, job->numLayers);
}
#endif
}
{
gvrender_engine_t *gvre = job->render.engine;
- job->gvc->sg = sg; /* set current cluster graph object */
+ job->gvg->sg = sg; /* set current cluster graph object */
#ifndef DISABLE_CODEGENS
Obj = CLST;
#endif
}
Obj = NONE;
#endif
- job->gvc->sg = g; /* reset current cluster to parent graph or cluster */
+ job->gvg->sg = g; /* reset current cluster to parent graph or cluster */
}
void gvrender_begin_nodes(GVJ_t * job)
#ifndef DISABLE_CODEGENS
Obj = NODE;
#endif
- job->gvc->n = n; /* set current node */
+ job->gvg->n = n; /* set current node */
if (gvre && gvre->begin_node)
gvre->begin_node(job, n->name, n->id);
#ifndef DISABLE_CODEGENS
}
Obj = NONE;
#endif
- job->gvc->n = NULL; /* clear current node */
+ job->gvg->n = NULL; /* clear current node */
}
void gvrender_begin_edge(GVJ_t * job, edge_t * e)
#ifndef DISABLE_CODEGENS
Obj = EDGE;
#endif
- job->gvc->e = e; /* set current edge */
+ job->gvg->e = e; /* set current edge */
if (gvre && gvre->begin_edge)
gvre->begin_edge(job, e->tail->name,
e->tail->graph->root->kind & AGFLAG_DIRECTED,
}
Obj = NONE;
#endif
- job->gvc->e = NULL; /* clear current edge */
+ job->gvg->e = NULL; /* clear current edge */
}
void gvrender_begin_context(GVJ_t * job)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
gvrender_engine_t *gvre = job->render.engine;
if (gvre) {
- (gvc->SP)++;
- assert((gvc->SP) < MAXNEST);
- gvc->styles[gvc->SP] = gvc->styles[(gvc->SP) - 1];
- job->style = &(gvc->styles[gvc->SP]);
+ (gvg->SP)++;
+ assert((gvg->SP) < MAXNEST);
+ gvg->styles[gvg->SP] = gvg->styles[(gvg->SP) - 1];
+ job->style = &(gvg->styles[gvg->SP]);
}
#ifndef DISABLE_CODEGENS
else {
void gvrender_end_context(GVJ_t * job)
{
- GVC_t *gvc = job->gvc;
+ GVG_t *gvg = job->gvg;
gvrender_engine_t *gvre = job->render.engine;
if (gvre) {
- gvc->SP--;
- assert(gvc->SP >= 0);
- job->style = &(gvc->styles[gvc->SP]);
+ gvg->SP--;
+ assert(gvg->SP >= 0);
+ job->style = &(gvg->styles[gvg->SP]);
}
#ifndef DISABLE_CODEGENS
else {
(char *) 0);
return TCL_ERROR;
}
- gvc->active_jobs = gvc->job;
+ gvc->gvg->active_jobs = gvc->gvg->job;
- gvc->job->surface = (void *)(&tkgendata);
- gvc->job->external_surface = TRUE;
+ gvc->gvg->job->surface = (void *)(&tkgendata);
+ gvc->gvg->job->external_surface = TRUE;
/* make sure that layout is done */
g = g->root;
(char *) 0);
return TCL_ERROR;
}
- gvc->active_jobs = gvc->job;
+ gvc->gvg->active_jobs = gvc->gvg->job;
if (! (hdl = tclhandleXlate(GDHandleTable, argv[2]))) {
Tcl_AppendResult(interp, "GD Image not found.", (char *) NULL);
return TCL_ERROR;
}
- gvc->job->surface = *hdl;
- gvc->job->external_surface = TRUE;
+ gvc->gvg->job->surface = *hdl;
+ gvc->gvg->job->external_surface = TRUE;
/* make sure that layout is done */
g = g->root;
"\". Use one of:", s, (char *)NULL);
return TCL_ERROR;
}
- gvc->active_jobs = gvc->job;
+ gvc->gvg->active_jobs = gvc->gvg->job;
/* populate new job struct with output language and output file data */
- gvc->job->output_lang =
- gvrender_select(gvc->job, gvc->job->output_langname);
+ gvc->gvg->job->output_lang =
+ gvrender_select(gvc->gvg->job, gvc->gvg->job->output_langname);
if (Tcl_GetOpenFile (interp, argv[2], 1, 1,
- (ClientData *) &(gvc->job->output_file)) != TCL_OK)
+ (ClientData *) &(gvc->gvg->job->output_file)) != TCL_OK)
return TCL_ERROR;
/* make sure that layout is done - unless canonical output */
if ((!GD_drawing(g) || argc > 4)
- && gvc->job->output_lang != CANONICAL_DOT) {
+ && gvc->gvg->job->output_lang != CANONICAL_DOT) {
tcldot_layout(gvc, g, (argc > 4) ? argv[4] : (char *) NULL);
}
{
}
-static void tk_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
+static void tk_begin_graph(GVJ_t * job, graph_t * g, box bb, point pb)
{
double dpi = GD_drawing(g)->dpi;
- Tkgendata = (tkgendata_t *)gvc->job->surface;
+ Tkgendata = (tkgendata_t *)job->surface;
if (dpi < 1.0)
dpi = DEFAULT_DPI;
DevScale = dpi / POINTS_PER_INCH;
- Viewport.x = gvc->job->width;
- Viewport.y = gvc->job->height;
+ Viewport.x = job->width;
+ Viewport.y = job->height;
if (Viewport.x) {
- Zoom = gvc->job->zoom;
- GraphFocus = gvc->job->focus;
+ Zoom = job->zoom;
+ GraphFocus = job->focus;
} else {
Viewport.x =
(bb.UR.x - bb.LL.x + 2 * GD_drawing(g)->margin.x) * DevScale +