output: Add support for colors in cells.
[pspp] / src / output / tab.c
index fe4b27402dddf71454691ef155fed65573fd644f..a158b22979e1cb79b9ec3f2dc2bd57e325ef42e9 100644 (file)
 #define _(msgid) gettext (msgid)
 \f
 
-#if DEBUGGING
 static const bool debugging = true;
-#else
-static const bool debugging = false;
-#endif
+
 
 /* Cell options. */
 #define TAB_JOIN     (1u << TAB_FIRST_AVAILABLE)
@@ -108,6 +105,8 @@ tab_create (int nc, int nr)
   t->fmtmap[RC_INTEGER] = ugly[RC_INTEGER];
   t->fmtmap[RC_OTHER] = *settings_get_format ();
 
+  memset (t->styles, 0, sizeof t->styles);
+
   t->col_ofs = t->row_ofs = 0;
 
   return t;
@@ -826,6 +825,11 @@ tab_get_cell (const struct table *table, int x, int y,
           cell->n_contents = 0;
         }
     }
+
+  int style_idx = (opt & TAB_STYLE_MASK) >> TAB_STYLE_SHIFT;
+  const struct cell_style *style = t->styles[style_idx];
+  if (style)
+    cell->style = style;
 }
 
 static int