[gnumeric] Sheet: improve default row height.



commit d1eef68a07fed791ad9b7c86abaaf2f6d0df1498
Author: Morten Welinder <terra gnome org>
Date:   Sat Mar 6 20:45:42 2021 -0500

    Sheet: improve default row height.
    
    Excel's 12.75pts doesn't cut it anymore.
    
    Compute the height that a number will get -- see cb_max_cell_height -- and
    make sure we are that tall.

 src/sheet.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/src/sheet.c b/src/sheet.c
index 399645591..0c84164b6 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -717,6 +717,9 @@ static void
 gnm_sheet_constructed (GObject *obj)
 {
        Sheet *sheet = SHEET (obj);
+       int ht;
+       GnmStyle *style;
+       PangoContext *context;
 
        if (parent_class->constructed)
                parent_class->constructed (obj);
@@ -772,6 +775,16 @@ gnm_sheet_constructed (GObject *obj)
                g_assert_not_reached ();
        }
 
+       style = sheet_style_default (sheet);
+       context = gnm_pango_context_get ();
+       ht = gnm_style_get_pango_height (style, context, 1);
+       gnm_style_unref (style);
+       g_object_unref (context);
+       ht += GNM_ROW_MARGIN + GNM_ROW_MARGIN + 1;
+       if (ht > sheet_row_get_default_size_pixels (sheet)) {
+               sheet_row_set_default_size_pixels (sheet, ht);
+       }
+
        sheet_scale_changed (sheet, TRUE, TRUE);
 }
 
@@ -5745,6 +5758,13 @@ sheet_colrow_default_calc (Sheet *sheet, double units,
 
        g_return_if_fail (units > 0.);
 
+       if (gnm_debug_flag ("colrow")) {
+               g_printerr ("Setting default %s size to %g%s\n",
+                           is_cols ? "column" : "row",
+                           units,
+                           is_pts ? "pts" : "px");
+       }
+
        cri->is_default = TRUE;
        cri->hard_size  = FALSE;
        cri->visible    = TRUE;


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