From 628ca43584542f85ffc3b6a1617af489607a8dea Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 26 May 2000 20:38:49 +0000 Subject: Made "drawgrid", "drawfocus", "spreadsheet", and "length_threshold" 2000-05-26 Christopher James Lahey * e-table-group-container.c, e-table-group-container.h, e-table-group-leaf.c, e-table-group-leaf.h, e-table.c, e-table.h: Made "drawgrid", "drawfocus", "spreadsheet", and "length_threshold" arguments set from the ETable effect all the end ETableItems. * e-table-header.c: Made column resize a bit less bumpy. svn path=/trunk/; revision=3223 --- widgets/e-table/e-table-header.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'widgets/e-table/e-table-header.c') diff --git a/widgets/e-table/e-table-header.c b/widgets/e-table/e-table-header.c index f1066f745c..383f7a9080 100644 --- a/widgets/e-table/e-table-header.c +++ b/widgets/e-table/e-table-header.c @@ -629,34 +629,31 @@ static void eth_calc_widths (ETableHeader *eth) { int i; - int extra, extra_left; + int extra; double expansion; - int last_resizeable = -1; + int last_position = 0; + double next_position = 0; + int last_resizable = -1; /* - 1 to account for the last pixel border. */ extra = eth->width - 1; expansion = 0; for (i = 0; i < eth->col_count; i++) { extra -= eth->columns[i]->min_width; - if (eth->columns[i]->resizeable && eth->columns[i]->expansion != 0.0) { - expansion += eth->columns[i]->expansion; - last_resizeable = i; - } + if (eth->columns[i]->resizeable && eth->columns[i]->expansion > 0) + last_resizable = i; + expansion += eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0; eth->columns[i]->width = eth->columns[i]->min_width; } if (eth->sort_info) extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT; - if (expansion == 0 || extra < 0) + if (expansion == 0 || extra <= 0) return; - extra_left = extra; - for (i = 0; i < last_resizeable; i++) { - if (eth->columns[i]->resizeable) { - int this_extra = MIN(extra_left, extra * (eth->columns[i]->expansion / expansion)); - eth->columns[i]->width += this_extra; - extra_left -= this_extra; - } + for (i = 0; i < last_resizable; i++) { + next_position += extra * (eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0)/expansion; + eth->columns[i]->width += next_position - last_position; + last_position = next_position; } - if (i >= 0 && i < eth->col_count && eth->columns[i]->resizeable) - eth->columns[i]->width += extra_left; + eth->columns[i]->width += extra - last_position; eth_update_offsets (eth); gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); -- cgit v1.2.3