Further tidy up of node redraw.

svn path=/trunk/netsurf/; revision=11057
This commit is contained in:
Michael Drake 2010-12-15 01:05:10 +00:00
parent 771b0e3b8b
commit f474bc06bf
1 changed files with 24 additions and 20 deletions

View File

@ -1661,28 +1661,28 @@ static void tree_draw_node(struct tree *tree, struct node *node,
/* Set up the clipping area */ /* Set up the clipping area */
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1); plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);
if ((node->previous != NULL) && /* Draw node's furniture */
(!(tree->flags & TREE_NO_FURNITURE))) {
/* There is a node above this
* Display furniture; line connecting up to previous */
x0 = x1 = tree_x + node->box.x - (NODE_INSTEP / 2);
y0 = tree_y + node->previous->box.y;
y1 = tree_y + node->box.y + (TREE_LINE_HEIGHT / 2);
plot.line(x0, y0, x1, y1, &plot_style_stroke_tree_furniture);
}
if ((node->next != NULL) &&
(!(tree->flags & TREE_NO_FURNITURE))) {
/* There is a node below this
* Display furniture; line connecting down to next */
x0 = x1 = tree_x + node->box.x - (NODE_INSTEP / 2);
y0 = tree_y + node->box.y + (TREE_LINE_HEIGHT / 2);
y1 = tree_y + node->next->box.y;
plot.line(x0, y0, x1, y1, &plot_style_stroke_tree_furniture);
}
/* Node is inside clip region */
if (!(tree->flags & TREE_NO_FURNITURE)) { if (!(tree->flags & TREE_NO_FURNITURE)) {
/* Display furniture */ /* Display furniture */
if (node->previous != NULL) {
/* There is a node above this
* Display furniture; line connecting up to previous */
x0 = x1 = tree_x + node->box.x - (NODE_INSTEP / 2);
y0 = tree_y + node->previous->box.y;
y1 = tree_y + node->box.y + (TREE_LINE_HEIGHT / 2);
plot.line(x0, y0, x1, y1,
&plot_style_stroke_tree_furniture);
}
if (node->next != NULL) {
/* There is a node below this
* Display furniture; line connecting down to next */
x0 = x1 = tree_x + node->box.x - (NODE_INSTEP / 2);
y0 = tree_y + node->box.y + (TREE_LINE_HEIGHT / 2);
y1 = tree_y + node->next->box.y;
plot.line(x0, y0, x1, y1,
&plot_style_stroke_tree_furniture);
}
parent = node->parent; parent = node->parent;
if ((parent != NULL) && (parent != tree->root) && if ((parent != NULL) && (parent != tree->root) &&
(parent->child == node)) { (parent->child == node)) {
@ -1700,8 +1700,12 @@ static void tree_draw_node(struct tree *tree, struct node *node,
y0 = y1 = tree_y + node->data.box.y + node->data.box.height - y0 = y1 = tree_y + node->data.box.y + node->data.box.height -
(TREE_LINE_HEIGHT / 2); (TREE_LINE_HEIGHT / 2);
plot.line(x0, y0, x1, y1, &plot_style_stroke_tree_furniture); plot.line(x0, y0, x1, y1, &plot_style_stroke_tree_furniture);
tree_draw_node_expansion_toggle(tree, node, tree_x, tree_y); tree_draw_node_expansion_toggle(tree, node, tree_x, tree_y);
} }
/* Draw node's element(s)
* NOTE: node's children are handled later in tree_draw_tree() */
if (node->expanded) { if (node->expanded) {
for (element = &node->data; element != NULL; for (element = &node->data; element != NULL;
element = element->next) { element = element->next) {