From a0a8d020201e0e38a63d9aa3dce228d7d9e6fb35 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Thu, 14 Mar 2013 12:42:39 +0100 Subject: Various changes. (bzr r11608.1.48) --- src/live_effects/lpeobject.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 3e4e40198..052202e44 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -66,7 +66,7 @@ LivePathEffectObject::livepatheffect_class_init(LivePathEffectObjectClass *klass livepatheffect_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT); - sp_object_class->build = livepatheffect_build; + //sp_object_class->build = livepatheffect_build; sp_object_class->release = livepatheffect_release; sp_object_class->set = livepatheffect_set; @@ -100,8 +100,9 @@ LivePathEffectObject::livepatheffect_build(SPObject *object, SPDocument *documen g_assert(object != NULL); g_assert(SP_IS_OBJECT(object)); - if (((SPObjectClass *) livepatheffect_parent_class)->build) - (* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr); +// if (((SPObjectClass *) livepatheffect_parent_class)->build) +// (* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr); +// CPPIFY: todo object->readAttr( "effect" ); -- cgit v1.2.3 From 732214b111f2e830a8a0b654a88b087766be9067 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 30 Mar 2013 00:46:09 +0100 Subject: Added "virtual pads" for - ColorProfile - LivePathEffectObject - Persp3D (bzr r11608.1.51) --- src/live_effects/lpeobject.cpp | 143 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 10 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 052202e44..e9801fc11 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -73,6 +73,13 @@ LivePathEffectObject::livepatheffect_class_init(LivePathEffectObjectClass *klass sp_object_class->write = livepatheffect_write; } +CLivePathEffectObject::CLivePathEffectObject(LivePathEffectObject* lpeo) : CObject(lpeo) { + this->livepatheffectobject = lpeo; +} + +CLivePathEffectObject::~CLivePathEffectObject() { +} + /** * Callback to initialize livepatheffect object. */ @@ -82,6 +89,10 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) #ifdef LIVEPATHEFFECT_VERBOSE g_message("Init livepatheffectobject"); #endif + + lpeobj->clivepatheffectobject = new CLivePathEffectObject(lpeobj); + lpeobj->cobject = lpeobj->clivepatheffectobject; + lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; lpeobj->lpe = NULL; @@ -97,12 +108,30 @@ LivePathEffectObject::livepatheffect_build(SPObject *object, SPDocument *documen #ifdef LIVEPATHEFFECT_VERBOSE g_message("Build livepatheffect"); #endif +// g_assert(object != NULL); +// g_assert(SP_IS_OBJECT(object)); +// +//// if (((SPObjectClass *) livepatheffect_parent_class)->build) +//// (* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr); +// +// object->readAttr( "effect" ); +// +// if (repr) { +// repr->addListener (&livepatheffect_repr_events, object); +// } +// +// /* Register ourselves, is this necessary? */ +//// document->addResource("path-effect", object); + ((LivePathEffectObject*)object)->clivepatheffectobject->onBuild(document, repr); +} + +void CLivePathEffectObject::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { + LivePathEffectObject* object = this->livepatheffectobject; + g_assert(object != NULL); g_assert(SP_IS_OBJECT(object)); -// if (((SPObjectClass *) livepatheffect_parent_class)->build) -// (* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr); -// CPPIFY: todo + CObject::onBuild(document, repr); object->readAttr( "effect" ); @@ -124,6 +153,42 @@ LivePathEffectObject::livepatheffect_release(SPObject *object) g_print("Releasing livepatheffect"); #endif +// LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); +// +// object->getRepr()->removeListenerByData(object); +// +// +///* +// if (object->document) { +// // Unregister ourselves +// sp_document_removeResource(object->document, "livepatheffect", object); +// } +// +// if (gradient->ref) { +// gradient->modified_connection.disconnect(); +// gradient->ref->detach(); +// delete gradient->ref; +// gradient->ref = NULL; +// } +// +// gradient->modified_connection.~connection(); +// +//*/ +// +// if (lpeobj->lpe) { +// delete lpeobj->lpe; +// lpeobj->lpe = NULL; +// } +// lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; +// +// if (((SPObjectClass *) livepatheffect_parent_class)->release) +// ((SPObjectClass *) livepatheffect_parent_class)->release(object); + ((LivePathEffectObject*)object)->clivepatheffectobject->onRelease(); +} + +void CLivePathEffectObject::onRelease() { + LivePathEffectObject* object = this->livepatheffectobject; + LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); object->getRepr()->removeListenerByData(object); @@ -152,8 +217,9 @@ LivePathEffectObject::livepatheffect_release(SPObject *object) } lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - if (((SPObjectClass *) livepatheffect_parent_class)->release) - ((SPObjectClass *) livepatheffect_parent_class)->release(object); +// if (((SPObjectClass *) livepatheffect_parent_class)->release) +// ((SPObjectClass *) livepatheffect_parent_class)->release(object); + CObject::onRelease(); } /** @@ -162,6 +228,38 @@ LivePathEffectObject::livepatheffect_release(SPObject *object) void LivePathEffectObject::livepatheffect_set(SPObject *object, unsigned key, gchar const *value) { +// LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); +//#ifdef LIVEPATHEFFECT_VERBOSE +// g_print("Set livepatheffect"); +//#endif +// switch (key) { +// case SP_PROP_PATH_EFFECT: +// if (lpeobj->lpe) { +// delete lpeobj->lpe; +// lpeobj->lpe = NULL; +// } +// +// if ( value && Inkscape::LivePathEffect::LPETypeConverter.is_valid_key(value) ) { +// lpeobj->effecttype = Inkscape::LivePathEffect::LPETypeConverter.get_id_from_key(value); +// lpeobj->lpe = Inkscape::LivePathEffect::Effect::New(lpeobj->effecttype, lpeobj); +// lpeobj->effecttype_set = true; +// } else { +// lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; +// lpeobj->effecttype_set = false; +// } +// object->requestModified(SP_OBJECT_MODIFIED_FLAG); +// break; +// } +// +// if (((SPObjectClass *) livepatheffect_parent_class)->set) { +// ((SPObjectClass *) livepatheffect_parent_class)->set(object, key, value); +// } + ((LivePathEffectObject*)object)->clivepatheffectobject->onSet(key, value); +} + +void CLivePathEffectObject::onSet(unsigned key, gchar const *value) { + LivePathEffectObject* object = this->livepatheffectobject; + LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); #ifdef LIVEPATHEFFECT_VERBOSE g_print("Set livepatheffect"); @@ -185,9 +283,10 @@ LivePathEffectObject::livepatheffect_set(SPObject *object, unsigned key, gchar c break; } - if (((SPObjectClass *) livepatheffect_parent_class)->set) { - ((SPObjectClass *) livepatheffect_parent_class)->set(object, key, value); - } +// if (((SPObjectClass *) livepatheffect_parent_class)->set) { +// ((SPObjectClass *) livepatheffect_parent_class)->set(object, key, value); +// } + CObject::onSet(key, value); } /** @@ -200,6 +299,28 @@ LivePathEffectObject::livepatheffect_write(SPObject *object, Inkscape::XML::Docu g_print("Write livepatheffect"); #endif +// LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); +// +// if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { +// repr = xml_doc->createElement("inkscape:path-effect"); +// } +// +// if ((flags & SP_OBJECT_WRITE_ALL) || lpeobj->lpe) { +// repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(lpeobj->effecttype).c_str()); +// +// lpeobj->lpe->writeParamsToSVG(); +// } +// +// if (((SPObjectClass *) livepatheffect_parent_class)->write) +// (* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, xml_doc, repr, flags); +// +// return repr; + return ((LivePathEffectObject*)object)->clivepatheffectobject->onWrite(xml_doc, repr, flags); +} + +Inkscape::XML::Node* CLivePathEffectObject::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + LivePathEffectObject* object = this->livepatheffectobject; + LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -212,8 +333,10 @@ LivePathEffectObject::livepatheffect_write(SPObject *object, Inkscape::XML::Docu lpeobj->lpe->writeParamsToSVG(); } - if (((SPObjectClass *) livepatheffect_parent_class)->write) - (* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, xml_doc, repr, flags); +// if (((SPObjectClass *) livepatheffect_parent_class)->write) +// (* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, xml_doc, repr, flags); + + CObject::onWrite(xml_doc, repr, flags); return repr; } -- cgit v1.2.3 From 957c3e4b7909d42c5a13f1b1dd583f877fc32259 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 30 Mar 2013 00:46:57 +0100 Subject: Removed function pointers from SPObject and subclasses. Added some missing virtual pads for classes that were hidden by preprocessor macros. (bzr r11608.1.55) --- src/live_effects/lpeobject.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index e9801fc11..0f9d09511 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -67,10 +67,10 @@ LivePathEffectObject::livepatheffect_class_init(LivePathEffectObjectClass *klass livepatheffect_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT); //sp_object_class->build = livepatheffect_build; - sp_object_class->release = livepatheffect_release; - - sp_object_class->set = livepatheffect_set; - sp_object_class->write = livepatheffect_write; +// sp_object_class->release = livepatheffect_release; +// +// sp_object_class->set = livepatheffect_set; +// sp_object_class->write = livepatheffect_write; } CLivePathEffectObject::CLivePathEffectObject(LivePathEffectObject* lpeo) : CObject(lpeo) { -- cgit v1.2.3 From 7df6616da5ea2debb86838366ddf746841549cdb Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 30 Mar 2013 00:56:13 +0100 Subject: Renamed virtual function names. (bzr r11608.1.57) --- src/live_effects/lpeobject.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index d742456d8..93f038473 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -98,13 +98,13 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) /** * Virtual build: set livepatheffect attributes from its associated XML node. */ -void CLivePathEffectObject::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { +void CLivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) { LivePathEffectObject* object = this->livepatheffectobject; g_assert(object != NULL); g_assert(SP_IS_OBJECT(object)); - CObject::onBuild(document, repr); + CObject::build(document, repr); object->readAttr( "effect" ); @@ -119,7 +119,7 @@ void CLivePathEffectObject::onBuild(SPDocument *document, Inkscape::XML::Node *r /** * Virtual release of livepatheffect members before destruction. */ -void CLivePathEffectObject::onRelease() { +void CLivePathEffectObject::release() { LivePathEffectObject* object = this->livepatheffectobject; LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); @@ -150,13 +150,13 @@ void CLivePathEffectObject::onRelease() { } lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - CObject::onRelease(); + CObject::release(); } /** * Virtual set: set attribute to value. */ -void CLivePathEffectObject::onSet(unsigned key, gchar const *value) { +void CLivePathEffectObject::set(unsigned key, gchar const *value) { LivePathEffectObject* object = this->livepatheffectobject; LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); @@ -182,13 +182,13 @@ void CLivePathEffectObject::onSet(unsigned key, gchar const *value) { break; } - CObject::onSet(key, value); + CObject::set(key, value); } /** * Virtual write: write object attributes to repr. */ -Inkscape::XML::Node* CLivePathEffectObject::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CLivePathEffectObject::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { LivePathEffectObject* object = this->livepatheffectobject; LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); @@ -203,7 +203,7 @@ Inkscape::XML::Node* CLivePathEffectObject::onWrite(Inkscape::XML::Document *xml lpeobj->lpe->writeParamsToSVG(); } - CObject::onWrite(xml_doc, repr, flags); + CObject::write(xml_doc, repr, flags); return repr; } -- cgit v1.2.3 From a5d6e692d661f0bf7648e64e8fcb04588bb8f3ab Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Mon, 1 Apr 2013 00:07:00 +0200 Subject: Prepared exchange of casting macros. (bzr r11608.1.63) --- src/live_effects/lpeobject.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 93f038473..d404b9743 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -85,6 +85,7 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) #endif lpeobj->clivepatheffectobject = new CLivePathEffectObject(lpeobj); + lpeobj->typeHierarchy.insert(typeid(LivePathEffectObject)); delete lpeobj->cobject; lpeobj->cobject = lpeobj->clivepatheffectobject; -- cgit v1.2.3 From 69f3b6f1abb2bb422935d43262e1e99aab359954 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Tue, 2 Apr 2013 01:41:30 +0200 Subject: Added constructors to SP classes. (bzr r11608.1.67) --- src/live_effects/lpeobject.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index d404b9743..15a8a26b6 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -35,14 +35,14 @@ LivePathEffectObject::livepatheffect_get_type () GTypeInfo livepatheffect_info = { sizeof (LivePathEffectObjectClass), NULL, NULL, - (GClassInitFunc) LivePathEffectObject::livepatheffect_class_init, + 0,//(GClassInitFunc) LivePathEffectObject::livepatheffect_class_init, NULL, NULL, sizeof (LivePathEffectObject), 16, (GInstanceInitFunc) LivePathEffectObject::livepatheffect_init, NULL, }; - livepatheffect_type = g_type_register_static (SP_TYPE_OBJECT, "LivePathEffectObject", &livepatheffect_info, (GTypeFlags)0); + livepatheffect_type = g_type_register_static (G_TYPE_OBJECT, "LivePathEffectObject", &livepatheffect_info, (GTypeFlags)0); } return livepatheffect_type; } @@ -74,12 +74,9 @@ CLivePathEffectObject::CLivePathEffectObject(LivePathEffectObject* lpeo) : CObje CLivePathEffectObject::~CLivePathEffectObject() { } -/** - * Callback to initialize livepatheffect object. - */ -void -LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) -{ +LivePathEffectObject::LivePathEffectObject() : SPObject() { + LivePathEffectObject* lpeobj = this; + #ifdef LIVEPATHEFFECT_VERBOSE g_message("Init livepatheffectobject"); #endif @@ -96,6 +93,15 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) lpeobj->effecttype_set = false; } +/** + * Callback to initialize livepatheffect object. + */ +void +LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) +{ + new (lpeobj) LivePathEffectObject(); +} + /** * Virtual build: set livepatheffect attributes from its associated XML node. */ -- cgit v1.2.3 From d1af3566872dfff2aeec84859c87f1f8d13f79df Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Tue, 2 Apr 2013 19:14:36 +0200 Subject: Registered classes with new factory. Hkern, Vkern and FeFuncX have to be rewritten, as they aren't real classes. (bzr r11608.1.69) --- src/live_effects/lpeobject.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 15a8a26b6..5191d612c 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -20,6 +20,16 @@ //#define LIVEPATHEFFECT_VERBOSE +#include "sp-factory.h" + +namespace { + SPObject* createLivepatheffect() { + return new LivePathEffectObject(); + } + + bool livepatheffectRegistered = SPFactory::instance().registerObject("inkscape:path-effect", createLivepatheffect); +} + 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; -- cgit v1.2.3 From 7b7e0294b0c06a8d3ec19b73486a91e12cf67adf Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 6 Apr 2013 22:16:05 +0200 Subject: Merged more classes. (bzr r11608.1.84) --- src/live_effects/lpeobject.cpp | 84 ++++++++---------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') 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); -- cgit v1.2.3 From 27e2102f96a5554bcd5310ec11435d155773b279 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sun, 7 Apr 2013 18:28:22 +0200 Subject: Merge Object and subclasses. Merging of SP- and C-classes complete. (bzr r11608.1.86) --- src/live_effects/lpeobject.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 012bf6612..b708a36cd 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -41,14 +41,11 @@ static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = { }; -LivePathEffectObject::LivePathEffectObject() : SPObject(), CObject(this) { +LivePathEffectObject::LivePathEffectObject() : SPObject() { #ifdef LIVEPATHEFFECT_VERBOSE g_message("Init livepatheffectobject"); #endif - delete this->cobject; - this->cobject = this; - this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; this->lpe = NULL; @@ -67,7 +64,7 @@ void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr g_assert(object != NULL); g_assert(SP_IS_OBJECT(object)); - CObject::build(document, repr); + SPObject::build(document, repr); object->readAttr( "effect" ); @@ -113,7 +110,7 @@ void LivePathEffectObject::release() { } lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - CObject::release(); + SPObject::release(); } /** @@ -145,7 +142,7 @@ void LivePathEffectObject::set(unsigned key, gchar const *value) { break; } - CObject::set(key, value); + SPObject::set(key, value); } /** @@ -166,7 +163,7 @@ Inkscape::XML::Node* LivePathEffectObject::write(Inkscape::XML::Document *xml_do lpeobj->lpe->writeParamsToSVG(); } - CObject::write(xml_doc, repr, flags); + SPObject::write(xml_doc, repr, flags); return repr; } -- cgit v1.2.3 From beecbea1b415d5b9536f2309c4f30fc258e346f5 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Wed, 31 Jul 2013 22:51:23 +0200 Subject: Cleaned up a bit; fixed struct vs. class forward declarations. (bzr r11608.1.111) --- src/live_effects/lpeobject.cpp | 70 +++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 42 deletions(-) (limited to 'src/live_effects/lpeobject.cpp') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index b708a36cd..d61f2b2fa 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -41,15 +41,13 @@ static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = { }; -LivePathEffectObject::LivePathEffectObject() : SPObject() { +LivePathEffectObject::LivePathEffectObject() + : SPObject(), effecttype(Inkscape::LivePathEffect::INVALID_LPE), effecttype_set(false), + lpe(NULL) +{ #ifdef LIVEPATHEFFECT_VERBOSE g_message("Init livepatheffectobject"); #endif - - this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - this->lpe = NULL; - - this->effecttype_set = false; } LivePathEffectObject::~LivePathEffectObject() { @@ -59,17 +57,15 @@ LivePathEffectObject::~LivePathEffectObject() { * Virtual build: set livepatheffect attributes from its associated XML node. */ void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) { - LivePathEffectObject* object = this; - - g_assert(object != NULL); - g_assert(SP_IS_OBJECT(object)); + g_assert(this != NULL); + g_assert(SP_IS_OBJECT(this)); SPObject::build(document, repr); - object->readAttr( "effect" ); + this->readAttr( "effect" ); if (repr) { - repr->addListener (&livepatheffect_repr_events, object); + repr->addListener (&livepatheffect_repr_events, this); } /* Register ourselves, is this necessary? */ @@ -80,12 +76,7 @@ void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr * Virtual release of livepatheffect members before destruction. */ void LivePathEffectObject::release() { - LivePathEffectObject* object = this; - - LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); - - object->getRepr()->removeListenerByData(object); - + this->getRepr()->removeListenerByData(this); /* if (object->document) { @@ -101,14 +92,14 @@ void LivePathEffectObject::release() { } gradient->modified_connection.~connection(); - */ - if (lpeobj->lpe) { - delete lpeobj->lpe; - lpeobj->lpe = NULL; + if (this->lpe) { + delete this->lpe; + this->lpe = NULL; } - lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; + + this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; SPObject::release(); } @@ -117,28 +108,27 @@ void LivePathEffectObject::release() { * Virtual set: set attribute to value. */ void LivePathEffectObject::set(unsigned key, gchar const *value) { - LivePathEffectObject* object = this; - - LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); #ifdef LIVEPATHEFFECT_VERBOSE g_print("Set livepatheffect"); #endif + switch (key) { case SP_PROP_PATH_EFFECT: - if (lpeobj->lpe) { - delete lpeobj->lpe; - lpeobj->lpe = NULL; + if (this->lpe) { + delete this->lpe; + this->lpe = NULL; } if ( value && Inkscape::LivePathEffect::LPETypeConverter.is_valid_key(value) ) { - lpeobj->effecttype = Inkscape::LivePathEffect::LPETypeConverter.get_id_from_key(value); - lpeobj->lpe = Inkscape::LivePathEffect::Effect::New(lpeobj->effecttype, lpeobj); - lpeobj->effecttype_set = true; + this->effecttype = Inkscape::LivePathEffect::LPETypeConverter.get_id_from_key(value); + this->lpe = Inkscape::LivePathEffect::Effect::New(this->effecttype, this); + this->effecttype_set = true; } else { - lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE; - lpeobj->effecttype_set = false; + this->effecttype = Inkscape::LivePathEffect::INVALID_LPE; + this->effecttype_set = false; } - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + + this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; } @@ -149,18 +139,14 @@ void LivePathEffectObject::set(unsigned key, gchar const *value) { * Virtual write: write object attributes to repr. */ Inkscape::XML::Node* LivePathEffectObject::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - LivePathEffectObject* object = this; - - LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("inkscape:path-effect"); } - if ((flags & SP_OBJECT_WRITE_ALL) || lpeobj->lpe) { - repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(lpeobj->effecttype).c_str()); + if ((flags & SP_OBJECT_WRITE_ALL) || this->lpe) { + repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(this->effecttype).c_str()); - lpeobj->lpe->writeParamsToSVG(); + this->lpe->writeParamsToSVG(); } SPObject::write(xml_doc, repr, flags); -- cgit v1.2.3