X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpspp-sheet-view.c;h=65b15fe574e937d588d74b90f167373ff1d4801c;hb=df285deec9fba4c1b78d9a8bcb199050fc563f4b;hp=9de116ce9e3650c71a12a4273e666130cd947b14;hpb=736604e671564634e89a8acb73c1532c1736fee3;p=pspp diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index 9de116ce9e..65b15fe574 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -1770,7 +1770,9 @@ pspp_sheet_view_size_request (GtkWidget *widget, tmp_list = tmp_list->next; if (gtk_widget_get_visible (child->widget)) - gtk_widget_size_request (child->widget, &child_requisition); + { + gtk_widget_get_preferred_size (child->widget, NULL, &child_requisition); + } } } @@ -2030,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 @@ -3823,36 +3828,35 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView *tree_view, gint max_y) { GList *list = tree_view->priv->columns; - gint i = 0; - gint current_x = 0; + gint x = 0; if (tree_view->priv->grid_lines != PSPP_SHEET_VIEW_GRID_LINES_VERTICAL && tree_view->priv->grid_lines != PSPP_SHEET_VIEW_GRID_LINES_BOTH) 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 (GTK_WIDGET (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; if (! column->visible) continue; - current_x += column->width; - - /* Generally the grid lines should fit within the column, but for the - last visible column we put it just past the end of the column. - (Otherwise horizontal grid lines sometimes stick out by one pixel.) */ - x = current_x; - if (i != n_visible_columns - 1) - x--; + if (!rtl) + x += column->width; cairo_set_line_width (cr, 1.0); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); cairo_move_to (cr, x + 0.5, min_y); - cairo_line_to (cr, x + 0.5, max_y - min_y); + cairo_line_to (cr, x + 0.5, max_y - min_y - 0.5); cairo_stroke (cr); + + if (rtl) + x += column->width; } } @@ -5125,7 +5129,6 @@ validate_visible_area (PsppSheetView *tree_view) GtkTreePath *above_path = NULL; GtkTreeIter iter; int node = -1; - gboolean size_changed = FALSE; gint total_height; gint area_above = 0; gint area_below = 0; @@ -5299,23 +5302,6 @@ validate_visible_area (PsppSheetView *tree_view) pspp_sheet_view_set_top_row (tree_view, above_path, -area_above); pspp_sheet_view_top_row_to_dy (tree_view); - /* update width/height and queue a resize */ - if (size_changed) - { - GtkRequisition requisition; - - /* We temporarily guess a size, under the assumption that it will be the - * same when we get our next size_allocate. If we don't do this, we'll be - * in an inconsistent state if we call top_row_to_dy. */ - - gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition); - gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->hadjustment), (gfloat)requisition.width)); - gtk_adjustment_set_upper (tree_view->priv->vadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), (gfloat)requisition.height)); - gtk_adjustment_changed (tree_view->priv->hadjustment); - gtk_adjustment_changed (tree_view->priv->vadjustment); - gtk_widget_queue_resize (GTK_WIDGET (tree_view)); - } - gtk_tree_row_reference_free (tree_view->priv->scroll_to_path); tree_view->priv->scroll_to_path = NULL; @@ -5386,7 +5372,7 @@ do_presize_handler (PsppSheetView *tree_view) if (! gtk_widget_get_realized (GTK_WIDGET (tree_view))) return FALSE; - gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition); + gtk_widget_get_preferred_size (GTK_WIDGET (tree_view), NULL, &requisition); gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->hadjustment), (gfloat)requisition.width)); gtk_adjustment_set_upper (tree_view->priv->vadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), (gfloat)requisition.height));