From: Andrea Zagli Date: Fri, 11 Oct 2013 07:16:57 +0000 (+0200) Subject: RtpReport::new_from_gtktreeview now doesn't print not visibile columns. X-Git-Tag: v0.2.2~3 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=8967f2a9383980f8592d4366c169bb1101f41295;p=reptool%2Flibreptool RtpReport::new_from_gtktreeview now doesn't print not visibile columns. --- diff --git a/src/rptreport.c b/src/rptreport.c index 510a925..a621d35 100644 --- a/src/rptreport.c +++ b/src/rptreport.c @@ -670,55 +670,59 @@ RptReport { col = (GtkTreeViewColumn *)columns->data; - col_title = g_strdup_printf ("\"%s\"", gtk_tree_view_column_get_title (col)); - col_width = rpt_common_points_to_value (RPT_UNIT_MILLIMETRE, (gtk_tree_view_column_get_width (col) * 72.0) / 96.0); - - point = rpt_common_rptpoint_new_with_values (x, height * 2); - if (columns->next == NULL && x < page_size->width) - { - /* the last column is always large until the end of the page */ - size = rpt_common_rptsize_new_with_values ((page_size->width - page_margin->left - page_margin->right) - x, height); - } - else + if (gtk_tree_view_column_get_visible (col)) { - size = rpt_common_rptsize_new_with_values (col_width, height); - } - font = rpt_common_rptfont_from_pango_description (pango_font); - font->bold = TRUE; + col_title = g_strdup_printf ("\"%s\"", gtk_tree_view_column_get_title (col)); + col_width = rpt_common_points_to_value (RPT_UNIT_MILLIMETRE, (gtk_tree_view_column_get_width (col) * 72.0) / 96.0); - obj = rpt_obj_text_new (g_strdup_printf ("title_%d", idx), *point); + point = rpt_common_rptpoint_new_with_values (x, height * 2); + if (columns->next == NULL && x < page_size->width) + { + /* the last column is always large until the end of the page */ + size = rpt_common_rptsize_new_with_values ((page_size->width - page_margin->left - page_margin->right) - x, height); + } + else + { + size = rpt_common_rptsize_new_with_values (col_width, height); + } + font = rpt_common_rptfont_from_pango_description (pango_font); + font->bold = TRUE; - g_object_set (obj, - "source", col_title, - "size", size, - "font", font, - NULL); + obj = rpt_obj_text_new (g_strdup_printf ("title_%d", idx), *point); - rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_HEADER); + g_object_set (obj, + "source", col_title, + "size", size, + "font", font, + NULL); - g_free (point); + rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_HEADER); - point = rpt_common_rptpoint_new_with_values (x, 0); - font = rpt_common_rptfont_from_pango_description (pango_font); + g_free (point); - field_name = g_strdup_printf ("field_%d", idx); - obj = rpt_obj_text_new (field_name, *point); + point = rpt_common_rptpoint_new_with_values (x, 0); + font = rpt_common_rptfont_from_pango_description (pango_font); - g_object_set (obj, - "source", g_strdup_printf ("[%s]", field_name), - "size", size, - "font", font, - "ellipsize", RPT_ELLIPSIZE_END, - NULL); + field_name = g_strdup_printf ("field_%d", idx); + obj = rpt_obj_text_new (field_name, *point); - rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_BODY); + g_object_set (obj, + "source", g_strdup_printf ("[%s]", field_name), + "size", size, + "font", font, + "ellipsize", RPT_ELLIPSIZE_END, + NULL); - g_free (point); - g_free (size); + rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_BODY); - g_hash_table_insert (columns_names, field_name, g_strdup_printf ("%d", idx)); + g_free (point); + g_free (size); + + g_hash_table_insert (columns_names, field_name, g_strdup_printf ("%d", idx)); + + x += col_width; + } - x += col_width; idx++; columns = g_list_next (columns);