sp-symbol.cpp revision 06aecef405c4cf6f7551ab622c3040562cb62c78
#define __SP_SYMBOL_C__
/*
* SVG <symbol> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1999-2003 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#include "libnr/nr-matrix-fns.h"
#include "libnr/nr-matrix-ops.h"
#include "display/nr-arena-group.h"
#include "attributes.h"
#include "print.h"
#include "sp-symbol.h"
#include "document.h"
static void sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
static Inkscape::XML::Node *sp_symbol_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static NRArenaItem *sp_symbol_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
static void sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static SPGroupClass *parent_class;
sp_symbol_get_type (void)
{
if (!type) {
sizeof (SPSymbolClass),
sizeof (SPSymbol),
16,
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
switch (key) {
case SP_ATTR_VIEWBOX:
if (value) {
char *eptr;
/* fixme: We have to take original item affine into account */
/* fixme: Think (Lauris) */
/* Set viewbox */
} else {
}
} else {
}
break;
/* Do setup before, so we can use break to escape */
if (value) {
int len;
gchar c[256];
const gchar *p, *e;
p = value;
while (*p && *p == 32) p += 1;
if (!*p) break;
e = p;
while (*e && *e != 32) e += 1;
len = e - p;
if (len > 8) break;
c[len] = 0;
/* Now the actual part */
if (!strcmp (c, "none")) {
} else if (!strcmp (c, "xMinYMin")) {
} else if (!strcmp (c, "xMidYMin")) {
} else if (!strcmp (c, "xMaxYMin")) {
} else if (!strcmp (c, "xMinYMid")) {
} else if (!strcmp (c, "xMidYMid")) {
} else if (!strcmp (c, "xMaxYMid")) {
} else if (!strcmp (c, "xMinYMax")) {
} else if (!strcmp (c, "xMidYMax")) {
} else if (!strcmp (c, "xMaxYMax")) {
} else {
break;
}
while (*e && *e == 32) e += 1;
if (*e) {
if (!strcmp (e, "meet")) {
} else if (!strcmp (e, "slice")) {
} else {
break;
}
}
}
break;
default:
break;
}
}
static void
{
}
static void
{
SPItemView *v;
if (SP_OBJECT_IS_CLONED (object)) {
/* Cloned <symbol> is actually renderable */
/* fixme: We have to set up clip here too */
/* Create copy of item context */
/* Calculate child to parent transformation */
/* Apply parent <use> translation (set up as vewport) */
if (symbol->viewBox_set) {
/* Determine actual viewbox in viewport coordinates */
x = 0.0;
y = 0.0;
} else {
/* Things are getting interesting */
/* Now place viewbox to requested position */
switch (symbol->aspect_align) {
case SP_ASPECT_XMIN_YMIN:
x = 0.0;
y = 0.0;
break;
case SP_ASPECT_XMID_YMIN:
y = 0.0;
break;
case SP_ASPECT_XMAX_YMIN:
y = 0.0;
break;
case SP_ASPECT_XMIN_YMID:
x = 0.0;
break;
case SP_ASPECT_XMID_YMID:
break;
case SP_ASPECT_XMAX_YMID:
break;
case SP_ASPECT_XMIN_YMAX:
x = 0.0;
break;
case SP_ASPECT_XMID_YMAX:
break;
case SP_ASPECT_XMAX_YMAX:
break;
default:
x = 0.0;
y = 0.0;
break;
}
}
/* Compose additional transformation from scale and position */
q[1] = 0.0;
q[2] = 0.0;
/* Append viewbox transformation */
}
/* If viewBox is set initialize child viewport */
/* Otherwise <use> has set it up already */
if (symbol->viewBox_set) {
}
/* And invoke parent method */
/* As last step set additional transform of arena group */
}
} else {
/* No-op */
}
}
static void
{
}
sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
return repr;
}
static NRArenaItem *
{
if (SP_OBJECT_IS_CLONED (symbol)) {
/* Cloned <symbol> is actually renderable */
if (ai) {
}
} else {
}
} else {
}
return ai;
}
static void
{
if (SP_OBJECT_IS_CLONED (symbol)) {
/* Cloned <symbol> is actually renderable */
}
}
static void
sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags)
{
if (SP_OBJECT_IS_CLONED (symbol)) {
/* Cloned <symbol> is actually renderable */
}
}
}
static void
{
if (SP_OBJECT_IS_CLONED (symbol)) {
/* Cloned <symbol> is actually renderable */
}
}
}