summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-04-06 20:16:05 +0000
committerMarkus Engel <markus.engel@tum.de>2013-04-06 20:16:05 +0000
commit7b7e0294b0c06a8d3ec19b73486a91e12cf67adf (patch)
tree842fb9e8768d87c73b35c0e10f5c69f10c154e09 /src/live_effects
parentMerged ObjectGroup and subclasses. (diff)
downloadinkscape-7b7e0294b0c06a8d3ec19b73486a91e12cf67adf.tar.gz
inkscape-7b7e0294b0c06a8d3ec19b73486a91e12cf67adf.zip
Merged more classes.
(bzr r11608.1.84)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpeobject.cpp84
-rw-r--r--src/live_effects/lpeobject.h31
2 files changed, 18 insertions, 97 deletions
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp
index 5191d612c..012bf6612 100644
--- a/src/live_effects/lpeobject.cpp
+++ b/src/live_effects/lpeobject.cpp
@@ -32,31 +32,6 @@ namespace {
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.
- */
-GType
-LivePathEffectObject::livepatheffect_get_type ()
-{
- static GType livepatheffect_type = 0;
-
- if (!livepatheffect_type) {
- GTypeInfo livepatheffect_info = {
- sizeof (LivePathEffectObjectClass),
- NULL, NULL,
- 0,//(GClassInitFunc) LivePathEffectObject::livepatheffect_class_init,
- NULL, NULL,
- sizeof (LivePathEffectObject),
- 16,
- (GInstanceInitFunc) LivePathEffectObject::livepatheffect_init,
- NULL,
- };
- livepatheffect_type = g_type_register_static (G_TYPE_OBJECT, "LivePathEffectObject", &livepatheffect_info, (GTypeFlags)0);
- }
- return livepatheffect_type;
-}
-
static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = {
NULL, /* child_added */
NULL, /* child_removed */
@@ -66,57 +41,28 @@ static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = {
};
-/**
- * Callback to initialize livepatheffect vtable.
- */
-void
-LivePathEffectObject::livepatheffect_class_init(LivePathEffectObjectClass *klass)
-{
- SPObjectClass *sp_object_class = (SPObjectClass *) klass;
-
- livepatheffect_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-}
-
-CLivePathEffectObject::CLivePathEffectObject(LivePathEffectObject* lpeo) : CObject(lpeo) {
- this->livepatheffectobject = lpeo;
-}
-
-CLivePathEffectObject::~CLivePathEffectObject() {
-}
-
-LivePathEffectObject::LivePathEffectObject() : SPObject() {
- LivePathEffectObject* lpeobj = this;
-
+LivePathEffectObject::LivePathEffectObject() : SPObject(), CObject(this) {
#ifdef LIVEPATHEFFECT_VERBOSE
g_message("Init livepatheffectobject");
#endif
- lpeobj->clivepatheffectobject = new CLivePathEffectObject(lpeobj);
- lpeobj->typeHierarchy.insert(typeid(LivePathEffectObject));
+ delete this->cobject;
+ this->cobject = this;
- delete lpeobj->cobject;
- lpeobj->cobject = lpeobj->clivepatheffectobject;
+ this->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
+ this->lpe = NULL;
- lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
- lpeobj->lpe = NULL;
-
- lpeobj->effecttype_set = false;
+ this->effecttype_set = false;
}
-/**
- * Callback to initialize livepatheffect object.
- */
-void
-LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj)
-{
- new (lpeobj) LivePathEffectObject();
+LivePathEffectObject::~LivePathEffectObject() {
}
/**
* Virtual build: set livepatheffect attributes from its associated XML node.
*/
-void CLivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
- LivePathEffectObject* object = this->livepatheffectobject;
+void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
+ LivePathEffectObject* object = this;
g_assert(object != NULL);
g_assert(SP_IS_OBJECT(object));
@@ -136,8 +82,8 @@ void CLivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *rep
/**
* Virtual release of livepatheffect members before destruction.
*/
-void CLivePathEffectObject::release() {
- LivePathEffectObject* object = this->livepatheffectobject;
+void LivePathEffectObject::release() {
+ LivePathEffectObject* object = this;
LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
@@ -173,8 +119,8 @@ void CLivePathEffectObject::release() {
/**
* Virtual set: set attribute to value.
*/
-void CLivePathEffectObject::set(unsigned key, gchar const *value) {
- LivePathEffectObject* object = this->livepatheffectobject;
+void LivePathEffectObject::set(unsigned key, gchar const *value) {
+ LivePathEffectObject* object = this;
LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
#ifdef LIVEPATHEFFECT_VERBOSE
@@ -205,8 +151,8 @@ void CLivePathEffectObject::set(unsigned key, gchar const *value) {
/**
* Virtual write: write object attributes to repr.
*/
-Inkscape::XML::Node* CLivePathEffectObject::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
- LivePathEffectObject* object = this->livepatheffectobject;
+Inkscape::XML::Node* LivePathEffectObject::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
+ LivePathEffectObject* object = this;
LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h
index 02d3344f5..d5aaa09bf 100644
--- a/src/live_effects/lpeobject.h
+++ b/src/live_effects/lpeobject.h
@@ -22,21 +22,13 @@ namespace Inkscape {
}
}
-#define TYPE_LIVEPATHEFFECT (LivePathEffectObject::livepatheffect_get_type())
#define LIVEPATHEFFECT(obj) ((LivePathEffectObject*)obj)
-#define IS_LIVEPATHEFFECT(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(LivePathEffectObject)))
+#define IS_LIVEPATHEFFECT(obj) (dynamic_cast<const LivePathEffectObject*>((SPObject*)obj))
-/// The LivePathEffect vtable.
-struct LivePathEffectObjectClass {
- SPObjectClass parent_class;
-};
-
-class CLivePathEffectObject;
-
-class LivePathEffectObject : public SPObject {
+class LivePathEffectObject : public SPObject, public CObject {
public:
LivePathEffectObject();
- CLivePathEffectObject* clivepatheffectobject;
+ virtual ~LivePathEffectObject();
Inkscape::LivePathEffect::EffectType effecttype;
@@ -51,29 +43,12 @@ public:
//private:
Inkscape::LivePathEffect::Effect *lpe; // this can be NULL in a valid LivePathEffectObject
- /* C-style class functions: */
-//public:
- static GType livepatheffect_get_type();
-//private:
- static void livepatheffect_class_init(LivePathEffectObjectClass *klass);
- static void livepatheffect_init(LivePathEffectObject *stop);
-};
-
-
-class CLivePathEffectObject : public CObject {
-public:
- CLivePathEffectObject(LivePathEffectObject* lpeo);
- virtual ~CLivePathEffectObject();
-
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
virtual void set(unsigned int key, const gchar* value);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- LivePathEffectObject* livepatheffectobject;
};
#endif