static void intr(int s)
{
if (gvc->g)
- dotneato_write(gvc);
+ dotneato_write(gvc, gvc->g);
dotneato_terminate(gvc);
exit(1);
}
agclose(prev);
}
gvlayout_layout(gvc, g);
- dotneato_write(gvc);
+ dotneato_write(gvc, g);
prev = g;
}
}
}
-void emit_reset(GVC_t * gvc)
+void emit_reset(GVC_t * gvc, graph_t * g)
{
- Agraph_t *g = gvc->g;
Agnode_t *n;
N_pages = 1;
gvrender_end_edge(gvc);
}
-void emit_graph(GVC_t * gvc, graph_t * g, int flags)
+void emit_init(GVC_t * gvc, graph_t * g)
{
- point curpage;
- graph_t *sg;
- node_t *n;
- edge_t *e;
- int c;
- char *str, *colors;
- double X, Y, Z, x, y;
- char *s, *url = NULL, *tooltip = NULL, *target = NULL;
+ char *str;
+ double X = 400.0, Y = 400.0, Z = 0.0, x = 0.0, y = 0.0;
+
+/* FIXME - init viewport to graph dimensions */
- X = Y = Z = x = y = 0.0;
if ((str = agget(g, "viewport")))
sscanf(str, "%lf,%lf,%lf,%lf,%lf", &X, &Y, &Z, &x, &y);
gvc->size.x = ROUND(X);
G_peripheries = agfindattr(g, "peripheries");
setup_graph(gvc, g);
- if (Page == 0)
- gvrender_begin_job(gvc, Lib, Pages);
+ gvrender_begin_job(gvc, Lib, Pages);
+}
+
+void emit_deinit(GVC_t * gvc, graph_t * g)
+{
+}
+
+void emit_graph(GVC_t * gvc, graph_t * g, int flags)
+{
+ point curpage;
+ graph_t *sg;
+ node_t *n;
+ edge_t *e;
+ int c;
+ char *str, *colors;
+ char *s, *url = NULL, *tooltip = NULL, *target = NULL;
+
+ /* FIXME - I don't understand why I need this again */
+ setup_graph(gvc, g);
+
gvrender_begin_graph(gvc, g, PB, PFC);
if (flags & EMIT_COLORS) {
gvrender_set_fillcolor(gvc, DEFAULT_FILL);
{
int flags;
+ gvc->g = g;
+ dotneato_set_margins(gvc, g);
+ emit_init(gvc, g);
if (NOT(gvrender_features(gvc) & GVRENDER_DOES_MULTIGRAPH_OUTPUT_FILES)
#ifndef DISABLE_CODEGENS
/* FIXME - bad hack until feaures supported in codegens */
#endif
#endif
)
- emit_reset(gvc);
- dotneato_set_margins(gvc, g);
+ emit_reset(gvc, g);
switch (gvc->job->output_lang) {
case GVRENDER_PLUGIN:
flags = chkOrder(g);
}
fflush(gvc->job->output_file);
+ emit_deinit(gvc, g);
}
-void dotneato_write(GVC_t * gvc)
+void dotneato_write(GVC_t * gvc, graph_t * g)
{
- graph_t *g = gvc->g;
gvrender_job_t *job;
for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
extern void dotneato_set_margins(GVC_t * gvc, Agraph_t *);
extern void dotneato_eof(GVC_t * gvc);
extern void dotneato_terminate(GVC_t * gvc);
- extern void dotneato_write(GVC_t * gvc);
- extern void dotneato_write_one(GVC_t * gvc, graph_t * g);
+ extern void dotneato_write(GVC_t * gvc, graph_t *g);
+ extern void dotneato_write_one(GVC_t * gvc, graph_t *g);
extern int edge_in_CB(Agedge_t *);
extern int edge_in_layer(Agraph_t *, Agedge_t *);
extern double elapsed_sec(void);
extern void enqueue(queue *, Agnode_t *);
extern void enqueue_neighbors(queue *, Agnode_t *, int);
+ extern void emit_init(GVC_t * gvc, graph_t * g);
+ extern void emit_deinit(GVC_t * gvc, graph_t * g);
extern void emit_attachment(GVC_t * gvc, textlabel_t *, splines *);
extern void emit_clusters(GVC_t * gvc, Agraph_t * g, int flags);
extern void emit_eof(GVC_t * gvc);
extern void emit_label(GVC_t * gvc, textlabel_t *, void *obj);
extern int emit_once(char *message);
extern void emit_once_reset();
- extern void emit_reset(GVC_t * gvc);
+ extern void emit_reset(GVC_t * gvc, graph_t * g);
extern void endpath(path *, Agedge_t *, int, pathend_t *, boolean);
extern void epsf_init(node_t * n);
extern void epsf_free(node_t * n);
unsigned int width, height;
- cairo_t *cr;
GVC_t *gvc;
+ graph_t *g;
+ int flags;
+
+ cairo_t *cr;
double tx, ty, zoom, oldx, oldy;
int needs_refresh, fit_mode, click, active;
int x, y;
XParseGeometry(geometry, &x, &y, &win->width, &win->height);
} else {
-/* FIXME - gvc->size is 0,0 at this time. need to set viewport and transform earlier */
-// svg_cairo_get_size(win->svgc, &win->width, &win->height);
win->width = win->gvc->size.x;
win->height = win->gvc->size.y;
}
else
key_binding[i].keycode = XKeysymToKeycode(dpy, keysym);
}
- win->cr = cairo_create();
+// win->cr = cairo_create();
surface = cairo_xlib_surface_create(dpy, win->pix, win->visual,
CAIRO_FORMAT_ARGB32, win->cmap);
cairo_set_target_surface(win->cr, surface);
static void win_deinit(win_t * win)
{
- cairo_destroy(win->cr);
- win->cr = NULL;
+// cairo_destroy(win->cr);
+// win->cr = NULL;
XFreeGC(win->dpy, win->gc);
XDestroyWindow(win->dpy, win->win);
}
cairo_translate(win->cr, win->tx, win->ty);
cairo_scale(win->cr, win->zoom, win->zoom);
-// svg_cairo_render(win->svgc, win->cr);
-// FIXME: flags = chkOrder(g) | gvc->render_features->flags;
- emit_graph(win->gvc, win->gvc->g, win->gvc->render_features->flags);
+ emit_graph(win->gvc, win->g, win->flags);
cairo_restore(win->cr);
XCopyArea(win->dpy, win->pix, win->win, win->gc,
win->fit_mode = !win->fit_mode;
if (win->fit_mode) {
int dflt_width, dflt_height;
-// svg_cairo_get_size(win->svgc, &dflt_width, &dflt_height);
dflt_width = win->gvc->size.x;
dflt_height = win->gvc->size.y;
win->zoom =
}
#endif /* X_DISPLAY_MISSING */
-
void gvemit_graph(GVC_t * gvc, graph_t * g, int flags)
{
if (flags & GVRENDER_X11_EVENTS) {
win_t win;
const char *display=NULL;
int argb=0;
- const char *geometry="200x200";
+ const char *geometry=NULL;
win.gvc = gvc;
+ win.g = g;
+ win.flags = flags;
+
+ gvc->surface = win.cr = cairo_create();;
+ gvc->external_surface = TRUE;
win.dpy = XOpenDisplay(display);
if (win.dpy == NULL) {
win_handle_events(&win);
+ cairo_destroy(win.cr);
win_deinit(&win);
XCloseDisplay(win.dpy);
else {
codegen_t *cg = gvc->codegen;
- if (cg && cg->begin_job)
+ if (cg && cg->begin_job && gvc->page_number == 0)
cg->begin_job(gvc->job->output_file, gvc->g, lib, gvc->user,
gvc->info, pages);
}
return TCL_OK;
} else if ((c == 'w') && (strncmp(argv[1], "write", length) == 0)) {
- gvc->g = g = g->root;
+ g = g->root;
if (argc < 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0],
tcldot_layout(g, (argc > 4) ? argv[4] : (char *) NULL);
}
- emit_reset(gvc); /* reset page numbers in postscript */
+ emit_reset(gvc, g); /* reset page numbers in postscript */
dotneato_write_one(gvc, g);
gvrender_delete_jobs(gvc);
return TCL_OK;