From 66031f68f0b4dc14d6db5f2a325482c0fdc1c156 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Mon, 29 Nov 1999 07:08:52 +0000 Subject: Small cosmetic fix svn path=/trunk/; revision=1443 --- widgets/ChangeLog | 3 +++ widgets/e-table-item.c | 42 +++++++++++++++++++++++++++++++++++------- widgets/e-table-item.h | 1 + widgets/e-table/ChangeLog | 3 +++ widgets/e-table/e-table-item.c | 42 +++++++++++++++++++++++++++++++++++------- widgets/e-table/e-table-item.h | 1 + widgets/table/e-table-item.c | 42 +++++++++++++++++++++++++++++++++++------- widgets/table/e-table-item.h | 1 + 8 files changed, 114 insertions(+), 21 deletions(-) diff --git a/widgets/ChangeLog b/widgets/ChangeLog index afc69d71a4..7972994a79 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,5 +1,8 @@ 1999-11-28 Miguel de Icaza + * e-table-item.c (eti_draw): Focus inside, not outside. + (eti_realize): Enhance our focus gc. + * e-cell-text.c (ect_enter_edit, ect_leave_edit): New methods; They implement editing. diff --git a/widgets/e-table-item.c b/widgets/e-table-item.c index 1b98bbfce4..5816acfb23 100644 --- a/widgets/e-table-item.c +++ b/widgets/e-table-item.c @@ -452,6 +452,11 @@ eti_init (GnomeCanvasItem *item) eti->selection_mode = GTK_SELECTION_SINGLE; } +#define gray50_width 2 +#define gray50_height 2 +static const char gray50_bits[] = { + 0x02, 0x01, }; + static void eti_realize (GnomeCanvasItem *item) { @@ -474,9 +479,13 @@ eti_realize (GnomeCanvasItem *item) gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->black); - gdk_gc_set_line_attributes (eti->focus_gc, 2, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - + gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); + gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); + eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); + gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); + gdk_gc_set_stipple (eti->focus_gc, eti->stipple); + gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); + /* * */ @@ -497,6 +506,8 @@ eti_unrealize (GnomeCanvasItem *item) eti->grid_gc = NULL; gdk_gc_unref (eti->focus_gc); eti->focus_gc = NULL; + gdk_bitmap_unref (eti->stipple); + eti->stipple = NULL; eti_unrealize_cell_views (eti); @@ -636,21 +647,38 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, f_y2 = yd + height; f_found = TRUE; } - + xd += ecol->width; } yd += height + 1; - gdk_draw_line (drawable, eti->grid_gc, - eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); + + if (eti->draw_grid) + gdk_draw_line ( + drawable, eti->grid_gc, + eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); } + if (eti->draw_grid){ + int xd = x_offset; + + for (col = first_col; col < last_col; col++){ + ETableCol *ecol = e_table_header_get_column (eti->header, col); + + gdk_draw_line ( + drawable, eti->grid_gc, + xd, y_offset, xd, yd); + + xd += ecol->width; + } + } + /* * Draw focus */ if (f_found && eti->draw_focus){ gdk_draw_rectangle ( drawable, eti->focus_gc, FALSE, - f_x1 - 1, f_y1 - 1, f_x2 - f_x1 + 2 , f_y2 - f_y1 + 2); + f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1); } } diff --git a/widgets/e-table-item.h b/widgets/e-table-item.h index 02f7beb1ac..3f3d2a7d4d 100644 --- a/widgets/e-table-item.h +++ b/widgets/e-table-item.h @@ -32,6 +32,7 @@ typedef struct { GdkGC *fill_gc; GdkGC *grid_gc; GdkGC *focus_gc; + GdkBitmap *stipple; unsigned int draw_grid:1; unsigned int draw_focus:1; diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index afc69d71a4..7972994a79 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,5 +1,8 @@ 1999-11-28 Miguel de Icaza + * e-table-item.c (eti_draw): Focus inside, not outside. + (eti_realize): Enhance our focus gc. + * e-cell-text.c (ect_enter_edit, ect_leave_edit): New methods; They implement editing. diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index 1b98bbfce4..5816acfb23 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -452,6 +452,11 @@ eti_init (GnomeCanvasItem *item) eti->selection_mode = GTK_SELECTION_SINGLE; } +#define gray50_width 2 +#define gray50_height 2 +static const char gray50_bits[] = { + 0x02, 0x01, }; + static void eti_realize (GnomeCanvasItem *item) { @@ -474,9 +479,13 @@ eti_realize (GnomeCanvasItem *item) gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->black); - gdk_gc_set_line_attributes (eti->focus_gc, 2, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - + gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); + gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); + eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); + gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); + gdk_gc_set_stipple (eti->focus_gc, eti->stipple); + gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); + /* * */ @@ -497,6 +506,8 @@ eti_unrealize (GnomeCanvasItem *item) eti->grid_gc = NULL; gdk_gc_unref (eti->focus_gc); eti->focus_gc = NULL; + gdk_bitmap_unref (eti->stipple); + eti->stipple = NULL; eti_unrealize_cell_views (eti); @@ -636,21 +647,38 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, f_y2 = yd + height; f_found = TRUE; } - + xd += ecol->width; } yd += height + 1; - gdk_draw_line (drawable, eti->grid_gc, - eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); + + if (eti->draw_grid) + gdk_draw_line ( + drawable, eti->grid_gc, + eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); } + if (eti->draw_grid){ + int xd = x_offset; + + for (col = first_col; col < last_col; col++){ + ETableCol *ecol = e_table_header_get_column (eti->header, col); + + gdk_draw_line ( + drawable, eti->grid_gc, + xd, y_offset, xd, yd); + + xd += ecol->width; + } + } + /* * Draw focus */ if (f_found && eti->draw_focus){ gdk_draw_rectangle ( drawable, eti->focus_gc, FALSE, - f_x1 - 1, f_y1 - 1, f_x2 - f_x1 + 2 , f_y2 - f_y1 + 2); + f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1); } } diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h index 02f7beb1ac..3f3d2a7d4d 100644 --- a/widgets/e-table/e-table-item.h +++ b/widgets/e-table/e-table-item.h @@ -32,6 +32,7 @@ typedef struct { GdkGC *fill_gc; GdkGC *grid_gc; GdkGC *focus_gc; + GdkBitmap *stipple; unsigned int draw_grid:1; unsigned int draw_focus:1; diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 1b98bbfce4..5816acfb23 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -452,6 +452,11 @@ eti_init (GnomeCanvasItem *item) eti->selection_mode = GTK_SELECTION_SINGLE; } +#define gray50_width 2 +#define gray50_height 2 +static const char gray50_bits[] = { + 0x02, 0x01, }; + static void eti_realize (GnomeCanvasItem *item) { @@ -474,9 +479,13 @@ eti_realize (GnomeCanvasItem *item) gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->black); - gdk_gc_set_line_attributes (eti->focus_gc, 2, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - + gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); + gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); + eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); + gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); + gdk_gc_set_stipple (eti->focus_gc, eti->stipple); + gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); + /* * */ @@ -497,6 +506,8 @@ eti_unrealize (GnomeCanvasItem *item) eti->grid_gc = NULL; gdk_gc_unref (eti->focus_gc); eti->focus_gc = NULL; + gdk_bitmap_unref (eti->stipple); + eti->stipple = NULL; eti_unrealize_cell_views (eti); @@ -636,21 +647,38 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, f_y2 = yd + height; f_found = TRUE; } - + xd += ecol->width; } yd += height + 1; - gdk_draw_line (drawable, eti->grid_gc, - eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); + + if (eti->draw_grid) + gdk_draw_line ( + drawable, eti->grid_gc, + eti->x1 - x, yd -1, eti->x1 + eti->width - x, yd -1); } + if (eti->draw_grid){ + int xd = x_offset; + + for (col = first_col; col < last_col; col++){ + ETableCol *ecol = e_table_header_get_column (eti->header, col); + + gdk_draw_line ( + drawable, eti->grid_gc, + xd, y_offset, xd, yd); + + xd += ecol->width; + } + } + /* * Draw focus */ if (f_found && eti->draw_focus){ gdk_draw_rectangle ( drawable, eti->focus_gc, FALSE, - f_x1 - 1, f_y1 - 1, f_x2 - f_x1 + 2 , f_y2 - f_y1 + 2); + f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1); } } diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 02f7beb1ac..3f3d2a7d4d 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -32,6 +32,7 @@ typedef struct { GdkGC *fill_gc; GdkGC *grid_gc; GdkGC *focus_gc; + GdkBitmap *stipple; unsigned int draw_grid:1; unsigned int draw_focus:1; -- cgit