bnc447004 - Flip tree lines around in the right-to-left case

2008-11-29  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtktreeview.c (gtk_tree_view_bin_expose): If tree lines are
	enabled, flip them around for the right-to-left case.  Fixes
	https://bugzilla.novell.com/show_bug.cgi?id=447004.  Patch by
	Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>

Signed-off-by: Federico Mena Quintero <federico@novell.com>

svn path=/trunk/; revision=21829
This commit is contained in:
Federico Mena Quintero 2008-11-29 22:15:37 +00:00 committed by Federico Mena Quintero
parent eed26b2f0d
commit d9c8224a91
2 changed files with 36 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2008-11-29 Federico Mena Quintero <federico@novell.com>
* gtk/gtktreeview.c (gtk_tree_view_bin_expose): If tree lines are
enabled, flip them around for the right-to-left case. Fixes
https://bugzilla.novell.com/show_bug.cgi?id=447004. Patch by
Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>
2008-11-29 Christian Persch <chpe@gnome.org> 2008-11-29 Christian Persch <chpe@gnome.org>
* gtk/gtkselection.c: Typo fix. * gtk/gtkselection.c: Typo fix.

View File

@ -4572,24 +4572,33 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
if (gtk_tree_view_is_expander_column (tree_view, column) && if (gtk_tree_view_is_expander_column (tree_view, column) &&
tree_view->priv->tree_lines_enabled) tree_view->priv->tree_lines_enabled)
{ {
gint x = background_area.x;
gint mult = rtl ? -1 : 1;
gint y0 = background_area.y;
gint y1 = background_area.y + background_area.height/2;
gint y2 = background_area.y + background_area.height;
if (rtl)
x += background_area.width - 1;
if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT
&& depth > 1) && depth > 1)
{ {
gdk_draw_line (event->window, gdk_draw_line (event->window,
tree_view->priv->tree_line_gc, tree_view->priv->tree_line_gc,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y + background_area.height / 2, y1,
background_area.x + tree_view->priv->expander_size * (depth - 1.1), x + tree_view->priv->expander_size * (depth - 1.1) * mult,
background_area.y + background_area.height / 2); y1);
} }
else if (depth > 1) else if (depth > 1)
{ {
gdk_draw_line (event->window, gdk_draw_line (event->window,
tree_view->priv->tree_line_gc, tree_view->priv->tree_line_gc,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y + background_area.height / 2, y1,
background_area.x + tree_view->priv->expander_size * (depth - 0.5), x + tree_view->priv->expander_size * (depth - 0.5) * mult,
background_area.y + background_area.height / 2); y1);
} }
if (depth > 1) if (depth > 1)
@ -4601,17 +4610,17 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
if (!_gtk_rbtree_next (tree, node)) if (!_gtk_rbtree_next (tree, node))
gdk_draw_line (event->window, gdk_draw_line (event->window,
tree_view->priv->tree_line_gc, tree_view->priv->tree_line_gc,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y, y0,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y + background_area.height / 2); y1);
else else
gdk_draw_line (event->window, gdk_draw_line (event->window,
tree_view->priv->tree_line_gc, tree_view->priv->tree_line_gc,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y, y0,
background_area.x + tree_view->priv->expander_size * (depth - 1.5), x + tree_view->priv->expander_size * (depth - 1.5) * mult,
background_area.y + background_area.height); y2);
tmp_node = tree->parent_node; tmp_node = tree->parent_node;
tmp_tree = tree->parent_tree; tmp_tree = tree->parent_tree;
@ -4621,10 +4630,10 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
if (_gtk_rbtree_next (tmp_tree, tmp_node)) if (_gtk_rbtree_next (tmp_tree, tmp_node))
gdk_draw_line (event->window, gdk_draw_line (event->window,
tree_view->priv->tree_line_gc, tree_view->priv->tree_line_gc,
background_area.x + tree_view->priv->expander_size * (i - 0.5), x + tree_view->priv->expander_size * (i - 0.5) * mult,
background_area.y, y0,
background_area.x + tree_view->priv->expander_size * (i - 0.5), x + tree_view->priv->expander_size * (i - 0.5) * mult,
background_area.y + background_area.height); y2);
tmp_node = tmp_tree->parent_node; tmp_node = tmp_tree->parent_node;
tmp_tree = tmp_tree->parent_tree; tmp_tree = tmp_tree->parent_tree;