/* PSPP - a program for statistical analysis.
- Copyright (C) 2009 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 <config.h>
-#include <libpspp/assertion.h>
-#include <libpspp/tower.h>
-#include <output/table-provider.h>
+#include "libpspp/assertion.h"
+#include "libpspp/tower.h"
+#include "output/table-provider.h"
#include "gl/minmax.h"
#include "gl/xalloc.h"
static struct table_paste *
table_paste_cast (const struct table *table)
{
- assert (table->class == &table_paste_class);
+ assert (table->klass == &table_paste_class);
return UP_CAST (table, struct table_paste, table);
}
static bool
is_table_paste (const struct table *table, int orientation)
{
- return (table->class == &table_paste_class
+ return (table->klass == &table_paste_class
&& table_paste_cast (table)->orientation == orientation);
}
if (b == NULL)
return a;
+ assert (a->n[!orientation] == b->n[!orientation]);
+
/* Handle tables that know how to paste themselves. */
if (!table_is_shared (a) && !table_is_shared (b) && a != b)
{
- if (a->class->paste != NULL)
+ if (a->klass->paste != NULL)
{
- struct table *new = a->class->paste (a, b, orientation);
+ struct table *new = a->klass->paste (a, b, orientation);
if (new != NULL)
return new;
}
- if (b->class->paste != NULL && a->class != b->class)
+ if (b->klass->paste != NULL && a->klass != b->klass)
{
- struct table *new = b->class->paste (a, b, orientation);
+ struct table *new = b->klass->paste (a, b, orientation);
if (new != NULL)
return new;
}
return table_paste (left, right, TABLE_HORZ);
}
-/* Shorthand for table_paste (left, right, TABLE_VERT). */
+/* Shorthand for table_paste (top, bottom, TABLE_VERT). */
struct table *
-table_vpaste (struct table *left, struct table *right)
+table_vpaste (struct table *top, struct table *bottom)
{
- return table_paste (left, right, TABLE_VERT);
+ return table_paste (top, bottom, TABLE_VERT);
}
static void
static int
table_paste_get_rule (const struct table *t,
- enum table_axis axis, int x, int y)
+ enum table_axis axis, int x, int y,
+ struct cell_color *color)
{
struct table_paste *tp = table_paste_cast (t);
int h = tp->orientation == TABLE_HORZ ? x : y;
ps = paste_subtable_lookup (tp, h == 0 ? 0 : h - 1, &start);
if (tp->orientation == TABLE_HORZ) /* XXX */
- r = table_get_rule (ps->table, axis, h - start, k);
+ r = table_get_rule (ps->table, axis, h - start, k, color);
else
- r = table_get_rule (ps->table, axis, k, h - start);
+ r = table_get_rule (ps->table, axis, k, h - start, color);
if (h == start + tower_node_get_size (&ps->node))
{
struct tower_node *ps2_ = tower_next (&tp->subtables, &ps->node);
int r2;
if (tp->orientation == TABLE_HORZ) /* XXX */
- r2 = table_get_rule (ps2->table, axis, 0, k);
+ r2 = table_get_rule (ps2->table, axis, 0, k, color);
else
- r2 = table_get_rule (ps2->table, axis, k, 0);
+ r2 = table_get_rule (ps2->table, axis, k, 0, color);
return table_rule_combine (r, r2);
}
}
{
ps = paste_subtable_lookup (tp, h, &start);
if (tp->orientation == TABLE_HORZ) /* XXX */
- return table_get_rule (ps->table, axis, h - start, k);
+ return table_get_rule (ps->table, axis, h - start, k, color);
else
- return table_get_rule (ps->table, axis, k, h - start);
+ return table_get_rule (ps->table, axis, k, h - start, color);
}
}