Adjust the sheet to get its spacings from the item_edit CSS

This commit is contained in:
Robert Fewell 2017-11-01 11:56:12 +00:00
parent 9f76441d50
commit bb16e07d8f

View File

@ -169,6 +169,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
int row, col;
gint max_height = -1;
PangoLayout *layout;
GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
/* g_return_if_fail (font != NULL); */
@ -196,13 +197,17 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), text);
pango_layout_get_pixel_size (layout, &width, &cd->pixel_height);
g_object_unref (layout);
width += 2 * CELL_HPADDING;
cd->pixel_height += 2 * CELL_VPADDING;
width += gnc_item_edit_get_margin (item_edit, left_right) +
gnc_item_edit_get_padding_border (item_edit, left_right);
cd->pixel_height += gnc_item_edit_get_margin (item_edit, top_bottom) +
gnc_item_edit_get_padding_border (item_edit, top_bottom);
}
else
{
width = 0;
cd->pixel_height = (2 * CELL_VPADDING);
cd->pixel_height = gnc_item_edit_get_margin (item_edit, top_bottom) +
gnc_item_edit_get_padding_border (item_edit, top_bottom);
}
max_height = MAX(max_height, cd->pixel_height);
@ -239,6 +244,7 @@ static void
set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
{
SheetBlockStyle *style;
GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
BlockDimensions *dimensions;
CellDimensions *cd;
GTable *cd_table;
@ -315,7 +321,8 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
pango_layout_get_pixel_size (layout, &sample_width, NULL);
g_object_unref (layout);
/*sample_width = gdk_string_width (font, text);*/
sample_width += 2 * CELL_HPADDING;
sample_width += gnc_item_edit_get_margin (item_edit, left_right) +
gnc_item_edit_get_padding_border (item_edit, left_right);
}
else
sample_width = 0;