From 6a1a65169de6998172eeac7d2b70536997797f99 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Tue, 21 Aug 2012 14:45:01 +0200 Subject: Added "virtual pad" to SPObjectGroup. (bzr r11608.1.37) --- src/sp-object-group.cpp | 63 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 65fbc0295..de5d0b612 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -52,40 +52,60 @@ void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass) sp_object_class->write = SPObjectGroup::write; } -void SPObjectGroup::init(SPObjectGroup * /*objectgroup*/) +CObjectGroup::CObjectGroup(SPObjectGroup* gr) : CObject(gr) { + this->spobjectgroup = gr; +} + +CObjectGroup::~CObjectGroup() { +} + +void SPObjectGroup::init(SPObjectGroup * objectgroup) { + objectgroup->cobjectgroup = new CObjectGroup(objectgroup); + objectgroup->cobject = objectgroup->cobjectgroup; +} + +void CObjectGroup::onChildAdded(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { + SPObjectGroup* object = this->spobjectgroup; + + CObject::onChildAdded(child, ref); + + object->requestModified(SP_OBJECT_MODIFIED_FLAG); } void SPObjectGroup::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added)(object, child, ref); - } + ((SPObjectGroup*)object)->cobjectgroup->onChildAdded(child, ref); +} - object->requestModified(SP_OBJECT_MODIFIED_FLAG); +void CObjectGroup::onRemoveChild(Inkscape::XML::Node *child) { + SPObjectGroup* object = this->spobjectgroup; + + CObject::onRemoveChild(child); + + object->requestModified(SP_OBJECT_MODIFIED_FLAG); } void SPObjectGroup::removeChild(SPObject *object, Inkscape::XML::Node *child) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child)(object, child); - } + ((SPObjectGroup*)object)->cobjectgroup->onRemoveChild(child); +} + +void CObjectGroup::onOrderChanged(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { + SPObjectGroup* object = this->spobjectgroup; + + CObject::onOrderChanged(child, old_ref, new_ref); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + object->requestModified(SP_OBJECT_MODIFIED_FLAG); } void SPObjectGroup::orderChanged(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed)(object, child, old_ref, new_ref); - } - - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + ((SPObjectGroup*)object)->cobjectgroup->onOrderChanged(child, old_ref, new_ref); } -Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject +Inkscape::XML::Node *CObjectGroup::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPObjectGroup* object = this->spobjectgroup; if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { @@ -109,13 +129,16 @@ Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Docum } } - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write) { - ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write(object, xml_doc, repr, flags); - } + CObject::onWrite(xml_doc, repr, flags); return repr; } +Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPObjectGroup*)object)->cobjectgroup->onWrite(xml_doc, repr, flags); +} + /* Local Variables: mode:c++ -- cgit v1.2.3 From cd0794c0d76a46a0ae47b6c450167015ee41bc35 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 17 Jan 2013 00:59:37 +0000 Subject: Cleanup more GObject type definitions (bzr r12034) --- src/sp-object-group.cpp | 98 ++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 45 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 65fbc0295..5158ec70a 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -16,74 +16,82 @@ #include "xml/repr.h" #include "document.h" -SPObjectClass * SPObjectGroupClass::static_parent_class = 0; +static void sp_objectgroup_child_added(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *ref); -GType SPObjectGroup::sp_objectgroup_get_type(void) -{ - static GType objectgroup_type = 0; - if (!objectgroup_type) { - GTypeInfo objectgroup_info = { - sizeof(SPObjectGroupClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) SPObjectGroupClass::sp_objectgroup_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(SPObjectGroup), - 16, /* n_preallocs */ - (GInstanceInitFunc) init, - NULL, /* value_table */ - }; - objectgroup_type = g_type_register_static(SP_TYPE_OBJECT, "SPObjectGroup", &objectgroup_info, (GTypeFlags)0); - } - return objectgroup_type; -} +static void sp_objectgroup_remove_child(SPObject *object, + Inkscape::XML::Node *child); -void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass) -{ - //GObjectClass * object_class = (GObjectClass *) klass; - SPObjectClass * sp_object_class = (SPObjectClass *) klass; +static void sp_objectgroup_order_changed(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *old_ref, + Inkscape::XML::Node *new_ref); - static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT); +static Inkscape::XML::Node* sp_objectgroup_write(SPObject *object, + Inkscape::XML::Document *doc, + Inkscape::XML::Node *repr, + guint flags); + +G_DEFINE_TYPE(SPObjectGroup, sp_objectgroup, SP_TYPE_OBJECT); + +static void +sp_objectgroup_class_init(SPObjectGroupClass *klass) +{ + SPObjectClass * sp_object_class = SP_OBJECT_CLASS(klass); - sp_object_class->child_added = SPObjectGroup::childAdded; - sp_object_class->remove_child = SPObjectGroup::removeChild; - sp_object_class->order_changed = SPObjectGroup::orderChanged; - sp_object_class->write = SPObjectGroup::write; + sp_object_class->child_added = sp_objectgroup_child_added; + sp_object_class->remove_child = sp_objectgroup_remove_child; + sp_object_class->order_changed = sp_objectgroup_order_changed; + sp_object_class->write = sp_objectgroup_write; } -void SPObjectGroup::init(SPObjectGroup * /*objectgroup*/) +static void +sp_objectgroup_init(SPObjectGroup * /*objectgroup*/) { } -void SPObjectGroup::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void +sp_objectgroup_child_added(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *ref) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->child_added)(object, child, ref); + if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->child_added) { + (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->child_added)(object, child, ref); } object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -void SPObjectGroup::removeChild(SPObject *object, Inkscape::XML::Node *child) +static void +sp_objectgroup_remove_child(SPObject *object, + Inkscape::XML::Node *child) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->remove_child)(object, child); + if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->remove_child) { + (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->remove_child)(object, child); } object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -void SPObjectGroup::orderChanged(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) +static void +sp_objectgroup_order_changed(SPObject *object, + Inkscape::XML::Node *child, + Inkscape::XML::Node *old_ref, + Inkscape::XML::Node *new_ref) { - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed) { - (* ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->order_changed)(object, child, old_ref, new_ref); + if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->order_changed) { + (* (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->order_changed)(object, child, old_ref, new_ref); } object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node* +sp_objectgroup_write(SPObject *object, + Inkscape::XML::Document *xml_doc, + Inkscape::XML::Node *repr, + guint flags) { SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject @@ -99,8 +107,8 @@ Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Docum } } while (l) { - repr->addChild((Inkscape::XML::Node *) l->data, NULL); - Inkscape::GC::release((Inkscape::XML::Node *) l->data); + repr->addChild(static_cast(l->data), NULL); + Inkscape::GC::release(static_cast(l->data)); l = g_slist_remove(l, l->data); } } else { @@ -109,8 +117,8 @@ Inkscape::XML::Node *SPObjectGroup::write(SPObject *object, Inkscape::XML::Docum } } - if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write) { - ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write(object, xml_doc, repr, flags); + if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write) { + (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write(object, xml_doc, repr, flags); } return repr; -- cgit v1.2.3 From efa9bdd372b89848165dc575fafff45851514e69 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 16 Mar 2013 12:20:26 +0000 Subject: Warning cleanup (bzr r12211) --- src/sp-object-group.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 5158ec70a..e2b601ab9 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -93,8 +93,6 @@ sp_objectgroup_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) { - SP_OBJECTGROUP(object); // Ensure we have the right type of SPObject - if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { repr = xml_doc->createElement("svg:g"); @@ -118,7 +116,7 @@ sp_objectgroup_write(SPObject *object, } if ((SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write) { - (SP_OBJECT_CLASS(sp_objectgroup_parent_class))->write(object, xml_doc, repr, flags); + SP_OBJECT_CLASS(sp_objectgroup_parent_class)->write(object, 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/sp-object-group.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index de5d0b612..e18755ea2 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -46,10 +46,10 @@ void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass) static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT); - sp_object_class->child_added = SPObjectGroup::childAdded; - sp_object_class->remove_child = SPObjectGroup::removeChild; - sp_object_class->order_changed = SPObjectGroup::orderChanged; - sp_object_class->write = SPObjectGroup::write; +// sp_object_class->child_added = SPObjectGroup::childAdded; +// sp_object_class->remove_child = SPObjectGroup::removeChild; +// sp_object_class->order_changed = SPObjectGroup::orderChanged; +// sp_object_class->write = SPObjectGroup::write; } CObjectGroup::CObjectGroup(SPObjectGroup* gr) : CObject(gr) { -- 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/sp-object-group.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index a4ada0120..ad2210574 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -41,34 +41,34 @@ CObjectGroup::~CObjectGroup() { } -void CObjectGroup::onChildAdded(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { +void CObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { SPObjectGroup* object = this->spobjectgroup; - CObject::onChildAdded(child, ref); + CObject::child_added(child, ref); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -void CObjectGroup::onRemoveChild(Inkscape::XML::Node *child) { +void CObjectGroup::remove_child(Inkscape::XML::Node *child) { SPObjectGroup* object = this->spobjectgroup; - CObject::onRemoveChild(child); + CObject::remove_child(child); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -void CObjectGroup::onOrderChanged(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { +void CObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { SPObjectGroup* object = this->spobjectgroup; - CObject::onOrderChanged(child, old_ref, new_ref); + CObject::order_changed(child, old_ref, new_ref); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -Inkscape::XML::Node *CObjectGroup::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node *CObjectGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPObjectGroup* object = this->spobjectgroup; if (flags & SP_OBJECT_WRITE_BUILD) { @@ -93,7 +93,7 @@ Inkscape::XML::Node *CObjectGroup::onWrite(Inkscape::XML::Document *xml_doc, Ink } } - 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/sp-object-group.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index ad2210574..093d044c4 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -28,6 +28,7 @@ static void sp_objectgroup_init(SPObjectGroup * objectgroup) { objectgroup->cobjectgroup = new CObjectGroup(objectgroup); + objectgroup->typeHierarchy.insert(typeid(SPObjectGroup)); delete objectgroup->cobject; objectgroup->cobject = objectgroup->cobjectgroup; -- 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/sp-object-group.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 093d044c4..29ac0eb43 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -17,16 +17,16 @@ #include "document.h" -G_DEFINE_TYPE(SPObjectGroup, sp_objectgroup, SP_TYPE_OBJECT); +G_DEFINE_TYPE(SPObjectGroup, sp_objectgroup, G_TYPE_OBJECT); static void sp_objectgroup_class_init(SPObjectGroupClass *klass) { } -static void -sp_objectgroup_init(SPObjectGroup * objectgroup) -{ +SPObjectGroup::SPObjectGroup() : SPObject() { + SPObjectGroup* objectgroup = this; + objectgroup->cobjectgroup = new CObjectGroup(objectgroup); objectgroup->typeHierarchy.insert(typeid(SPObjectGroup)); @@ -34,6 +34,12 @@ sp_objectgroup_init(SPObjectGroup * objectgroup) objectgroup->cobject = objectgroup->cobjectgroup; } +static void +sp_objectgroup_init(SPObjectGroup * objectgroup) +{ + new (objectgroup) SPObjectGroup(); +} + CObjectGroup::CObjectGroup(SPObjectGroup* gr) : CObject(gr) { this->spobjectgroup = gr; } -- cgit v1.2.3 From 8f5e6d495f0478701218adc8078db5063b710a05 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 6 Apr 2013 16:26:39 +0200 Subject: Merged ObjectGroup and subclasses. (bzr r11608.1.83) --- src/sp-object-group.cpp | 48 ++++++++++++------------------------------------ 1 file changed, 12 insertions(+), 36 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 29ac0eb43..afe425211 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -16,40 +16,16 @@ #include "xml/repr.h" #include "document.h" - -G_DEFINE_TYPE(SPObjectGroup, sp_objectgroup, G_TYPE_OBJECT); - -static void -sp_objectgroup_class_init(SPObjectGroupClass *klass) -{ -} - -SPObjectGroup::SPObjectGroup() : SPObject() { - SPObjectGroup* objectgroup = this; - - objectgroup->cobjectgroup = new CObjectGroup(objectgroup); - objectgroup->typeHierarchy.insert(typeid(SPObjectGroup)); - - delete objectgroup->cobject; - objectgroup->cobject = objectgroup->cobjectgroup; +SPObjectGroup::SPObjectGroup() : SPObject(), CObject(this) { + delete this->cobject; + this->cobject = this; } -static void -sp_objectgroup_init(SPObjectGroup * objectgroup) -{ - new (objectgroup) SPObjectGroup(); +SPObjectGroup::~SPObjectGroup() { } -CObjectGroup::CObjectGroup(SPObjectGroup* gr) : CObject(gr) { - this->spobjectgroup = gr; -} - -CObjectGroup::~CObjectGroup() { -} - - -void CObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPObjectGroup* object = this->spobjectgroup; +void SPObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { + SPObjectGroup* object = this; CObject::child_added(child, ref); @@ -57,8 +33,8 @@ void CObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node * } -void CObjectGroup::remove_child(Inkscape::XML::Node *child) { - SPObjectGroup* object = this->spobjectgroup; +void SPObjectGroup::remove_child(Inkscape::XML::Node *child) { + SPObjectGroup* object = this; CObject::remove_child(child); @@ -66,8 +42,8 @@ void CObjectGroup::remove_child(Inkscape::XML::Node *child) { } -void CObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { - SPObjectGroup* object = this->spobjectgroup; +void SPObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { + SPObjectGroup* object = this; CObject::order_changed(child, old_ref, new_ref); @@ -75,8 +51,8 @@ void CObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node } -Inkscape::XML::Node *CObjectGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPObjectGroup* object = this->spobjectgroup; +Inkscape::XML::Node *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPObjectGroup* object = this; if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { -- 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/sp-object-group.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index afe425211..19b813236 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -16,9 +16,7 @@ #include "xml/repr.h" #include "document.h" -SPObjectGroup::SPObjectGroup() : SPObject(), CObject(this) { - delete this->cobject; - this->cobject = this; +SPObjectGroup::SPObjectGroup() : SPObject() { } SPObjectGroup::~SPObjectGroup() { @@ -27,7 +25,7 @@ SPObjectGroup::~SPObjectGroup() { void SPObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { SPObjectGroup* object = this; - CObject::child_added(child, ref); + SPObject::child_added(child, ref); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } @@ -36,7 +34,7 @@ void SPObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node void SPObjectGroup::remove_child(Inkscape::XML::Node *child) { SPObjectGroup* object = this; - CObject::remove_child(child); + SPObject::remove_child(child); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } @@ -45,7 +43,7 @@ void SPObjectGroup::remove_child(Inkscape::XML::Node *child) { void SPObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { SPObjectGroup* object = this; - CObject::order_changed(child, old_ref, new_ref); + SPObject::order_changed(child, old_ref, new_ref); object->requestModified(SP_OBJECT_MODIFIED_FLAG); } @@ -76,7 +74,7 @@ Inkscape::XML::Node *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inks } } - CObject::write(xml_doc, repr, flags); + SPObject::write(xml_doc, repr, flags); return repr; } -- cgit v1.2.3 From bf4a1d2d49850170b936c30cfe2b30e798716406 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 3 Aug 2013 03:03:43 +0200 Subject: Cleaned up. (bzr r11608.1.117) --- src/sp-object-group.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/sp-object-group.cpp') diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 19b813236..c3967461e 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -23,53 +23,48 @@ SPObjectGroup::~SPObjectGroup() { } void SPObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPObjectGroup* object = this; - SPObject::child_added(child, ref); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + this->requestModified(SP_OBJECT_MODIFIED_FLAG); } void SPObjectGroup::remove_child(Inkscape::XML::Node *child) { - SPObjectGroup* object = this; - SPObject::remove_child(child); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + this->requestModified(SP_OBJECT_MODIFIED_FLAG); } void SPObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) { - SPObjectGroup* object = this; - SPObject::order_changed(child, old_ref, new_ref); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); + this->requestModified(SP_OBJECT_MODIFIED_FLAG); } Inkscape::XML::Node *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPObjectGroup* object = this; - if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { repr = xml_doc->createElement("svg:g"); } + GSList *l = 0; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); + if (crepr) { l = g_slist_prepend(l, crepr); } } + while (l) { repr->addChild(static_cast(l->data), NULL); Inkscape::GC::release(static_cast(l->data)); l = g_slist_remove(l, l->data); } } else { - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { child->updateRepr(flags); } } -- cgit v1.2.3