lpeobject.cpp revision d05f5e48661e499738feca18812be9462f8fa73e
/*
* Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpeobject.h"
#include "live_effects/effect.h"
#include "xml/node-event-vector.h"
#include "sp-object.h"
#include "attributes.h"
#include "document.h"
#include "document-private.h"
//#define LIVEPATHEFFECT_VERBOSE
static void livepatheffect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *livepatheffect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
static void livepatheffect_on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
static SPObjectClass *livepatheffect_parent_class;
/**
* Registers the LivePathEffect class with Gdk and returns its type number.
*/
{
static GType livepatheffect_type = 0;
if (!livepatheffect_type) {
sizeof (LivePathEffectObjectClass),
sizeof (LivePathEffectObject),
16,
NULL,
};
livepatheffect_type = g_type_register_static (SP_TYPE_OBJECT, "LivePathEffectObject", &livepatheffect_info, (GTypeFlags)0);
}
return livepatheffect_type;
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
/**
* Callback to initialize livepatheffect vtable.
*/
static void
{
}
/**
* Callback to initialize livepatheffect object.
*/
static void
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_message("Init livepatheffectobject");
#endif
lpeobj->effecttype_set = false;
}
/**
* Virtual build: set livepatheffect attributes from its associated XML node.
*/
static void
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_message("Build livepatheffect");
#endif
if (repr) {
}
/* Register ourselves, is this necessary? */
// sp_document_add_resource(document, "path-effect", object);
}
/**
* Virtual release of livepatheffect members before destruction.
*/
static void
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_print("Releasing livepatheffect");
#endif
/*
if (SP_OBJECT_DOCUMENT(object)) {
// Unregister ourselves
sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "livepatheffect", SP_OBJECT(object));
}
if (gradient->ref) {
gradient->modified_connection.disconnect();
gradient->ref->detach();
delete gradient->ref;
gradient->ref = NULL;
}
gradient->modified_connection.~connection();
*/
}
}
/**
* Virtual set: set attribute to value.
*/
static void
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_print("Set livepatheffect");
#endif
switch (key) {
case SP_PROP_PATH_EFFECT:
}
lpeobj->effecttype_set = true;
} else {
lpeobj->effecttype_set = false;
}
break;
}
}
}
/**
* Virtual write: write object attributes to repr.
*/
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_print("Write livepatheffect");
#endif
}
repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(lpeobj->effecttype).c_str());
// lpeobj->lpe->write(repr); something like this.
return repr;
}
static void
const gchar */*oldval*/,
bool /*is_interactive*/,
void * data )
{
#ifdef LIVEPATHEFFECT_VERBOSE
g_print("livepatheffect_on_repr_attr_changed");
#endif
if (!data)
return;
return;
}
/**
* If this has other users, create a new private duplicate and return it
* returns 'this' when no forking was necessary (and therefore no duplicate was made)
*/
{
if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) {
return lpeobj_new;
}
return this;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :