aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorVibha Yadav <yvibha@novell.com>2010-05-07 14:00:49 +0800
committerBharath Acharya <abharath@novell.com>2010-05-07 14:00:49 +0800
commit37b839a2d3be8bacf160df237e673d33b1689204 (patch)
treed2f4f4f76537734deff5ea9d91a24e6349413673 /widgets/table
parent0b743a787cf5cc69b2521d41e1c7f5ec8a798101 (diff)
downloadgsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar.gz
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar.bz2
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar.lz
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar.xz
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.tar.zst
gsoc2013-evolution-37b839a2d3be8bacf160df237e673d33b1689204.zip
Bug #545462 - Printing of contacts is weird.
Lot of improvements in contact printing. A few more to follow suit.
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-text.c28
-rw-r--r--widgets/table/e-table-group-container.c9
2 files changed, 32 insertions, 5 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index ba246316bb..06dde0eb01 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -613,7 +613,7 @@ build_layout (ECellTextView *text_view, gint row, const gchar *text, gint width)
}
pango_layout_set_width (layout, width * PANGO_SCALE);
- pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
+ pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
pango_layout_set_height (layout, 0);
@@ -1356,7 +1356,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
cairo_save (cr);
layout = gtk_print_context_create_pango_layout (context);
- font_des = pango_font_description_from_string ("sans 12"); /* fix me font hardcoded */
+ font_des = pango_font_description_from_string ("sans 10"); /* fix me font hardcoded */
pango_layout_set_font_description (layout, font_des);
pango_layout_set_text (layout, string, -1);
@@ -1415,6 +1415,7 @@ ect_print (ECellView *ecell_view, GtkPrintContext *context,
cairo_move_to(cr, 2, text_height- 5);
pango_layout_set_width (layout, (width - 4)*PANGO_SCALE);
+ pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
pango_cairo_show_layout(cr, layout);
cairo_restore (cr);
@@ -1435,7 +1436,28 @@ ect_print_height (ECellView *ecell_view, GtkPrintContext *context,
* Height of some special font is much higher than others,
* such as Arabic. So leave some more margin for cell.
*/
- return 16 + 8;
+ PangoFontDescription *font_des;
+ PangoLayout *layout;
+ ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
+ ECellTextView *ectView = (ECellTextView *)ecell_view;
+ gchar *string;
+ gdouble text_width = 0.0, text_height = 0.0;
+ gint lines=1;
+
+ string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
+
+ layout = gtk_print_context_create_pango_layout (context);
+ font_des = pango_font_description_from_string ("sans 10"); /* fix me font hardcoded */
+ pango_layout_set_font_description (layout, font_des);
+
+ pango_layout_set_text (layout, string, -1);
+ get_font_size (layout, font_des, string, &text_width, &text_height);
+ /* Checking if the text width goes beyond the column width to increase the
+ * number of lines.
+ */
+ if ( text_width > width-4)
+ lines = (text_width / (width-4)) + 1;
+ return 16*lines + 8;
}
static gint
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 72f2323acd..cf8aae1aff 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -1191,7 +1191,9 @@ e_table_group_container_print_page (EPrintable *ep,
ETGCPrintContext *groupcontext)
{
cairo_t *cr;
+ GtkPageSetup *setup;
gdouble yd;
+ gdouble page_height, page_margin;
gdouble child_height;
ETableGroupContainerChildNode *child_node;
GList *child;
@@ -1202,7 +1204,10 @@ e_table_group_container_print_page (EPrintable *ep,
child_printable = groupcontext->child_printable;
child = groupcontext->child;
- yd = 6.5 * 72;
+ setup = gtk_print_context_get_page_setup (context);
+ page_height = gtk_page_setup_get_page_height (setup, GTK_UNIT_POINTS);
+ page_margin = gtk_page_setup_get_bottom_margin (setup, GTK_UNIT_POINTS) + gtk_page_setup_get_top_margin (setup, GTK_UNIT_POINTS);
+ yd = page_height - page_margin;
if (child_printable) {
if (child)
@@ -1266,7 +1271,7 @@ e_table_group_container_print_page (EPrintable *ep,
cairo_rectangle (cr, 0, 0, width - 2 * TEXT_AREA_HEIGHT,child_height);
cairo_clip(cr);
- e_printable_print_page (child_printable, context, width-2 * TEXT_AREA_HEIGHT, 0, quantize);
+ e_printable_print_page (child_printable, context, width-2 * TEXT_AREA_HEIGHT, height , quantize);
yd += child_height + TEXT_AREA_HEIGHT;
if (e_printable_data_left(child_printable))