graph.rect[1].y = node.pos.y + node.size.y / 2;
}
}
- graph.graphattr.bb = concat (graph.rect[0].x, ',',
- graph.rect[0].y, ',', graph.rect[1].x, ',',
- graph.rect[1].y);
+ graph.graphattr.bb = concat (graph.rect[0].x, ',',
+ graph.rect[0].y, ',', graph.rect[1].x, ',',
+ graph.rect[1].y);
if (graph.lp & tablesize (graph.lp) > 0)
graph.graphattr.lp = concat (graph.lp.x, ',', graph.lp.y);
} else
dotty.views[vt.view] = vt;
if (protovt.colors & tablesize (protovt.colors) > 0) {
for (id in protovt.colors)
- if (setwidgetattr (vt.canvas, ['color' = [
+ if (id == '_bgcolor_')
+ setwidgetattr (vt.canvas, ['color' = [0 = protovt.colors[id];];]);
+ else if (setwidgetattr (vt.canvas, ['color' = [
protovt.colors[id] = id;
];]) ~= 1) {
t = split (id, ' ');
break;
ovt = gt.views[id];
for (id in ovt.colors)
- if (setwidgetattr (vt.canvas, ['color' = [
+ if (id == '_bgcolor_')
+ setwidgetattr (vt.canvas, ['color' = [0 = ovt.colors[id];];]);
+ else if (setwidgetattr (vt.canvas, ['color' = [
ovt.colors[id] = id;
];]) ~= 1) {
t = split (id, ' ');
}
for (cname in vt.colors) {
cid = vt.colors[cname];
- if (setwidgetattr (pscanvas, ['color' = [cid = cname;];]) ~= 1) {
+ if (cname == '_bgcolor_')
+ setwidgetattr (pscanvas, ['color' = [0 = cid;];]);
+ else if (setwidgetattr (pscanvas, ['color' = [cid = cname;];]) ~= 1) {
t = split (cname, ' ');
if (tablesize (t) ~= 3 |
setwidgetattr (pscanvas, ['color' = [cid = [
sgraph.fontname = fontmap[sgraph.graphattr.fontname];
gt.drawsgraph (gt, [0 = vt;], sgraph);
}
- graph.fontname = fontmap[graph.graphattr.fontname];
- gt.drawsgraph (gt, [0 = vt;], graph);
+ graph.fontname = fontmap[graph.graphattr.fontname];
+ gt.drawsgraph (gt, [0 = vt;], graph);
gt.edgehandles = edgehandles;
vt.canvas = canvas;
destroywidget (pscanvas);
}
return color;
};
+dotty.protogt.setbgcolor = function (views, name) {
+ local vid, vt, t;
+
+ for (vid in views) {
+ vt = views[vid];
+ if (setwidgetattr (vt.canvas, ['color' = [0 = name;];]) ~= 1) {
+ t = split (name, ' ');
+ if (tablesize (t) ~= 3 |
+ setwidgetattr (vt.canvas, ['color' = [0 = [
+ 'h' = ston (t[0]); 's' = ston (t[1]); 'v' = ston (t[2]);
+ ];];]) ~= 1) {
+ dotty.message (0, concat ('unknown bgcolor ', name));
+ return;
+ }
+ }
+ vt.colors['_bgcolor_'] = name;
+ }
+};
dotty.protogt.unpacksgraphattr = function (gt, sgraph) {
local attr;
graph[dotty.keys.color] = gt.getcolor (gt.views, 'grey');
else
graph[dotty.keys.color] = gt.getcolor (gt.views, attr.color);
+ if (attr.bgcolor ~= '')
+ gt.setbgcolor (gt.views, attr.bgcolor);
for (gid in graph.graphdict) {
sgraph = graph.graphs[graph.graphdict[gid]];
attr = sgraph.graphattr;
}
/* XAllocColor may change the rgb values */
cp->red = r, cp->green = g, cp->blue = b;
+ if (color == 0) {
+ XSetBackground (Gdisplay, GC, WCU->colors[0].color.pixel);
+ ADD2ARGS (XtNbackground, WCU->colors[0].color.pixel);
+ } else if (color == 1) {
+ XSetForeground (Gdisplay, GC, WCU->colors[1].color.pixel);
+ ADD2ARGS (XtNforeground, WCU->colors[1].color.pixel);
+ }
+ XtSetValues (widget->w, argp, argn);
+ RESETARGS;
if (color == WCU->gattr.color)
WCU->gattr.color = -1;
break;