[gnumeric] RenderedValue: add debug code



commit 99c5649cd2efbd77ef07d17188f4911913982b90
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 11 13:25:38 2014 -0400

    RenderedValue: add debug code

 src/rendered-value.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/rendered-value.c b/src/rendered-value.c
index 6215cc5..0b1cbe3 100644
--- a/src/rendered-value.c
+++ b/src/rendered-value.c
@@ -63,6 +63,16 @@ static int rv_allocations;
 #define CHUNK_FREE(p,v) (rv_allocations--, g_slice_free1 (sizeof(*v),(v)))
 #endif
 
+static gboolean
+debug_rv (void)
+{
+       static int res = -1;
+       if (res == -1) {
+               res = gnm_debug_flag ("rendered-value");
+       }
+       return res > 0;
+}
+
 
 static guint16
 calc_indent (PangoContext *context, const GnmStyle *mstyle)
@@ -220,12 +230,16 @@ gnm_rendered_value_new (GnmCell const *cell,
        GnmStyle const *mstyle;
        PangoDirection dir;
        char const *text;
+       gboolean debug = debug_rv ();
 
        g_return_val_if_fail (cell != NULL, NULL);
 
        /* sheet->workbook can be NULL when called from preview-grid.c  */
        sheet = cell->base.sheet;
 
+       if (debug)
+               g_printerr ("Rendering %s\n", cell_name (cell));
+
        displayed_formula =
                gnm_cell_has_expr (cell) && sheet->display_formulas;
 
@@ -314,6 +328,9 @@ gnm_rendered_value_new (GnmCell const *cell,
                        double font_size, scale = 1., tscale;
                        int rise = 0;
 
+                       if (debug)
+                               g_printerr ("  Markup on value: %s\n", go_format_as_XL (fmt));
+
                        attrs = pango_attr_list_copy (attrs);
 
                        iter = pango_attr_list_get_iterator (attrs);


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