72
72
static inline gboolean
73
73
invalid_cell (HTMLTable *table, gint r, gint c)
75
return (table->cells [r][c] == NULL
76
|| c != table->cells [r][c]->col
77
|| r != table->cells [r][c]->row);
75
return (table->cells[r][c] == NULL
76
|| c != table->cells[r][c]->col
77
|| r != table->cells[r][c]->row);
80
80
/* HTMLObject methods. */
141
141
d->cells = g_new (HTMLTableCell **, rows);
142
142
for (r = 0; r < rows; r++)
143
d->cells [r] = g_new0 (HTMLTableCell *, cols);
143
d->cells[r] = g_new0 (HTMLTableCell *, cols);
145
145
dest->change = HTML_CHANGE_ALL_CALC;
202
202
for (r = 0; r < rows; r++)
203
203
for (c = 0; c < cols; c++) {
204
HTMLTableCell *cell = t->cells [start->row + r][c + start_col];
204
HTMLTableCell *cell = t->cells[start->row + r][c + start_col];
206
206
if (!cell || (end->row != start->row
207
207
&& ((r == 0 && c < start->col) || (r == rows - 1 && c > end->col)))) {
208
208
html_table_set_cell (nt, r, c, html_engine_new_cell (e, nt));
209
html_table_cell_set_position (nt->cells [r][c], r, c);
209
html_table_cell_set_position (nt->cells[r][c], r, c);
211
211
if (cell->row == r + start->row && cell->col == c + start_col) {
212
212
HTMLTableCell *cell_copy;
219
219
html_table_cell_set_position (cell_copy, r, c);
221
221
if (cell->row - start->row >= 0 && cell->col - start_col >= 0) {
222
nt->cells [r][c] = nt->cells [cell->row - start->row][cell->col - start_col];
222
nt->cells[r][c] = nt->cells[cell->row - start->row][cell->col - start_col];
224
224
html_table_set_cell (nt, r, c, html_engine_new_cell (e, nt));
225
html_table_cell_set_position (nt->cells [r][c], r, c);
225
html_table_cell_set_position (nt->cells[r][c], r, c);
246
246
for (r = 0; r < t->totalRows; r++)
247
247
for (c = 0; c < t->totalCols; c++)
248
if (t->cells [r][c] && t->cells [r][c]->row == r && t->cells [r][c]->col == c)
248
if (t->cells[r][c] && t->cells[r][c]->row == r && t->cells[r][c]->col == c)
251
251
/* printf ("table n_children %d\n", n_children); */
263
263
for (r = 0; r < t->totalRows && !child; r++)
264
264
for (c = 0; c < t->totalCols; c++)
265
if (t->cells [r][c] && t->cells [r][c]->row == r && t->cells [r][c]->col == c) {
265
if (t->cells[r][c] && t->cells[r][c]->row == r && t->cells[r][c]->col == c) {
266
266
if (n == index) {
267
child = HTML_OBJECT (t->cells [r][c]);
267
child = HTML_OBJECT (t->cells[r][c]);
273
273
/* printf ("table ref %d child %p\n", index, child); */
285
285
for (r = 0; r < t->totalRows; r++)
286
286
for (c = 0; c < t->totalCols; c++) {
287
if (t->cells [r][c] && t->cells [r][c]->row == r && t->cells [r][c]->col == c) {
288
if (HTML_OBJECT (t->cells [r][c]) == child) {
287
if (t->cells[r][c] && t->cells[r][c]->row == r && t->cells[r][c]->col == c) {
288
if (HTML_OBJECT (t->cells[r][c]) == child) {
289
289
/* printf ("table child %p index %d\n", child, n); */
307
307
for (r = 0; r < t->totalRows; r++)
308
308
for (c = 0; c < t->totalCols; c++)
309
if (t->cells [r][c] && t->cells [r][c]->row == r && t->cells [r][c]->col == c)
310
len += html_object_get_recursive_length (HTML_OBJECT (t->cells [r][c])) + 1;
309
if (t->cells[r][c] && t->cells[r][c]->row == r && t->cells[r][c]->col == c)
310
len += html_object_get_recursive_length (HTML_OBJECT (t->cells[r][c])) + 1;
338
338
cell->row + r, cell->col + c, cell->rspan, cell->cspan, r, c);
341
t->cells [cell->row + r][cell->col + c] = NULL;
341
t->cells[cell->row + r][cell->col + c] = NULL;
343
343
HTML_OBJECT (cell)->parent = NULL;
385
385
for (r = 0; r < t->totalRows; r++) {
386
386
for (c = 0; c < t->totalCols; c++) {
387
cell = t->cells [r][c];
387
cell = t->cells[r][c];
388
388
if (cell && cell->row == r && cell->col == c) {
389
389
if (((r == start_row && c < start_col) || r < start_row)
390
390
|| ((r == end_row && c > end_col) || r > end_row)) {
391
391
html_table_set_cell (nt, r, c, html_engine_new_cell (e, nt));
392
html_table_cell_set_position (nt->cells [r][c], r, c);
392
html_table_cell_set_position (nt->cells[r][c], r, c);
394
394
HTMLTableCell *cell_cut;
402
402
html_table_set_cell (nt, r, c, cell_cut);
403
403
html_table_cell_set_position (cell_cut, r, c);
405
if (t->cells [r][c] == NULL) {
405
if (t->cells[r][c] == NULL) {
406
406
html_table_set_cell (t, r, c, html_engine_new_cell (e, t));
407
html_table_cell_set_position (t->cells [r][c], r, c);
407
html_table_cell_set_position (t->cells[r][c], r, c);
470
470
dup = HTML_OBJECT (g_new0 (HTMLTable, 1));
471
471
dup_table = HTML_TABLE (dup);
472
472
copy_sized (self, dup, t->totalRows, t->totalCols);
473
for (r = 0; r < t->totalRows; r ++) {
474
for (c = 0; c < t->totalCols; c ++) {
473
for (r = 0; r < t->totalRows; r++) {
474
for (c = 0; c < t->totalCols; c++) {
475
475
HTMLTableCell *cc;
477
cc = t->cells [r][c];
478
478
if (cc && cc->row == r && cc->col == c) {
479
479
if ((r == cell->row && c < cell->col) || r < cell->row) {
480
480
/* empty cell in dup table */
481
481
html_table_set_cell (dup_table, r, c, html_engine_new_cell (e, dup_table));
482
html_table_cell_set_position (dup_table->cells [r][c], r, c);
482
html_table_cell_set_position (dup_table->cells[r][c], r, c);
483
483
} else if ((r == dup_cell->row && c > dup_cell->col) || r > dup_cell->row) {
484
484
/* move cc to dup table */
485
485
remove_cell (t, cc);
486
486
html_table_set_cell (dup_table, r, c, cc);
487
html_table_cell_set_position (dup_table->cells [r][c], r, c);
487
html_table_cell_set_position (dup_table->cells[r][c], r, c);
488
488
/* place empty cell in t table */
489
489
html_table_set_cell (t, r, c, html_engine_new_cell (e, t));
490
html_table_cell_set_position (t->cells [r][c], r, c);
490
html_table_cell_set_position (t->cells[r][c], r, c);
493
493
if (r == cell->row && c == cell->col) {
495
495
/* empty cell in dup table */
496
496
html_table_set_cell (dup_table, r, c,
497
497
html_engine_new_cell (e, dup_table));
498
html_table_cell_set_position (dup_table->cells [r][c], r, c);
498
html_table_cell_set_position (dup_table->cells[r][c], r, c);
506
506
remove_cell (t, cell);
508
508
html_table_set_cell (dup_table, r, c, dup_cell);
509
html_table_cell_set_position (dup_table->cells [r][c], r, c);
509
html_table_cell_set_position (dup_table->cells[r][c], r, c);
511
511
if (r != cell->row || c != cell->col) {
512
512
/* empty cell in orig table */
513
513
html_table_set_cell (t, r, c, html_engine_new_cell (e, t));
514
html_table_cell_set_position (t->cells [r][c], r, c);
514
html_table_cell_set_position (t->cells[r][c], r, c);
558
558
|| t1->totalCols != t2->totalCols || t1->totalRows != t2->totalRows)
561
for (r = 0; r < t1->totalRows; r ++) {
562
for (c = 0; c < t1->totalCols; c ++) {
561
for (r = 0; r < t1->totalRows; r++) {
562
for (c = 0; c < t1->totalCols; c++) {
563
563
HTMLTableCell *c1, *c2;
565
c1 = t1->cells [r][c];
566
c2 = t2->cells [r][c];
565
c1 = t1->cells[r][c];
566
c2 = t2->cells[r][c];
612
612
html_object_destroy (HTML_OBJECT (c1));
613
613
remove_cell (t2, c2);
614
614
html_table_set_cell (t1, r, c, c2);
615
html_table_cell_set_position (t1->cells [r][c], r, c);
615
html_table_cell_set_position (t1->cells[r][c], r, c);
653
653
cursor_cell_2 = HTML_TABLE_CELL (object_get_parent_cell (cursor->object, HTML_OBJECT (t1)));
654
654
cursor_cell_3 = HTML_TABLE_CELL (object_get_parent_cell (e->cursor->object, HTML_OBJECT (t2)));
656
for (r = 0; r < t1->totalRows; r ++) {
657
for (c = 0; c < t1->totalCols; c ++) {
656
for (r = 0; r < t1->totalRows; r++) {
657
for (c = 0; c < t1->totalCols; c++) {
658
658
HTMLTableCell *c1, *c2;
660
c1 = t1->cells [r][c];
661
c2 = t2->cells [r][c];
660
c1 = t1->cells[r][c];
661
c2 = t2->cells[r][c];
664
664
if (!html_clue_is_empty (HTML_CLUE (c2))) {
680
680
+ (t1->totalCols - c1->col);
681
681
for (list = *left; list; list = list->next)
682
682
if (list->data && HTML_IS_TABLE (list->data))
683
e->cursor->position --;
683
e->cursor->position--;
685
685
/* printf ("3rd dec: %d t1_tail %d,%d\n",
686
686
(t1->totalRows - c1->row - 1)*t1->totalCols
774
774
for (i=0; i < table->totalRows - 1; i++)
775
if (table->cells [i][c - 1])
776
do_cspan (table, i, c, table->cells [i][c - 1]);
775
if (table->cells[i][c - 1])
776
do_cspan (table, i, c, table->cells[i][c - 1]);
784
784
for (r = 0; r < table->allocRows; r++) {
785
table->cells [r] = g_renew (HTMLTableCell *, table->cells [r], table->totalCols + num);
786
memset (table->cells [r] + table->totalCols, 0, num * sizeof (HTMLTableCell *));
785
table->cells[r] = g_renew (HTMLTableCell *, table->cells[r], table->totalCols + num);
786
memset (table->cells[r] + table->totalCols, 0, num * sizeof (HTMLTableCell *));
788
788
table->totalCols += num;
803
803
table->cells = g_renew (HTMLTableCell **, table->cells, table->allocRows + num);
805
805
for (r = table->allocRows; r < table->allocRows + num; r++) {
806
table->cells [r] = g_new (HTMLTableCell *, table->totalCols);
807
memset (table->cells [r], 0, table->totalCols * sizeof (HTMLTableCell *));
806
table->cells[r] = g_new (HTMLTableCell *, table->totalCols);
807
memset (table->cells[r], 0, table->totalCols * sizeof (HTMLTableCell *));
810
810
table->allocRows += num;
869
869
if (LL col_width * (ARR (cell->col + i + 1) - ARR (cell->col))
870
870
- LL new_width * span_width > LL (new_width + 1) * span_width
871
871
- LL col_width * (ARR (cell->col + i + 1) - ARR (cell->col)))
874
874
new_width = added + col_width / span;
875
875
if (col_width - LL span * new_width > LL span * (new_width + 1) - col_width)
878
878
new_width -= added;
879
879
added += new_width;
881
if (sizes [cell->col + i] < new_width)
882
sizes [cell->col + i] = new_width;
881
if (sizes[cell->col + i] < new_width)
882
sizes[cell->col + i] = new_width;
884
884
/* printf ("%d added %d col_width %d span_width %d\n",
885
885
col_width - added, added, col_width, span_width); */
912
912
for (c = 0; c < table->totalCols; c++) {
913
913
ARR (c + 1) += add;
914
if (ARR (c + 1) - ARR (c) < arr [c]) {
915
add += arr [c] - (ARR (c + 1) - ARR (c));
916
ARR (c + 1) = ARR (c) + arr [c];
914
if (ARR (c + 1) - ARR (c) < arr[c]) {
915
add += arr[c] - (ARR (c + 1) - ARR (c));
916
ARR (c + 1) = ARR (c) + arr[c];
923
923
for (c = 0; c < table->totalCols; c++)
942
942
g_assert (row >= 0);
944
944
/* add previous column cell which has cspan > 1 */
945
while (table->col < table->totalCols && table->cells [row][table->col] != 0) {
946
html_table_alloc_cell (table, row, table->col + table->cells [row][table->col]->cspan);
947
do_cspan (table, row, table->col + 1, table->cells [row][table->col]);
948
table->col += (table->cells [row][table->col])->cspan;
945
while (table->col < table->totalCols && table->cells[row][table->col] != 0) {
946
html_table_alloc_cell (table, row, table->col + table->cells[row][table->col]->cspan);
947
do_cspan (table, row, table->col + 1, table->cells[row][table->col]);
948
table->col += (table->cells[row][table->col])->cspan;
957
957
g_assert (row > 0);
959
959
for (i=0; i<table->totalCols; i++)
960
if (table->cells [row - 1][i]
961
&& (table->cells [row - 1][i])->row + (table->cells [row - 1][i])->rspan
960
if (table->cells[row - 1][i]
961
&& (table->cells[row - 1][i])->row + (table->cells[row - 1][i])->rspan
963
html_table_set_cell (table, table->row, i, table->cells [table->row - 1][i]);
964
do_cspan (table, table->row, i + 1, table->cells [table->row -1][i]);
963
html_table_set_cell (table, table->row, i, table->cells[table->row - 1][i]);
964
do_cspan (table, table->row, i + 1, table->cells[table->row -1][i]);
969
969
html_table_set_cell (HTMLTable *table, gint r, gint c, HTMLTableCell *cell)
971
if (!table->cells [r][c]) {
971
if (!table->cells[r][c]) {
972
972
#ifdef GTKHTML_DEBUG_TABLE
973
973
printf ("set cell: %d,%d %p\n", r, c, cell);
975
table->cells [r][c] = cell;
975
table->cells[r][c] = cell;
976
976
HTML_OBJECT (cell)->parent = HTML_OBJECT (table);
1245
1245
if (cell == NULL)
1247
if (c < end_col && cell == table->cells [r][c + 1])
1247
if (c < end_col && cell == table->cells[r][c + 1])
1249
if (r < end_row && table->cells [r + 1][c] == cell)
1249
if (r < end_row && table->cells[r + 1][c] == cell)
1252
1252
html_object_draw (HTML_OBJECT (cell), p,
1363
1363
cl = cell_end_col (table, cell);
1364
if (col_percent [cl] - col_percent [c] < cell->fixed_width) {
1364
if (col_percent[cl] - col_percent[c] < cell->fixed_width) {
1365
1365
gint cp, part, added, pleft, not_percented, np;
1367
1367
not_percented = 0;
1368
1368
for (cp = 0; cp < span; cp++)
1369
1369
if (!PERC (c + cp))
1374
pleft = cell->fixed_width - (col_percent [cl] - col_percent [c]);
1374
pleft = cell->fixed_width - (col_percent[cl] - col_percent[c]);
1375
1375
for (cp = 0; cp < span; cp++) {
1376
1376
if (not_percented) {
1377
1377
if (!PERC (c + cp)) {
1379
1379
if (np * pleft - part * not_percented >
1380
1380
(part + 1) * not_percented - np * pleft)
1385
part = ((col_percent [c + cp + 1] - col_percent [c]) * pleft)
1386
/ (col_percent [cl] - col_percent [cell->col]);
1387
if ((col_percent [c + cp + 1] - col_percent [c]) * pleft
1388
- part * (col_percent [cl] - col_percent [c])
1389
> (part + 1) * (col_percent [cl] - col_percent [c])
1390
- (col_percent [c + cp + 1] - col_percent [c]) * pleft)
1385
part = ((col_percent[c + cp + 1] - col_percent[c]) * pleft)
1386
/ (col_percent[cl] - col_percent[cell->col]);
1387
if ((col_percent[c + cp + 1] - col_percent[c]) * pleft
1388
- part * (col_percent[cl] - col_percent[c])
1389
> (part + 1) * (col_percent[cl] - col_percent[c])
1390
- (col_percent[c + cp + 1] - col_percent[c]) * pleft)
1395
span_percent [c + cp] = PERC (c + cp) + part;
1395
span_percent[c + cp] = PERC (c + cp) + part;
1407
1407
gboolean next = TRUE;
1409
1409
percent = g_new0 (gint, table->totalCols);
1410
for (span = 1; next && span <= table->totalCols; span ++) {
1410
for (span = 1; next && span <= table->totalCols; span++) {
1411
1411
for (c = 0; c < table->totalCols; c++)
1414
1414
next = calc_percentage_step (table, col_percent, percent, span);
1417
1417
for (c = 0; c < table->totalCols; c++) {
1418
col_percent [c + 1] += add;
1419
if (PERC (c) < percent [c]) {
1420
add += percent [c] - PERC (c);
1421
col_percent [c + 1] = col_percent [c] + percent [c];
1418
col_percent[c + 1] += add;
1419
if (PERC (c) < percent[c]) {
1420
add += percent[c] - PERC (c);
1421
col_percent[c + 1] = col_percent[c] + percent[c];
1447
1447
for (c = 0; c < table->totalCols; c++) {
1448
1448
request = (LL max_width * (PERC (c))) / 100;
1449
if (max_size [c] < request)
1450
to_fill += request - max_size [c];
1449
if (max_size[c] < request)
1450
to_fill += request - max_size[c];
1453
1453
/* printf ("to fill %d\n", to_fill); */
1458
1458
for (c = 0; c < table->totalCols; c++) {
1459
1459
request = (LL max_width * (PERC (c))) / 100;
1460
if (max_size [c] < request) {
1461
add = LL left * (request - max_size [c] + filled) / to_fill;
1462
if (LL left * (request - max_size [c] + filled) - LL add * to_fill >
1463
LL (add + 1) * to_fill - LL left * (request - max_size [c] + filled))
1460
if (max_size[c] < request) {
1461
add = LL left * (request - max_size[c] + filled) / to_fill;
1462
if (LL left * (request - max_size[c] + filled) - LL add * to_fill >
1463
LL (add + 1) * to_fill - LL left * (request - max_size[c] + filled))
1467
filled += request - max_size [c];
1468
max_size [c] += add;
1467
filled += request - max_size[c];
1485
1485
*ret_total_pref = 0;
1486
1486
*ret_total = 0;
1487
1487
for (c = 0; c < table->totalCols; c++)
1488
if (col_percent [c + 1] == col_percent [c]) {
1488
if (col_percent[c + 1] == col_percent[c]) {
1489
1489
pw = PREF (c + 1) - PREF (c)
1490
1490
- pixel_size * (table->spacing + border_extra);
1491
1491
/* printf ("col %d pw %d size %d\n", c, pw, max_size [c]); */
1492
if (max_size [c] < pw) {
1493
if (pw - max_size [c] < min_fill) {
1492
if (max_size[c] < pw) {
1493
if (pw - max_size[c] < min_fill) {
1495
min_fill = pw - max_size [c];
1495
min_fill = pw - max_size[c];
1498
1498
(*ret_total_pref) += pw;
1499
(*ret_total) += max_size [c];
1499
(*ret_total) += max_size[c];
1516
1516
- pixel_size * (table->spacing + border_extra);
1517
1517
/* printf ("min: %d left: %d\n", min_col, left); */
1518
1518
to_divide = MIN (total_pref - total, left);
1519
if (min_pw - max_size [min_col] < ((gdouble) min_pw * to_divide) / total_pref) {
1520
added = min_pw - max_size [min_col];
1519
if (min_pw - max_size[min_col] < ((gdouble) min_pw * to_divide) / total_pref) {
1520
added = min_pw - max_size[min_col];
1522
1522
min_fill = to_divide - added;
1523
max_size [min_col] += added;
1523
max_size[min_col] += added;
1524
1524
total_pref -= min_pw;
1526
1526
min_fill = to_divide;
1533
1533
for (c = 0; c < table->totalCols; c++) {
1534
if (col_percent [c + 1] == col_percent [c]) {
1534
if (col_percent[c + 1] == col_percent[c]) {
1535
1535
pw = PREF (c + 1) - PREF (c)
1536
1536
- pixel_size * (table->spacing + border_extra);
1537
if (max_size [c] < pw) {
1537
if (max_size[c] < pw) {
1538
1538
processed_pw += pw;
1539
1539
part = (LL min_fill * processed_pw) / total_pref;
1540
1540
if (LL min_fill * processed_pw - LL part * total_pref
1541
1541
> LL (part + 1) * total_pref - LL min_fill * processed_pw)
1544
if (max_size [c] + part > pw)
1545
part = pw - max_size [c];
1544
if (max_size[c] + part > pw)
1545
part = pw - max_size[c];
1547
max_size [c] += part;
1547
max_size[c] += part;
1549
1549
/* printf ("cell %d add: %d --> %d\n", c, part, max_size [c]); */
1569
1569
#define FW(c) COLUMN_FIX (table, c + 1) - COLUMN_FIX (table, c)
1571
1571
for (c = 0; c < table->totalCols; c++)
1572
if (col_percent [c + 1] == col_percent [c] && PW (c) > FW (c))
1572
if (col_percent[c + 1] == col_percent[c] && PW (c) > FW (c))
1573
1573
pref += COLUMN_PREF (table, c + 1) - COLUMN_PREF (table, c)
1574
1574
- pixel_size * (table->spacing + border_extra);
1575
1575
/* printf ("col pref: %d size: %d\n", COLUMN_PREF (table, c + 1)
1576
1576
- COLUMN_PREF (table, c)
1577
- pixel_size * (table->spacing + border_extra), max_size [c]); */
1577
- pixel_size * (table->spacing + border_extra), max_size[c]); */
1580
1580
processed_pw = 0;
1584
1584
for (c = 0; c < table->totalCols; c++) {
1585
if (col_percent [c + 1] == col_percent [c] && PW (c) > FW (c)) {
1585
if (col_percent[c + 1] == col_percent[c] && PW (c) > FW (c)) {
1586
1586
pw = COLUMN_PREF (table, c + 1) - COLUMN_PREF (table, c)
1587
1587
- pixel_size * (table->spacing + border_extra);
1588
1588
processed_pw += pw;
1591
1591
pw, part, total_fill, processed_pw); */
1592
1592
if (LL total_fill * processed_pw - LL part * pref
1593
1593
> LL (part + 1) * pref - LL total_fill * processed_pw)
1596
max_size [c] += part;
1596
max_size[c] += part;
1599
1599
/* printf ("col %d (add %d) --> %d (pw=%d)\n", c, part, max_size [c], pw); */
1627
1627
active = g_new (gboolean, table->totalCols);
1628
1628
for (c = 0; c < table->totalCols; c++)
1631
percent = col_percent [table->totalCols];
1631
percent = col_percent[table->totalCols];
1632
1632
width = max_width;
1634
1634
sub_percent = 0.0;
1635
1635
sub_width = width;
1636
1636
all_active = TRUE;
1637
1637
for (c = 0; c < table->totalCols; c++) {
1639
if (max_size [c] < ((gdouble) width * PERC (c)) / percent)
1639
if (max_size[c] < ((gdouble) width * PERC (c)) / percent)
1640
1640
sub_percent += PERC (c);
1642
sub_width -= max_size [c];
1642
sub_width -= max_size[c];
1643
1643
all_active = FALSE;
1652
1652
/* printf ("sub_width %d\n", sub_width); */
1653
1653
for (c = 0; c < table->totalCols; c++)
1654
if (active [c] && max_size [c] < ((gdouble) width * PERC (c)) / percent)
1655
max_size [c] = ((gdouble) width) * (PERC (c)) / percent;
1654
if (active[c] && max_size[c] < ((gdouble) width * PERC (c)) / percent)
1655
max_size[c] = ((gdouble) width) * (PERC (c)) / percent;
1657
1657
g_free (active);
1671
1671
for (c = 0; c < table->totalCols; c++) {
1672
1672
cell = table->cells[r][c];
1674
size = max_size [c] + (cell->col != c ? size : 0);
1674
size = max_size[c] + (cell->col != c ? size : 0);
1675
1675
if (cell_end_col (table, cell) - 1 == c && cell->row == r)
1676
1676
html_object_set_max_width (HTML_OBJECT (cell), painter, size
1677
1677
+ pixel_size * (table->spacing + border_extra) * CSPAN);
1688
1688
COLUMN_OPT (table, 0) = COLUMN_MIN (table, 0);
1690
1690
for (c = 0; c < table->totalCols; c++)
1691
COLUMN_OPT (table, c + 1) = COLUMN_OPT (table, c) + max_size [c]
1691
COLUMN_OPT (table, c + 1) = COLUMN_OPT (table, c) + max_size[c]
1692
1692
+ pixel_size * (table->spacing + (table->border ? 2 : 0));
1704
1704
col_percent = g_new (gint, table->totalCols + 1);
1705
1705
for (c = 0; c <= table->totalCols; c++)
1706
col_percent [c] = 0;
1708
1708
calc_col_percentage (table, col_percent);
1709
1709
/* printf ("width_left: %d percented: %d\n", width_left, col_percent [table->totalCols]); */
1730
1730
max_size = g_new (gint, table->totalCols);
1731
1731
for (c = 0; c < table->totalCols; c++)
1732
max_size [c] = COLUMN_MIN (table, c+1) - COLUMN_MIN (table, c) - pixel_size * (table->spacing + border_extra);
1732
max_size[c] = COLUMN_MIN (table, c+1) - COLUMN_MIN (table, c) - pixel_size * (table->spacing + border_extra);
1734
1734
return max_size;
2031
2031
/* remove last \n from added text */
2032
2032
if (buffer->len != len) {
2034
if (buffer->str [buffer->len-1] == '\n')
2034
if (buffer->str[buffer->len-1] == '\n')
2035
2035
g_string_truncate (buffer, buffer->len - 1);
2053
2053
for (c = 0; c < table->totalCols; c++) {
2054
2054
if (invalid_cell (table, r, c))
2056
return HTML_OBJECT (table->cells [r][c]);
2056
return HTML_OBJECT (table->cells[r][c]);
2069
2069
for (c = table->totalCols - 1; c >= 0; c--) {
2070
2070
if (invalid_cell (table, r, c))
2072
return HTML_OBJECT (table->cells [r][c]);
2072
return HTML_OBJECT (table->cells[r][c]);
2087
2087
for (; c < table->totalCols; c++) {
2088
2088
if (invalid_cell (table, r, c))
2090
return HTML_OBJECT (table->cells [r][c]);
2090
return HTML_OBJECT (table->cells[r][c]);
2156
2156
for (r = 0; r < table->totalRows; r++) {
2157
2157
SB "<TR>\n" SE;
2158
2158
for (c = 0; c < table->totalCols; c++) {
2159
if (!table->cells [r][c]
2160
|| table->cells [r][c]->row != r
2161
|| table->cells [r][c]->col != c)
2159
if (!table->cells[r][c]
2160
|| table->cells[r][c]->row != r
2161
|| table->cells[r][c]->col != c)
2163
if (!html_object_save (HTML_OBJECT (table->cells [r][c]), state))
2163
if (!html_object_save (HTML_OBJECT (table->cells[r][c]), state))
2166
2166
SB "</TR>\n" SE;
2184
2184
for (r = 0; r < table->totalRows; r++) {
2185
2185
for (c = 0; c < table->totalCols; c++) {
2186
if (!table->cells [r][c]
2187
|| table->cells [r][c]->row != r
2188
|| table->cells [r][c]->col != c)
2186
if (!table->cells[r][c]
2187
|| table->cells[r][c]->row != r
2188
|| table->cells[r][c]->col != c)
2190
2190
/* FIXME the width calculation for the column here is completely broken */
2191
result &= html_object_save_plain (HTML_OBJECT (table->cells [r][c]), state, requested_width / table->totalCols);
2191
result &= html_object_save_plain (HTML_OBJECT (table->cells[r][c]), state, requested_width / table->totalCols);
2385
2385
prev_col_do_cspan (table, table->row);
2387
2387
/* look for first free cell */
2388
while (table->cells [table->row][table->col] && table->col < table->totalCols)
2388
while (table->cells[table->row][table->col] && table->col < table->totalCols)
2391
2391
html_table_alloc_cell (table, table->row, table->col);
2414
2414
gint r, c, cells = 0;
2416
for (r = 0; r < table->totalRows; r ++)
2417
for (c = 0; c < table->totalCols; c ++)
2418
if (table->cells [r][c]) {
2419
if (HTML_CLUE (table->cells [r][c])->head == NULL) {
2420
HTMLTableCell *cell = table->cells [r][c];
2416
for (r = 0; r < table->totalRows; r++)
2417
for (c = 0; c < table->totalCols; c++)
2418
if (table->cells[r][c]) {
2419
if (HTML_CLUE (table->cells[r][c])->head == NULL) {
2420
HTMLTableCell *cell = table->cells[r][c];
2422
2422
remove_cell (table, cell);
2423
2423
html_object_destroy (HTML_OBJECT (cell));