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,
for (list = tree_view->priv->columns; list; list = list->next, i++)
{
PsppSheetViewColumn *column = list->data;
-
- /* We don't want a line for the last column */
- if (i == n_visible_columns - 1)
- break;
+ 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--;
+
cairo_set_line_width (cr, 1.0);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
- cairo_move_to (cr, current_x - 0.5, min_y);
- cairo_line_to (cr, current_x - 0.5 , max_y - min_y);
-
+ cairo_move_to (cr, x + 0.5, min_y);
+ cairo_line_to (cr, x + 0.5, max_y - min_y);
cairo_stroke (cr);
}
}
* 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;
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;
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);
}
if (node < 0)
- return TRUE;
+ return;
/* find the path for the node */
path = _pspp_sheet_view_find_path ((PsppSheetView *)widget, node);
#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,
#endif
}
- if (y_offset + max_height >= Zarea.height - 0.5)
+ if (y_offset + max_height <= Zarea.height - 0.5)
{
#if GTK3_TRANSITION
gdk_draw_line (event->window,
done = TRUE;
/* Sanity Check! */
- TREE_VIEW_INTERNAL_ASSERT (has_next, FALSE);
+ TREE_VIEW_INTERNAL_ASSERT_VOID (has_next);
}
else
goto done;
if (drag_dest_path)
gtk_tree_path_free (drag_dest_path);
- return FALSE;
+ return;
}
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
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;
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);
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;
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);
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,
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);
- }
- }
}
}