2000-10-05 01:04:57 +00:00
|
|
|
/* gtkrbtree.c
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
#include "gtkrbtree.h"
|
2001-01-09 17:45:34 +00:00
|
|
|
#include "gtkdebug.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
static GtkRBNode * _gtk_rbnode_new (GtkRBTree *tree,
|
|
|
|
gint height);
|
|
|
|
static void _gtk_rbnode_free (GtkRBNode *node);
|
|
|
|
static void _gtk_rbnode_rotate_left (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node);
|
|
|
|
static void _gtk_rbnode_rotate_right (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node);
|
|
|
|
static void _gtk_rbtree_insert_fixup (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node);
|
|
|
|
static void _gtk_rbtree_remove_node_fixup (GtkRBTree *tree,
|
2011-11-21 20:13:53 +00:00
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBNode *parent);
|
2001-12-08 01:10:52 +00:00
|
|
|
static inline void _fixup_validation (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node);
|
2011-11-16 03:14:00 +00:00
|
|
|
static inline void _fixup_total_count (GtkRBTree *tree,
|
2001-12-10 21:24:15 +00:00
|
|
|
GtkRBNode *node);
|
2011-11-21 15:59:37 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
static void _gtk_rbtree_test (const gchar *where,
|
|
|
|
GtkRBTree *tree);
|
|
|
|
static void _gtk_rbtree_debug_spew (GtkRBTree *tree);
|
|
|
|
#endif
|
2001-12-08 01:10:52 +00:00
|
|
|
|
2011-11-22 00:32:28 +00:00
|
|
|
static const GtkRBNode nil = {
|
|
|
|
/* .flags = */ GTK_RBNODE_BLACK,
|
|
|
|
|
|
|
|
/* rest is NULL */
|
|
|
|
};
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
gboolean
|
|
|
|
_gtk_rbtree_is_nil (GtkRBNode *node)
|
|
|
|
{
|
|
|
|
return node == &nil;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
static GtkRBNode *
|
|
|
|
_gtk_rbnode_new (GtkRBTree *tree,
|
|
|
|
gint height)
|
|
|
|
{
|
2005-11-01 18:10:51 +00:00
|
|
|
GtkRBNode *node = g_slice_new (GtkRBNode);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-22 02:18:31 +00:00
|
|
|
node->left = (GtkRBNode *) &nil;
|
|
|
|
node->right = (GtkRBNode *) &nil;
|
|
|
|
node->parent = (GtkRBNode *) &nil;
|
2000-10-05 01:04:57 +00:00
|
|
|
node->flags = GTK_RBNODE_RED;
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count = 1;
|
2000-10-05 01:04:57 +00:00
|
|
|
node->count = 1;
|
|
|
|
node->children = NULL;
|
|
|
|
node->offset = height;
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbnode_free (GtkRBNode *node)
|
|
|
|
{
|
2011-11-21 15:59:22 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
{
|
2005-11-01 18:10:51 +00:00
|
|
|
node->left = (gpointer) 0xdeadbeef;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
node->right = (gpointer) 0xdeadbeef;
|
|
|
|
node->parent = (gpointer) 0xdeadbeef;
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count = 56789;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
node->offset = 56789;
|
|
|
|
node->count = 56789;
|
|
|
|
node->flags = 0;
|
|
|
|
}
|
2011-11-21 15:59:22 +00:00
|
|
|
#endif
|
2005-11-01 18:10:51 +00:00
|
|
|
g_slice_free (GtkRBNode, node);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbnode_rotate_left (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
gint node_height, right_height;
|
|
|
|
GtkRBNode *right = node->right;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
g_return_if_fail (!_gtk_rbtree_is_nil (node));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
node_height = node->offset -
|
|
|
|
(node->left?node->left->offset:0) -
|
|
|
|
(node->right?node->right->offset:0) -
|
|
|
|
(node->children?node->children->root->offset:0);
|
|
|
|
right_height = right->offset -
|
|
|
|
(right->left?right->left->offset:0) -
|
|
|
|
(right->right?right->right->offset:0) -
|
|
|
|
(right->children?right->children->root->offset:0);
|
|
|
|
node->right = right->left;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (right->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
right->left->parent = node;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (right))
|
2000-10-05 01:04:57 +00:00
|
|
|
right->parent = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->parent))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
if (node == node->parent->left)
|
|
|
|
node->parent->left = right;
|
|
|
|
else
|
|
|
|
node->parent->right = right;
|
|
|
|
} else {
|
|
|
|
tree->root = right;
|
|
|
|
}
|
|
|
|
|
|
|
|
right->left = node;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
node->parent = right;
|
|
|
|
|
|
|
|
node->count = 1 + (node->left?node->left->count:0) +
|
|
|
|
(node->right?node->right->count:0);
|
|
|
|
right->count = 1 + (right->left?right->left->count:0) +
|
|
|
|
(right->right?right->right->count:0);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
node->offset = node_height +
|
|
|
|
(node->left?node->left->offset:0) +
|
|
|
|
(node->right?node->right->offset:0) +
|
|
|
|
(node->children?node->children->root->offset:0);
|
|
|
|
right->offset = right_height +
|
|
|
|
(right->left?right->left->offset:0) +
|
|
|
|
(right->right?right->right->offset:0) +
|
|
|
|
(right->children?right->children->root->offset:0);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
_fixup_validation (tree, node);
|
|
|
|
_fixup_validation (tree, right);
|
2011-11-16 03:14:00 +00:00
|
|
|
_fixup_total_count (tree, node);
|
|
|
|
_fixup_total_count (tree, right);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbnode_rotate_right (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
gint node_height, left_height;
|
|
|
|
GtkRBNode *left = node->left;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
g_return_if_fail (!_gtk_rbtree_is_nil (node));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
node_height = node->offset -
|
|
|
|
(node->left?node->left->offset:0) -
|
|
|
|
(node->right?node->right->offset:0) -
|
|
|
|
(node->children?node->children->root->offset:0);
|
|
|
|
left_height = left->offset -
|
|
|
|
(left->left?left->left->offset:0) -
|
|
|
|
(left->right?left->right->offset:0) -
|
|
|
|
(left->children?left->children->root->offset:0);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
node->left = left->right;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (left->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
left->right->parent = node;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (left))
|
2000-10-05 01:04:57 +00:00
|
|
|
left->parent = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->parent))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
if (node == node->parent->right)
|
|
|
|
node->parent->right = left;
|
|
|
|
else
|
|
|
|
node->parent->left = left;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree->root = left;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* link node and left */
|
|
|
|
left->right = node;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
node->parent = left;
|
|
|
|
|
|
|
|
node->count = 1 + (node->left?node->left->count:0) +
|
|
|
|
(node->right?node->right->count:0);
|
|
|
|
left->count = 1 + (left->left?left->left->count:0) +
|
|
|
|
(left->right?left->right->count:0);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
node->offset = node_height +
|
|
|
|
(node->left?node->left->offset:0) +
|
|
|
|
(node->right?node->right->offset:0) +
|
|
|
|
(node->children?node->children->root->offset:0);
|
|
|
|
left->offset = left_height +
|
|
|
|
(left->left?left->left->offset:0) +
|
|
|
|
(left->right?left->right->offset:0) +
|
|
|
|
(left->children?left->children->root->offset:0);
|
2001-10-25 20:32:40 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
_fixup_validation (tree, node);
|
|
|
|
_fixup_validation (tree, left);
|
2011-11-16 03:14:00 +00:00
|
|
|
_fixup_total_count (tree, node);
|
|
|
|
_fixup_total_count (tree, left);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_insert_fixup (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* check Red-Black properties */
|
|
|
|
while (node != tree->root && GTK_RBNODE_GET_COLOR (node->parent) == GTK_RBNODE_RED)
|
|
|
|
{
|
|
|
|
/* we have a violation */
|
|
|
|
if (node->parent == node->parent->parent->left)
|
|
|
|
{
|
|
|
|
GtkRBNode *y = node->parent->parent->right;
|
|
|
|
if (GTK_RBNODE_GET_COLOR (y) == GTK_RBNODE_RED)
|
|
|
|
{
|
|
|
|
/* uncle is GTK_RBNODE_RED */
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (y, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent->parent, GTK_RBNODE_RED);
|
|
|
|
node = node->parent->parent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* uncle is GTK_RBNODE_BLACK */
|
|
|
|
if (node == node->parent->right)
|
|
|
|
{
|
|
|
|
/* make node a left child */
|
|
|
|
node = node->parent;
|
|
|
|
_gtk_rbnode_rotate_left (tree, node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* recolor and rotate */
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent->parent, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_right(tree, node->parent->parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* mirror image of above code */
|
|
|
|
GtkRBNode *y = node->parent->parent->left;
|
|
|
|
if (GTK_RBNODE_GET_COLOR (y) == GTK_RBNODE_RED)
|
|
|
|
{
|
|
|
|
/* uncle is GTK_RBNODE_RED */
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (y, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent->parent, GTK_RBNODE_RED);
|
|
|
|
node = node->parent->parent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* uncle is GTK_RBNODE_BLACK */
|
|
|
|
if (node == node->parent->left)
|
|
|
|
{
|
|
|
|
node = node->parent;
|
|
|
|
_gtk_rbnode_rotate_right (tree, node);
|
|
|
|
}
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (node->parent->parent, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_left (tree, node->parent->parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GTK_RBNODE_SET_COLOR (tree->root, GTK_RBNODE_BLACK);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_remove_node_fixup (GtkRBTree *tree,
|
2011-11-21 20:13:53 +00:00
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBNode *parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
while (node != tree->root && GTK_RBNODE_GET_COLOR (node) == GTK_RBNODE_BLACK)
|
|
|
|
{
|
2011-11-21 21:28:36 +00:00
|
|
|
if (node == parent->left)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2011-11-21 21:28:36 +00:00
|
|
|
GtkRBNode *w = parent->right;
|
2000-10-05 01:04:57 +00:00
|
|
|
if (GTK_RBNODE_GET_COLOR (w) == GTK_RBNODE_RED)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_BLACK);
|
2011-11-21 21:28:36 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (parent, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_left (tree, parent);
|
|
|
|
w = parent->right;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
if (GTK_RBNODE_GET_COLOR (w->left) == GTK_RBNODE_BLACK && GTK_RBNODE_GET_COLOR (w->right) == GTK_RBNODE_BLACK)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_RED);
|
2011-11-21 21:28:36 +00:00
|
|
|
node = parent;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_GET_COLOR (w->right) == GTK_RBNODE_BLACK)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w->left, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_right (tree, w);
|
2011-11-21 21:28:36 +00:00
|
|
|
w = parent->right;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2011-11-21 21:28:36 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_GET_COLOR (parent));
|
|
|
|
GTK_RBNODE_SET_COLOR (parent, GTK_RBNODE_BLACK);
|
2000-10-05 01:04:57 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (w->right, GTK_RBNODE_BLACK);
|
2011-11-21 21:28:36 +00:00
|
|
|
_gtk_rbnode_rotate_left (tree, parent);
|
2000-10-05 01:04:57 +00:00
|
|
|
node = tree->root;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-21 21:28:36 +00:00
|
|
|
GtkRBNode *w = parent->left;
|
2000-10-05 01:04:57 +00:00
|
|
|
if (GTK_RBNODE_GET_COLOR (w) == GTK_RBNODE_RED)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_BLACK);
|
2011-11-21 21:28:36 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (parent, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_right (tree, parent);
|
|
|
|
w = parent->left;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
if (GTK_RBNODE_GET_COLOR (w->right) == GTK_RBNODE_BLACK && GTK_RBNODE_GET_COLOR (w->left) == GTK_RBNODE_BLACK)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_RED);
|
2011-11-21 21:28:36 +00:00
|
|
|
node = parent;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_GET_COLOR (w->left) == GTK_RBNODE_BLACK)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_COLOR (w->right, GTK_RBNODE_BLACK);
|
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_RED);
|
|
|
|
_gtk_rbnode_rotate_left (tree, w);
|
2011-11-21 21:28:36 +00:00
|
|
|
w = parent->left;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2011-11-21 21:28:36 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (w, GTK_RBNODE_GET_COLOR (parent));
|
|
|
|
GTK_RBNODE_SET_COLOR (parent, GTK_RBNODE_BLACK);
|
2000-10-05 01:04:57 +00:00
|
|
|
GTK_RBNODE_SET_COLOR (w->left, GTK_RBNODE_BLACK);
|
2011-11-21 21:28:36 +00:00
|
|
|
_gtk_rbnode_rotate_right (tree, parent);
|
2000-10-05 01:04:57 +00:00
|
|
|
node = tree->root;
|
|
|
|
}
|
|
|
|
}
|
2011-11-21 21:28:36 +00:00
|
|
|
|
|
|
|
parent = node->parent;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
GTK_RBNODE_SET_COLOR (node, GTK_RBNODE_BLACK);
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkRBTree *
|
|
|
|
_gtk_rbtree_new (void)
|
|
|
|
{
|
|
|
|
GtkRBTree *retval;
|
|
|
|
|
2006-01-18 05:23:24 +00:00
|
|
|
retval = g_new (GtkRBTree, 1);
|
2000-10-05 01:04:57 +00:00
|
|
|
retval->parent_tree = NULL;
|
|
|
|
retval->parent_node = NULL;
|
|
|
|
|
2011-11-22 02:18:31 +00:00
|
|
|
retval->root = (GtkRBNode *) &nil;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_free_helper (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
if (node->children)
|
|
|
|
_gtk_rbtree_free (node->children);
|
|
|
|
|
|
|
|
_gtk_rbnode_free (node);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_rbtree_free (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
_gtk_rbtree_traverse (tree,
|
|
|
|
tree->root,
|
|
|
|
G_POST_ORDER,
|
|
|
|
_gtk_rbtree_free_helper,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (tree->parent_node &&
|
|
|
|
tree->parent_node->children == tree)
|
|
|
|
tree->parent_node->children = NULL;
|
|
|
|
g_free (tree);
|
|
|
|
}
|
|
|
|
|
2011-11-19 11:59:39 +00:00
|
|
|
static void
|
|
|
|
gtk_rbnode_adjust (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
int count_diff,
|
|
|
|
int total_count_diff,
|
|
|
|
int offset_diff)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
while (tree && node && !_gtk_rbtree_is_nil (node))
|
2011-11-19 11:59:39 +00:00
|
|
|
{
|
|
|
|
_fixup_validation (tree, node);
|
|
|
|
node->offset += offset_diff;
|
|
|
|
node->count += count_diff;
|
|
|
|
node->total_count += total_count_diff;
|
|
|
|
|
|
|
|
node = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2011-11-19 11:59:39 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
count_diff = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_remove (GtkRBTree *tree)
|
|
|
|
{
|
2011-11-19 11:59:39 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkRBTree *tmp_tree;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
2002-05-16 21:37:49 +00:00
|
|
|
#endif
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
/* ugly hack to make _fixup_validation work in the first iteration of the
|
|
|
|
* loop below */
|
|
|
|
GTK_RBNODE_UNSET_FLAG (tree->root, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
|
2011-11-19 11:59:39 +00:00
|
|
|
gtk_rbnode_adjust (tree->parent_tree,
|
|
|
|
tree->parent_node,
|
|
|
|
0,
|
|
|
|
- (int) tree->root->total_count,
|
|
|
|
- tree->root->offset);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-19 11:59:39 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
tmp_tree = tree->parent_tree;
|
2011-11-19 11:59:39 +00:00
|
|
|
#endif
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
_gtk_rbtree_free (tree);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2002-05-16 21:37:49 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tmp_tree);
|
2002-05-16 21:37:49 +00:00
|
|
|
#endif
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GtkRBNode *
|
2001-12-04 23:49:57 +00:00
|
|
|
_gtk_rbtree_insert_after (GtkRBTree *tree,
|
|
|
|
GtkRBNode *current,
|
|
|
|
gint height,
|
|
|
|
gboolean valid)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
gboolean right = TRUE;
|
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 20:14:15 +00:00
|
|
|
{
|
2002-05-16 19:11:43 +00:00
|
|
|
g_print ("\n\n_gtk_rbtree_insert_after: %p\n", current);
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
2001-12-08 20:14:15 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (current != NULL && !_gtk_rbtree_is_nil (current->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
current = current->right;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (current->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
current = current->left;
|
|
|
|
right = FALSE;
|
|
|
|
}
|
|
|
|
/* setup new node */
|
|
|
|
node = _gtk_rbnode_new (tree, height);
|
|
|
|
|
|
|
|
/* insert node in tree */
|
|
|
|
if (current)
|
|
|
|
{
|
2011-11-22 02:18:31 +00:00
|
|
|
node->parent = current;
|
2000-10-05 01:04:57 +00:00
|
|
|
if (right)
|
|
|
|
current->right = node;
|
|
|
|
else
|
|
|
|
current->left = node;
|
2011-11-19 12:06:22 +00:00
|
|
|
gtk_rbnode_adjust (tree, node->parent,
|
|
|
|
1, 1, height);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
g_assert (_gtk_rbtree_is_nil (tree->root));
|
2000-10-05 01:04:57 +00:00
|
|
|
tree->root = node;
|
2011-11-19 12:06:22 +00:00
|
|
|
gtk_rbnode_adjust (tree->parent_tree, tree->parent_node,
|
|
|
|
0, 1, height);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2001-12-04 23:49:57 +00:00
|
|
|
|
|
|
|
if (valid)
|
|
|
|
_gtk_rbtree_node_mark_valid (tree, node);
|
|
|
|
else
|
|
|
|
_gtk_rbtree_node_mark_invalid (tree, node);
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_insert_fixup (tree, node);
|
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 20:14:15 +00:00
|
|
|
{
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("_gtk_rbtree_insert_after finished...\n");
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("\n\n");
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
2001-12-08 01:10:52 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkRBNode *
|
2001-12-04 23:49:57 +00:00
|
|
|
_gtk_rbtree_insert_before (GtkRBTree *tree,
|
|
|
|
GtkRBNode *current,
|
|
|
|
gint height,
|
|
|
|
gboolean valid)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
gboolean left = TRUE;
|
2002-05-16 19:11:43 +00:00
|
|
|
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 20:14:15 +00:00
|
|
|
{
|
2002-05-16 19:11:43 +00:00
|
|
|
g_print ("\n\n_gtk_rbtree_insert_before: %p\n", current);
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (current != NULL && !_gtk_rbtree_is_nil (current->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
current = current->left;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (current->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
current = current->right;
|
|
|
|
left = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup new node */
|
|
|
|
node = _gtk_rbnode_new (tree, height);
|
|
|
|
|
|
|
|
/* insert node in tree */
|
|
|
|
if (current)
|
|
|
|
{
|
2011-11-22 02:18:31 +00:00
|
|
|
node->parent = current;
|
2000-10-05 01:04:57 +00:00
|
|
|
if (left)
|
|
|
|
current->left = node;
|
|
|
|
else
|
|
|
|
current->right = node;
|
2011-11-19 12:08:10 +00:00
|
|
|
gtk_rbnode_adjust (tree, node->parent,
|
|
|
|
1, 1, height);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
g_assert (_gtk_rbtree_is_nil (tree->root));
|
2000-10-05 01:04:57 +00:00
|
|
|
tree->root = node;
|
2011-11-19 12:08:10 +00:00
|
|
|
gtk_rbnode_adjust (tree->parent_tree, tree->parent_node,
|
|
|
|
0, 1, height);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2001-12-04 23:49:57 +00:00
|
|
|
|
|
|
|
if (valid)
|
|
|
|
_gtk_rbtree_node_mark_valid (tree, node);
|
|
|
|
else
|
|
|
|
_gtk_rbtree_node_mark_invalid (tree, node);
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_insert_fixup (tree, node);
|
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 20:14:15 +00:00
|
|
|
{
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("_gtk_rbtree_insert_before finished...\n");
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("\n\n");
|
2001-12-08 20:14:15 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkRBNode *
|
|
|
|
_gtk_rbtree_find_count (GtkRBTree *tree,
|
|
|
|
gint count)
|
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
|
|
|
|
node = tree->root;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node) && (node->left->count + 1 != count))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
if (node->left->count >= count)
|
|
|
|
node = node->left;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
count -= (node->left->count + 1);
|
|
|
|
node = node->right;
|
|
|
|
}
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
return NULL;
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_rbtree_node_set_height (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
gint diff = height - GTK_RBNODE_GET_HEIGHT (node);
|
|
|
|
|
|
|
|
if (diff == 0)
|
|
|
|
return;
|
|
|
|
|
2011-11-19 12:10:05 +00:00
|
|
|
gtk_rbnode_adjust (tree, node, 0, 0, diff);
|
|
|
|
|
2002-05-16 21:37:49 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
2002-05-16 21:37:49 +00:00
|
|
|
#endif
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-10-25 20:32:40 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_node_mark_invalid (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID))
|
|
|
|
return;
|
|
|
|
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_INVALID);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_DESCENDANTS_INVALID))
|
|
|
|
return;
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
node = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2001-10-25 20:32:40 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (node);
|
|
|
|
}
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
#if 0
|
|
|
|
/* Draconian version. */
|
|
|
|
void
|
|
|
|
_gtk_rbtree_node_mark_invalid (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_INVALID);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
_fixup_validation (tree, node);
|
|
|
|
node = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (node);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-10-25 20:32:40 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_node_mark_valid (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
2001-12-04 23:49:57 +00:00
|
|
|
if ((!GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID)) &&
|
|
|
|
(!GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)))
|
2001-10-25 20:32:40 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_INVALID);
|
2001-12-04 23:49:57 +00:00
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_COLUMN_INVALID);
|
|
|
|
|
2001-10-25 20:32:40 +00:00
|
|
|
do
|
|
|
|
{
|
2001-12-04 23:49:57 +00:00
|
|
|
if ((GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID)) ||
|
|
|
|
(GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) ||
|
2001-10-25 20:32:40 +00:00
|
|
|
(node->children && GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
2011-11-22 01:17:05 +00:00
|
|
|
(!_gtk_rbtree_is_nil (node->left) && GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
|
|
|
(!_gtk_rbtree_is_nil (node->right) && GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID)))
|
2001-10-25 20:32:40 +00:00
|
|
|
return;
|
2001-12-04 23:49:57 +00:00
|
|
|
|
2001-10-25 20:32:40 +00:00
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
node = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2001-10-25 20:32:40 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (node);
|
|
|
|
}
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
#if 0
|
|
|
|
/* Draconian version */
|
|
|
|
void
|
|
|
|
_gtk_rbtree_node_mark_valid (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_INVALID);
|
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_COLUMN_INVALID);
|
2001-12-04 23:49:57 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
_fixup_validation (tree, node);
|
|
|
|
node = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (node);
|
|
|
|
}
|
|
|
|
#endif
|
2001-12-04 23:49:57 +00:00
|
|
|
/* Assume tree is the root node as it doesn't set DESCENDANTS_INVALID above.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_gtk_rbtree_column_invalid (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
|
|
|
|
if (tree == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-11-22 01:58:05 +00:00
|
|
|
node = _gtk_rbtree_first (tree);
|
2001-12-04 23:49:57 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (! (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID)))
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_COLUMN_INVALID);
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
_gtk_rbtree_column_invalid (node->children);
|
|
|
|
}
|
|
|
|
while ((node = _gtk_rbtree_next (tree, node)) != NULL);
|
|
|
|
}
|
|
|
|
|
2002-01-27 22:21:27 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_mark_invalid (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
|
|
|
|
if (tree == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-11-22 01:58:05 +00:00
|
|
|
node = _gtk_rbtree_first (tree);
|
2002-01-27 22:21:27 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_INVALID);
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
_gtk_rbtree_mark_invalid (node->children);
|
|
|
|
}
|
|
|
|
while ((node = _gtk_rbtree_next (tree, node)) != NULL);
|
|
|
|
}
|
|
|
|
|
2002-03-20 22:06:05 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_set_fixed_height (GtkRBTree *tree,
|
2005-07-08 19:17:10 +00:00
|
|
|
gint height,
|
|
|
|
gboolean mark_valid)
|
2002-03-20 22:06:05 +00:00
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
|
|
|
|
if (tree == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-11-22 01:58:05 +00:00
|
|
|
node = _gtk_rbtree_first (tree);
|
2002-03-20 22:06:05 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID))
|
2005-07-08 19:17:10 +00:00
|
|
|
{
|
|
|
|
_gtk_rbtree_node_set_height (tree, node, height);
|
|
|
|
if (mark_valid)
|
|
|
|
_gtk_rbtree_node_mark_valid (tree, node);
|
|
|
|
}
|
2002-03-20 22:06:05 +00:00
|
|
|
|
|
|
|
if (node->children)
|
2005-07-08 19:17:10 +00:00
|
|
|
_gtk_rbtree_set_fixed_height (node->children, height, mark_valid);
|
2002-03-20 22:06:05 +00:00
|
|
|
}
|
|
|
|
while ((node = _gtk_rbtree_next (tree, node)) != NULL);
|
|
|
|
}
|
|
|
|
|
2001-03-28 22:27:20 +00:00
|
|
|
typedef struct _GtkRBReorder
|
|
|
|
{
|
|
|
|
GtkRBTree *children;
|
|
|
|
gint height;
|
|
|
|
gint flags;
|
|
|
|
gint order;
|
2001-03-29 21:30:05 +00:00
|
|
|
gint invert_order;
|
2011-11-16 03:14:00 +00:00
|
|
|
guint total_count;
|
2001-03-28 22:27:20 +00:00
|
|
|
} GtkRBReorder;
|
|
|
|
|
|
|
|
static int
|
|
|
|
gtk_rbtree_reorder_sort_func (gconstpointer a,
|
|
|
|
gconstpointer b)
|
|
|
|
{
|
return a value in the range of [-1, 1] instead [0, 1],
Wed Nov 20 19:29:50 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkrbtree.c (gtk_rbtree_reorder_sort_func): return a value
in the range of [-1, 1] instead [0, 1],
(gtk_rbtree_reorder_invert_func): ditto,
This makes treeview reordering working on platforms as FreeBSD and
solaris, thanks go to Heiner Eichmann for finding this out and
sending in a patch (#98251).
Wed Nov 20 19:27:07 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (node_free): only free the data list if
node->data is not NULL,
(gtk_tree_store_remove): free the data list from the node if
needed. (#94728, pointed out by Peter Bloomfield).
Wed Nov 20 19:23:13 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_remove_column): stop editing
and set the edited_column to NULL if edited_column is set.
(#91288, modified patch from Josh Parsons).
Wed Nov 20 19:20:34 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): do a full
redraw if vadjustment->value is bigger than tree_view->priv->height,
(gtk_tree_view_row_deleted): free the row ref if it isn't valid
anymore. (#83726, reported by Robert Kinsella).
2002-11-20 18:15:28 +00:00
|
|
|
return ((GtkRBReorder *) a)->order - ((GtkRBReorder *) b)->order;
|
2001-03-28 22:27:20 +00:00
|
|
|
}
|
|
|
|
|
2001-03-29 21:30:05 +00:00
|
|
|
static int
|
|
|
|
gtk_rbtree_reorder_invert_func (gconstpointer a,
|
|
|
|
gconstpointer b)
|
|
|
|
{
|
return a value in the range of [-1, 1] instead [0, 1],
Wed Nov 20 19:29:50 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkrbtree.c (gtk_rbtree_reorder_sort_func): return a value
in the range of [-1, 1] instead [0, 1],
(gtk_rbtree_reorder_invert_func): ditto,
This makes treeview reordering working on platforms as FreeBSD and
solaris, thanks go to Heiner Eichmann for finding this out and
sending in a patch (#98251).
Wed Nov 20 19:27:07 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (node_free): only free the data list if
node->data is not NULL,
(gtk_tree_store_remove): free the data list from the node if
needed. (#94728, pointed out by Peter Bloomfield).
Wed Nov 20 19:23:13 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_remove_column): stop editing
and set the edited_column to NULL if edited_column is set.
(#91288, modified patch from Josh Parsons).
Wed Nov 20 19:20:34 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): do a full
redraw if vadjustment->value is bigger than tree_view->priv->height,
(gtk_tree_view_row_deleted): free the row ref if it isn't valid
anymore. (#83726, reported by Robert Kinsella).
2002-11-20 18:15:28 +00:00
|
|
|
return ((GtkRBReorder *) a)->invert_order - ((GtkRBReorder *) b)->invert_order;
|
2001-03-29 21:30:05 +00:00
|
|
|
}
|
|
|
|
|
2001-03-28 22:27:20 +00:00
|
|
|
static void
|
|
|
|
gtk_rbtree_reorder_fixup (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2001-03-28 22:27:20 +00:00
|
|
|
return;
|
|
|
|
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count = 1;
|
2001-11-02 00:13:30 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2001-03-28 22:27:20 +00:00
|
|
|
{
|
|
|
|
gtk_rbtree_reorder_fixup (tree, node->left);
|
|
|
|
node->offset += node->left->offset;
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count += node->left->total_count;
|
2001-03-28 22:27:20 +00:00
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2001-03-28 22:27:20 +00:00
|
|
|
{
|
|
|
|
gtk_rbtree_reorder_fixup (tree, node->right);
|
|
|
|
node->offset += node->right->offset;
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count += node->right->total_count;
|
2001-03-28 22:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (node->children)
|
2001-11-02 00:13:30 +00:00
|
|
|
{
|
|
|
|
node->offset += node->children->root->offset;
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count += node->children->root->total_count;
|
2001-11-02 00:13:30 +00:00
|
|
|
}
|
2001-12-04 23:49:57 +00:00
|
|
|
|
|
|
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
|
2011-11-22 01:17:05 +00:00
|
|
|
(!_gtk_rbtree_is_nil (node->right) && GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
|
|
|
(!_gtk_rbtree_is_nil (node->left) && GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
2001-12-04 23:49:57 +00:00
|
|
|
(node->children && GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID)))
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
else
|
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
2001-03-28 22:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* It basically pulls everything out of the tree, rearranges it, and puts it
|
|
|
|
* back together. Our strategy is to keep the old RBTree intact, and just
|
|
|
|
* rearrange the contents. When that is done, we go through and update the
|
|
|
|
* heights. There is probably a more elegant way to write this function. If
|
|
|
|
* anyone wants to spend the time writing it, patches will be accepted.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_gtk_rbtree_reorder (GtkRBTree *tree,
|
|
|
|
gint *new_order,
|
|
|
|
gint length)
|
|
|
|
{
|
2004-10-28 15:00:05 +00:00
|
|
|
GtkRBReorder reorder = { NULL };
|
2001-03-28 22:27:20 +00:00
|
|
|
GArray *array;
|
|
|
|
GtkRBNode *node;
|
|
|
|
gint i;
|
2001-09-01 20:56:41 +00:00
|
|
|
|
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
g_return_if_fail (length > 0);
|
|
|
|
g_return_if_fail (tree->root->count == length);
|
|
|
|
|
2001-03-28 22:27:20 +00:00
|
|
|
/* Sort the trees values in the new tree. */
|
|
|
|
array = g_array_sized_new (FALSE, FALSE, sizeof (GtkRBReorder), length);
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
reorder.order = new_order[i];
|
2001-03-29 21:30:05 +00:00
|
|
|
reorder.invert_order = i;
|
2001-03-28 22:27:20 +00:00
|
|
|
g_array_append_val (array, reorder);
|
2001-03-29 21:30:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_array_sort(array, gtk_rbtree_reorder_sort_func);
|
|
|
|
|
|
|
|
/* rewind node*/
|
2011-11-22 01:58:05 +00:00
|
|
|
node = _gtk_rbtree_first (tree);
|
2001-03-29 21:30:05 +00:00
|
|
|
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
g_assert (!_gtk_rbtree_is_nil (node));
|
2001-03-29 21:30:05 +00:00
|
|
|
g_array_index (array, GtkRBReorder, i).children = node->children;
|
|
|
|
g_array_index (array, GtkRBReorder, i).flags = GTK_RBNODE_NON_COLORS & node->flags;
|
|
|
|
g_array_index (array, GtkRBReorder, i).height = GTK_RBNODE_GET_HEIGHT (node);
|
2001-03-28 22:27:20 +00:00
|
|
|
|
|
|
|
node = _gtk_rbtree_next (tree, node);
|
|
|
|
}
|
|
|
|
|
2001-03-29 21:30:05 +00:00
|
|
|
g_array_sort (array, gtk_rbtree_reorder_invert_func);
|
|
|
|
|
2001-03-28 22:27:20 +00:00
|
|
|
/* rewind node*/
|
2011-11-22 01:58:05 +00:00
|
|
|
node = _gtk_rbtree_first (tree);
|
2001-03-28 22:27:20 +00:00
|
|
|
|
|
|
|
/* Go through the tree and change the values to the new ones. */
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
reorder = g_array_index (array, GtkRBReorder, i);
|
|
|
|
node->children = reorder.children;
|
2001-06-15 23:03:27 +00:00
|
|
|
if (node->children)
|
|
|
|
node->children->parent_node = node;
|
2001-03-28 22:27:20 +00:00
|
|
|
node->flags = GTK_RBNODE_GET_COLOR (node) | reorder.flags;
|
|
|
|
/* We temporarily set the height to this. */
|
|
|
|
node->offset = reorder.height;
|
|
|
|
node = _gtk_rbtree_next (tree, node);
|
|
|
|
}
|
|
|
|
gtk_rbtree_reorder_fixup (tree, tree->root);
|
2002-06-06 15:18:52 +00:00
|
|
|
|
|
|
|
g_array_free (array, TRUE);
|
2001-03-28 22:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
|
|
|
_gtk_rbtree_node_find_offset (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
GtkRBNode *last;
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
gint retval;
|
|
|
|
|
|
|
|
g_assert (node);
|
|
|
|
g_assert (node->left);
|
|
|
|
|
|
|
|
retval = node->left->offset;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
while (tree && node && !_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
last = node;
|
|
|
|
node = node->parent;
|
2001-01-19 22:39:19 +00:00
|
|
|
|
|
|
|
/* Add left branch, plus children, iff we came from the right */
|
2000-10-05 01:04:57 +00:00
|
|
|
if (node->right == last)
|
2001-01-19 22:39:19 +00:00
|
|
|
retval += node->offset - node->right->offset;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
2001-01-19 22:39:19 +00:00
|
|
|
|
|
|
|
/* Add the parent node, plus the left branch. */
|
2000-10-05 01:04:57 +00:00
|
|
|
if (node)
|
2001-01-19 22:39:19 +00:00
|
|
|
retval += node->left->offset + GTK_RBNODE_GET_HEIGHT (node);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2011-11-12 04:15:53 +00:00
|
|
|
guint
|
|
|
|
_gtk_rbtree_node_get_index (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
{
|
|
|
|
GtkRBNode *last;
|
2011-11-12 04:15:53 +00:00
|
|
|
guint retval;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
g_assert (node);
|
|
|
|
g_assert (node->left);
|
|
|
|
|
2011-11-16 03:14:00 +00:00
|
|
|
retval = node->left->total_count;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
while (tree && node && !_gtk_rbtree_is_nil (node))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
{
|
|
|
|
last = node;
|
|
|
|
node = node->parent;
|
|
|
|
|
|
|
|
/* Add left branch, plus children, iff we came from the right */
|
|
|
|
if (node->right == last)
|
2011-11-16 03:14:00 +00:00
|
|
|
retval += node->total_count - node->right->total_count;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
{
|
|
|
|
node = tree->parent_node;
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
|
|
|
|
/* Add the parent node, plus the left branch. */
|
|
|
|
if (node)
|
2011-11-16 03:14:00 +00:00
|
|
|
retval += node->left->total_count + 1; /* 1 == GTK_RBNODE_GET_PARITY() */
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-12 04:15:53 +00:00
|
|
|
return retval;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
2001-12-04 23:49:57 +00:00
|
|
|
_gtk_rbtree_real_find_offset (GtkRBTree *tree,
|
|
|
|
gint height,
|
|
|
|
GtkRBTree **new_tree,
|
|
|
|
GtkRBNode **new_node)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkRBNode *tmp_node;
|
|
|
|
|
2001-12-04 23:49:57 +00:00
|
|
|
g_assert (tree);
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (height < 0)
|
|
|
|
{
|
|
|
|
*new_tree = NULL;
|
|
|
|
*new_node = NULL;
|
2001-12-04 23:49:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-12-04 23:49:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
tmp_node = tree->root;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (tmp_node) &&
|
2000-10-05 01:04:57 +00:00
|
|
|
(tmp_node->left->offset > height ||
|
|
|
|
(tmp_node->offset - tmp_node->right->offset) < height))
|
|
|
|
{
|
|
|
|
if (tmp_node->left->offset > height)
|
|
|
|
tmp_node = tmp_node->left;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
height -= (tmp_node->offset - tmp_node->right->offset);
|
|
|
|
tmp_node = tmp_node->right;
|
|
|
|
}
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (tmp_node))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
*new_tree = NULL;
|
|
|
|
*new_node = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (tmp_node->children)
|
|
|
|
{
|
|
|
|
if ((tmp_node->offset -
|
|
|
|
tmp_node->right->offset -
|
|
|
|
tmp_node->children->root->offset) > height)
|
|
|
|
{
|
|
|
|
*new_tree = tree;
|
|
|
|
*new_node = tmp_node;
|
|
|
|
return (height - tmp_node->left->offset);
|
|
|
|
}
|
2001-12-04 23:49:57 +00:00
|
|
|
return _gtk_rbtree_real_find_offset (tmp_node->children,
|
|
|
|
height - tmp_node->left->offset -
|
|
|
|
(tmp_node->offset -
|
|
|
|
tmp_node->left->offset -
|
|
|
|
tmp_node->right->offset -
|
|
|
|
tmp_node->children->root->offset),
|
|
|
|
new_tree,
|
|
|
|
new_node);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
*new_tree = tree;
|
|
|
|
*new_node = tmp_node;
|
|
|
|
return (height - tmp_node->left->offset);
|
|
|
|
}
|
|
|
|
|
2001-12-04 23:49:57 +00:00
|
|
|
gint
|
|
|
|
_gtk_rbtree_find_offset (GtkRBTree *tree,
|
|
|
|
gint height,
|
|
|
|
GtkRBTree **new_tree,
|
|
|
|
GtkRBNode **new_node)
|
|
|
|
{
|
|
|
|
g_assert (tree);
|
|
|
|
|
|
|
|
if ((height < 0) ||
|
|
|
|
(height >= tree->root->offset))
|
|
|
|
{
|
|
|
|
*new_tree = NULL;
|
|
|
|
*new_node = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2001-12-08 01:10:52 +00:00
|
|
|
return _gtk_rbtree_real_find_offset (tree, height, new_tree, new_node);
|
2001-12-04 23:49:57 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-07-07 07:52:24 +00:00
|
|
|
gboolean
|
|
|
|
_gtk_rbtree_find_index (GtkRBTree *tree,
|
|
|
|
guint index,
|
|
|
|
GtkRBTree **new_tree,
|
|
|
|
GtkRBNode **new_node)
|
|
|
|
{
|
|
|
|
GtkRBNode *tmp_node;
|
|
|
|
|
|
|
|
g_assert (tree);
|
|
|
|
|
|
|
|
tmp_node = tree->root;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (tmp_node))
|
2011-07-07 07:52:24 +00:00
|
|
|
{
|
|
|
|
if (tmp_node->left->total_count > index)
|
|
|
|
{
|
|
|
|
tmp_node = tmp_node->left;
|
|
|
|
}
|
|
|
|
else if (tmp_node->total_count - tmp_node->right->total_count <= index)
|
|
|
|
{
|
|
|
|
index -= tmp_node->total_count - tmp_node->right->total_count;
|
|
|
|
tmp_node = tmp_node->right;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
index -= tmp_node->left->total_count;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (tmp_node))
|
2011-07-07 07:52:24 +00:00
|
|
|
{
|
|
|
|
*new_tree = NULL;
|
|
|
|
*new_node = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index > 0)
|
|
|
|
{
|
|
|
|
g_assert (tmp_node->children);
|
|
|
|
|
|
|
|
return _gtk_rbtree_find_index (tmp_node->children,
|
|
|
|
index - 1,
|
|
|
|
new_tree,
|
|
|
|
new_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
*new_tree = tree;
|
|
|
|
*new_node = tmp_node;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
_gtk_rbtree_remove_node (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
GtkRBNode *x, *y;
|
2001-11-02 21:47:27 +00:00
|
|
|
gint y_height;
|
2011-11-20 20:27:46 +00:00
|
|
|
guint y_total_count;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
g_return_if_fail (node != NULL);
|
2001-12-08 01:10:52 +00:00
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
2002-05-16 19:11:43 +00:00
|
|
|
g_print ("\n\n_gtk_rbtree_remove_node: %p\n", node);
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
/* make sure we're deleting a node that's actually in the tree */
|
2011-11-22 01:17:05 +00:00
|
|
|
for (x = node; !_gtk_rbtree_is_nil (x->parent); x = x->parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
;
|
|
|
|
g_return_if_fail (x == tree->root);
|
|
|
|
|
2002-05-16 21:37:49 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
2002-05-16 21:37:49 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node->left) ||
|
|
|
|
_gtk_rbtree_is_nil (node->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
y = node;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y = node->right;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (y->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
y = y->left;
|
|
|
|
}
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-20 20:27:46 +00:00
|
|
|
y_height = GTK_RBNODE_GET_HEIGHT (y)
|
|
|
|
+ (y->children ? y->children->root->offset : 0);
|
|
|
|
y_total_count = 1 + (y->children ? y->children->root->total_count : 0);
|
2001-11-02 21:47:27 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
/* x is y's only child, or nil */
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (y->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
x = y->left;
|
|
|
|
else
|
|
|
|
x = y->right;
|
|
|
|
|
|
|
|
/* remove y from the parent chain */
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (x))
|
2011-11-21 20:13:53 +00:00
|
|
|
x->parent = y->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (y->parent))
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
if (y == y->parent->left)
|
|
|
|
y->parent->left = x;
|
|
|
|
else
|
|
|
|
y->parent->right = x;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
else
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
tree->root = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We need to clean up the validity of the tree.
|
|
|
|
*/
|
2011-11-20 20:27:46 +00:00
|
|
|
gtk_rbnode_adjust (tree, y, -1, - y_total_count, - y_height);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-21 20:13:53 +00:00
|
|
|
if (GTK_RBNODE_GET_COLOR (y) == GTK_RBNODE_BLACK)
|
|
|
|
_gtk_rbtree_remove_node_fixup (tree, x, y->parent);
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (y != node)
|
2001-02-28 00:35:25 +00:00
|
|
|
{
|
2011-11-21 15:07:52 +00:00
|
|
|
gint node_height, node_total_count;
|
2011-11-20 20:27:46 +00:00
|
|
|
|
2011-11-21 15:07:52 +00:00
|
|
|
/* We want to see how much we remove from the aggregate values.
|
|
|
|
* This is all the children we remove plus the node's values.
|
2011-11-20 20:27:46 +00:00
|
|
|
*/
|
2011-11-21 15:07:52 +00:00
|
|
|
node_height = GTK_RBNODE_GET_HEIGHT (node)
|
|
|
|
+ (node->children ? node->children->root->offset : 0);
|
|
|
|
node_total_count = 1
|
|
|
|
+ (node->children ? node->children->root->total_count : 0);
|
2001-11-02 21:47:27 +00:00
|
|
|
|
2011-11-21 15:07:52 +00:00
|
|
|
/* Move the node over */
|
|
|
|
if (GTK_RBNODE_GET_COLOR (node) != GTK_RBNODE_GET_COLOR (y))
|
2011-11-21 20:13:53 +00:00
|
|
|
y->flags ^= (GTK_RBNODE_BLACK | GTK_RBNODE_RED);
|
2011-11-21 15:07:52 +00:00
|
|
|
|
|
|
|
y->left = node->left;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (y->left))
|
2011-11-21 15:07:52 +00:00
|
|
|
y->left->parent = y;
|
|
|
|
y->right = node->right;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (y->right))
|
2011-11-21 15:07:52 +00:00
|
|
|
y->right->parent = y;
|
|
|
|
y->parent = node->parent;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (y->parent))
|
2011-11-21 15:07:52 +00:00
|
|
|
{
|
|
|
|
if (y->parent->left == node)
|
|
|
|
y->parent->left = y;
|
|
|
|
else
|
|
|
|
y->parent->right = y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree->root = y;
|
|
|
|
}
|
|
|
|
y->count = node->count;
|
|
|
|
y->total_count = node->total_count;
|
|
|
|
y->offset = node->offset;
|
|
|
|
|
|
|
|
gtk_rbnode_adjust (tree, y,
|
|
|
|
0,
|
|
|
|
y_total_count - node_total_count,
|
|
|
|
y_height - node_height);
|
2001-02-28 00:35:25 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-21 15:07:52 +00:00
|
|
|
_gtk_rbnode_free (node);
|
2001-01-09 17:45:34 +00:00
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-09-08 15:17:57 +00:00
|
|
|
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("_gtk_rbtree_remove_node finished...\n");
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_debug_spew (tree);
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("\n\n");
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test (G_STRLOC, tree);
|
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2011-11-22 01:58:05 +00:00
|
|
|
GtkRBNode *
|
|
|
|
_gtk_rbtree_first (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
GtkRBNode *node;
|
|
|
|
|
|
|
|
node = tree->root;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2011-11-22 01:58:05 +00:00
|
|
|
return NULL;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node->left))
|
2011-11-22 01:58:05 +00:00
|
|
|
node = node->left;
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkRBNode *
|
|
|
|
_gtk_rbtree_next (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree != NULL, NULL);
|
|
|
|
g_return_val_if_fail (node != NULL, NULL);
|
|
|
|
|
|
|
|
/* Case 1: the node's below us. */
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
node = node->right;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
node = node->left;
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Case 2: it's an ancestor */
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node->parent))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
if (node->parent->right == node)
|
|
|
|
node = node->parent;
|
|
|
|
else
|
|
|
|
return (node->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Case 3: There is no next node */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkRBNode *
|
|
|
|
_gtk_rbtree_prev (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree != NULL, NULL);
|
|
|
|
g_return_val_if_fail (node != NULL, NULL);
|
|
|
|
|
|
|
|
/* Case 1: the node's below us. */
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
node = node->left;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
node = node->right;
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Case 2: it's an ancestor */
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil (node->parent))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
if (node->parent->left == node)
|
|
|
|
node = node->parent;
|
|
|
|
else
|
|
|
|
return (node->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Case 3: There is no next node */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_rbtree_next_full (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBTree **new_tree,
|
|
|
|
GtkRBNode **new_node)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
g_return_if_fail (new_tree != NULL);
|
|
|
|
g_return_if_fail (new_node != NULL);
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
{
|
|
|
|
*new_tree = node->children;
|
|
|
|
*new_node = (*new_tree)->root;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil ((*new_node)->left))
|
2000-10-05 01:04:57 +00:00
|
|
|
*new_node = (*new_node)->left;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
*new_tree = tree;
|
|
|
|
*new_node = _gtk_rbtree_next (tree, node);
|
|
|
|
|
|
|
|
while ((*new_node == NULL) &&
|
|
|
|
(*new_tree != NULL))
|
|
|
|
{
|
|
|
|
*new_node = (*new_tree)->parent_node;
|
|
|
|
*new_tree = (*new_tree)->parent_tree;
|
|
|
|
if (*new_tree)
|
|
|
|
*new_node = _gtk_rbtree_next (*new_tree, *new_node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_rbtree_prev_full (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBTree **new_tree,
|
|
|
|
GtkRBNode **new_node)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
g_return_if_fail (new_tree != NULL);
|
|
|
|
g_return_if_fail (new_node != NULL);
|
|
|
|
|
|
|
|
*new_tree = tree;
|
|
|
|
*new_node = _gtk_rbtree_prev (tree, node);
|
|
|
|
|
|
|
|
if (*new_node == NULL)
|
|
|
|
{
|
|
|
|
*new_node = (*new_tree)->parent_node;
|
|
|
|
*new_tree = (*new_tree)->parent_tree;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while ((*new_node)->children)
|
|
|
|
{
|
|
|
|
*new_tree = (*new_node)->children;
|
|
|
|
*new_node = (*new_tree)->root;
|
2011-11-22 01:17:05 +00:00
|
|
|
while (!_gtk_rbtree_is_nil ((*new_node)->right))
|
2000-10-05 01:04:57 +00:00
|
|
|
*new_node = (*new_node)->right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
gint
|
|
|
|
_gtk_rbtree_get_depth (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
GtkRBTree *tmp_tree;
|
|
|
|
gint depth = 0;
|
|
|
|
|
|
|
|
tmp_tree = tree->parent_tree;
|
|
|
|
while (tmp_tree)
|
|
|
|
{
|
|
|
|
++depth;
|
|
|
|
tmp_tree = tmp_tree->parent_tree;
|
|
|
|
}
|
|
|
|
|
|
|
|
return depth;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
static void
|
|
|
|
_gtk_rbtree_traverse_pre_order (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBTreeTraverseFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
(* func) (tree, node, data);
|
|
|
|
_gtk_rbtree_traverse_pre_order (tree, node->left, func, data);
|
|
|
|
_gtk_rbtree_traverse_pre_order (tree, node->right, func, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_traverse_post_order (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
GtkRBTreeTraverseFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2000-10-05 01:04:57 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
_gtk_rbtree_traverse_post_order (tree, node->left, func, data);
|
|
|
|
_gtk_rbtree_traverse_post_order (tree, node->right, func, data);
|
|
|
|
(* func) (tree, node, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_rbtree_traverse (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
GTraverseType order,
|
|
|
|
GtkRBTreeTraverseFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
g_return_if_fail (func != NULL);
|
|
|
|
g_return_if_fail (order <= G_LEVEL_ORDER);
|
|
|
|
|
|
|
|
switch (order)
|
|
|
|
{
|
|
|
|
case G_PRE_ORDER:
|
|
|
|
_gtk_rbtree_traverse_pre_order (tree, node, func, data);
|
|
|
|
break;
|
|
|
|
case G_POST_ORDER:
|
|
|
|
_gtk_rbtree_traverse_post_order (tree, node, func, data);
|
|
|
|
break;
|
|
|
|
case G_IN_ORDER:
|
|
|
|
case G_LEVEL_ORDER:
|
|
|
|
default:
|
|
|
|
g_warning ("unsupported traversal order.");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
static inline
|
|
|
|
void _fixup_validation (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
|
|
|
|
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) ||
|
2011-11-22 01:17:05 +00:00
|
|
|
(!_gtk_rbtree_is_nil (node->left) && GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
|
|
|
(!_gtk_rbtree_is_nil (node->right) && GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
2001-12-08 01:10:52 +00:00
|
|
|
(node->children != NULL && GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID)))
|
|
|
|
{
|
|
|
|
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-10 21:24:15 +00:00
|
|
|
static inline
|
2011-11-16 03:14:00 +00:00
|
|
|
void _fixup_total_count (GtkRBTree *tree,
|
2001-12-10 21:24:15 +00:00
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count = 1 +
|
|
|
|
(node->children != NULL ? node->children->root->total_count : 0) +
|
|
|
|
node->left->total_count + node->right->total_count;
|
2001-12-10 21:24:15 +00:00
|
|
|
}
|
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
static guint
|
2011-11-16 03:14:00 +00:00
|
|
|
get_total_count (GtkRBNode *node)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
guint child_total = 0;
|
|
|
|
|
2011-11-16 03:14:00 +00:00
|
|
|
child_total += (guint) node->left->total_count;
|
|
|
|
child_total += (guint) node->right->total_count;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
if (node->children)
|
2011-11-16 03:14:00 +00:00
|
|
|
child_total += (guint) node->children->root->total_count;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-07-07 06:48:06 +00:00
|
|
|
return child_total + 1;
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
static guint
|
2011-11-16 03:14:00 +00:00
|
|
|
count_total (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
{
|
|
|
|
guint res;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
res =
|
2011-11-16 03:14:00 +00:00
|
|
|
count_total (tree, node->left) +
|
|
|
|
count_total (tree, node->right) +
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
(guint)1 +
|
2011-11-16 03:14:00 +00:00
|
|
|
(node->children ? count_total (node->children, node->children->root) : 0);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-16 03:14:00 +00:00
|
|
|
if (res != node->total_count)
|
|
|
|
g_print ("total count incorrect for node\n");
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2011-11-16 03:14:00 +00:00
|
|
|
if (get_total_count (node) != node->total_count)
|
|
|
|
g_error ("Node has incorrect total count %u, should be %u", node->total_count, get_total_count (node));
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
return res;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:22:34 +00:00
|
|
|
static gint
|
|
|
|
_count_nodes (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
|
|
|
gint res;
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (node))
|
2010-04-12 19:22:34 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
g_assert (node->left);
|
|
|
|
g_assert (node->right);
|
|
|
|
|
|
|
|
res = (_count_nodes (tree, node->left) +
|
|
|
|
_count_nodes (tree, node->right) + 1);
|
|
|
|
|
|
|
|
if (res != node->count)
|
|
|
|
g_print ("Tree failed\n");
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
static void
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test_height (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
gint computed_offset = 0;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
/* This whole test is sort of a useless truism. */
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
computed_offset += node->left->offset;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
computed_offset += node->right->offset;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (node->children && !_gtk_rbtree_is_nil (node->children->root))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
computed_offset += node->children->root->offset;
|
|
|
|
|
|
|
|
if (GTK_RBNODE_GET_HEIGHT (node) + computed_offset != node->offset)
|
|
|
|
g_error ("node has broken offset\n");
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test_height (tree, node->left);
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test_height (tree, node->right);
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (node->children && !_gtk_rbtree_is_nil (node->children->root))
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test_height (node->children, node->children->root);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
static void
|
|
|
|
_gtk_rbtree_test_dirty (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
gint expected_dirtyness)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (expected_dirtyness)
|
|
|
|
{
|
|
|
|
g_assert (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) ||
|
|
|
|
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
|
2011-11-22 01:17:05 +00:00
|
|
|
(!_gtk_rbtree_is_nil (node->left) && GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
|
|
|
(!_gtk_rbtree_is_nil (node->right) && GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID)) ||
|
2001-12-08 01:10:52 +00:00
|
|
|
(node->children && GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_assert (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) &&
|
|
|
|
! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID));
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2001-12-08 01:10:52 +00:00
|
|
|
g_assert (! GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID));
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2001-12-08 01:10:52 +00:00
|
|
|
g_assert (! GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID));
|
|
|
|
if (node->children != NULL)
|
|
|
|
g_assert (! GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID));
|
|
|
|
}
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test_dirty (tree, node->left, GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID));
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test_dirty (tree, node->right, GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID));
|
2011-11-22 01:17:05 +00:00
|
|
|
if (node->children != NULL && !_gtk_rbtree_is_nil (node->children->root))
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test_dirty (node->children, node->children->root, GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _gtk_rbtree_test_structure (GtkRBTree *tree);
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_test_structure_helper (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node)
|
|
|
|
{
|
2011-11-22 01:17:05 +00:00
|
|
|
g_assert (!_gtk_rbtree_is_nil (node));
|
2001-12-08 01:10:52 +00:00
|
|
|
|
|
|
|
g_assert (node->left != NULL);
|
|
|
|
g_assert (node->right != NULL);
|
|
|
|
g_assert (node->parent != NULL);
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
g_assert (node->left->parent == node);
|
|
|
|
_gtk_rbtree_test_structure_helper (tree, node->left);
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2001-12-08 01:10:52 +00:00
|
|
|
{
|
|
|
|
g_assert (node->right->parent == node);
|
|
|
|
_gtk_rbtree_test_structure_helper (tree, node->right);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->children != NULL)
|
|
|
|
{
|
|
|
|
g_assert (node->children->parent_tree == tree);
|
|
|
|
g_assert (node->children->parent_node == node);
|
|
|
|
|
|
|
|
_gtk_rbtree_test_structure (node->children);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
_gtk_rbtree_test_structure (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
g_assert (tree->root);
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (tree->root))
|
2001-12-10 21:24:15 +00:00
|
|
|
return;
|
2001-12-08 01:10:52 +00:00
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
g_assert (_gtk_rbtree_is_nil (tree->root->parent));
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test_structure_helper (tree, tree->root);
|
|
|
|
}
|
2010-04-12 19:22:34 +00:00
|
|
|
|
2011-11-21 15:59:37 +00:00
|
|
|
static void
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
_gtk_rbtree_test (const gchar *where,
|
|
|
|
GtkRBTree *tree)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
GtkRBTree *tmp_tree;
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
if (tree == NULL)
|
|
|
|
return;
|
|
|
|
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
/* Test the entire tree */
|
|
|
|
tmp_tree = tree;
|
|
|
|
while (tmp_tree->parent_tree)
|
|
|
|
tmp_tree = tmp_tree->parent_tree;
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (tmp_tree->root))
|
2001-12-10 21:24:15 +00:00
|
|
|
return;
|
2001-12-08 01:10:52 +00:00
|
|
|
|
|
|
|
_gtk_rbtree_test_structure (tmp_tree);
|
|
|
|
|
|
|
|
g_assert ((_count_nodes (tmp_tree, tmp_tree->root->left) +
|
|
|
|
_count_nodes (tmp_tree, tmp_tree->root->right) + 1) == tmp_tree->root->count);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_test_height (tmp_tree, tmp_tree->root);
|
|
|
|
_gtk_rbtree_test_dirty (tmp_tree, tmp_tree->root, GTK_RBNODE_FLAG_SET (tmp_tree->root, GTK_RBNODE_DESCENDANTS_INVALID));
|
2011-11-16 03:14:00 +00:00
|
|
|
g_assert (count_total (tmp_tree, tmp_tree->root) == tmp_tree->root->total_count);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2001-12-08 01:10:52 +00:00
|
|
|
static void
|
|
|
|
_gtk_rbtree_debug_spew_helper (GtkRBTree *tree,
|
|
|
|
GtkRBNode *node,
|
|
|
|
gint depth)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
g_print ("\t");
|
|
|
|
|
2002-05-16 19:11:43 +00:00
|
|
|
g_print ("(%p - %s) (Offset %d) (Parity %d) (Validity %d%d%d)\n",
|
|
|
|
node,
|
2001-12-08 01:10:52 +00:00
|
|
|
(GTK_RBNODE_GET_COLOR (node) == GTK_RBNODE_BLACK)?"BLACK":" RED ",
|
2001-12-08 20:14:15 +00:00
|
|
|
node->offset,
|
2011-11-16 03:14:00 +00:00
|
|
|
node->total_count,
|
2001-12-08 01:10:52 +00:00
|
|
|
(GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_DESCENDANTS_INVALID))?1:0,
|
|
|
|
(GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID))?1:0,
|
|
|
|
(GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))?1:0);
|
2001-12-10 21:24:15 +00:00
|
|
|
if (node->children != NULL)
|
|
|
|
{
|
|
|
|
g_print ("Looking at child.\n");
|
|
|
|
_gtk_rbtree_debug_spew (node->children);
|
|
|
|
g_print ("Done looking at child.\n");
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->left))
|
2001-12-10 21:24:15 +00:00
|
|
|
{
|
|
|
|
_gtk_rbtree_debug_spew_helper (tree, node->left, depth+1);
|
|
|
|
}
|
2011-11-22 01:17:05 +00:00
|
|
|
if (!_gtk_rbtree_is_nil (node->right))
|
2001-12-10 21:24:15 +00:00
|
|
|
{
|
|
|
|
_gtk_rbtree_debug_spew_helper (tree, node->right, depth+1);
|
|
|
|
}
|
2001-12-08 01:10:52 +00:00
|
|
|
}
|
|
|
|
|
2011-11-21 15:59:37 +00:00
|
|
|
static void
|
2001-12-08 01:10:52 +00:00
|
|
|
_gtk_rbtree_debug_spew (GtkRBTree *tree)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree != NULL);
|
|
|
|
|
2011-11-22 01:17:05 +00:00
|
|
|
if (_gtk_rbtree_is_nil (tree->root))
|
2001-12-10 21:24:15 +00:00
|
|
|
g_print ("Empty tree...\n");
|
|
|
|
else
|
|
|
|
_gtk_rbtree_debug_spew_helper (tree, tree->root, 0);
|
2001-12-08 01:10:52 +00:00
|
|
|
}
|
2002-05-16 19:11:43 +00:00
|
|
|
#endif /* G_ENABLE_DEBUG */
|