]> saetta.ns0.it Git - reptool/libreptool/commitdiff
RtpReport::new_from_gtktreeview now doesn't print not visibile columns.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 11 Oct 2013 07:16:57 +0000 (09:16 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 11 Oct 2013 07:16:57 +0000 (09:16 +0200)
src/rptreport.c

index 510a925b01f339ee05ecdb569f8dfac0ebc230be..a621d35b240e25fea2350accdeddb1756b07d9e4 100644 (file)
@@ -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);