Resize description field on window shrink.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3207 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-11-29 00:23:09 +00:00
parent 00f3af5b50
commit 069ee0a760
2 changed files with 43 additions and 3 deletions

View File

@ -937,10 +937,10 @@ gnucash_sheet_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
allocation->width == sheet->window_width)
return;
sheet->window_height = allocation->height;
sheet->window_width = allocation->width;
gnucash_sheet_styles_set_dimensions (sheet, allocation->width);
gnucash_sheet_styles_set_dimensions(sheet, allocation->width);
sheet->window_height = allocation->height;
sheet->window_width = allocation->width;
gnucash_cursor_configure (GNUCASH_CURSOR (sheet->cursor));
gnucash_header_reconfigure (GNUCASH_HEADER(sheet->header_item));

View File

@ -268,6 +268,46 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
break;
}
else if (width > default_width && width == sheet->window_width)
{
GdkFont *font = GNUCASH_GRID(sheet->grid)->normal_font;
for (col = 0; col < num_cols; col++)
{
CellBlockCell *cb_cell;
const char *text;
int sample_width;
int old_width;
cb_cell = gnc_cellblock_get_cell (cursor, 0, col);
if (!cb_cell->expandable)
continue;
cd = g_table_index (cd_table, 0, col);
old_width = cd->pixel_width;
cd->pixel_width += (default_width - width);
text = cb_cell->sample_text;
if (text)
{
sample_width = gdk_string_width (font, text);
sample_width += 2 * CELL_HPADDING;
}
else
sample_width = 0;
cd->pixel_width = MAX (cd->pixel_width, sample_width);
width += cd->pixel_width - old_width;
widths[col] = cd->pixel_width;
break;
}
}
/* adjust widths to be consistent */
for (i = 0; i < NUM_CURSOR_TYPES; i++)