summaryrefslogtreecommitdiffstats
path: root/src/sp-object-group.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
committerMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
commit5a4fb2325f60d292b47330f540b26a3279341c90 (patch)
treed2aa7967be25450b83e625025366c618101ae49f /src/sp-object-group.cpp
parentThe Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff)
parentRemove Snap menu item and improve grid menu item text (diff)
downloadinkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz
inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/sp-object-group.cpp')
-rw-r--r--src/sp-object-group.cpp84
1 files changed, 21 insertions, 63 deletions
diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp
index 65fbc0295..c3967461e 100644
--- a/src/sp-object-group.cpp
+++ b/src/sp-object-group.cpp
@@ -16,102 +16,60 @@
#include "xml/repr.h"
#include "document.h"
-SPObjectClass * SPObjectGroupClass::static_parent_class = 0;
-
-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;
+SPObjectGroup::SPObjectGroup() : SPObject() {
}
-void SPObjectGroupClass::sp_objectgroup_class_init(SPObjectGroupClass *klass)
-{
- //GObjectClass * object_class = (GObjectClass *) klass;
- SPObjectClass * sp_object_class = (SPObjectClass *) klass;
+SPObjectGroup::~SPObjectGroup() {
+}
- static_parent_class = (SPObjectClass *)g_type_class_ref(SP_TYPE_OBJECT);
+void SPObjectGroup::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
+ SPObject::child_added(child, ref);
- 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;
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
-void SPObjectGroup::init(SPObjectGroup * /*objectgroup*/)
-{
-}
-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);
- }
+void SPObjectGroup::remove_child(Inkscape::XML::Node *child) {
+ SPObject::remove_child(child);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->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);
- }
-
- 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);
- }
+void SPObjectGroup::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) {
+ 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(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 *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
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((Inkscape::XML::Node *) l->data, NULL);
- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
+ repr->addChild(static_cast<Inkscape::XML::Node *>(l->data), NULL);
+ Inkscape::GC::release(static_cast<Inkscape::XML::Node *>(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);
}
}
- if (((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write) {
- ((SPObjectClass *) (SPObjectGroupClass::static_parent_class))->write(object, xml_doc, repr, flags);
- }
+ SPObject::write(xml_doc, repr, flags);
return repr;
}