aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-04-25 05:39:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-04-25 05:39:24 +0800
commit8cf870c27718e7fa8f3cbe57c839e7ae90635c0d (patch)
tree3397ba104b2c840aa8ca8e892567f450afee9d41 /widgets/table
parent0448dc0fcc6eac15a283d0fee096a23cece61a6c (diff)
downloadgsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar.gz
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar.bz2
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar.lz
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar.xz
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.tar.zst
gsoc2013-evolution-8cf870c27718e7fa8f3cbe57c839e7ae90635c0d.zip
implement printing (pixbuf_print_height): implement print height
2002-04-24 JP Rosevear <jpr@ximian.com> * e-cell-pixbuf.c (pixbuf_print): implement printing (pixbuf_print_height): implement print height (e_cell_pixbuf_class_init): set printing virtual methods * e-cell-toggle.c (etog_print): remove clipping, default clipping is done by the table, scale based on toggle height * e-table-item.c (e_table_item_calculate_print_widths): make the scale 1:1 svn path=/trunk/; revision=16577
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-pixbuf.c50
-rw-r--r--widgets/table/e-cell-toggle.c19
-rw-r--r--widgets/table/e-table-item.c2
3 files changed, 53 insertions, 18 deletions
diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c
index 9294e4a703..565eae8d8b 100644
--- a/widgets/table/e-cell-pixbuf.c
+++ b/widgets/table/e-cell-pixbuf.c
@@ -197,6 +197,54 @@ pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row)
return gdk_pixbuf_get_height (pixbuf) + 6;
}
+/*
+ * ECell::print method
+ */
+static void
+pixbuf_print (ECellView *ecell_view, GnomePrintContext *context,
+ int model_col, int view_col, int row,
+ double width, double height)
+{
+ GdkPixbuf *pixbuf;
+ int scale;
+
+ pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+ if (pixbuf == NULL)
+ return;
+ scale = gdk_pixbuf_get_height (pixbuf);
+
+ gnome_print_gsave(context);
+
+ gnome_print_translate (context, 0, (height - scale) / 2);
+ gnome_print_scale (context, scale, scale);
+ gnome_print_pixbuf (context, pixbuf);
+
+ gnome_print_grestore(context);
+}
+
+static gdouble
+pixbuf_print_height (ECellView *ecell_view, GnomePrintContext *context,
+ int model_col, int view_col, int row,
+ double width)
+{
+ GdkPixbuf *pixbuf;
+
+ if (row == -1) {
+ if (e_table_model_row_count (ecell_view->e_table_model) > 0) {
+ row = 0;
+ } else {
+ return 6;
+ }
+ }
+
+ pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+ if (!pixbuf)
+ return 0;
+
+ /* We give ourselves 3 pixels of padding on either side */
+ return gdk_pixbuf_get_height (pixbuf);
+}
+
static gint
pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col)
{
@@ -308,6 +356,8 @@ e_cell_pixbuf_class_init (GtkObjectClass *object_class)
ecc->draw = pixbuf_draw;
ecc->event = pixbuf_event;
ecc->height = pixbuf_height;
+ ecc->print = pixbuf_print;
+ ecc->print_height = pixbuf_print_height;
ecc->max_width = pixbuf_max_width;
parent_class = gtk_type_class (E_CELL_TYPE);
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 269cddc0a4..4458605e6d 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -311,7 +311,6 @@ etog_print (ECellView *ecell_view, GnomePrintContext *context,
{
ECellToggle *toggle = E_CELL_TOGGLE(ecell_view->ecell);
GdkPixbuf *image;
- int scale;
const int value = GPOINTER_TO_INT (
e_table_model_value_at (ecell_view->e_table_model, model_col, row));
@@ -323,24 +322,10 @@ etog_print (ECellView *ecell_view, GnomePrintContext *context,
gnome_print_gsave(context);
- if (gnome_print_moveto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
-
image = toggle->images[value];
- scale = MIN (width - 4, height - 4);
- gnome_print_translate (context, 2, (height - scale) / 2);
- gnome_print_scale (context, scale, scale);
+ gnome_print_translate (context, 0, (height - toggle->height) / 2);
+ gnome_print_scale (context, toggle->height, toggle->height);
gnome_print_pixbuf (context, image);
gnome_print_grestore(context);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 754234868e..10fc205625 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -3197,7 +3197,7 @@ e_table_item_calculate_print_widths (ETableHeader *eth, gdouble width)
double extra;
double expansion;
int last_resizable = -1;
- gdouble scale = 300.0L / 70.0L;
+ gdouble scale = 1.0L;
gdouble *widths = g_new(gdouble, e_table_header_count(eth));
/* - 1 to account for the last pixel border. */
extra = width - 1;