r->x = psppire_axis_start_pixel (sheet->haxis, range->col0);
r->x -= round (sheet->hadjustment->value);
- if ( sheet->row_titles_visible)
- r->x += sheet->row_title_area.width;
-
-
r->y = psppire_axis_start_pixel (sheet->vaxis, range->row0);
r->y -= round (sheet->vadjustment->value);
- if ( sheet->column_titles_visible)
- r->y += sheet->column_title_area.height;
-
r->width = psppire_axis_start_pixel (sheet->haxis, range->coli) -
psppire_axis_start_pixel (sheet->haxis, range->col0) +
psppire_axis_unit_size (sheet->haxis, range->coli);
psppire_axis_start_pixel (sheet->vaxis, range->row0) +
psppire_axis_unit_size (sheet->vaxis, range->rowi);
+ if ( sheet->column_titles_visible)
+ {
+ r->y += sheet->column_title_area.height;
+ }
+
+ if ( sheet->row_titles_visible)
+ {
+ r->x += sheet->row_title_area.width;
+ }
+
return TRUE;
}
gint column);
-static void gtk_sheet_row_size_request (GtkSheet *sheet,
- gint row,
- guint *requisition);
-
-
/* Signals */
enum
{
redraw_range (GtkSheet *sheet, GtkSheetRange *range)
{
GdkRectangle rect;
-
+
if ( ! GTK_WIDGET_REALIZED (sheet))
return;
{
GdkRegion *r = gdk_drawable_get_visible_region (sheet->sheet_window);
gdk_region_get_clipbox (r, &rect);
+
+ if ( sheet->column_titles_visible)
+ {
+ rect.y += sheet->column_title_area.height;
+ rect.height -= sheet->column_title_area.height;
+ }
+
+ if ( sheet->row_titles_visible)
+ {
+ rect.x += sheet->row_title_area.width;
+ rect.width -= sheet->row_title_area.width;
+ }
}
gdk_window_invalidate_rect (sheet->sheet_window, &rect, FALSE);
if (sheet->vadjustment)
g_signal_emit_by_name (sheet->vadjustment,
"value_changed");
+
size_allocate_global_button (sheet);
+
+ if ( sheet->row_titles_visible)
+ gtk_widget_show (sheet->button);
}
if (sheet->hadjustment)
g_signal_emit_by_name (sheet->hadjustment,
"value_changed");
+
size_allocate_global_button (sheet);
+
+ if ( sheet->column_titles_visible)
+ gtk_widget_show (sheet->button);
}
void
{
if (sheet->column_title_window)
gdk_window_hide (sheet->column_title_window);
- if (GTK_WIDGET_VISIBLE (sheet->button))
- gtk_widget_hide (sheet->button);
+
+ gtk_widget_hide (sheet->button);
adjust_scrollbars (sheet);
}
if (sheet->row_title_window)
gdk_window_hide (sheet->row_title_window);
- if (GTK_WIDGET_VISIBLE (sheet->button))
- gtk_widget_hide (sheet->button);
+ gtk_widget_hide (sheet->button);
adjust_scrollbars (sheet);
}
if (row >= 0)
- {
- gint y = psppire_axis_start_pixel (sheet->vaxis, row);
+ {
+ gint y = psppire_axis_start_pixel (sheet->vaxis, row);
- gtk_adjustment_set_value (sheet->vadjustment, y - height * row_align);
- }
+ gtk_adjustment_set_value (sheet->vadjustment, y - height * row_align);
+ }
if (col >= 0)
- {
- gint x = psppire_axis_start_pixel (sheet->haxis, col);
+ {
+ gint x = psppire_axis_start_pixel (sheet->haxis, col);
- gtk_adjustment_set_value (sheet->hadjustment, x - width * col_align);
- }
+ gtk_adjustment_set_value (sheet->hadjustment, x - width * col_align);
+ }
}
{
sheet->button = gtk_button_new_with_label (" ");
+ GTK_WIDGET_UNSET_FLAGS(sheet->button, GTK_CAN_FOCUS);
+
g_object_ref_sink (sheet->button);
g_signal_connect (sheet->button,
allocation.height = sheet->column_title_area.height;
gtk_widget_size_allocate (sheet->button, &allocation);
- gtk_widget_show (sheet->button);
}
static void
gtk_widget_map (sheet->entry_widget);
}
- if (GTK_WIDGET_VISIBLE (sheet->button) &&
- !GTK_WIDGET_MAPPED (sheet->button))
+ if (!GTK_WIDGET_MAPPED (sheet->button))
{
gtk_widget_show (sheet->button);
gtk_widget_map (sheet->button);
}
- if (GTK_BIN (sheet->button)->child)
- if (GTK_WIDGET_VISIBLE (GTK_BIN (sheet->button)->child) &&
- !GTK_WIDGET_MAPPED (GTK_BIN (sheet->button)->child))
- gtk_widget_map (GTK_BIN (sheet->button)->child);
-
redraw_range (sheet, NULL);
change_active_cell (sheet,
sheet->active_cell.row,
if ( gtk_sheet_get_pixel_info (sheet, x, y, &row, &column) )
{
- if (sheet->row_title_under)
+ if (sheet->row_title_under && row >= 0)
{
gchar *text = g_sheet_model_get_row_subtitle (sheet->model, row);
g_free (text);
}
- if (sheet->column_title_under)
+ if (sheet->column_title_under && column >= 0)
{
gchar *text = g_sheet_model_get_column_subtitle (sheet->model,
column);
if (sheet->column_titles_visible)
sheet->row_title_area.y += sheet->column_title_area.height;
-
if (GTK_WIDGET_REALIZED (widget) && sheet->column_titles_visible)
gdk_window_move_resize (sheet->column_title_window,
sheet->column_title_area.x,
sheet->row_title_area.width,
sheet->row_title_area.height);
+ size_allocate_global_button (sheet);
+
if (sheet->haxis)
{
gint width = sheet->column_title_area.width;
if (!GTK_WIDGET_DRAWABLE (sheet)) return;
- size_allocate_global_button (sheet);
-
draw_column_title_buttons_range (sheet, min_visible_column (sheet),
max_visible_column (sheet));
}
if (!GTK_WIDGET_DRAWABLE (sheet)) return;
- size_allocate_global_button (sheet);
-
-
draw_row_title_buttons_range (sheet, min_visible_row (sheet),
max_visible_row (sheet));
}
}
}
+/* Subtracts the region of WIDGET from REGION */
+static void
+subtract_widget_region (GdkRegion *region, GtkWidget *widget)
+{
+ GdkRectangle rect;
+ GdkRectangle intersect;
+ GdkRegion *region2;
+
+ gdk_region_get_clipbox (region, &rect);
+ gtk_widget_intersect (widget,
+ &rect,
+ &intersect);
+
+ region2 = gdk_region_rectangle (&intersect);
+ gdk_region_subtract (region, region2);
+ gdk_region_destroy (region2);
+}
+
static void
vadjustment_value_changed (GtkAdjustment *adjustment,
gpointer data)
region =
gdk_drawable_get_visible_region (GDK_DRAWABLE (sheet->sheet_window));
+ subtract_widget_region (region, sheet->button);
gdk_window_begin_paint_region (sheet->sheet_window, region);
draw_sheet_region (sheet, region);
draw_row_title_buttons (sheet);
- // size_allocate_global_button (sheet);
gtk_sheet_draw_active_cell (sheet);
gdk_window_end_paint (sheet->sheet_window);
region =
gdk_drawable_get_visible_region (GDK_DRAWABLE (sheet->sheet_window));
+ subtract_widget_region (region, sheet->button);
gdk_window_begin_paint_region (sheet->sheet_window, region);
draw_sheet_region (sheet, region);
draw_column_title_buttons (sheet);
- // size_allocate_global_button (sheet);
gtk_sheet_draw_active_cell (sheet);