-void
-gtk_sheet_clip_range (GtkSheet *sheet, const GtkSheetRange *range)
-{
-
- g_return_if_fail (sheet != NULL);
- g_return_if_fail (GTK_IS_SHEET (sheet));
-
- if (GTK_SHEET_IN_CLIP (sheet)) return;
-
- GTK_SHEET_SET_FLAGS (sheet, GTK_SHEET_IN_CLIP);
-
- if (range == NULL)
- sheet->clip_range = sheet->range;
- else
- sheet->clip_range=*range;
-
- sheet->interval = 0;
- sheet->clip_timer = g_timeout_add (TIMEOUT_FLASH, gtk_sheet_flash, sheet);
-
- g_signal_emit (G_OBJECT (sheet), sheet_signals[CLIP_RANGE], 0,
- &sheet->clip_range);
-}
-
-void
-gtk_sheet_unclip_range (GtkSheet *sheet)
-{
-
- g_return_if_fail (sheet != NULL);
- g_return_if_fail (GTK_IS_SHEET (sheet));
-
- if (!GTK_SHEET_IN_CLIP (sheet)) return;
-
- GTK_SHEET_UNSET_FLAGS (sheet, GTK_SHEET_IN_CLIP);
-
- g_source_remove (sheet->clip_timer);
- gtk_sheet_range_draw (sheet, &sheet->clip_range);
-
- if (gtk_sheet_range_isvisible (sheet, sheet->range))
- gtk_sheet_range_draw (sheet, &sheet->range);
-}
-
-gboolean
-gtk_sheet_in_clip (GtkSheet *sheet)
-{
- g_return_val_if_fail (sheet != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SHEET (sheet), FALSE);
-
- return GTK_SHEET_IN_CLIP (sheet);
-}
-
-static gint
-gtk_sheet_flash (gpointer data)
-{
- GtkSheet *sheet;
- gint x,y,width,height;
- GdkRectangle clip_area;
-
- sheet = GTK_SHEET (data);
-
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (sheet))) return TRUE;
- if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (sheet))) return TRUE;
- if (!gtk_sheet_range_isvisible (sheet, sheet->clip_range)) return TRUE;
- if (GTK_SHEET_IN_XDRAG (sheet)) return TRUE;
- if (GTK_SHEET_IN_YDRAG (sheet)) return TRUE;
-
- GDK_THREADS_ENTER ();
-
- x = COLUMN_LEFT_XPIXEL (sheet,sheet->clip_range.col0)+1;
- y = ROW_TOP_YPIXEL (sheet,sheet->clip_range.row0)+1;
- width = COLUMN_LEFT_XPIXEL (sheet,sheet->clip_range.coli)- x+
- xxx_column_width (sheet, sheet->clip_range.coli) - 1;
- height = ROW_TOP_YPIXEL (sheet,sheet->clip_range.rowi)- y+
- yyy_row_height (sheet, sheet->clip_range.rowi)- 1;
-
- clip_area.x = COLUMN_LEFT_XPIXEL (sheet, MIN_VISIBLE_COLUMN (sheet));
- clip_area.y = ROW_TOP_YPIXEL (sheet, MIN_VISIBLE_ROW (sheet));
- clip_area.width = sheet->sheet_window_width;
- clip_area.height = sheet->sheet_window_height;
-
- if (x < 0)
- {
- width += x + 1;
- x =- 1;
- }
- if (width > clip_area.width) width = clip_area.width + 10;
- if (y < 0)
- {
- height += y + 1;
- y =- 1;
- }
- if (height > clip_area.height) height = clip_area.height + 10;
-
- gdk_draw_pixmap (sheet->sheet_window,
- GTK_WIDGET (sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- x, y,
- x, y,
- 1, height);
-
- gdk_draw_pixmap (sheet->sheet_window,
- GTK_WIDGET (sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- x, y,
- x, y,
- width, 1);
-
- gdk_draw_pixmap (sheet->sheet_window,
- GTK_WIDGET (sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- x, y + height,
- x, y + height,
- width, 1);
-
- gdk_draw_pixmap (sheet->sheet_window,
- GTK_WIDGET (sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- x + width, y,
- x + width, y,
- 1, height);
-
-
- sheet->interval = sheet->interval + 1;
- if (sheet->interval == TIME_INTERVAL) sheet->interval = 0;
-
- gdk_gc_set_dashes (sheet->xor_gc, sheet->interval, (gint8*)"\4\4", 2);
- gtk_sheet_draw_flashing_range (sheet,sheet->clip_range);
- gdk_gc_set_dashes (sheet->xor_gc, 0, (gint8*)"\4\4", 2);
-
- GDK_THREADS_LEAVE ();
-
- return TRUE;
-}
-
-static void
-gtk_sheet_draw_flashing_range (GtkSheet *sheet, GtkSheetRange range)
-{
- GdkRectangle clip_area;
- gint x,y,width,height;
-
- if (!gtk_sheet_range_isvisible (sheet, sheet->clip_range)) return;
-
- clip_area.x = COLUMN_LEFT_XPIXEL (sheet, MIN_VISIBLE_COLUMN (sheet));
- clip_area.y = ROW_TOP_YPIXEL (sheet, MIN_VISIBLE_ROW (sheet));
- clip_area.width = sheet->sheet_window_width;
- clip_area.height = sheet->sheet_window_height;
-
- gdk_gc_set_clip_rectangle (sheet->xor_gc, &clip_area);
-
- x = COLUMN_LEFT_XPIXEL (sheet,sheet->clip_range.col0)+1;
- y = ROW_TOP_YPIXEL (sheet,sheet->clip_range.row0)+1;
- width = COLUMN_LEFT_XPIXEL (sheet,sheet->clip_range.coli)- x+
- xxx_column_width (sheet, sheet->clip_range.coli) - 1;
- height = ROW_TOP_YPIXEL (sheet,sheet->clip_range.rowi)- y+
- yyy_row_height (sheet, sheet->clip_range.rowi)- 1;
-
- if (x < 0)
- {
- width += x + 1;
- x =- 1;
- }
- if (width > clip_area.width) width = clip_area.width + 10;
- if (y < 0)
- {
- height += y + 1;
- y =- 1;
- }
- if (height > clip_area.height) height = clip_area.height + 10;
-
- gdk_gc_set_line_attributes (sheet->xor_gc, 1, 1, 0, 0 );
-
- gdk_draw_rectangle (sheet->sheet_window, sheet->xor_gc, FALSE,
- x, y,
- width, height);
-
- gdk_gc_set_line_attributes (sheet->xor_gc, 1, 0, 0, 0);
-
- gdk_gc_set_clip_rectangle (sheet->xor_gc, NULL);
-}