Correct the rendering of the data and variable sheets in RTL locales
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2015 20:26:51 +0000 (21:26 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2015 20:44:40 +0000 (21:44 +0100)
NEWS
src/ui/gui/pspp-sheet-view.c

diff --git a/NEWS b/NEWS
index f7deed7fa77106d0e3acdbd3d6942e6d8247960d..bb63af173b5d759c05d39c75cf5199123c6cbaf3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,9 @@ Changes from 0.8.5 to 0.9.0:
      For compatibility, the behavior that ESCAPE enabled is now the
      default and only supported behavior.
 
+   - Rendering of the variable and data sheets in right-to-left locales
+     now works properly.
+
 Changes from 0.8.4 to 0.8.5:
 
  * The FREQUENCIES and CROSSTABS commands can now generate barcharts.
index ad86bd69d8cf5b7e9952877d5ea715554c586d7d..79a1d5320afe487211dc4c70a5cbd8328fd27b51 100644 (file)
@@ -2032,6 +2032,9 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
   if (allocation->width != old_allocation.width)
     width_changed = TRUE;
 
+  if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)   
+    allocation->x += allocation->width - tree_view->priv->width ;
+
   gtk_widget_set_allocation (widget, allocation);
 
   /* We size-allocate the columns first because the width of the
@@ -3833,7 +3836,11 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView    *tree_view,
     return;
 
   /* Only draw the lines for visible rows and columns */
-  for (list = tree_view->priv->columns; list; list = list->next, i++)
+  gboolean rtl = (gtk_widget_get_direction (tree_view) == GTK_TEXT_DIR_RTL);
+
+  for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+       list;
+       list = (rtl ? list->prev : list->next))
     {
       PsppSheetViewColumn *column = list->data;
       gint x;