[evolution] Bug #563471 - Printing tasks fails when grouped by category.



commit b82402ca8c3c502ef5f7fef605e62177949f8820
Author: Vibha Yadav <yvibha novell com>
Date:   Tue Sep 14 11:25:16 2010 +0530

    Bug #563471 - Printing tasks fails when grouped by category.
    
    This works if Tasks/ Memos/ Contacts are grouped till level 1.
    If grouping level is increased then some text would be missing.

 calendar/gui/print.c                    |    3 +-
 widgets/table/e-table-group-container.c |   46 +++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 15 deletions(-)
---
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 5457f0a..4396a88 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -2885,7 +2885,8 @@ print_title (GtkPrintContext *context, const gchar *text, gdouble page_width)
 
 	cairo_move_to (cr, 0.0, 0.0);
 	pango_cairo_show_layout (cr, layout);
-
+	cairo_translate (cr, 0.0, 18);
+	cairo_save (cr);
 	cairo_restore (cr);
 
 	g_object_unref (layout);
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 3db409c..ba6ddf9 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -1194,7 +1194,7 @@ e_table_group_container_print_page  (EPrintable *ep,
 	GtkPageSetup *setup;
 	gdouble yd;
 	gdouble page_height, page_margin;
-	gdouble child_height;
+	gdouble child_height, child_margin = 0;
 	ETableGroupContainerChildNode *child_node;
 	GList *child;
 	EPrintable *child_printable;
@@ -1236,17 +1236,27 @@ e_table_group_container_print_page  (EPrintable *ep,
 	pango_font_description_free (desc);
 
 	while (1) {
-		child_height = e_printable_height (child_printable, context, width,yd + 2 * TEXT_AREA_HEIGHT, quantize);
+		child_height = e_printable_height(child_printable, context, width,yd, quantize);
+		if (child_height < 0)
+			child_height = -child_height;
+		if (yd < 2 * TEXT_AREA_HEIGHT + 20 + child_height )
+		{
+			cairo_show_page (cr);
+			cairo_translate(cr, -2 * TEXT_AREA_HEIGHT, -TEXT_AREA_HEIGHT);
+			break;
+		}
+
 		cr = gtk_print_context_get_cairo_context (context);
 		cairo_save (cr);
-		cairo_rectangle (cr, 0, 0, width,TEXT_AREA_HEIGHT);
-		cairo_rectangle (cr, 0, 0, 2 * TEXT_AREA_HEIGHT, child_height + TEXT_AREA_HEIGHT);
+		cairo_rectangle (cr, 0.0, 0.0, width, TEXT_AREA_HEIGHT);
+		cairo_rectangle (cr, 0.0, 0.0, 2 * TEXT_AREA_HEIGHT, child_height + 2 * TEXT_AREA_HEIGHT);
 		cairo_set_source_rgb (cr, .7, .7, .7);
 		cairo_fill (cr);
 		cairo_restore (cr);
+		child_margin = TEXT_AREA_HEIGHT;
 
 		cairo_save (cr);
-		cairo_rectangle (cr, 0, 0, width, TEXT_AREA_HEIGHT);
+		cairo_rectangle (cr, 2 * TEXT_AREA_HEIGHT, TEXT_AREA_HEIGHT, width - 2 * TEXT_AREA_HEIGHT, TEXT_AREA_HEIGHT);
 		cairo_clip (cr);
 		cairo_restore (cr);
 
@@ -1268,28 +1278,36 @@ e_table_group_container_print_page  (EPrintable *ep,
 
 		cairo_translate (cr, 2 * TEXT_AREA_HEIGHT, TEXT_AREA_HEIGHT);
 		cairo_move_to (cr, 0, 0);
-		cairo_rectangle (cr, 0, 0, width - 2 * TEXT_AREA_HEIGHT,child_height);
+		cairo_save (cr);
+		cairo_rectangle (cr, 0, child_margin, width - 2 * TEXT_AREA_HEIGHT, child_height + child_margin + 20);
 		cairo_clip (cr);
 
-		e_printable_print_page (child_printable, context, width-2 * TEXT_AREA_HEIGHT, height , quantize);
-		yd += child_height + TEXT_AREA_HEIGHT;
+		e_printable_print_page (child_printable, context, width-2 * TEXT_AREA_HEIGHT, child_margin, quantize);
+		yd -= child_height + TEXT_AREA_HEIGHT;
 
-		if (e_printable_data_left (child_printable))
-			break;
+		if (e_printable_data_left (child_printable)){
+			cairo_restore (cr);
+			cairo_translate(cr, -2 * TEXT_AREA_HEIGHT, -TEXT_AREA_HEIGHT);
+ 			break;
+		}
 
-		    child = child->next;
+		child = child->next;
 		if (!child) {
 			child_printable = NULL;
 			break;
 		}
 
-		    child_node = child->data;
+		child_node = child->data;
 		if (child_printable)
 			g_object_unref (child_printable);
-		    child_printable = e_table_group_get_printable (child_node->child);
+		   
+		child_printable = e_table_group_get_printable(child_node->child);
+		cairo_restore(cr);
+		cairo_translate(cr, -2 * TEXT_AREA_HEIGHT, child_height + child_margin + 20);
+		
 		if (child_printable)
 			g_object_ref (child_printable);
-		 e_printable_reset (child_printable);
+		e_printable_reset (child_printable);
 	}
 	if (groupcontext->child_printable)
 		g_object_unref (groupcontext->child_printable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]