char *separator; /* Field separator (usually comma or tab). */
int quote; /* Quote character (usually ' or ") or 0. */
char *quote_set; /* Characters that force quoting. */
- bool captions; /* Print table captions? */
+ bool titles; /* Print table titles? */
char *file_name; /* Output file name. */
char *command_name; /* Current command. */
csv->quote = quote[0];
free (quote);
csv->quote_set = xasprintf ("\n\r\t%s%c", csv->separator, csv->quote);
- csv->captions = parse_boolean (opt (d, o, "captions", "true"));
+ csv->titles = parse_boolean (opt (d, o, "titles", "true"));
csv->file_name = xstrdup (file_name);
csv->file = fn_open (csv->file_name, "w");
csv->n_items = 0;
const struct table_item *item)
{
const struct table *t = table_item_get_table (item);
- const char *caption = table_item_get_caption (item);
+ const char *title = table_item_get_title (item);
int y, x;
- if (csv->captions && caption != NULL)
+ if (csv->titles && title != NULL)
{
- csv_output_field_format (csv, "Table: %s", caption);
+ csv_output_field_format (csv, "Table: %s", title);
putc ('\n', csv->file);
}
if (is_table_item (output_item))
{
struct table_item *table_item = to_table_item (output_item);
- const char *caption = table_item_get_caption (table_item);
+ const char *title = table_item_get_title (table_item);
const struct table *t = table_item_get_table (table_item);
int footnote_idx;
int x, y;
csv_put_separator (csv);
- if (csv->captions && caption != NULL)
+ if (csv->titles && title != NULL)
{
- csv_output_field_format (csv, "Table: %s", caption);
+ csv_output_field_format (csv, "Table: %s", title);
putc ('\n', csv->file);
}
html_output_table (struct html_driver *html, const struct table_item *item)
{
const struct table *t = table_item_get_table (item);
- const char *caption = table_item_get_caption (item);
+ const char *title = table_item_get_title (item);
int footnote_idx = 0;
int y;
fputs ("<TBODY VALIGN=\"TOP\">\n", html->file);
- if (caption != NULL)
+ if (title != NULL)
{
fputs (" <CAPTION>", html->file);
- escape_string (html->file, caption, strlen (caption), " ", "<BR>");
+ escape_string (html->file, title, strlen (title), " ", "<BR>");
fputs ("</CAPTION>\n", html->file);
}
write_table (struct odt_driver *odt, const struct table_item *item)
{
const struct table *tab = table_item_get_table (item);
- const char *caption = table_item_get_caption (item);
+ const char *title = table_item_get_title (item);
int r, c;
/* Write a heading for the table */
- if (caption != NULL)
+ if (title != NULL)
{
xmlTextWriterStartElement (odt->content_wtr, _xml("text:h"));
xmlTextWriterWriteFormatAttribute (odt->content_wtr,
_xml("text:outline-level"), "%d", 2);
xmlTextWriterWriteString (odt->content_wtr,
- _xml (table_item_get_caption (item)) );
+ _xml (table_item_get_title (item)) );
xmlTextWriterEndElement (odt->content_wtr);
}
const struct table_item *table_item)
{
struct render_pager *p;
- const char *caption;
+ const char *title;
p = xzalloc (sizeof *p);
p->params = params;
- caption = table_item_get_caption (table_item);
- if (caption)
- render_pager_add_table (p, table_from_string (TAB_LEFT, caption));
+ title = table_item_get_title (table_item);
+ if (title)
+ render_pager_add_table (p, table_from_string (TAB_LEFT, title));
render_pager_add_table (p, table_ref (table_item_get_table (table_item)));
add_footnote_page (p, p->pages[p->n_pages - 1]);
Some of the features of this type of table are obsolete but have not yet
been removed, because some code still uses them. These features are:
- - The title. The title (or caption, actually) is a property of the
- table_item (see output/table-item.h) in which a table is embedded,
- not a property of the table itself.
+ - The title. The title is a property of the table_item (see
+ output/table-item.h) in which a table is embedded, not a property of
+ the table itself.
- Row and columns offsets (via tab_offset(), tab_next_row()). This
feature simply isn't used enough to justify keeping it.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "gl/xalloc.h"
/* Initializes ITEM as a table item for rendering TABLE. The new table item
- initially has the specified CAPTION, which may be NULL if no caption is yet
- available. The caller retains ownership of CAPTION. */
+ initially has the specified TITLE, which may be NULL if no title is yet
+ available. The caller retains ownership of TITLE. */
struct table_item *
-table_item_create (struct table *table, const char *caption)
+table_item_create (struct table *table, const char *title)
{
struct table_item *item = xmalloc (sizeof *item);
output_item_init (&item->output_item, &table_item_class);
item->table = table;
- item->caption = caption != NULL ? xstrdup (caption) : NULL;
+ item->title = title != NULL ? xstrdup (title) : NULL;
return item;
}
return table_item->table;
}
-/* Returns ITEM's caption, which is a null pointer if no caption has been
+/* Returns ITEM's title, which is a null pointer if no title has been
set. */
const char *
-table_item_get_caption (const struct table_item *item)
+table_item_get_title (const struct table_item *item)
{
- return item->caption;
+ return item->title;
}
-/* Sets ITEM's caption to CAPTION, replacing any previous caption. Specify
- NULL for CAPTION to clear any caption from ITEM. The caller retains
- ownership of CAPTION.
+/* Sets ITEM's title to TITLE, replacing any previous title. Specify NULL for
+ TITLE to clear any title from ITEM. The caller retains ownership of TITLE.
This function may only be used on a table_item that is unshared. */
void
-table_item_set_caption (struct table_item *item, const char *caption)
+table_item_set_title (struct table_item *item, const char *title)
{
assert (!table_item_is_shared (item));
- free (item->caption);
- item->caption = caption != NULL ? xstrdup (caption) : NULL;
+ free (item->title);
+ item->title = title != NULL ? xstrdup (title) : NULL;
}
/* Submits TABLE_ITEM to the configured output drivers, and transfers ownership
table_item_destroy (struct output_item *output_item)
{
struct table_item *item = to_table_item (output_item);
- free (item->caption);
+ free (item->title);
table_unref (item->table);
free (item);
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
A table item is a subclass of an output item (see output-item.h) that
contains a table (see table.h) and some formatting properties (currently
- just a caption). */
+ just a title). */
#include "libpspp/compiler.h"
#include "output/output-item.h"
{
struct output_item output_item; /* Superclass. */
struct table *table; /* The table to be rendered. */
- char *caption; /* May be null if there is no caption. */
+ char *title; /* May be null if there is no title. */
};
-struct table_item *table_item_create (struct table *, const char *caption);
+struct table_item *table_item_create (struct table *, const char *title);
const struct table *table_item_get_table (const struct table_item *);
-const char *table_item_get_caption (const struct table_item *);
-void table_item_set_caption (struct table_item *, const char *);
+const char *table_item_get_title (const struct table_item *);
+void table_item_set_title (struct table_item *, const char *);
\f
/* This boilerplate for table_item, a subclass of output_item, was
autogenerated by mk-class-boilerplate. */
enum
{
- COL_TITLE, /* Table title. */
+ COL_NAME, /* Table name. */
COL_ADDR, /* Pointer to the table */
- COL_Y, /* Y position of top of title. */
+ COL_Y, /* Y position of top of name. */
N_COLS
};
{
GtkWidget *drawing_area;
struct xr_rendering *r;
- struct string title;
+ struct string name;
GtkTreeStore *store;
GtkTreePath *path;
GtkTreeIter iter;
{
store = GTK_TREE_STORE (gtk_tree_view_get_model (view->overview));
- ds_init_empty (&title);
+ ds_init_empty (&name);
if (is_text_item (item)
&& text_item_get_type (to_text_item (item)) == TEXT_ITEM_COMMAND_OPEN)
{
gtk_tree_store_append (store, &iter, p);
}
- ds_clear (&title);
+ ds_clear (&name);
if (is_text_item (item))
- ds_put_cstr (&title, text_item_get_text (to_text_item (item)));
+ ds_put_cstr (&name, text_item_get_text (to_text_item (item)));
else if (is_message_item (item))
{
const struct message_item *msg_item = to_message_item (item);
const struct msg *msg = message_item_get_msg (msg_item);
- ds_put_format (&title, "%s: %s", _("Message"),
+ ds_put_format (&name, "%s: %s", _("Message"),
msg_severity_to_string (msg->severity));
}
else if (is_table_item (item))
{
- const char *caption = table_item_get_caption (to_table_item (item));
- if (caption != NULL)
- ds_put_format (&title, "Table: %s", caption);
+ const char *title = table_item_get_title (to_table_item (item));
+ if (title != NULL)
+ ds_put_format (&name, "Table: %s", title);
else
- ds_put_cstr (&title, "Table");
+ ds_put_cstr (&name, "Table");
}
else if (is_chart_item (item))
{
const char *s = chart_item_get_title (to_chart_item (item));
if (s != NULL)
- ds_put_format (&title, "Chart: %s", s);
+ ds_put_format (&name, "Chart: %s", s);
else
- ds_put_cstr (&title, "Chart");
+ ds_put_cstr (&name, "Chart");
}
gtk_tree_store_set (store, &iter,
- COL_TITLE, ds_cstr (&title),
+ COL_NAME, ds_cstr (&name),
COL_ADDR, item,
COL_Y, view->y,
-1);
- ds_destroy (&title);
+ ds_destroy (&name);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
gtk_tree_view_expand_row (view->overview, path, TRUE);
{
model = GTK_TREE_MODEL (gtk_tree_store_new (
N_COLS,
- G_TYPE_STRING, /* COL_TITLE */
+ G_TYPE_STRING, /* COL_NAME */
G_TYPE_POINTER, /* COL_ADDR */
G_TYPE_LONG)); /* COL_Y */
gtk_tree_view_set_model (overview, model);
gtk_tree_view_append_column (GTK_TREE_VIEW (overview), column);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
- gtk_tree_view_column_add_attribute (column, renderer, "text", COL_TITLE);
+ gtk_tree_view_column_add_attribute (column, renderer, "text", COL_NAME);
g_signal_connect (GTK_TREE_VIEW (overview),
"row-activated", G_CALLBACK (on_row_activate), view);