From d5ec942afbcd814dbe6f9adaa0bf4d31b7b1b26a Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 24 Jan 2008 08:34:13 +0000 Subject: Cairofication of the preference window's etable. svn path=/trunk/; revision=34877 --- widgets/table/e-cell-pixbuf.c | 55 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 39 deletions(-) (limited to 'widgets/table/e-cell-pixbuf.c') diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index 36fd8a49b3..2dc98d367b 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -115,31 +115,11 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, GdkPixbuf *cell_pixbuf; int real_x, real_y, real_w, real_h; int pix_w, pix_h; - ECellPixbuf *ecp; - - cell_pixbuf = NULL; + cairo_t *cr; + + cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model, + 1, row); - ecp = E_CELL_PIXBUF (ecell_view->ecell); - - if (flags & E_CELL_SELECTED) { - if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (ecell_view->e_table_item_view)->canvas)) { - if (ecp->focused_column != -1) - cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, - ecp->focused_column, row); - } else { - if (ecp->selected_column != -1) - cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, - ecp->selected_column, row); - } - } else { - if (ecp->unselected_column != -1) - cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model, - ecp->unselected_column, row); - } - - if (cell_pixbuf == NULL) - cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model, - model_col, row); /* we can't make sure we really got a pixbuf since, well, it's a Gdk thing */ if (x2 - x1 == 0) @@ -170,15 +150,12 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, real_h = y2 - y1; } - - gdk_draw_pixbuf (drawable, - NULL, - cell_pixbuf, - 0, 0, - real_x, real_y, - real_w, real_h, - GDK_RGB_DITHER_NORMAL, - 0, 0); + cr = gdk_cairo_create (drawable); + cairo_save (cr); + gdk_cairo_set_source_pixbuf (cr, cell_pixbuf, real_x, real_y); + cairo_paint_with_alpha (cr, 1); + cairo_restore (cr); + cairo_destroy (cr); } static gint @@ -203,7 +180,7 @@ pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row) } } - pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row); + pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row); if (!pixbuf) return 0; @@ -223,7 +200,7 @@ pixbuf_print (ECellView *ecell_view, GtkPrintContext *context, int scale; cairo_t *cr = gtk_print_context_get_cairo_context (context); - pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row); + pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row); if (pixbuf == NULL) return; @@ -250,7 +227,7 @@ pixbuf_print_height (ECellView *ecell_view, GtkPrintContext *context, } } - pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row); + pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row); if (!pixbuf) return 0; @@ -271,10 +248,10 @@ pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col) for (i = 0; i <= num_rows; i++) { GdkPixbuf *pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, - model_col, + 1, i); - if (!pixbuf) - continue; + if (!pixbuf) + continue; pw = gdk_pixbuf_get_width (pixbuf); if (max_width < pw) max_width = pw; -- cgit