aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-27 04:38:49 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-27 04:38:49 +0800
commit628ca43584542f85ffc3b6a1617af489607a8dea (patch)
tree71039a6aca0bd45f0650b29120f55cc8eb522a8e /widgets/table/e-table-header.c
parent7434b2831bd5604c6ee939c604cec5a91205b4d2 (diff)
downloadgsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar.gz
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar.bz2
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar.lz
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar.xz
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.tar.zst
gsoc2013-evolution-628ca43584542f85ffc3b6a1617af489607a8dea.zip
Made "drawgrid", "drawfocus", "spreadsheet", and "length_threshold"
2000-05-26 Christopher James Lahey <clahey@helixcode.com> * 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
Diffstat (limited to 'widgets/table/e-table-header.c')
-rw-r--r--widgets/table/e-table-header.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index f1066f745c..383f7a9080 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/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]);