summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-07-31 20:51:23 +0000
committerMarkus Engel <markus.engel@tum.de>2013-07-31 20:51:23 +0000
commitbeecbea1b415d5b9536f2309c4f30fc258e346f5 (patch)
treec7e2df507bb1f06e8bdf237f07c3fd4e5bc2fcce /src/live_effects
parentFixed SPObject ctor and dtor; removed singleton.h; some smaller changes. (diff)
downloadinkscape-beecbea1b415d5b9536f2309c4f30fc258e346f5.tar.gz
inkscape-beecbea1b415d5b9536f2309c4f30fc258e346f5.zip
Cleaned up a bit; fixed struct vs. class forward declarations.
(bzr r11608.1.111)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpeobject.cpp70
-rw-r--r--src/live_effects/lpeobject.h2
2 files changed, 29 insertions, 43 deletions
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);
diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h
index 28ed93f1a..534a12897 100644
--- a/src/live_effects/lpeobject.h
+++ b/src/live_effects/lpeobject.h
@@ -40,9 +40,9 @@ public:
* So one should always check whether the returned value is NULL or not */
Inkscape::LivePathEffect::Effect * get_lpe() { return lpe; };
-//private:
Inkscape::LivePathEffect::Effect *lpe; // this can be NULL in a valid LivePathEffectObject
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();