diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-03-10 14:50:00 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-10 09:22:26 -0700 |
commit | a9d613640d7d541eba92993977b4e5fb7df2083d (patch) | |
tree | 90f4ea2a68748bec9b1aaddb6c698dc5ecbd7dee /print.c | |
parent | 6c7e2f9ffae975204f11524382bfa8553807ce20 (diff) | |
download | subsurface-a9d613640d7d541eba92993977b4e5fb7df2083d.tar.gz |
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 <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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); |