aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/e-table/ChangeLog7
-rw-r--r--widgets/e-table/e-cell-text.c10
-rw-r--r--widgets/e-table/e-cell-toggle.c14
-rw-r--r--widgets/e-table/e-cell-tree.c10
-rw-r--r--widgets/e-table/e-table-item.c18
-rw-r--r--widgets/e-table/e-tree-model.c1
-rw-r--r--widgets/table/e-cell-text.c10
-rw-r--r--widgets/table/e-cell-toggle.c14
-rw-r--r--widgets/table/e-cell-tree.c10
-rw-r--r--widgets/table/e-table-item.c18
-rw-r--r--widgets/table/e-tree-model.c1
11 files changed, 53 insertions, 60 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 605826c0c3..9ff6fbfe97 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,10 @@
+2000-08-22 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-cell-text.c, e-cell-toggle.c, e-cell-tree.c, e-table-item.c:
+ Moved drawing of the cell backgrounds from ECell into ETableItem.
+
+ * e-tree-model.c: Include stdlib.c.
+
2000-08-21 Lauris Kaplinski <lauris@helixcode.com>
* e-cell-text.c: Changed UTF-8 syntax from char based to byte based
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index 8a6f9d96e2..279ef4975b 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -441,7 +441,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
CellEdit *edit = text_view->edit;
gboolean edit_display = FALSE;
ECellTextLineBreaks *linebreaks;
- GdkColor *background, *foreground, *cell_foreground, *cursor_color;
+ GdkColor *foreground, *cell_foreground, *cursor_color;
gchar *color_spec;
EFontStyle style = E_FONT_PLAIN;
@@ -472,13 +472,8 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
clip_rect = &rect;
if (selected){
- background = &canvas->style->bg [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_SELECTED];
} else {
- if (row % 2)
- background = &canvas->style->base [GTK_STATE_NORMAL];
- else
- background = &canvas->style->base [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_NORMAL];
}
@@ -493,9 +488,6 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
foreground = cell_foreground;
}
- gdk_gc_set_foreground (text_view->gc, background);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
gdk_gc_set_foreground (text_view->gc, foreground);
x1 += 4;
diff --git a/widgets/e-table/e-cell-toggle.c b/widgets/e-table/e-cell-toggle.c
index d694c15b90..1be01348db 100644
--- a/widgets/e-table/e-cell-toggle.c
+++ b/widgets/e-table/e-cell-toggle.c
@@ -88,10 +88,11 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
int x1, int y1, int x2, int y2)
{
ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
+#if 0
ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
+#endif
GdkPixbuf *image;
int x, y, width, height;
- GdkColor *background;
const int value = GPOINTER_TO_INT (
e_table_model_value_at (ecell_view->e_table_model, model_col, row));
@@ -102,17 +103,6 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
return;
}
- /*
- * Paint the background
- */
- if (selected){
- background = &GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED];
- } else {
- background = &GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL];
- }
- gdk_gc_set_foreground (toggle_view->gc, background);
- gdk_draw_rectangle (drawable, toggle_view->gc, TRUE, x1, y1, x2 - x1, y2 - y1);
-
image = toggle->images [value];
if ((x2 - x1) < gdk_pixbuf_get_width (image)){
diff --git a/widgets/e-table/e-cell-tree.c b/widgets/e-table/e-cell-tree.c
index 46c8c862c9..d4106271e6 100644
--- a/widgets/e-table/e-cell-tree.c
+++ b/widgets/e-table/e-cell-tree.c
@@ -160,7 +160,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkRectangle rect, *clip_rect;
GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
- GdkColor *background, *foreground;
+ GdkColor *foreground;
int offset, subcell_offset;
gboolean expanded, expandable;
@@ -197,16 +197,12 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
gdk_gc_set_clip_rectangle (fg_gc, &rect);
clip_rect = &rect;
- if (selected){
- background = &canvas->style->bg [GTK_STATE_SELECTED];
+ if (selected) {
foreground = &canvas->style->text [GTK_STATE_SELECTED];
} else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
foreground = &canvas->style->text [GTK_STATE_NORMAL];
}
- gdk_gc_set_foreground (tree_view->gc, background);
- gdk_draw_rectangle (drawable, tree_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
+
gdk_gc_set_foreground (tree_view->gc, foreground);
/* draw our lines */
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index b394669110..0f70861f1e 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -1016,8 +1016,7 @@ eti_realize (GnomeCanvasItem *item)
*/
window = canvas_widget->window;
- eti->fill_gc = canvas_widget->style->white_gc;
- gdk_gc_ref (canvas_widget->style->white_gc);
+ eti->fill_gc = gdk_gc_new (window);
eti->grid_gc = gdk_gc_new (window);
#if 0
@@ -1084,6 +1083,8 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
gboolean f_found;
double i2c [6];
ArtPoint eti_base, eti_base_item;
+ GtkWidget *canvas = GTK_WIDGET(item->canvas);
+ GdkColor *background;
/*
* Clear the background
@@ -1201,6 +1202,19 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
break;
}
+ if (selected){
+ background = &canvas->style->bg [GTK_STATE_SELECTED];
+ } else {
+ if (row % 2)
+ background = &canvas->style->base [GTK_STATE_NORMAL];
+ else
+ background = &canvas->style->base [GTK_STATE_SELECTED];
+ }
+
+ gdk_gc_set_foreground (eti->fill_gc, background);
+ gdk_draw_rectangle (drawable, eti->fill_gc, TRUE,
+ xd, yd, ecol->width, height);
+
e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, col_selected,
xd, yd, xd + ecol->width, yd + height);
diff --git a/widgets/e-table/e-tree-model.c b/widgets/e-table/e-tree-model.c
index 943f190732..c57bf2d683 100644
--- a/widgets/e-table/e-tree-model.c
+++ b/widgets/e-table/e-tree-model.c
@@ -11,6 +11,7 @@
*/
#include <config.h>
#include <gtk/gtksignal.h>
+#include <stdlib.h>
#include "e-util/e-util.h"
#include "e-tree-model.h"
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 8a6f9d96e2..279ef4975b 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -441,7 +441,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
CellEdit *edit = text_view->edit;
gboolean edit_display = FALSE;
ECellTextLineBreaks *linebreaks;
- GdkColor *background, *foreground, *cell_foreground, *cursor_color;
+ GdkColor *foreground, *cell_foreground, *cursor_color;
gchar *color_spec;
EFontStyle style = E_FONT_PLAIN;
@@ -472,13 +472,8 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
clip_rect = &rect;
if (selected){
- background = &canvas->style->bg [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_SELECTED];
} else {
- if (row % 2)
- background = &canvas->style->base [GTK_STATE_NORMAL];
- else
- background = &canvas->style->base [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_NORMAL];
}
@@ -493,9 +488,6 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
foreground = cell_foreground;
}
- gdk_gc_set_foreground (text_view->gc, background);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
gdk_gc_set_foreground (text_view->gc, foreground);
x1 += 4;
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index d694c15b90..1be01348db 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -88,10 +88,11 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
int x1, int y1, int x2, int y2)
{
ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
+#if 0
ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
+#endif
GdkPixbuf *image;
int x, y, width, height;
- GdkColor *background;
const int value = GPOINTER_TO_INT (
e_table_model_value_at (ecell_view->e_table_model, model_col, row));
@@ -102,17 +103,6 @@ etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
return;
}
- /*
- * Paint the background
- */
- if (selected){
- background = &GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED];
- } else {
- background = &GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL];
- }
- gdk_gc_set_foreground (toggle_view->gc, background);
- gdk_draw_rectangle (drawable, toggle_view->gc, TRUE, x1, y1, x2 - x1, y2 - y1);
-
image = toggle->images [value];
if ((x2 - x1) < gdk_pixbuf_get_width (image)){
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 46c8c862c9..d4106271e6 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -160,7 +160,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GdkRectangle rect, *clip_rect;
GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
- GdkColor *background, *foreground;
+ GdkColor *foreground;
int offset, subcell_offset;
gboolean expanded, expandable;
@@ -197,16 +197,12 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
gdk_gc_set_clip_rectangle (fg_gc, &rect);
clip_rect = &rect;
- if (selected){
- background = &canvas->style->bg [GTK_STATE_SELECTED];
+ if (selected) {
foreground = &canvas->style->text [GTK_STATE_SELECTED];
} else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
foreground = &canvas->style->text [GTK_STATE_NORMAL];
}
- gdk_gc_set_foreground (tree_view->gc, background);
- gdk_draw_rectangle (drawable, tree_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
+
gdk_gc_set_foreground (tree_view->gc, foreground);
/* draw our lines */
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index b394669110..0f70861f1e 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1016,8 +1016,7 @@ eti_realize (GnomeCanvasItem *item)
*/
window = canvas_widget->window;
- eti->fill_gc = canvas_widget->style->white_gc;
- gdk_gc_ref (canvas_widget->style->white_gc);
+ eti->fill_gc = gdk_gc_new (window);
eti->grid_gc = gdk_gc_new (window);
#if 0
@@ -1084,6 +1083,8 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
gboolean f_found;
double i2c [6];
ArtPoint eti_base, eti_base_item;
+ GtkWidget *canvas = GTK_WIDGET(item->canvas);
+ GdkColor *background;
/*
* Clear the background
@@ -1201,6 +1202,19 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
break;
}
+ if (selected){
+ background = &canvas->style->bg [GTK_STATE_SELECTED];
+ } else {
+ if (row % 2)
+ background = &canvas->style->base [GTK_STATE_NORMAL];
+ else
+ background = &canvas->style->base [GTK_STATE_SELECTED];
+ }
+
+ gdk_gc_set_foreground (eti->fill_gc, background);
+ gdk_draw_rectangle (drawable, eti->fill_gc, TRUE,
+ xd, yd, ecol->width, height);
+
e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, col_selected,
xd, yd, xd + ecol->width, yd + height);
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index 943f190732..c57bf2d683 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -11,6 +11,7 @@
*/
#include <config.h>
#include <gtk/gtksignal.h>
+#include <stdlib.h>
#include "e-util/e-util.h"
#include "e-tree-model.h"