- size=area.width;
- area.x+=area.width;
- if(!gtk_sheet_clip_text(sheet)){
- for(i=col-1; i>=MIN_VISIBLE_COLUMN(sheet); i--){
- if( !gtk_sheet_cell_empty(sheet, row, i)) break;
- if(size>=text_width+CELLOFFSET) break;
- size+=xxx_column_width(sheet, i);
- xxx_column_set_right_column(sheet, i,
- MAX(col,
- xxx_column_right_column(sheet, i)));
- }
- area.width=size;
- }
- area.x-=size;
- xoffset+=area.width-text_width - 2 * CELLOFFSET -
- attributes.border.width/2;
- break;
- case GTK_JUSTIFY_CENTER:
- sizel=area.width/2;
- sizer=area.width/2;
- area.x+=area.width/2;
- if(!gtk_sheet_clip_text(sheet)){
- for(i=col+1; i<=MAX_VISIBLE_COLUMN(sheet); i++){
- if( ! gtk_sheet_cell_empty(sheet, row, i)) break;
- if(sizer>=text_width/2) break;
- sizer+= xxx_column_width(sheet, i);
- xxx_column_set_left_column(sheet, i,
- MIN(
- col,
- xxx_column_left_column(sheet, i)));
- }
- for(i=col-1; i>=MIN_VISIBLE_COLUMN(sheet); i--){
- if( ! gtk_sheet_cell_empty(sheet, row, i)) break;
- if(sizel>=text_width/2) break;
- sizel+=xxx_column_width(sheet, i);
- xxx_column_set_right_column(sheet, i,
- MAX(col,
- xxx_column_right_column(sheet, i)));
- }
- size=MIN(sizel, sizer);
- }
- area.x-=sizel;
- xoffset+= sizel - text_width/2 - CELLOFFSET;
- area.width=sizel+sizer;
- break;
- case GTK_JUSTIFY_LEFT:
- default:
- size=area.width;
- if(!gtk_sheet_clip_text(sheet)){
- for(i=col+1; i<=MAX_VISIBLE_COLUMN(sheet); i++){
- if(! gtk_sheet_cell_empty(sheet, row, i)) break;
- if(size>=text_width+CELLOFFSET) break;
- size+=xxx_column_width(sheet, i);
- xxx_column_set_left_column(sheet, i,
- MIN(
- col,
- xxx_column_left_column(sheet, i)));
-
- }
- area.width=size;
- }
- xoffset += attributes.border.width/2;
- break;
- }
-
- if(!gtk_sheet_clip_text(sheet)) clip_area = area;
- gdk_gc_set_clip_rectangle(fg_gc, &clip_area);
-
-
- gdk_draw_layout (sheet->pixmap, fg_gc,
- area.x + xoffset + CELLOFFSET,
- y,
- layout);
-
- gdk_gc_set_clip_rectangle(fg_gc, NULL);
- g_object_unref(G_OBJECT(layout));
-
- gdk_draw_pixmap(sheet->sheet_window,
- GTK_WIDGET(sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- area.x,
- area.y,
- area.x,
- area.y,
- area.width,
- area.height);
-
-}
-
-
-
-static void
-gtk_sheet_range_draw(GtkSheet *sheet, const GtkSheetRange *range)
-{
- gint i,j;
- GtkSheetRange drawing_range;
- GdkRectangle area;
-
- g_return_if_fail(sheet != NULL);
- g_return_if_fail(GTK_SHEET(sheet));
-
- if(!GTK_WIDGET_DRAWABLE(GTK_WIDGET(sheet))) return;
- if(!GTK_WIDGET_REALIZED(GTK_WIDGET(sheet))) return;
- if(!GTK_WIDGET_MAPPED(GTK_WIDGET(sheet))) return;
-
- if(range == NULL)
- {
- drawing_range.row0=MIN_VISIBLE_ROW(sheet);
- drawing_range.col0=MIN_VISIBLE_COLUMN(sheet);
- drawing_range.rowi=MIN(MAX_VISIBLE_ROW(sheet), yyy_row_count(sheet) - 1);
- drawing_range.coli=MAX_VISIBLE_COLUMN(sheet);
-
-
- gdk_draw_rectangle (sheet->pixmap,
- GTK_WIDGET(sheet)->style->white_gc,
- TRUE,
- 0,0,
- sheet->sheet_window_width,sheet->sheet_window_height);
-
- }
- else
- {
- drawing_range.row0=MAX(range->row0, MIN_VISIBLE_ROW(sheet));
- drawing_range.col0=MAX(range->col0, MIN_VISIBLE_COLUMN(sheet));
- drawing_range.rowi=MIN(range->rowi, MAX_VISIBLE_ROW(sheet));
- drawing_range.coli=MIN(range->coli, MAX_VISIBLE_COLUMN(sheet));
- }
-
-
- if(drawing_range.coli == xxx_column_count(sheet) - 1)
- {
- area.x=COLUMN_LEFT_XPIXEL(sheet,
- xxx_column_count(sheet) - 1) +
- xxx_column_width(sheet, xxx_column_count(sheet) - 1) + 1;
-
- area.y=0;
-
- gdk_gc_set_foreground(sheet->fg_gc, &sheet->bg_color);
-
- gdk_draw_rectangle (sheet->pixmap,
- sheet->fg_gc,
- TRUE,
- area.x,area.y,
- sheet->sheet_window_width - area.x,
- sheet->sheet_window_height);
-
- gdk_draw_pixmap(sheet->sheet_window,
- GTK_WIDGET(sheet)->style->fg_gc[GTK_STATE_NORMAL],
- sheet->pixmap,
- area.x,
- area.y,
- area.x,
- area.y,
- sheet->sheet_window_width - area.x,
- sheet->sheet_window_height);
- }
-
- if(drawing_range.rowi == yyy_row_count(sheet) - 1){
- area.x=0;
- area.y=ROW_TOP_YPIXEL(sheet,
- yyy_row_count(sheet) - 1) +
- yyy_row_height(sheet, yyy_row_count(sheet) - 1) + 1;
-
- gdk_gc_set_foreground(sheet->fg_gc, &sheet->bg_color);
+ size = area.width;
+ area.x +=area.width;
+ {
+ for (i = col - 1; i >= MIN_VISIBLE_COLUMN (sheet); i--)
+ {
+ if ( !gtk_sheet_cell_empty (sheet, row, i)) break;
+ if (size >= text_width + CELLOFFSET) break;
+ size +=xxx_column_width (sheet, i);
+ xxx_column_set_right_column (sheet, i,
+ MAX (col,
+ xxx_column_right_column (sheet, i)));
+ }
+ area.width = size;
+ }
+ area.x -= size;
+ xoffset += area.width - text_width - 2 * CELLOFFSET -
+ attributes.border.width / 2;
+ break;
+ case GTK_JUSTIFY_CENTER:
+ sizel = area.width / 2;
+ sizer = area.width / 2;
+ area.x += area.width / 2;
+ {
+ for (i = col + 1; i <= MAX_VISIBLE_COLUMN (sheet); i++)
+ {
+ if ( ! gtk_sheet_cell_empty (sheet, row, i)) break;
+ if (sizer >= text_width / 2) break;
+ sizer += xxx_column_width (sheet, i);
+ xxx_column_set_left_column (sheet, i,
+ MIN (
+ col,
+ xxx_column_left_column (sheet, i)));
+ }
+ for (i = col - 1; i >= MIN_VISIBLE_COLUMN (sheet); i--)
+ {
+ if ( ! gtk_sheet_cell_empty (sheet, row, i)) break;
+ if (sizel >= text_width / 2) break;
+ sizel +=xxx_column_width (sheet, i);
+ xxx_column_set_right_column (sheet, i,
+ MAX (col,
+ xxx_column_right_column (sheet, i)));
+ }
+ size = MIN (sizel, sizer);
+ }
+ area.x -= sizel;
+ xoffset += sizel - text_width / 2 - CELLOFFSET;
+ area.width = sizel + sizer;
+ break;
+ case GTK_JUSTIFY_LEFT:
+ default:
+ size = area.width;
+ {
+ for (i = col + 1; i <= MAX_VISIBLE_COLUMN (sheet); i++)
+ {
+ if (! gtk_sheet_cell_empty (sheet, row, i)) break;
+ if (size >= text_width + CELLOFFSET) break;
+ size +=xxx_column_width (sheet, i);
+ xxx_column_set_left_column (sheet, i,
+ MIN (
+ col,
+ xxx_column_left_column (sheet, i)));