mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
Clean up height code a bit. I don't think it's completely correct yet, but
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code a bit. I don't think it's completely correct yet, but it's getting there.
This commit is contained in:
parent
44934dca38
commit
050625298e
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1,3 +1,9 @@
|
||||
Fri Nov 2 16:45:17 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtkrbtree.c (_gtk_rbtree_remove_node): Clean up height code
|
||||
a bit. I don't think it's completely correct yet, but it's
|
||||
getting there.
|
||||
|
||||
Fri Nov 2 16:14:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkviewport.c (gtk_viewport_size_request): Remove
|
||||
|
@ -1055,6 +1055,8 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
|
||||
GtkRBNode *x, *y;
|
||||
GtkRBTree *tmp_tree;
|
||||
GtkRBNode *tmp_node;
|
||||
gint node_height;
|
||||
gint y_height;
|
||||
|
||||
g_return_if_fail (tree != NULL);
|
||||
g_return_if_fail (node != NULL);
|
||||
@ -1067,6 +1069,7 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
|
||||
if (gtk_debug_flags & GTK_DEBUG_TREE)
|
||||
_gtk_rbtree_test (G_STRLOC, tree);
|
||||
|
||||
|
||||
if (node->left == tree->nil || node->right == tree->nil)
|
||||
{
|
||||
y = node;
|
||||
@ -1086,14 +1089,16 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
|
||||
/* y->count = node->count; */
|
||||
|
||||
/* offsets and parity adjust all the way up through parent trees */
|
||||
y_height = GTK_RBNODE_GET_HEIGHT (y);
|
||||
node_height = GTK_RBNODE_GET_HEIGHT (node) + (node->children?node->children->root->offset:0);
|
||||
|
||||
/* Do this twice for code clarities sake. */
|
||||
tmp_tree = tree;
|
||||
tmp_node = y;
|
||||
|
||||
while (tmp_tree && tmp_node && tmp_node != tmp_tree->nil)
|
||||
{
|
||||
/* tmp_node->offset -= y->offset; */
|
||||
tmp_node->parity -= (guint) 1; /* parity of y is always 1 */
|
||||
tmp_node->offset -= (y_height + (y->children?y->children->root->offset:0));
|
||||
tmp_node->parity -= (1 + (y->children?y->children->root->parity:0));
|
||||
|
||||
tmp_node = tmp_node->parent;
|
||||
if (tmp_node == tmp_tree->nil)
|
||||
@ -1121,12 +1126,35 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
|
||||
|
||||
if (y != node)
|
||||
{
|
||||
gint diff;
|
||||
|
||||
/* Copy the node over */
|
||||
if (GTK_RBNODE_GET_COLOR (node) == GTK_RBNODE_BLACK)
|
||||
node->flags = ((y->flags & (GTK_RBNODE_NON_COLORS)) | GTK_RBNODE_BLACK);
|
||||
else
|
||||
node->flags = ((y->flags & (GTK_RBNODE_NON_COLORS)) | GTK_RBNODE_RED);
|
||||
node->children = y->children;
|
||||
|
||||
/* We want to see how different our height is from the previous node.
|
||||
* To do this, we compare our current height with our supposed height.
|
||||
*/
|
||||
diff = y_height - GTK_RBNODE_GET_HEIGHT (node);
|
||||
if (diff != 0)
|
||||
{
|
||||
tmp_tree = tree;
|
||||
tmp_node = node;
|
||||
|
||||
while (tmp_tree && tmp_node && tmp_node != tmp_tree->nil)
|
||||
{
|
||||
tmp_node->offset += diff;
|
||||
tmp_node = tmp_node->parent;
|
||||
if (tmp_node == tmp_tree->nil)
|
||||
{
|
||||
tmp_node = tmp_tree->parent_node;
|
||||
tmp_tree = tmp_tree->parent_tree;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GTK_RBNODE_GET_COLOR (y) == GTK_RBNODE_BLACK)
|
||||
|
@ -3012,7 +3012,7 @@ gtk_tree_view_focus_out (GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* Incremental Reflow */
|
||||
#if 0
|
||||
|
||||
static void
|
||||
validate_visible_area (GtkTreeView *tree_view)
|
||||
{
|
||||
@ -3045,7 +3045,7 @@ install_presize_handler (GtkTreeView *tree_view)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Drag-and-drop */
|
||||
|
||||
static void
|
||||
|
@ -312,8 +312,6 @@ void gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
|
||||
GtkDestroyNotify destroy);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
Loading…
Reference in New Issue
Block a user