2
* compute node and edge coordinates
11
static void update_bb(ddview_t *view)
13
Agnode_t *left, *right;
15
double lb,glb,rb,grb; /* left and right bounds: local, global */
19
glb = MAXDOUBLE; grb = -MAXDOUBLE;
20
for (r = view->config->low; r <= view->config->high; r++) {
21
if ((left = dd_leftmost(view,r))) {
22
sz = dd_nodesize(view,left);
23
lb = dd_pos(left).x - sz.x / 2.0;
24
if (glb > lb) glb = lb;
25
right = dd_rightmost(view,r);
26
sz = dd_nodesize(view,right);
27
rb = dd_pos(right).x + sz.x / 2.0;
28
if (grb < rb) grb = rb;
32
view->base.client->actual_bb.ll.x = glb;
33
rd = dd_rankd(view,view->config->low);
35
view->base.client->actual_bb.ll.y = rd->y_base - rd->delta_above;
37
view->base.client->actual_bb.ur.x = grb;
38
rd = dd_rankd(view,view->config->high);
40
view->base.client->actual_bb.ur.y = rd->y_base + rd->delta_below;
42
/*BASE(view)->bb.size.ll.x = glb;
43
BASE(view)->bb.size.ur.x = grb;*/
44
BASE(view)->bb.size = view->base.client->actual_bb;
45
BASE(view)->bb.valid = TRUE;
48
/* (re)spline edges */
50
static ilbool node_moved(Agnode_t *n)
55
if (dspec->prev.valid &&
56
(dspec->cur.pos.x == dspec->prev.pos.x) &&
57
(dspec->cur.pos.y == dspec->prev.pos.y)) return FALSE;
61
static ilbool edge_needs_redraw(ddview_t *view, ddpath_t *path)
64
Agnode_t *n, *left, *right;
69
if (path->unclipped_path == NILcurve) return TRUE; /* new edge */
70
/* check for endpoint resize */
71
if (il_node(agtail(path->model))->update & IL_UPD_SHAPE) return TRUE;
72
if (il_node(aghead(path->model))->update & IL_UPD_SHAPE) return TRUE;
75
if (ve == NILedge) { /* flat */
76
if (node_moved(dd_rep(agtail(path->model)))) return TRUE;
77
if (node_moved(dd_rep(aghead(path->model)))) return TRUE;
80
sep = view->base.client->separation.x;
81
if (node_moved(agtail(ve))) return TRUE;
82
while (dd_is_a_vnode((n = ve->node))) {
83
if(NOT(dd_node(n)->actual_x_valid)) return TRUE;
84
x = D(dd_node(n)->actual_x);
85
if ((left = dd_left(view, n))) {
87
if (dd_is_a_vnode(left)) {
88
if (nd->actual_x_valid && D(nd->actual_x) + sep > x) return TRUE;
90
else { if (nd->cur.pos.x + il_nodesize(BASE(view),nd->model).x / 2.0 + sep > x) return TRUE; }
92
if ((right = dd_right(view, n))) {
94
if (dd_is_a_vnode(right)) {
95
if (nd->actual_x_valid && D(nd->actual_x) - sep < x) return TRUE;
97
else { if (nd->cur.pos.x - il_nodesize(BASE(view),nd->model).x / 2.0 - sep < x) return TRUE; }
101
if (node_moved(aghead(ve))) return TRUE;
105
static void update_edges(ddview_t *view)
112
for (mn = agfstnode(BASE(view)->model.main); mn; mn = agnxtnode(mn)) {
113
for (me = agfstout(mn); me; me = agnxtout(me)) {
114
if (agsubedge(BASE(view)->model.e[IL_DEL],me,FALSE)) continue;
115
if ((path = dd_pathrep(me))) {
116
espec = ddm_espec(me);
117
if (edge_needs_redraw(view,path)) {
118
if (path->unclipped_path)
119
il_freecurve(vmregion(path->unclipped_path),
120
path->unclipped_path);
121
path->unclipped_path = NILcurve;
122
il_register_edge_callback(BASE(view), espec, IL_MOD);
127
for (mn = agfstnode(BASE(view)->model.main); mn; mn = agnxtnode(mn)) {
128
for (me = agfstout(mn); me; me = agnxtout(me)) {
129
if (agsubedge(BASE(view)->model.e[IL_DEL],me,FALSE)) continue;
130
if ((path = dd_pathrep(me)) && (path->unclipped_path == NILcurve))
131
dd_make_edge_spline(view,path);
136
/* recompute coordinates */
139
void dd_update_geometry(ddview_t *view)