X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Frender.c;h=a7cc3e67b6e6e5b812a7a4c6e74711784c815b29;hb=f8cba0fb13cceeac43fe4b15e2d5b48798ab1a6e;hp=423940b068eabaeff29b63e06ffea287820152c0;hpb=eb142a3b4d4e2d4296fb3fcddb683c360748b6ca;p=pspp diff --git a/src/output/render.c b/src/output/render.c index 423940b068..a7cc3e67b6 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -26,7 +26,6 @@ #include "libpspp/hash-functions.h" #include "libpspp/hmap.h" #include "libpspp/pool.h" -#include "output/pivot-table.h" /* XXX for PIVOT_AREA_FOOTER */ #include "output/render.h" #include "output/table-item.h" #include "output/table.h" @@ -727,7 +726,7 @@ render_page_create (const struct render_params *params, struct table *table, for (int i = 0; i < 2; i++) columns[i] = xzalloc (nc * sizeof *columns[i]); for (int y = 0; y < nr; y++) - for (int x = 0; x < nc; ) + for (int x = 0; x < nc;) { struct table_cell cell; @@ -752,7 +751,7 @@ render_page_create (const struct render_params *params, struct table *table, for (int x = 0; x < nc; x++) columns[i][x].width = columns[i][x].unspanned; for (int y = 0; y < nr; y++) - for (int x = 0; x < nc; ) + for (int x = 0; x < nc;) { struct table_cell cell; @@ -810,7 +809,7 @@ render_page_create (const struct render_params *params, struct table *table, /* Calculate heights of cells that do not span multiple rows. */ struct render_row *rows = xzalloc (nr * sizeof *rows); for (int y = 0; y < nr; y++) - for (int x = 0; x < nc; ) + for (int x = 0; x < nc;) { struct render_row *r = &rows[y]; struct table_cell cell; @@ -838,7 +837,7 @@ render_page_create (const struct render_params *params, struct table *table, /* Distribute heights of spanned rows. */ for (int y = 0; y < nr; y++) - for (int x = 0; x < nc; ) + for (int x = 0; x < nc;) { struct table_cell cell; @@ -993,10 +992,10 @@ render_direction_rtl (void) this string with "output-direction-rtl". Otherwise either leave it untranslated or copy it verbatim. */ const char *dir = _("output-direction-ltr"); - if ( 0 == strcmp ("output-direction-rtl", dir)) + if (0 == strcmp ("output-direction-rtl", dir)) return true; - if ( 0 != strcmp ("output-direction-ltr", dir)) + if (0 != strcmp ("output-direction-ltr", dir)) fprintf (stderr, "This localisation has been incorrectly translated. " "Complain to the translator.\n"); @@ -1080,6 +1079,7 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES], bb[V][1] = clip[V][1] = ofs[V] + page->cp[V][cell->d[V][1] * 2]; enum table_valign valign = cell->style->cell_style.valign; + int valign_offset = 0; if (valign != TABLE_VALIGN_TOP) { int height = page->params->measure_cell_height ( @@ -1089,7 +1089,7 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES], { if (valign == TABLE_VALIGN_CENTER) extra /= 2; - bb[V][0] += extra; + valign_offset += extra; } } @@ -1126,7 +1126,7 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES], ? 0 : (cell->d[V][0] - page->h[V][0]) & 1); page->params->draw_cell (page->params->aux, cell, color_idx, - bb, spill, clip); + bb, valign_offset, spill, clip); } /* Draws the cells of PAGE indicated in BB. */ @@ -1135,7 +1135,7 @@ render_page_draw_cells (const struct render_page *page, int ofs[TABLE_N_AXES], int bb[TABLE_N_AXES][2]) { for (int y = bb[V][0]; y < bb[V][1]; y++) - for (int x = bb[H][0]; x < bb[H][1]; ) + for (int x = bb[H][0]; x < bb[H][1];) if (!is_rule (x) && !is_rule (y)) { struct table_cell cell; @@ -1371,7 +1371,7 @@ render_break_next (struct render_break *b, int size) number of pixels available, which might look bad e.g. because it breaks in the middle of a line of text. */ if (axis == TABLE_VERT && page->params->adjust_break) - for (int x = 0; x < page->n[H]; ) + for (int x = 0; x < page->n[H];) { struct table_cell cell; @@ -1510,17 +1510,10 @@ add_footnote_page (struct render_pager *p, const struct table_item *item) struct table *t = table_create (1, n_footnotes, 0, 0, 0, 0); - const struct area_style *style = item->table->styles[PIVOT_AREA_FOOTER]; - if (!style) - style = pivot_area_get_default_style (PIVOT_AREA_FOOTER); - t->styles[PIVOT_AREA_FOOTER] = area_style_clone (t->container, style); - for (size_t i = 0; i < n_footnotes; i++) { - table_text_format (t, 0, i, PIVOT_AREA_FOOTER << TAB_STYLE_SHIFT, - "%s. %s", f[i]->marker, f[i]->content); - if (f[i]->style) - table_add_style (t, 0, i, f[i]->style); + table_text_format (t, 0, i, 0, "%s. %s", f[i]->marker, f[i]->content); + table_add_style (t, 0, i, f[i]->style); } render_pager_add_table (p, t, 0); @@ -1539,7 +1532,7 @@ add_text_page (struct render_pager *p, const struct table_item_text *t, for (size_t i = 0; i < t->n_footnotes; i++) table_add_footnote (tab, 0, 0, t->footnotes[i]); if (t->style) - tab->styles[0] = area_style_clone (tab->container, t->style); + tab->styles[0] = table_area_style_clone (tab->container, t->style); render_pager_add_table (p, tab, min_width); } @@ -1559,7 +1552,7 @@ add_layers_page (struct render_pager *p, table_add_footnote (tab, 0, i, layer->footnotes[j]); } if (layers->style) - tab->styles[0] = area_style_clone (tab->container, layers->style); + tab->styles[0] = table_area_style_clone (tab->container, layers->style); render_pager_add_table (p, tab, min_width); } @@ -1880,7 +1873,7 @@ render_page_select (const struct render_page *page, enum table_axis axis, }; if (!page->h[a][0] || z0 > page->h[a][0] || p0) - for (int z = 0; z < page->n[b]; ) + for (int z = 0; z < page->n[b];) { int d[TABLE_N_AXES]; d[a] = z0; @@ -1915,7 +1908,7 @@ render_page_select (const struct render_page *page, enum table_axis axis, } if (!page->h[a][1] || z1 < page->n[a] - page->h[a][1] || p1) - for (int z = 0; z < page->n[b]; ) + for (int z = 0; z < page->n[b];) { int d[TABLE_N_AXES]; d[a] = z1 - 1;