/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2013, 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
int top_margin; /* Top margin in lines. */
int bottom_margin; /* Bottom margin in lines. */
+ int min_break[TABLE_N_AXES]; /* Min cell size to break across pages. */
+
const ucs4_t *box; /* Line & box drawing characters. */
/* Internal state. */
struct string_map *o)
{
enum { BOX_ASCII, BOX_UNICODE } box;
+ int min_break[TABLE_N_AXES];
struct output_driver *d;
struct ascii_driver *a;
int paper_length;
a->top_margin = parse_int (opt (d, o, "top-margin", "0"), 0, INT_MAX);
a->bottom_margin = parse_int (opt (d, o, "bottom-margin", "0"), 0, INT_MAX);
+ min_break[H] = parse_int (opt (d, o, "min-hbreak", "-1"), -1, INT_MAX);
+ min_break[V] = parse_int (opt (d, o, "min-vbreak", "-1"), -1, INT_MAX);
+
a->width = parse_page_size (opt (d, o, "width", "79"));
paper_length = parse_page_size (opt (d, o, "length", "66"));
a->auto_width = a->width < 0;
a->auto_length = paper_length < 0;
a->length = paper_length - vertical_margins (a);
+ a->min_break[H] = min_break[H] >= 0 ? min_break[H] : a->width / 2;
+ a->min_break[V] = min_break[V] >= 0 ? min_break[V] : a->length / 2;
#ifdef HAVE_CAIRO
parse_color (d, o, "background-color", "#FFFFFFFFFFFF", &a->bg);
parse_color (d, o, "foreground-color", "#000000000000", &a->fg);
params.line_widths[H][i] = width;
params.line_widths[V][i] = width;
}
+ for (i = 0; i < TABLE_N_AXES; i++)
+ params.min_break[i] = a->min_break[i];
if (a->file == NULL && !ascii_open_page (a))
return;
int line_space; /* Space between lines. */
int line_width; /* Width of lines. */
+ int min_break[TABLE_N_AXES]; /* Min cell size to break across pages. */
+
struct xr_color bg; /* Background color */
struct xr_color fg; /* Foreground color */
int top_margin, bottom_margin;
int paper_width, paper_length;
int font_size;
+ int min_break[TABLE_N_AXES];
/* Scale factor from inch/72000 to inch/(72 * XR_POINT). */
const double scale = XR_POINT / 1000.;
top_margin = parse_dimension (opt (d, o, "top-margin", ".5in"));
bottom_margin = parse_dimension (opt (d, o, "bottom-margin", ".5in"));
+ min_break[H] = parse_dimension (opt (d, o, "min-hbreak", NULL)) * scale;
+ min_break[V] = parse_dimension (opt (d, o, "min-vbreak", NULL)) * scale;
+
/* Convert to inch/(XR_POINT * 72). */
xr->left_margin = left_margin * scale;
xr->right_margin = right_margin * scale;
xr->bottom_margin = bottom_margin * scale;
xr->width = (paper_width - left_margin - right_margin) * scale;
xr->length = (paper_length - top_margin - bottom_margin) * scale;
+ xr->min_break[H] = min_break[H] >= 0 ? min_break[H] : xr->width / 2;
+ xr->min_break[V] = min_break[V] >= 0 ? min_break[V] : xr->length / 2;
}
static struct xr_driver *
xr->params->line_widths[i][RENDER_LINE_SINGLE] = single_width;
xr->params->line_widths[i][RENDER_LINE_DOUBLE] = double_width;
}
+
+ for (i = 0; i < TABLE_N_AXES; i++)
+ xr->params->min_break[i] = xr->min_break[i];
}
cairo_set_source_rgb (xr->cairo, xr->fg.red, xr->fg.green, xr->fg.blue);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 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
o->driver_name = xstrdup (driver_name);
o->name = xstrdup (name);
o->value = value != NULL ? xstrdup (value) : NULL;
- o->default_value = xstrdup (default_value);
+ o->default_value = default_value ? xstrdup (default_value) : NULL;
return o;
}
{
int retval;
- retval = o->value != NULL ? measure_dimension (o->value) : -1;
- if (retval == -1)
- retval = measure_dimension (o->default_value);
+ retval = (o->value != NULL ? measure_dimension (o->value)
+ : o->default_value != NULL ? measure_dimension (o->default_value)
+ : -1);
driver_option_destroy (o);
return retval;
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011, 2013, 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
const struct render_page *page = b->page;
enum table_axis axis = b->axis;
- return cell_width (page, axis, cell) > page->params->size[axis] / 2;
+ return cell_width (page, axis, cell) >= page->params->min_break[axis];
}
\f
/* render_page_select() and helpers. */
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 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
/* Width of different kinds of lines. */
int line_widths[TABLE_N_AXES][RENDER_N_LINES];
+
+ /* Minimum cell width or height before allowing the cell to be broken
+ across two pages. (Joined cells may always be broken at join
+ points.) */
+ int min_break[TABLE_N_AXES];
};
\f
/* A "page" of content that is ready to be rendered.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011, 2012, 2013, 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
}
static void
-configure_drivers (int width, int length)
+configure_drivers (int width, int length, int min_break)
{
struct string_map options, tmp;
struct output_driver *driver;
xasprintf ("%d", width));
string_map_insert_nocopy (&options, xstrdup ("length"),
xasprintf ("%d", length));
+ if (min_break >= 0)
+ {
+ string_map_insert_nocopy (&options, xstrdup ("min-hbreak"),
+ xasprintf ("%d", min_break));
+ string_map_insert_nocopy (&options, xstrdup ("min-vbreak"),
+ xasprintf ("%d", min_break));
+ }
if (emphasis != NULL)
string_map_insert (&options, "emphasis", emphasis);
if (box != NULL)
string_map_insert (&options, "right-margin", "0");
string_map_insert_nocopy (&options, xstrdup ("paper-size"),
xasprintf ("%dx%dpt", width * 5, length * 8));
+ if (min_break >= 0)
+ {
+ string_map_insert_nocopy (&options, xstrdup ("min-hbreak"),
+ xasprintf ("%d", min_break * 5));
+ string_map_insert_nocopy (&options, xstrdup ("min-vbreak"),
+ xasprintf ("%d", min_break * 8));
+ }
driver = output_driver_create (&options);
if (driver == NULL)
exit (EXIT_FAILURE);
{
int width = 79;
int length = 66;
+ int min_break = -1;
for (;;)
{
enum {
OPT_WIDTH = UCHAR_MAX + 1,
OPT_LENGTH,
+ OPT_MIN_BREAK,
OPT_EMPHASIS,
OPT_BOX,
OPT_HELP
{
{"width", required_argument, NULL, OPT_WIDTH},
{"length", required_argument, NULL, OPT_LENGTH},
+ {"min-break", required_argument, NULL, OPT_MIN_BREAK},
{"transpose", no_argument, &transpose, 1},
{"emphasis", required_argument, NULL, OPT_EMPHASIS},
{"box", required_argument, NULL, OPT_BOX},
length = atoi (optarg);
break;
+ case OPT_MIN_BREAK:
+ min_break = atoi (optarg);
+ break;
+
case OPT_EMPHASIS:
emphasis = optarg;
break;
}
- configure_drivers (width, length);
+ configure_drivers (width, length, min_break);
if (optind + 1 != argc)
error (1, 0, "exactly one non-option argument required; "