From a9d613640d7d541eba92993977b4e5fb7df2083d Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sun, 10 Mar 2013 14:50:00 +0200 Subject: Table print: Only show a table header when not 'paginating' Strangely on Linux everything looks fine, but Windows shows the header two times on the first page, which is due to the pango_cairo_show_layout() function being called both for the 'paginating' and 'regular' stages in show_table_header(). Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- print.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/print.c b/print.c index d7b6d44aa..a04725d0d 100644 --- a/print.c +++ b/print.c @@ -495,7 +495,7 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w, g_object_unref (layout); } -static void show_table_header(cairo_t *cr, PangoLayout *layout, double w) +static void show_table_header(cairo_t *cr, PangoLayout *layout, double w, gboolean paginate) { int i; double maxwidth, colwidth, curwidth; @@ -514,7 +514,8 @@ static void show_table_header(cairo_t *cr, PangoLayout *layout, double w) curwidth = curwidth + (colwidth * rel_width[i]); pango_layout_set_text(layout, _(headers[i]), -1); pango_layout_set_justify(layout, 0); - pango_cairo_show_layout(cr, layout); + if (!paginate) + pango_cairo_show_layout(cr, layout); } cairo_move_to(cr, 0, 0); } @@ -788,7 +789,7 @@ static void draw_table(GtkPrintOperation *operation, GtkPrintContext *context, g pango_layout_get_extents(layout, NULL, &logic_ext); cairo_translate (cr, w/10, 2.0 * logic_ext.height / PANGO_SCALE); y = 2.0 * logic_ext.height / PANGO_SCALE; - show_table_header(cr, layout, w*2); + show_table_header(cr, layout, w*2, paginate); set_font(layout, font, FONT_NORMAL*1.2, PANGO_ALIGN_LEFT); /* We wanted the header ellipsized but not the data */ pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_NONE); -- cgit v1.2.3-70-g09d2