X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpspp-sheet-view.c;h=d13d995efd3547c5a2825120894a9a630a691dfc;hb=766df5faec86f167a9dd9dbc90bd511ad1567b3b;hp=ccdbd10e9919b5d61cbc059bd6d4c7284c66e277;hpb=e2da62d735c597afeef2e0e9b36e5a4a83d7da94;p=pspp diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index ccdbd10e99..d13d995efd 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -1979,12 +1979,6 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget, pspp_sheet_view_column_size_allocate (column, &col_allocation); - if (span_intersects (col_allocation.x, col_allocation.width, - gtk_adjustment_get_value (tree_view->priv->hadjustment), - allocation.width) - && gtk_widget_get_realized (widget)) - pspp_sheet_view_column_set_need_button (column, TRUE); - if (column->window) gdk_window_move_resize (column->window, col_allocation.x + (rtl ? 0 : col_allocation.width) - TREE_VIEW_DRAG_WIDTH/2, @@ -3862,9 +3856,9 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView *tree_view, * KEEP IN SYNC WITH pspp_sheet_view_create_row_drag_icon()! * FIXME: It's not... */ -static gboolean -pspp_sheet_view_bin_expose (GtkWidget *widget, - cairo_t *cr) +static void +pspp_sheet_view_draw_bin (GtkWidget *widget, + cairo_t *cr) { PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); GtkTreePath *path; @@ -3900,6 +3894,9 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, GtkAllocation allocation; gtk_widget_get_allocation (widget, &allocation); + GdkRectangle exposed_rect; + gdk_cairo_get_clip_rectangle (cr, &exposed_rect); + Zarea.x = 0; Zarea.y = 0; Zarea.height = allocation.height; @@ -3917,13 +3914,13 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, if (tree_view->priv->row_count == 0) { draw_empty_focus (tree_view); - return TRUE; + return; } #if GTK3_TRANSITION /* clip event->area to the visible area */ if (Zarea.height < 0.5) - return TRUE; + return; #endif validate_visible_area (tree_view); @@ -3954,7 +3951,7 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, } if (node < 0) - return TRUE; + return; /* find the path for the node */ path = _pspp_sheet_view_find_path ((PsppSheetView *)widget, node); @@ -4137,11 +4134,14 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, #if GTK3_TRANSITION if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT) +#else + if (!gdk_rectangle_intersect (&background_area, &exposed_rect, NULL)) +#endif { cell_offset += column->width; continue; } -#endif + pspp_sheet_view_column_cell_set_cell_data (column, tree_view->priv->model, @@ -4441,7 +4441,7 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, done = TRUE; /* Sanity Check! */ - TREE_VIEW_INTERNAL_ASSERT (has_next, FALSE); + TREE_VIEW_INTERNAL_ASSERT_VOID (has_next); } else goto done; @@ -4477,7 +4477,7 @@ done: if (drag_dest_path) gtk_tree_path_free (drag_dest_path); - return FALSE; + return; } @@ -4486,17 +4486,14 @@ pspp_sheet_view_draw (GtkWidget *widget, cairo_t *cr) { PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget); - GtkAllocation allocation; - gtk_widget_get_allocation (widget, &allocation); if (gtk_cairo_should_draw_window (cr, tree_view->priv->bin_window)) { - gboolean retval; GList *tmp_list; cairo_save (cr); - cairo_translate (cr, 0, gdk_window_get_height (tree_view->priv->header_window)); - retval = pspp_sheet_view_bin_expose (widget, cr); + gtk_cairo_transform_to_window(cr,widget,tree_view->priv->bin_window); + pspp_sheet_view_draw_bin (widget, cr); cairo_restore (cr); /* We can't just chain up to Container::expose as it will try to send the @@ -4511,26 +4508,12 @@ pspp_sheet_view_draw (GtkWidget *widget, gtk_container_propagate_draw (GTK_CONTAINER (tree_view), child->widget, cr); } - - return retval; } - else if (gtk_cairo_should_draw_window (cr, tree_view->priv->header_window)) + if (gtk_cairo_should_draw_window (cr, tree_view->priv->header_window)) { gint n_visible_columns; GList *list; - gtk_paint_flat_box (gtk_widget_get_style (widget), - cr, - GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - widget, - "cell_odd", - allocation.x, - allocation.y, - allocation.width, - allocation.height - ); - for (list = tree_view->priv->columns; list != NULL; list = list->next) { PsppSheetViewColumn *column = list->data; @@ -4539,7 +4522,8 @@ pspp_sheet_view_draw (GtkWidget *widget, continue; if (span_intersects (column->allocation.x, column->allocation.width, - allocation.x, allocation.width) + (int) gtk_adjustment_get_value (tree_view->priv->hadjustment), + (int) gtk_widget_get_allocated_width (widget)) && column->button != NULL) gtk_container_propagate_draw (GTK_CONTAINER (tree_view), column->button, cr); @@ -4552,21 +4536,21 @@ pspp_sheet_view_draw (GtkWidget *widget, continue; n_visible_columns ++; } + cairo_save (cr); + gtk_cairo_transform_to_window(cr,widget,tree_view->priv->header_window); pspp_sheet_view_draw_vertical_grid_lines (tree_view, cr, n_visible_columns, - allocation.y, - allocation.height); - - return TRUE; + 0, + TREE_VIEW_HEADER_HEIGHT (tree_view)); + cairo_restore (cr); } - else if (gtk_cairo_should_draw_window (cr, tree_view->priv->drag_window)) + if (tree_view->priv->drag_window && + gtk_cairo_should_draw_window (cr, tree_view->priv->drag_window)) { gtk_container_propagate_draw (GTK_CONTAINER (tree_view), tree_view->priv->drag_column->button, cr); - - return TRUE; } return FALSE; @@ -6723,13 +6707,6 @@ pspp_sheet_view_focus_column (PsppSheetView *tree_view, g_return_if_fail (focus_column != NULL); tree_view->priv->focus_column = focus_column; - if (!focus_column->button) - { - pspp_sheet_view_column_set_need_button (focus_column, TRUE); - // g_return_if_fail (focus_column->button != NULL); - if (focus_column->button == NULL) - return; - } if (gtk_container_get_focus_child (GTK_CONTAINER (tree_view)) != focus_column->button) gtk_widget_grab_focus (focus_column->button); @@ -6860,7 +6837,6 @@ pspp_sheet_view_header_focus (PsppSheetView *tree_view, if (column->visible && pspp_sheet_view_column_can_focus (column)) { - pspp_sheet_view_column_set_need_button (column, TRUE); if (column->button) { pspp_sheet_view_focus_column (tree_view, column, @@ -9003,23 +8979,6 @@ pspp_sheet_view_adjustment_changed (GtkAdjustment *adjustment, if (!tree_view->priv->in_top_row_to_dy) pspp_sheet_view_dy_to_top_row (tree_view); } - - for (list = tree_view->priv->columns; list; list = list->next) - { - PsppSheetViewColumn *column = list->data; - GtkAllocation *col_allocation = &column->allocation; - GtkAllocation widget_allocation; - gtk_widget_get_allocation (GTK_WIDGET (tree_view), &widget_allocation); - - if (span_intersects (col_allocation->x, col_allocation->width, - gtk_adjustment_get_value (tree_view->priv->hadjustment), - widget_allocation.width)) - { - pspp_sheet_view_column_set_need_button (column, TRUE); - if (!column->button) - pspp_sheet_view_column_update_button (column); - } - } } }