From b86f217e4c4fb55989128b028faaa95650b9d639 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 18 Aug 2012 16:32:37 +0200 Subject: Added "virtual pad" to - SPGenericEllipse - SPEllipse - SPCircle - SPArc (bzr r11608.1.5) --- src/sp-ellipse.cpp | 303 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 221 insertions(+), 82 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index d74eaa6fb..d5d25504b 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -121,9 +121,22 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) lpe_item_class->update_patheffect = sp_genericellipse_update_patheffect; } +CGenericEllipse::CGenericEllipse(SPGenericEllipse* genericEllipse) : CShape(genericEllipse) { + this->spgenericEllipse = genericEllipse; +} + +CGenericEllipse::~CGenericEllipse() { +} + static void sp_genericellipse_init(SPGenericEllipse *ellipse) { + ellipse->cgenericEllipse = new CGenericEllipse(ellipse); + ellipse->cshape = ellipse->cgenericEllipse; + ellipse->clpeitem = ellipse->cgenericEllipse; + ellipse->citem = ellipse->cgenericEllipse; + ellipse->cobject = ellipse->cgenericEllipse; + ellipse->cx.unset(); ellipse->cy.unset(); ellipse->rx.unset(); @@ -134,9 +147,9 @@ sp_genericellipse_init(SPGenericEllipse *ellipse) ellipse->closed = TRUE; } -static void -sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags) -{ +void CGenericEllipse::onUpdate(SPCtx *ctx, guint flags) { + SPGenericEllipse* object = this->spgenericEllipse; + if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { SPGenericEllipse *ellipse = (SPGenericEllipse *) object; SPStyle const *style = object->style; @@ -154,14 +167,18 @@ sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags) static_cast(object)->setShape(); } - if (((SPObjectClass *) ge_parent_class)->update) - ((SPObjectClass *) ge_parent_class)->update(object, ctx, flags); + CShape::onUpdate(ctx, flags); } +// CPPIFY: remove static void -sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write) +sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags) { - SPShape *shape = (SPShape *) lpeitem; + ((SPGenericEllipse*)object)->cgenericEllipse->onUpdate(ctx, flags); +} + +void CGenericEllipse::onUpdatePatheffect(bool write) { + SPShape *shape = this->spgenericEllipse; sp_genericellipse_set_shape(shape); if (write) { @@ -178,10 +195,19 @@ sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write) ((SPObject *)shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } +// CPPIFY: remove +static void +sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write) +{ + ((SPGenericEllipse*)lpeitem)->cgenericEllipse->onUpdatePatheffect(write); + +} + /* fixme: Think (Lauris) */ /* Can't we use arcto in this method? */ -static void sp_genericellipse_set_shape(SPShape *shape) -{ +void CGenericEllipse::onSetShape() { + SPGenericEllipse* shape = this->spgenericEllipse; + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { g_warning ("The ellipse shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as ellipse will remove the bad LPE"); if (shape->getRepr()->attribute("d")) { @@ -269,8 +295,15 @@ static void sp_genericellipse_set_shape(SPShape *shape) curve->unref(); } -static void sp_genericellipse_snappoints(SPItem const *item, std::vector &p, Inkscape::SnapPreferences const *snapprefs) +// CPPIFY: remove +static void sp_genericellipse_set_shape(SPShape *shape) { + ((SPGenericEllipse*)shape)->cgenericEllipse->onSetShape(); +} + +void CGenericEllipse::onSnappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { + SPGenericEllipse* item = this->spgenericEllipse; + g_assert(item != NULL); g_assert(SP_IS_GENERICELLIPSE(item)); @@ -336,6 +369,12 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector &p, Inkscape::SnapPreferences const *snapprefs) +{ + ((SPGenericEllipse*)item)->cgenericEllipse->onSnappoints(p, snapprefs); +} + void sp_genericellipse_normalize(SPGenericEllipse *ellipse) { @@ -351,9 +390,9 @@ sp_genericellipse_normalize(SPGenericEllipse *ellipse) /* Now we keep: 0 <= start < end <= 2*PI */ } -static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - SPGenericEllipse *ellipse = SP_GENERICELLIPSE(object); +Inkscape::XML::Node* CGenericEllipse::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this->spgenericEllipse; + SPGenericEllipse* object = ellipse; if (flags & SP_OBJECT_WRITE_EXT) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -370,13 +409,17 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape:: } } - if (((SPObjectClass *) ge_parent_class)->write) { - ((SPObjectClass *) ge_parent_class)->write(object, xml_doc, repr, flags); - } + CShape::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPGenericEllipse*)object)->cgenericEllipse->onWrite(xml_doc, repr, flags); +} + /* SVG element */ static void sp_ellipse_class_init(SPEllipseClass *klass); @@ -425,30 +468,43 @@ static void sp_ellipse_class_init(SPEllipseClass *klass) item_class->description = sp_ellipse_description; } -static void -sp_ellipse_init(SPEllipse */*ellipse*/) -{ - /* Nothing special */ +CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { + this->spellipse = ellipse; +} + +CEllipse::~CEllipse() { } static void -sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_ellipse_init(SPEllipse *ellipse) { - if (((SPObjectClass *) ellipse_parent_class)->build) - (* ((SPObjectClass *) ellipse_parent_class)->build) (object, document, repr); + ellipse->cellipse = new CEllipse(ellipse); + ellipse->cgenericEllipse = ellipse->cellipse; + ellipse->cshape = ellipse->cellipse; + ellipse->clpeitem = ellipse->cellipse; + ellipse->citem = ellipse->cellipse; + ellipse->cobject = ellipse->cellipse; +} +void CEllipse::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { + CGenericEllipse::onBuild(document, repr); + + SPEllipse* object = this->spellipse; object->readAttr( "cx" ); object->readAttr( "cy" ); object->readAttr( "rx" ); object->readAttr( "ry" ); } -static Inkscape::XML::Node * -sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +// CPPIFY: remove +static void +sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - SPGenericEllipse *ellipse; + ((SPEllipse*)object)->cellipse->onBuild(document, repr); +} - ellipse = SP_GENERICELLIPSE(object); +Inkscape::XML::Node* CEllipse::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this->spellipse; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:ellipse"); @@ -459,18 +515,21 @@ sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X sp_repr_set_svg_double(repr, "rx", ellipse->rx.computed); sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed); - if (((SPObjectClass *) ellipse_parent_class)->write) - (* ((SPObjectClass *) ellipse_parent_class)->write) (object, xml_doc, repr, flags); + CGenericEllipse::onWrite(xml_doc, repr, flags); return repr; } -static void -sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value) +// CPPIFY: remove +static Inkscape::XML::Node * +sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse; + return ((SPEllipse*)object)->cellipse->onWrite(xml_doc, repr, flags); +} - ellipse = SP_GENERICELLIPSE(object); +void CEllipse::onSet(unsigned int key, gchar const* value) { + SPEllipse *ellipse = this->spellipse; + SPEllipse* object = (SPEllipse*)ellipse; switch (key) { case SP_ATTR_CX: @@ -494,15 +553,26 @@ sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - if (((SPObjectClass *) ellipse_parent_class)->set) - ((SPObjectClass *) ellipse_parent_class)->set(object, key, value); + CGenericEllipse::onSet(key, value); break; } } -static gchar *sp_ellipse_description(SPItem */*item*/) +// CPPIFY: remove +static void +sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value) { - return g_strdup(_("Ellipse")); + ((SPEllipse*)object)->cellipse->onSet(key, value); +} + +gchar* CEllipse::onDescription() { + return g_strdup(_("Ellipse")); +} + +// CPPIFY: remove +static gchar *sp_ellipse_description(SPItem *item) +{ + return ((SPEllipse*)item)->cellipse->onDescription(); } @@ -573,29 +643,43 @@ sp_circle_class_init(SPCircleClass *klass) item_class->description = sp_circle_description; } -static void -sp_circle_init(SPCircle */*circle*/) -{ - /* Nothing special */ +CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { + this->spcircle = circle; +} + +CCircle::~CCircle() { } static void -sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_circle_init(SPCircle *circle) { - if (((SPObjectClass *) circle_parent_class)->build) - (* ((SPObjectClass *) circle_parent_class)->build)(object, document, repr); + circle->ccircle = new CCircle(circle); + circle->cgenericEllipse = circle->ccircle; + circle->cshape = circle->ccircle; + circle->clpeitem = circle->ccircle; + circle->citem = circle->ccircle; + circle->cobject = circle->ccircle; +} + +void CCircle::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { + SPCircle* object = this->spcircle; + + CGenericEllipse::onBuild(document, repr); object->readAttr( "cx" ); object->readAttr( "cy" ); object->readAttr( "r" ); } -static Inkscape::XML::Node * -sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +// CPPIFY: remove +static void +sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - SPGenericEllipse *ellipse; + ((SPCircle*)object)->ccircle->onBuild(document, repr); +} - ellipse = SP_GENERICELLIPSE(object); +Inkscape::XML::Node* CCircle::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this->spcircle; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:circle"); @@ -605,18 +689,21 @@ sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed); sp_repr_set_svg_double(repr, "r", ellipse->rx.computed); - if (((SPObjectClass *) circle_parent_class)->write) - ((SPObjectClass *) circle_parent_class)->write(object, xml_doc, repr, flags); + CGenericEllipse::onWrite(xml_doc, repr, flags); return repr; } -static void -sp_circle_set(SPObject *object, unsigned int key, gchar const *value) +// CPPIFY: remove +static Inkscape::XML::Node * +sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ge; + return ((SPCircle*)object)->ccircle->onWrite(xml_doc, repr, flags); +} - ge = SP_GENERICELLIPSE(object); +void CCircle::onSet(unsigned int key, gchar const* value) { + SPGenericEllipse *ge = this->spcircle; + SPCircle* object = (SPCircle*)ge; switch (key) { case SP_ATTR_CX: @@ -635,15 +722,26 @@ sp_circle_set(SPObject *object, unsigned int key, gchar const *value) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - if (((SPObjectClass *) circle_parent_class)->set) - ((SPObjectClass *) circle_parent_class)->set(object, key, value); + CGenericEllipse::onSet(key, value); break; } } -static gchar *sp_circle_description(SPItem */*item*/) +// CPPIFY: remove +static void +sp_circle_set(SPObject *object, unsigned int key, gchar const *value) { - return g_strdup(_("Circle")); + ((SPCircle*)object)->ccircle->onSet(key, value); +} + +gchar* CCircle::onDescription() { + return g_strdup(_("Circle")); +} + +// CPPIFY: remove +gchar *sp_circle_description(SPItem *item) +{ + return ((SPCircle*)item)->ccircle->onDescription(); } /* element */ @@ -698,17 +796,29 @@ sp_arc_class_init(SPArcClass *klass) item_class->description = sp_arc_description; } -static void -sp_arc_init(SPArc */*arc*/) -{ - /* Nothing special */ +CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { + this->sparc = arc; +} + +CArc::~CArc() { + } static void -sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_arc_init(SPArc *arc) { - if (((SPObjectClass *) arc_parent_class)->build) - (* ((SPObjectClass *) arc_parent_class)->build) (object, document, repr); + arc->carc = new CArc(arc); + arc->cgenericEllipse = arc->carc; + arc->cshape = arc->carc; + arc->clpeitem = arc->carc; + arc->citem = arc->carc; + arc->cobject = arc->carc; +} + +void CArc::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { + SPArc* object = this->sparc; + + CGenericEllipse::onBuild(document, repr); object->readAttr( "sodipodi:cx" ); object->readAttr( "sodipodi:cy" ); @@ -720,6 +830,13 @@ sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) object->readAttr( "sodipodi:open" ); } +// CPPIFY: remove +static void +sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +{ + ((SPArc*)object)->carc->onBuild(document, repr); +} + /* * sp_arc_set_elliptical_path_attribute: * @@ -762,11 +879,10 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) return true; } -static Inkscape::XML::Node * -sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - SPGenericEllipse *ge = SP_GENERICELLIPSE(object); - SPArc *arc = SP_ARC(object); +Inkscape::XML::Node* CArc::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPArc* object = this->sparc; + SPGenericEllipse *ge = object; + SPArc *arc = object; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:path"); @@ -796,16 +912,21 @@ sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:: // write d= sp_arc_set_elliptical_path_attribute(arc, repr); - if (((SPObjectClass *) arc_parent_class)->write) - ((SPObjectClass *) arc_parent_class)->write(object, xml_doc, repr, flags); + CGenericEllipse::onWrite(xml_doc, repr, flags); return repr; } -static void -sp_arc_set(SPObject *object, unsigned int key, gchar const *value) +// CPPIFY: remove +static Inkscape::XML::Node * +sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ge = SP_GENERICELLIPSE(object); + return ((SPArc*)object)->carc->onWrite(xml_doc, repr, flags); +} + +void CArc::onSet(unsigned int key, gchar const* value) { + SPArc* object = this->sparc; + SPGenericEllipse *ge = object; switch (key) { case SP_ATTR_SODIPODI_CX: @@ -849,26 +970,38 @@ sp_arc_set(SPObject *object, unsigned int key, gchar const *value) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - if (((SPObjectClass *) arc_parent_class)->set) - ((SPObjectClass *) arc_parent_class)->set(object, key, value); + CGenericEllipse::onSet(key, value); break; } } +// CPPIFY: remove static void -sp_arc_modified(SPObject *object, guint flags) +sp_arc_set(SPObject *object, unsigned int key, gchar const *value) { + ((SPArc*)object)->carc->onSet(key, value); +} + +void CArc::onModified(guint flags) { + SPArc* object = this->sparc; + if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { ((SPShape *) object)->setShape(); } - if (((SPObjectClass *) arc_parent_class)->modified) - ((SPObjectClass *) arc_parent_class)->modified(object, flags); + CGenericEllipse::onModified(flags); } -static gchar *sp_arc_description(SPItem *item) +// CPPIFY: remove +static void +sp_arc_modified(SPObject *object, guint flags) { - SPGenericEllipse *ge = SP_GENERICELLIPSE(item); + ((SPArc*)object)->carc->onModified(flags); +} + +gchar* CArc::onDescription() { + SPArc* item = this->sparc; + SPGenericEllipse *ge = item; gdouble len = fmod(ge->end - ge->start, SP_2PI); if (len < 0.0) len += SP_2PI; @@ -883,6 +1016,12 @@ static gchar *sp_arc_description(SPItem *item) } } +// CPPIFY: remove +static gchar *sp_arc_description(SPItem *item) +{ + return ((SPArc*)item)->carc->onDescription(); +} + void sp_arc_position_set(SPArc *arc, gdouble x, gdouble y, gdouble rx, gdouble ry) { -- cgit v1.2.3 From 260c7156ca920232cca2e829782373a805d59cae Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 29 Sep 2012 17:43:15 +0200 Subject: Removed old calls to set_shape and update_patheffect. (bzr r11608.1.45) --- src/sp-ellipse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index d5d25504b..73965dfcb 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -117,8 +117,8 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) item_class->snappoints = sp_genericellipse_snappoints; - shape_class->set_shape = sp_genericellipse_set_shape; - lpe_item_class->update_patheffect = sp_genericellipse_update_patheffect; + //shape_class->set_shape = sp_genericellipse_set_shape; + //lpe_item_class->update_patheffect = sp_genericellipse_update_patheffect; } CGenericEllipse::CGenericEllipse(SPGenericEllipse* genericEllipse) : CShape(genericEllipse) { -- cgit v1.2.3 From 99cb30e28d4ee193f39e23464abbd7630cac8a2d Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 6 Oct 2012 23:56:27 +0200 Subject: Added virtual pad to SPFlowtext; removed old calls to virtual SPItem methods. (bzr r11608.1.46) --- src/sp-ellipse.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 73965dfcb..0a0e37434 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -115,7 +115,7 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) sp_object_class->update = sp_genericellipse_update; sp_object_class->write = sp_genericellipse_write; - item_class->snappoints = sp_genericellipse_snappoints; + //item_class->snappoints = sp_genericellipse_snappoints; //shape_class->set_shape = sp_genericellipse_set_shape; //lpe_item_class->update_patheffect = sp_genericellipse_update_patheffect; @@ -465,7 +465,7 @@ static void sp_ellipse_class_init(SPEllipseClass *klass) sp_object_class->write = sp_ellipse_write; sp_object_class->set = sp_ellipse_set; - item_class->description = sp_ellipse_description; +// item_class->description = sp_ellipse_description; } CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { @@ -640,7 +640,7 @@ sp_circle_class_init(SPCircleClass *klass) sp_object_class->write = sp_circle_write; sp_object_class->set = sp_circle_set; - item_class->description = sp_circle_description; +// item_class->description = sp_circle_description; } CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { @@ -793,7 +793,7 @@ sp_arc_class_init(SPArcClass *klass) sp_object_class->set = sp_arc_set; sp_object_class->modified = sp_arc_modified; - item_class->description = sp_arc_description; +// item_class->description = sp_arc_description; } CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { -- cgit v1.2.3 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/sp-ellipse.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 0a0e37434..f5c0c160c 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -461,7 +461,7 @@ static void sp_ellipse_class_init(SPEllipseClass *klass) ellipse_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); - sp_object_class->build = sp_ellipse_build; + //sp_object_class->build = sp_ellipse_build; sp_object_class->write = sp_ellipse_write; sp_object_class->set = sp_ellipse_set; @@ -636,7 +636,7 @@ sp_circle_class_init(SPCircleClass *klass) circle_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); - sp_object_class->build = sp_circle_build; + //sp_object_class->build = sp_circle_build; sp_object_class->write = sp_circle_write; sp_object_class->set = sp_circle_set; @@ -788,7 +788,7 @@ sp_arc_class_init(SPArcClass *klass) arc_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); - sp_object_class->build = sp_arc_build; + //sp_object_class->build = sp_arc_build; sp_object_class->write = sp_arc_write; sp_object_class->set = sp_arc_set; sp_object_class->modified = sp_arc_modified; -- 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-ellipse.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index f5c0c160c..c215e5b19 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -112,8 +112,8 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) ge_parent_class = (SPShapeClass*) g_type_class_ref(SP_TYPE_SHAPE); - sp_object_class->update = sp_genericellipse_update; - sp_object_class->write = sp_genericellipse_write; +// sp_object_class->update = sp_genericellipse_update; +// sp_object_class->write = sp_genericellipse_write; //item_class->snappoints = sp_genericellipse_snappoints; @@ -462,8 +462,8 @@ static void sp_ellipse_class_init(SPEllipseClass *klass) ellipse_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); //sp_object_class->build = sp_ellipse_build; - sp_object_class->write = sp_ellipse_write; - sp_object_class->set = sp_ellipse_set; +// sp_object_class->write = sp_ellipse_write; +// sp_object_class->set = sp_ellipse_set; // item_class->description = sp_ellipse_description; } @@ -637,8 +637,8 @@ sp_circle_class_init(SPCircleClass *klass) circle_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); //sp_object_class->build = sp_circle_build; - sp_object_class->write = sp_circle_write; - sp_object_class->set = sp_circle_set; +// sp_object_class->write = sp_circle_write; +// sp_object_class->set = sp_circle_set; // item_class->description = sp_circle_description; } @@ -789,9 +789,9 @@ sp_arc_class_init(SPArcClass *klass) arc_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE); //sp_object_class->build = sp_arc_build; - sp_object_class->write = sp_arc_write; - sp_object_class->set = sp_arc_set; - sp_object_class->modified = sp_arc_modified; +// sp_object_class->write = sp_arc_write; +// sp_object_class->set = sp_arc_set; +// sp_object_class->modified = sp_arc_modified; // item_class->description = sp_arc_description; } -- 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-ellipse.cpp | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 42a85080f..29f7f0397 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -100,7 +100,7 @@ sp_genericellipse_init(SPGenericEllipse *ellipse) ellipse->closed = TRUE; } -void CGenericEllipse::onUpdate(SPCtx *ctx, guint flags) { +void CGenericEllipse::update(SPCtx *ctx, guint flags) { SPGenericEllipse* object = this->spgenericEllipse; if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { @@ -120,12 +120,12 @@ void CGenericEllipse::onUpdate(SPCtx *ctx, guint flags) { static_cast(object)->setShape(); } - CShape::onUpdate(ctx, flags); + CShape::update(ctx, flags); } -void CGenericEllipse::onUpdatePatheffect(bool write) { +void CGenericEllipse::update_patheffect(bool write) { SPShape *shape = this->spgenericEllipse; - this->onSetShape(); + this->set_shape(); if (write) { Inkscape::XML::Node *repr = shape->getRepr(); @@ -143,7 +143,7 @@ void CGenericEllipse::onUpdatePatheffect(bool write) { /* fixme: Think (Lauris) */ /* Can't we use arcto in this method? */ -void CGenericEllipse::onSetShape() { +void CGenericEllipse::set_shape() { SPGenericEllipse* shape = this->spgenericEllipse; if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { @@ -233,7 +233,7 @@ void CGenericEllipse::onSetShape() { curve->unref(); } -void CGenericEllipse::onSnappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { +void CGenericEllipse::snappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { SPGenericEllipse* item = this->spgenericEllipse; g_assert(item != NULL); @@ -316,7 +316,7 @@ sp_genericellipse_normalize(SPGenericEllipse *ellipse) /* Now we keep: 0 <= start < end <= 2*PI */ } -Inkscape::XML::Node* CGenericEllipse::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse = this->spgenericEllipse; SPGenericEllipse* object = ellipse; @@ -334,9 +334,9 @@ Inkscape::XML::Node* CGenericEllipse::onWrite(Inkscape::XML::Document *xml_doc, sp_arc_set_elliptical_path_attribute(SP_ARC(object), object->getRepr()); } } - this->onSetShape(); // evaluate SPCurve + this->set_shape(); // evaluate SPCurve - CShape::onWrite(xml_doc, repr, flags); + CShape::write(xml_doc, repr, flags); return repr; } @@ -369,8 +369,8 @@ sp_ellipse_init(SPEllipse *ellipse) ellipse->cobject = ellipse->cellipse; } -void CEllipse::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { - CGenericEllipse::onBuild(document, repr); +void CEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { + CGenericEllipse::build(document, repr); SPEllipse* object = this->spellipse; object->readAttr( "cx" ); @@ -380,7 +380,7 @@ void CEllipse::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { } -Inkscape::XML::Node* CEllipse::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse = this->spellipse; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -392,13 +392,13 @@ Inkscape::XML::Node* CEllipse::onWrite(Inkscape::XML::Document *xml_doc, Inkscap sp_repr_set_svg_double(repr, "rx", ellipse->rx.computed); sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed); - CGenericEllipse::onWrite(xml_doc, repr, flags); + CGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CEllipse::onSet(unsigned int key, gchar const* value) { +void CEllipse::set(unsigned int key, gchar const* value) { SPEllipse *ellipse = this->spellipse; SPEllipse* object = (SPEllipse*)ellipse; @@ -424,12 +424,12 @@ void CEllipse::onSet(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::onSet(key, value); + CGenericEllipse::set(key, value); break; } } -gchar* CEllipse::onDescription() { +gchar* CEllipse::description() { return g_strdup(_("Ellipse")); } @@ -481,10 +481,10 @@ sp_circle_init(SPCircle *circle) circle->cobject = circle->ccircle; } -void CCircle::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { +void CCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { SPCircle* object = this->spcircle; - CGenericEllipse::onBuild(document, repr); + CGenericEllipse::build(document, repr); object->readAttr( "cx" ); object->readAttr( "cy" ); @@ -492,7 +492,7 @@ void CCircle::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { } -Inkscape::XML::Node* CCircle::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CCircle::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse = this->spcircle; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { @@ -503,13 +503,13 @@ Inkscape::XML::Node* CCircle::onWrite(Inkscape::XML::Document *xml_doc, Inkscape sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed); sp_repr_set_svg_double(repr, "r", ellipse->rx.computed); - CGenericEllipse::onWrite(xml_doc, repr, flags); + CGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CCircle::onSet(unsigned int key, gchar const* value) { +void CCircle::set(unsigned int key, gchar const* value) { SPGenericEllipse *ge = this->spcircle; SPCircle* object = (SPCircle*)ge; @@ -530,12 +530,12 @@ void CCircle::onSet(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::onSet(key, value); + CGenericEllipse::set(key, value); break; } } -gchar* CCircle::onDescription() { +gchar* CCircle::description() { return g_strdup(_("Circle")); } @@ -568,10 +568,10 @@ sp_arc_init(SPArc *arc) arc->cobject = arc->carc; } -void CArc::onBuild(SPDocument *document, Inkscape::XML::Node *repr) { +void CArc::build(SPDocument *document, Inkscape::XML::Node *repr) { SPArc* object = this->sparc; - CGenericEllipse::onBuild(document, repr); + CGenericEllipse::build(document, repr); object->readAttr( "sodipodi:cx" ); object->readAttr( "sodipodi:cy" ); @@ -625,7 +625,7 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) return true; } -Inkscape::XML::Node* CArc::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPArc* object = this->sparc; SPGenericEllipse *ge = object; SPArc *arc = object; @@ -658,12 +658,12 @@ Inkscape::XML::Node* CArc::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::X // write d= sp_arc_set_elliptical_path_attribute(arc, repr); - CGenericEllipse::onWrite(xml_doc, repr, flags); + CGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CArc::onSet(unsigned int key, gchar const* value) { +void CArc::set(unsigned int key, gchar const* value) { SPArc* object = this->sparc; SPGenericEllipse *ge = object; @@ -709,23 +709,23 @@ void CArc::onSet(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::onSet(key, value); + CGenericEllipse::set(key, value); break; } } -void CArc::onModified(guint flags) { +void CArc::modified(guint flags) { SPArc* object = this->sparc; if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { ((SPShape *) object)->setShape(); } - CGenericEllipse::onModified(flags); + CGenericEllipse::modified(flags); } -gchar* CArc::onDescription() { +gchar* CArc::description() { SPArc* item = this->sparc; SPGenericEllipse *ge = item; -- 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-ellipse.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 29f7f0397..ac0351a5e 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -83,6 +83,7 @@ static void sp_genericellipse_init(SPGenericEllipse *ellipse) { ellipse->cgenericEllipse = new CGenericEllipse(ellipse); + ellipse->typeHierarchy.insert(typeid(SPGenericEllipse)); delete ellipse->cshape; ellipse->cshape = ellipse->cgenericEllipse; @@ -360,6 +361,7 @@ static void sp_ellipse_init(SPEllipse *ellipse) { ellipse->cellipse = new CEllipse(ellipse); + ellipse->typeHierarchy.insert(typeid(SPEllipse)); delete ellipse->cgenericEllipse; ellipse->cgenericEllipse = ellipse->cellipse; @@ -472,6 +474,7 @@ static void sp_circle_init(SPCircle *circle) { circle->ccircle = new CCircle(circle); + circle->typeHierarchy.insert(typeid(SPCircle)); delete circle->cgenericEllipse; circle->cgenericEllipse = circle->ccircle; @@ -559,6 +562,7 @@ static void sp_arc_init(SPArc *arc) { arc->carc = new CArc(arc); + arc->typeHierarchy.insert(typeid(SPArc)); delete arc->cgenericEllipse; arc->cgenericEllipse = arc->carc; -- 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-ellipse.cpp | 56 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index ac0351a5e..a2c94c508 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -66,7 +66,7 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); -G_DEFINE_TYPE(SPGenericEllipse, sp_genericellipse, SP_TYPE_SHAPE); +G_DEFINE_TYPE(SPGenericEllipse, sp_genericellipse, G_TYPE_OBJECT); static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) { @@ -79,9 +79,9 @@ CGenericEllipse::CGenericEllipse(SPGenericEllipse* genericEllipse) : CShape(gene CGenericEllipse::~CGenericEllipse() { } -static void -sp_genericellipse_init(SPGenericEllipse *ellipse) -{ +SPGenericEllipse::SPGenericEllipse() : SPShape() { + SPGenericEllipse* ellipse = this; + ellipse->cgenericEllipse = new CGenericEllipse(ellipse); ellipse->typeHierarchy.insert(typeid(SPGenericEllipse)); @@ -101,6 +101,12 @@ sp_genericellipse_init(SPGenericEllipse *ellipse) ellipse->closed = TRUE; } +static void +sp_genericellipse_init(SPGenericEllipse *ellipse) +{ + new (ellipse) SPGenericEllipse(); +} + void CGenericEllipse::update(SPCtx *ctx, guint flags) { SPGenericEllipse* object = this->spgenericEllipse; @@ -344,7 +350,7 @@ Inkscape::XML::Node* CGenericEllipse::write(Inkscape::XML::Document *xml_doc, In /* SVG element */ -G_DEFINE_TYPE(SPEllipse, sp_ellipse, SP_TYPE_GENERICELLIPSE); +G_DEFINE_TYPE(SPEllipse, sp_ellipse, G_TYPE_OBJECT); static void sp_ellipse_class_init(SPEllipseClass *klass) { @@ -357,9 +363,9 @@ CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { CEllipse::~CEllipse() { } -static void -sp_ellipse_init(SPEllipse *ellipse) -{ +SPEllipse::SPEllipse() : SPGenericEllipse() { + SPEllipse* ellipse = this; + ellipse->cellipse = new CEllipse(ellipse); ellipse->typeHierarchy.insert(typeid(SPEllipse)); @@ -371,6 +377,12 @@ sp_ellipse_init(SPEllipse *ellipse) ellipse->cobject = ellipse->cellipse; } +static void +sp_ellipse_init(SPEllipse *ellipse) +{ + new (ellipse) SPEllipse(); +} + void CEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { CGenericEllipse::build(document, repr); @@ -456,7 +468,7 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ -G_DEFINE_TYPE(SPCircle, sp_circle, SP_TYPE_GENERICELLIPSE); +G_DEFINE_TYPE(SPCircle, sp_circle, G_TYPE_OBJECT); static void sp_circle_class_init(SPCircleClass *klass) @@ -470,9 +482,9 @@ CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { CCircle::~CCircle() { } -static void -sp_circle_init(SPCircle *circle) -{ +SPCircle::SPCircle() : SPGenericEllipse() { + SPCircle* circle = this; + circle->ccircle = new CCircle(circle); circle->typeHierarchy.insert(typeid(SPCircle)); @@ -484,6 +496,12 @@ sp_circle_init(SPCircle *circle) circle->cobject = circle->ccircle; } +static void +sp_circle_init(SPCircle *circle) +{ + new (circle) SPCircle(); +} + void CCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { SPCircle* object = this->spcircle; @@ -544,7 +562,7 @@ gchar* CCircle::description() { /* element */ -G_DEFINE_TYPE(SPArc, sp_arc, SP_TYPE_GENERICELLIPSE); +G_DEFINE_TYPE(SPArc, sp_arc, G_TYPE_OBJECT); static void sp_arc_class_init(SPArcClass *klass) @@ -558,9 +576,9 @@ CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { CArc::~CArc() { } -static void -sp_arc_init(SPArc *arc) -{ +SPArc::SPArc() : SPGenericEllipse() { + SPArc* arc = this; + arc->carc = new CArc(arc); arc->typeHierarchy.insert(typeid(SPArc)); @@ -572,6 +590,12 @@ sp_arc_init(SPArc *arc) arc->cobject = arc->carc; } +static void +sp_arc_init(SPArc *arc) +{ + new (arc) SPArc(); +} + void CArc::build(SPDocument *document, Inkscape::XML::Node *repr) { SPArc* object = this->sparc; -- 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/sp-ellipse.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index a2c94c508..66c7a81a8 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -35,6 +35,28 @@ #define noELLIPSE_VERBOSE + +#include "sp-factory.h" + +namespace { + SPObject* createEllipse() { + return new SPEllipse(); + } + + SPObject* createCircle() { + return new SPCircle(); + } + + SPObject* createArc() { + return new SPArc(); + } + + bool ellipseRegistered = SPFactory::instance().registerObject("svg:ellipse", createEllipse); + bool circleRegistered = SPFactory::instance().registerObject("svg:circle", createCircle); + bool arcRegistered = SPFactory::instance().registerObject("arc", createArc); +} + + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif -- cgit v1.2.3 From 8443720ce6429b9beec839e60b8a808595f4ba72 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Tue, 2 Apr 2013 23:01:45 +0200 Subject: Cleaned up a bit. Uses some C++11 features. (bzr r11608.1.72) --- src/sp-ellipse.cpp | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 66c7a81a8..0e84a0360 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -88,11 +88,6 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); -G_DEFINE_TYPE(SPGenericEllipse, sp_genericellipse, G_TYPE_OBJECT); - -static void sp_genericellipse_class_init(SPGenericEllipseClass *klass) -{ -} CGenericEllipse::CGenericEllipse(SPGenericEllipse* genericEllipse) : CShape(genericEllipse) { this->spgenericEllipse = genericEllipse; @@ -123,12 +118,6 @@ SPGenericEllipse::SPGenericEllipse() : SPShape() { ellipse->closed = TRUE; } -static void -sp_genericellipse_init(SPGenericEllipse *ellipse) -{ - new (ellipse) SPGenericEllipse(); -} - void CGenericEllipse::update(SPCtx *ctx, guint flags) { SPGenericEllipse* object = this->spgenericEllipse; @@ -372,12 +361,6 @@ Inkscape::XML::Node* CGenericEllipse::write(Inkscape::XML::Document *xml_doc, In /* SVG element */ -G_DEFINE_TYPE(SPEllipse, sp_ellipse, G_TYPE_OBJECT); - -static void sp_ellipse_class_init(SPEllipseClass *klass) -{ -} - CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { this->spellipse = ellipse; } @@ -399,12 +382,6 @@ SPEllipse::SPEllipse() : SPGenericEllipse() { ellipse->cobject = ellipse->cellipse; } -static void -sp_ellipse_init(SPEllipse *ellipse) -{ - new (ellipse) SPEllipse(); -} - void CEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { CGenericEllipse::build(document, repr); @@ -490,13 +467,6 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ -G_DEFINE_TYPE(SPCircle, sp_circle, G_TYPE_OBJECT); - -static void -sp_circle_class_init(SPCircleClass *klass) -{ -} - CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { this->spcircle = circle; } @@ -518,12 +488,6 @@ SPCircle::SPCircle() : SPGenericEllipse() { circle->cobject = circle->ccircle; } -static void -sp_circle_init(SPCircle *circle) -{ - new (circle) SPCircle(); -} - void CCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { SPCircle* object = this->spcircle; @@ -551,7 +515,6 @@ Inkscape::XML::Node* CCircle::write(Inkscape::XML::Document *xml_doc, Inkscape:: return repr; } - void CCircle::set(unsigned int key, gchar const* value) { SPGenericEllipse *ge = this->spcircle; SPCircle* object = (SPCircle*)ge; @@ -584,13 +547,6 @@ gchar* CCircle::description() { /* element */ -G_DEFINE_TYPE(SPArc, sp_arc, G_TYPE_OBJECT); - -static void -sp_arc_class_init(SPArcClass *klass) -{ -} - CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { this->sparc = arc; } @@ -612,12 +568,6 @@ SPArc::SPArc() : SPGenericEllipse() { arc->cobject = arc->carc; } -static void -sp_arc_init(SPArc *arc) -{ - new (arc) SPArc(); -} - void CArc::build(SPDocument *document, Inkscape::XML::Node *repr) { SPArc* object = this->sparc; -- cgit v1.2.3 From 748ffce08bb6250c87adabb64f45bff02509e9e7 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 5 Apr 2013 00:27:58 +0200 Subject: Combined some classes. (bzr r11608.1.75) --- src/sp-ellipse.cpp | 198 ++++++++++++++++++++--------------------------------- 1 file changed, 76 insertions(+), 122 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 0e84a0360..23a7c91b0 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -88,38 +88,28 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); +SPGenericEllipse::SPGenericEllipse() : SPShape(), CShape(this) { + delete this->cshape; + this->cshape = this; + this->clpeitem = this; + this->citem = this; + this->cobject = this; -CGenericEllipse::CGenericEllipse(SPGenericEllipse* genericEllipse) : CShape(genericEllipse) { - this->spgenericEllipse = genericEllipse; -} + this->cx.unset(); + this->cy.unset(); + this->rx.unset(); + this->ry.unset(); -CGenericEllipse::~CGenericEllipse() { + this->start = 0.0; + this->end = SP_2PI; + this->closed = TRUE; } -SPGenericEllipse::SPGenericEllipse() : SPShape() { - SPGenericEllipse* ellipse = this; - - ellipse->cgenericEllipse = new CGenericEllipse(ellipse); - ellipse->typeHierarchy.insert(typeid(SPGenericEllipse)); - - delete ellipse->cshape; - ellipse->cshape = ellipse->cgenericEllipse; - ellipse->clpeitem = ellipse->cgenericEllipse; - ellipse->citem = ellipse->cgenericEllipse; - ellipse->cobject = ellipse->cgenericEllipse; - - ellipse->cx.unset(); - ellipse->cy.unset(); - ellipse->rx.unset(); - ellipse->ry.unset(); - - ellipse->start = 0.0; - ellipse->end = SP_2PI; - ellipse->closed = TRUE; +SPGenericEllipse::~SPGenericEllipse() { } -void CGenericEllipse::update(SPCtx *ctx, guint flags) { - SPGenericEllipse* object = this->spgenericEllipse; +void SPGenericEllipse::update(SPCtx *ctx, guint flags) { + SPGenericEllipse* object = this; if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { SPGenericEllipse *ellipse = (SPGenericEllipse *) object; @@ -141,8 +131,8 @@ void CGenericEllipse::update(SPCtx *ctx, guint flags) { CShape::update(ctx, flags); } -void CGenericEllipse::update_patheffect(bool write) { - SPShape *shape = this->spgenericEllipse; +void SPGenericEllipse::update_patheffect(bool write) { + SPShape *shape = this; this->set_shape(); if (write) { @@ -161,8 +151,8 @@ void CGenericEllipse::update_patheffect(bool write) { /* fixme: Think (Lauris) */ /* Can't we use arcto in this method? */ -void CGenericEllipse::set_shape() { - SPGenericEllipse* shape = this->spgenericEllipse; +void SPGenericEllipse::set_shape() { + SPGenericEllipse* shape = this; if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { g_warning ("The ellipse shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as ellipse will remove the bad LPE"); @@ -251,8 +241,8 @@ void CGenericEllipse::set_shape() { curve->unref(); } -void CGenericEllipse::snappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { - SPGenericEllipse* item = this->spgenericEllipse; +void SPGenericEllipse::snappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { + SPGenericEllipse* item = this; g_assert(item != NULL); g_assert(SP_IS_GENERICELLIPSE(item)); @@ -334,8 +324,8 @@ sp_genericellipse_normalize(SPGenericEllipse *ellipse) /* Now we keep: 0 <= start < end <= 2*PI */ } -Inkscape::XML::Node* CGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this->spgenericEllipse; +Inkscape::XML::Node* SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this; SPGenericEllipse* object = ellipse; if (flags & SP_OBJECT_WRITE_EXT) { @@ -360,32 +350,20 @@ Inkscape::XML::Node* CGenericEllipse::write(Inkscape::XML::Document *xml_doc, In } /* SVG element */ - -CEllipse::CEllipse(SPEllipse* ellipse) : CGenericEllipse(ellipse) { - this->spellipse = ellipse; -} - -CEllipse::~CEllipse() { -} - SPEllipse::SPEllipse() : SPGenericEllipse() { - SPEllipse* ellipse = this; - - ellipse->cellipse = new CEllipse(ellipse); - ellipse->typeHierarchy.insert(typeid(SPEllipse)); + this->cshape = this; + this->clpeitem = this; + this->citem = this; + this->cobject = this; +} - delete ellipse->cgenericEllipse; - ellipse->cgenericEllipse = ellipse->cellipse; - ellipse->cshape = ellipse->cellipse; - ellipse->clpeitem = ellipse->cellipse; - ellipse->citem = ellipse->cellipse; - ellipse->cobject = ellipse->cellipse; +SPEllipse::~SPEllipse() { } -void CEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { - CGenericEllipse::build(document, repr); +void SPEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { + SPGenericEllipse::build(document, repr); - SPEllipse* object = this->spellipse; + SPEllipse* object = this; object->readAttr( "cx" ); object->readAttr( "cy" ); object->readAttr( "rx" ); @@ -393,8 +371,8 @@ void CEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { } -Inkscape::XML::Node* CEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this->spellipse; +Inkscape::XML::Node* SPEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:ellipse"); @@ -405,14 +383,14 @@ Inkscape::XML::Node* CEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape: sp_repr_set_svg_double(repr, "rx", ellipse->rx.computed); sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed); - CGenericEllipse::write(xml_doc, repr, flags); + SPGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CEllipse::set(unsigned int key, gchar const* value) { - SPEllipse *ellipse = this->spellipse; +void SPEllipse::set(unsigned int key, gchar const* value) { + SPEllipse *ellipse = this; SPEllipse* object = (SPEllipse*)ellipse; switch (key) { @@ -437,12 +415,12 @@ void CEllipse::set(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::set(key, value); + SPGenericEllipse::set(key, value); break; } } -gchar* CEllipse::description() { +gchar* SPEllipse::description() { return g_strdup(_("Ellipse")); } @@ -466,32 +444,20 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd } /* SVG element */ - -CCircle::CCircle(SPCircle* circle) : CGenericEllipse(circle) { - this->spcircle = circle; -} - -CCircle::~CCircle() { -} - SPCircle::SPCircle() : SPGenericEllipse() { - SPCircle* circle = this; - - circle->ccircle = new CCircle(circle); - circle->typeHierarchy.insert(typeid(SPCircle)); + this->cshape = this; + this->clpeitem = this; + this->citem = this; + this->cobject = this; +} - delete circle->cgenericEllipse; - circle->cgenericEllipse = circle->ccircle; - circle->cshape = circle->ccircle; - circle->clpeitem = circle->ccircle; - circle->citem = circle->ccircle; - circle->cobject = circle->ccircle; +SPCircle::~SPCircle() { } -void CCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPCircle* object = this->spcircle; +void SPCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { + SPCircle* object = this; - CGenericEllipse::build(document, repr); + SPGenericEllipse::build(document, repr); object->readAttr( "cx" ); object->readAttr( "cy" ); @@ -499,8 +465,8 @@ void CCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { } -Inkscape::XML::Node* CCircle::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this->spcircle; +Inkscape::XML::Node* SPCircle::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPGenericEllipse *ellipse = this; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:circle"); @@ -510,13 +476,13 @@ Inkscape::XML::Node* CCircle::write(Inkscape::XML::Document *xml_doc, Inkscape:: sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed); sp_repr_set_svg_double(repr, "r", ellipse->rx.computed); - CGenericEllipse::write(xml_doc, repr, flags); + SPGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CCircle::set(unsigned int key, gchar const* value) { - SPGenericEllipse *ge = this->spcircle; +void SPCircle::set(unsigned int key, gchar const* value) { + SPGenericEllipse *ge = this; SPCircle* object = (SPCircle*)ge; switch (key) { @@ -536,42 +502,30 @@ void CCircle::set(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::set(key, value); + SPGenericEllipse::set(key, value); break; } } -gchar* CCircle::description() { +gchar* SPCircle::description() { return g_strdup(_("Circle")); } /* element */ - -CArc::CArc(SPArc* arc) : CGenericEllipse(arc) { - this->sparc = arc; -} - -CArc::~CArc() { -} - SPArc::SPArc() : SPGenericEllipse() { - SPArc* arc = this; - - arc->carc = new CArc(arc); - arc->typeHierarchy.insert(typeid(SPArc)); + this->cshape = this; + this->clpeitem = this; + this->citem = this; + this->cobject = this; +} - delete arc->cgenericEllipse; - arc->cgenericEllipse = arc->carc; - arc->cshape = arc->carc; - arc->clpeitem = arc->carc; - arc->citem = arc->carc; - arc->cobject = arc->carc; +SPArc::~SPArc() { } -void CArc::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPArc* object = this->sparc; +void SPArc::build(SPDocument *document, Inkscape::XML::Node *repr) { + SPArc* object = this; - CGenericEllipse::build(document, repr); + SPGenericEllipse::build(document, repr); object->readAttr( "sodipodi:cx" ); object->readAttr( "sodipodi:cy" ); @@ -625,8 +579,8 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) return true; } -Inkscape::XML::Node* CArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPArc* object = this->sparc; +Inkscape::XML::Node* SPArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPArc* object = this; SPGenericEllipse *ge = object; SPArc *arc = object; @@ -658,13 +612,13 @@ Inkscape::XML::Node* CArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML // write d= sp_arc_set_elliptical_path_attribute(arc, repr); - CGenericEllipse::write(xml_doc, repr, flags); + SPGenericEllipse::write(xml_doc, repr, flags); return repr; } -void CArc::set(unsigned int key, gchar const* value) { - SPArc* object = this->sparc; +void SPArc::set(unsigned int key, gchar const* value) { + SPArc* object = this; SPGenericEllipse *ge = object; switch (key) { @@ -709,24 +663,24 @@ void CArc::set(unsigned int key, gchar const* value) { object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; default: - CGenericEllipse::set(key, value); + SPGenericEllipse::set(key, value); break; } } -void CArc::modified(guint flags) { - SPArc* object = this->sparc; +void SPArc::modified(guint flags) { + SPArc* object = this; if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { ((SPShape *) object)->setShape(); } - CGenericEllipse::modified(flags); + SPGenericEllipse::modified(flags); } -gchar* CArc::description() { - SPArc* item = this->sparc; +gchar* SPArc::description() { + SPArc* item = this; SPGenericEllipse *ge = item; gdouble len = fmod(ge->end - ge->start, SP_2PI); -- cgit v1.2.3 From cfe48de7f071e2e07a1f2f2ace3456f7b410e93b Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 5 Apr 2013 15:37:33 +0200 Subject: Merged Shape and subclasses. Cleaned up a bit. (bzr r11608.1.76) --- src/sp-ellipse.cpp | 376 ++++++++++++++++++++++++++++------------------------- 1 file changed, 196 insertions(+), 180 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 23a7c91b0..303a0cde6 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -88,9 +88,7 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); -SPGenericEllipse::SPGenericEllipse() : SPShape(), CShape(this) { - delete this->cshape; - this->cshape = this; +SPGenericEllipse::SPGenericEllipse() : SPShape() { this->clpeitem = this; this->citem = this; this->cobject = this; @@ -109,36 +107,34 @@ SPGenericEllipse::~SPGenericEllipse() { } void SPGenericEllipse::update(SPCtx *ctx, guint flags) { - SPGenericEllipse* object = this; - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - SPGenericEllipse *ellipse = (SPGenericEllipse *) object; - SPStyle const *style = object->style; Geom::Rect const &viewbox = ((SPItemCtx const *) ctx)->viewport; double const dx = viewbox.width(); double const dy = viewbox.height(); double const dr = sqrt(dx*dx + dy*dy)/sqrt(2); - double const em = style->font_size.computed; + double const em = this->style->font_size.computed; double const ex = em * 0.5; // fixme: get from pango or libnrtype - ellipse->cx.update(em, ex, dx); - ellipse->cy.update(em, ex, dy); - ellipse->rx.update(em, ex, dr); - ellipse->ry.update(em, ex, dr); - static_cast(object)->setShape(); + + this->cx.update(em, ex, dx); + this->cy.update(em, ex, dy); + this->rx.update(em, ex, dr); + this->ry.update(em, ex, dr); + + this->set_shape(); } - CShape::update(ctx, flags); + SPShape::update(ctx, flags); } void SPGenericEllipse::update_patheffect(bool write) { - SPShape *shape = this; this->set_shape(); if (write) { - Inkscape::XML::Node *repr = shape->getRepr(); - if ( shape->_curve != NULL ) { - gchar *str = sp_svg_write_path(shape->_curve->get_pathvector()); + Inkscape::XML::Node *repr = this->getRepr(); + + if ( this->_curve != NULL ) { + gchar *str = sp_svg_write_path(this->_curve->get_pathvector()); repr->setAttribute("d", str); g_free(str); } else { @@ -146,23 +142,23 @@ void SPGenericEllipse::update_patheffect(bool write) { } } - ((SPObject *)shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } /* fixme: Think (Lauris) */ /* Can't we use arcto in this method? */ void SPGenericEllipse::set_shape() { - SPGenericEllipse* shape = this; - - if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + if (sp_lpe_item_has_broken_path_effect(this)) { g_warning ("The ellipse shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as ellipse will remove the bad LPE"); - if (shape->getRepr()->attribute("d")) { + + if (this->getRepr()->attribute("d")) { // unconditionally read the curve from d, if any, to preserve appearance - Geom::PathVector pv = sp_svg_read_pathv(shape->getRepr()->attribute("d")); + Geom::PathVector pv = sp_svg_read_pathv(this->getRepr()->attribute("d")); SPCurve *cold = new SPCurve(pv); - shape->setCurveInsync( cold, TRUE); + this->setCurveInsync( cold, TRUE); cold->unref(); } + return; } @@ -172,33 +168,43 @@ void SPGenericEllipse::set_shape() { gint slice = FALSE; // gint i; - SPGenericEllipse *ellipse = (SPGenericEllipse *) shape; + if ((this->rx.computed < 1e-18) || (this->ry.computed < 1e-18)) { + return; + } - if ((ellipse->rx.computed < 1e-18) || (ellipse->ry.computed < 1e-18)) return; - if (fabs(ellipse->end - ellipse->start) < 1e-9) return; + if (fabs(this->end - this->start) < 1e-9) { + return; + } - sp_genericellipse_normalize(ellipse); + sp_genericellipse_normalize(this); - rx = ellipse->rx.computed; - ry = ellipse->ry.computed; + rx = this->rx.computed; + ry = this->ry.computed; // figure out if we have a slice, guarding against rounding errors - len = fmod(ellipse->end - ellipse->start, SP_2PI); - if (len < 0.0) len += SP_2PI; + len = fmod(this->end - this->start, SP_2PI); + + if (len < 0.0) { + len += SP_2PI; + } + if (fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8) { slice = FALSE; - ellipse->end = ellipse->start + SP_2PI; + this->end = this->start + SP_2PI; } else { slice = TRUE; } SPCurve * curve = new SPCurve(); - curve->moveto(cos(ellipse->start), sin(ellipse->start)); + curve->moveto(cos(this->start), sin(this->start)); - for (s = ellipse->start; s < ellipse->end; s += M_PI_2) { + for (s = this->start; s < this->end; s += M_PI_2) { e = s + M_PI_2; - if (e > ellipse->end) - e = ellipse->end; + + if (e > this->end) { + e = this->end; + } + len = 4*tan((e - s)/4)/3; x0 = cos(s); y0 = sin(s); @@ -215,66 +221,69 @@ void SPGenericEllipse::set_shape() { curve->curveto(x1,y1, x2,y2, x3,y3); } - if (slice && ellipse->closed) { // TODO: is this check for "ellipse->closed" necessary? + if (slice && this->closed) { // TODO: is this check for "ellipse->closed" necessary? curve->lineto(0., 0.); } - if (ellipse->closed) { + + if (this->closed) { curve->closepath(); } - Geom::Affine aff = Geom::Scale(rx, ry) * Geom::Translate(ellipse->cx.computed, ellipse->cy.computed); + Geom::Affine aff = Geom::Scale(rx, ry) * Geom::Translate(this->cx.computed, this->cy.computed); curve->transform(aff); /* Reset the shape's curve to the "original_curve" * This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/ - shape->setCurveInsync( curve, TRUE); - shape->setCurveBeforeLPE(curve); + this->setCurveInsync( curve, TRUE); + this->setCurveBeforeLPE(curve); - if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) { + if (sp_lpe_item_has_path_effect(this) && sp_lpe_item_path_effects_enabled(this)) { SPCurve *c_lpe = curve->copy(); - bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); + bool success = sp_lpe_item_perform_path_effect(this, c_lpe); + if (success) { - shape->setCurveInsync( c_lpe, TRUE); + this->setCurveInsync( c_lpe, TRUE); } + c_lpe->unref(); } + curve->unref(); } void SPGenericEllipse::snappoints(std::vector &p, Inkscape::SnapPreferences const *snapprefs) { - SPGenericEllipse* item = this; - - g_assert(item != NULL); - g_assert(SP_IS_GENERICELLIPSE(item)); - - SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item); - sp_genericellipse_normalize(ellipse); - Geom::Affine const i2dt = item->i2dt_affine(); + sp_genericellipse_normalize(this); + Geom::Affine const i2dt = this->i2dt_affine(); // figure out if we have a slice, while guarding against rounding errors bool slice = false; - double len = fmod(ellipse->end - ellipse->start, SP_2PI); - if (len < 0.0) len += SP_2PI; + double len = fmod(this->end - this->start, SP_2PI); + + if (len < 0.0) { + len += SP_2PI; + } + if (fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8) { slice = false; - ellipse->end = ellipse->start + SP_2PI; + this->end = this->start + SP_2PI; } else { slice = true; } - double rx = ellipse->rx.computed; - double ry = ellipse->ry.computed; - double cx = ellipse->cx.computed; - double cy = ellipse->cy.computed; + double rx = this->rx.computed; + double ry = this->ry.computed; + double cx = this->cx.computed; + double cy = this->cy.computed; Geom::Point pt; - // Snap to the 4 quadrant points of the ellipse, but only if the arc + // Snap to the 4 quadrant points of the this, but only if the arc // spans far enough to include them if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)) { double angle = 0; + for (angle = 0; angle < SP_2PI; angle += M_PI_2) { - if (angle >= ellipse->start && angle <= ellipse->end) { + if (angle >= this->start && angle <= this->end) { pt = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)); } @@ -282,13 +291,16 @@ void SPGenericEllipse::snappoints(std::vector &p, } // Add the centre, if we have a closed slice or when explicitly asked for - bool c1 = snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice && ellipse->closed; + bool c1 = snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice && this->closed; bool c2 = snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT); + if (c1 || c2) { pt = Geom::Point(cx, cy) * i2dt; + if (c1) { p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } + if (c2) { p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } @@ -297,13 +309,14 @@ void SPGenericEllipse::snappoints(std::vector &p, // And if we have a slice, also snap to the endpoints if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice) { // Add the start point, if it's not coincident with a quadrant point - if (fmod(ellipse->start, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2dt; + if (fmod(this->start, M_PI_2) != 0.0 ) { + pt = Geom::Point(cx + cos(this->start)*rx, cy + sin(this->start)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } + // Add the end point, if it's not coincident with a quadrant point - if (fmod(ellipse->end, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2dt; + if (fmod(this->end, M_PI_2) != 0.0 ) { + pt = Geom::Point(cx + cos(this->end)*rx, cy + sin(this->end)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } } @@ -315,43 +328,44 @@ sp_genericellipse_normalize(SPGenericEllipse *ellipse) ellipse->start = fmod(ellipse->start, SP_2PI); ellipse->end = fmod(ellipse->end, SP_2PI); - if (ellipse->start < 0.0) + if (ellipse->start < 0.0) { ellipse->start += SP_2PI; + } + double diff = ellipse->start - ellipse->end; - if (diff >= 0.0) + + if (diff >= 0.0) { ellipse->end += diff - fmod(diff, SP_2PI) + SP_2PI; + } /* Now we keep: 0 <= start < end <= 2*PI */ } Inkscape::XML::Node* SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this; - SPGenericEllipse* object = ellipse; - if (flags & SP_OBJECT_WRITE_EXT) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:path"); } - sp_repr_set_svg_double(repr, "sodipodi:cx", ellipse->cx.computed); - sp_repr_set_svg_double(repr, "sodipodi:cy", ellipse->cy.computed); - sp_repr_set_svg_double(repr, "sodipodi:rx", ellipse->rx.computed); - sp_repr_set_svg_double(repr, "sodipodi:ry", ellipse->ry.computed); + sp_repr_set_svg_double(repr, "sodipodi:cx", this->cx.computed); + sp_repr_set_svg_double(repr, "sodipodi:cy", this->cy.computed); + sp_repr_set_svg_double(repr, "sodipodi:rx", this->rx.computed); + sp_repr_set_svg_double(repr, "sodipodi:ry", this->ry.computed); - if (SP_IS_ARC(ellipse)) { - sp_arc_set_elliptical_path_attribute(SP_ARC(object), object->getRepr()); + if (SP_IS_ARC(this)) { + sp_arc_set_elliptical_path_attribute(SP_ARC(this), this->getRepr()); } } + this->set_shape(); // evaluate SPCurve - CShape::write(xml_doc, repr, flags); + SPShape::write(xml_doc, repr, flags); return repr; } /* SVG element */ SPEllipse::SPEllipse() : SPGenericEllipse() { - this->cshape = this; this->clpeitem = this; this->citem = this; this->cobject = this; @@ -363,25 +377,22 @@ SPEllipse::~SPEllipse() { void SPEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) { SPGenericEllipse::build(document, repr); - SPEllipse* object = this; - object->readAttr( "cx" ); - object->readAttr( "cy" ); - object->readAttr( "rx" ); - object->readAttr( "ry" ); + this->readAttr( "cx" ); + this->readAttr( "cy" ); + this->readAttr( "rx" ); + this->readAttr( "ry" ); } Inkscape::XML::Node* SPEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this; - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:ellipse"); } - sp_repr_set_svg_double(repr, "cx", ellipse->cx.computed); - sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed); - sp_repr_set_svg_double(repr, "rx", ellipse->rx.computed); - sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed); + sp_repr_set_svg_double(repr, "cx", this->cx.computed); + sp_repr_set_svg_double(repr, "cy", this->cy.computed); + sp_repr_set_svg_double(repr, "rx", this->rx.computed); + sp_repr_set_svg_double(repr, "ry", this->ry.computed); SPGenericEllipse::write(xml_doc, repr, flags); @@ -390,30 +401,33 @@ Inkscape::XML::Node* SPEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape void SPEllipse::set(unsigned int key, gchar const* value) { - SPEllipse *ellipse = this; - SPEllipse* object = (SPEllipse*)ellipse; - switch (key) { case SP_ATTR_CX: - ellipse->cx.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cx.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_CY: - ellipse->cy.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cy.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_RX: - if (!ellipse->rx.read(value) || (ellipse->rx.value <= 0.0)) { - ellipse->rx.unset(); + if (!this->rx.read(value) || (this->rx.value <= 0.0)) { + this->rx.unset(); } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_RY: - if (!ellipse->ry.read(value) || (ellipse->ry.value <= 0.0)) { - ellipse->ry.unset(); + if (!this->ry.read(value) || (this->ry.value <= 0.0)) { + this->ry.unset(); } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + default: SPGenericEllipse::set(key, value); break; @@ -445,7 +459,6 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ SPCircle::SPCircle() : SPGenericEllipse() { - this->cshape = this; this->clpeitem = this; this->citem = this; this->cobject = this; @@ -455,26 +468,22 @@ SPCircle::~SPCircle() { } void SPCircle::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPCircle* object = this; - SPGenericEllipse::build(document, repr); - object->readAttr( "cx" ); - object->readAttr( "cy" ); - object->readAttr( "r" ); + this->readAttr( "cx" ); + this->readAttr( "cy" ); + this->readAttr( "r" ); } Inkscape::XML::Node* SPCircle::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPGenericEllipse *ellipse = this; - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:circle"); } - sp_repr_set_svg_double(repr, "cx", ellipse->cx.computed); - sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed); - sp_repr_set_svg_double(repr, "r", ellipse->rx.computed); + sp_repr_set_svg_double(repr, "cx", this->cx.computed); + sp_repr_set_svg_double(repr, "cy", this->cy.computed); + sp_repr_set_svg_double(repr, "r", this->rx.computed); SPGenericEllipse::write(xml_doc, repr, flags); @@ -482,25 +491,26 @@ Inkscape::XML::Node* SPCircle::write(Inkscape::XML::Document *xml_doc, Inkscape: } void SPCircle::set(unsigned int key, gchar const* value) { - SPGenericEllipse *ge = this; - SPCircle* object = (SPCircle*)ge; - switch (key) { case SP_ATTR_CX: - ge->cx.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cx.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_CY: - ge->cy.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cy.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_R: - if (!ge->rx.read(value) || ge->rx.value <= 0.0) { - ge->rx.unset(); + if (!this->rx.read(value) || this->rx.value <= 0.0) { + this->rx.unset(); } - ge->ry = ge->rx; - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->ry = this->rx; + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + default: SPGenericEllipse::set(key, value); break; @@ -513,7 +523,6 @@ gchar* SPCircle::description() { /* element */ SPArc::SPArc() : SPGenericEllipse() { - this->cshape = this; this->clpeitem = this; this->citem = this; this->cobject = this; @@ -523,18 +532,16 @@ SPArc::~SPArc() { } void SPArc::build(SPDocument *document, Inkscape::XML::Node *repr) { - SPArc* object = this; - SPGenericEllipse::build(document, repr); - object->readAttr( "sodipodi:cx" ); - object->readAttr( "sodipodi:cy" ); - object->readAttr( "sodipodi:rx" ); - object->readAttr( "sodipodi:ry" ); + this->readAttr( "sodipodi:cx" ); + this->readAttr( "sodipodi:cy" ); + this->readAttr( "sodipodi:rx" ); + this->readAttr( "sodipodi:ry" ); - object->readAttr( "sodipodi:start" ); - object->readAttr( "sodipodi:end" ); - object->readAttr( "sodipodi:open" ); + this->readAttr( "sodipodi:start" ); + this->readAttr( "sodipodi:end" ); + this->readAttr( "sodipodi:open" ); } /* @@ -580,28 +587,30 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) } Inkscape::XML::Node* SPArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPArc* object = this; - SPGenericEllipse *ge = object; - SPArc *arc = object; - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:path"); } if (flags & SP_OBJECT_WRITE_EXT) { repr->setAttribute("sodipodi:type", "arc"); - sp_repr_set_svg_double(repr, "sodipodi:cx", ge->cx.computed); - sp_repr_set_svg_double(repr, "sodipodi:cy", ge->cy.computed); - sp_repr_set_svg_double(repr, "sodipodi:rx", ge->rx.computed); - sp_repr_set_svg_double(repr, "sodipodi:ry", ge->ry.computed); + + sp_repr_set_svg_double(repr, "sodipodi:cx", this->cx.computed); + sp_repr_set_svg_double(repr, "sodipodi:cy", this->cy.computed); + sp_repr_set_svg_double(repr, "sodipodi:rx", this->rx.computed); + sp_repr_set_svg_double(repr, "sodipodi:ry", this->ry.computed); // write start and end only if they are non-trivial; otherwise remove - gdouble len = fmod(ge->end - ge->start, SP_2PI); - if (len < 0.0) len += SP_2PI; + gdouble len = fmod(this->end - this->start, SP_2PI); + + if (len < 0.0) { + len += SP_2PI; + } + if (!(fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8)) { - sp_repr_set_svg_double(repr, "sodipodi:start", ge->start); - sp_repr_set_svg_double(repr, "sodipodi:end", ge->end); - repr->setAttribute("sodipodi:open", (!ge->closed) ? "true" : NULL); + sp_repr_set_svg_double(repr, "sodipodi:start", this->start); + sp_repr_set_svg_double(repr, "sodipodi:end", this->end); + + repr->setAttribute("sodipodi:open", (!this->closed) ? "true" : NULL); } else { repr->setAttribute("sodipodi:end", NULL); repr->setAttribute("sodipodi:start", NULL); @@ -610,7 +619,7 @@ Inkscape::XML::Node* SPArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XM } // write d= - sp_arc_set_elliptical_path_attribute(arc, repr); + sp_arc_set_elliptical_path_attribute(this, repr); SPGenericEllipse::write(xml_doc, repr, flags); @@ -618,50 +627,58 @@ Inkscape::XML::Node* SPArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XM } void SPArc::set(unsigned int key, gchar const* value) { - SPArc* object = this; - SPGenericEllipse *ge = object; - switch (key) { case SP_ATTR_SODIPODI_CX: - ge->cx.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cx.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_CY: - ge->cy.readOrUnset(value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->cy.readOrUnset(value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_RX: - if (!ge->rx.read(value) || ge->rx.computed <= 0.0) { - ge->rx.unset(); + if (!this->rx.read(value) || this->rx.computed <= 0.0) { + this->rx.unset(); } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_RY: - if (!ge->ry.read(value) || ge->ry.computed <= 0.0) { - ge->ry.unset(); + if (!this->ry.read(value) || this->ry.computed <= 0.0) { + this->ry.unset(); } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_START: if (value) { - sp_svg_number_read_d(value, &ge->start); + sp_svg_number_read_d(value, &this->start); } else { - ge->start = 0; + this->start = 0; } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_END: if (value) { - sp_svg_number_read_d(value, &ge->end); + sp_svg_number_read_d(value, &this->end); } else { - ge->end = 2 * M_PI; + this->end = 2 * M_PI; } - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + case SP_ATTR_SODIPODI_OPEN: - ge->closed = (!value); - object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->closed = (!value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; + default: SPGenericEllipse::set(key, value); break; @@ -669,10 +686,8 @@ void SPArc::set(unsigned int key, gchar const* value) { } void SPArc::modified(guint flags) { - SPArc* object = this; - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - ((SPShape *) object)->setShape(); + this->set_shape(); } SPGenericEllipse::modified(flags); @@ -680,13 +695,14 @@ void SPArc::modified(guint flags) { gchar* SPArc::description() { - SPArc* item = this; - SPGenericEllipse *ge = item; + gdouble len = fmod(this->end - this->start, SP_2PI); + + if (len < 0.0) { + len += SP_2PI; + } - gdouble len = fmod(ge->end - ge->start, SP_2PI); - if (len < 0.0) len += SP_2PI; if (!(fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8)) { - if (ge->closed) { + if (this->closed) { return g_strdup(_("Segment")); } else { return g_strdup(_("Arc")); -- cgit v1.2.3 From 19d00efa85cfc42ccae9bd17ef575602f0d22c50 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 5 Apr 2013 19:42:32 +0200 Subject: Merged more classes. (bzr r11608.1.78) --- src/sp-ellipse.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 303a0cde6..d71ae04a9 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -89,7 +89,6 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); SPGenericEllipse::SPGenericEllipse() : SPShape() { - this->clpeitem = this; this->citem = this; this->cobject = this; @@ -366,7 +365,6 @@ Inkscape::XML::Node* SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I /* SVG element */ SPEllipse::SPEllipse() : SPGenericEllipse() { - this->clpeitem = this; this->citem = this; this->cobject = this; } @@ -459,7 +457,6 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ SPCircle::SPCircle() : SPGenericEllipse() { - this->clpeitem = this; this->citem = this; this->cobject = this; } @@ -523,7 +520,6 @@ gchar* SPCircle::description() { /* element */ SPArc::SPArc() : SPGenericEllipse() { - this->clpeitem = this; this->citem = this; this->cobject = this; } -- cgit v1.2.3 From 8073924aacdda310fb7492750f78d5389b3186af Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 5 Apr 2013 22:45:01 +0200 Subject: Merged Item. (bzr r11608.1.81) --- src/sp-ellipse.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index d71ae04a9..5efd9ade2 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -89,7 +89,6 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); SPGenericEllipse::SPGenericEllipse() : SPShape() { - this->citem = this; this->cobject = this; this->cx.unset(); @@ -365,7 +364,6 @@ Inkscape::XML::Node* SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I /* SVG element */ SPEllipse::SPEllipse() : SPGenericEllipse() { - this->citem = this; this->cobject = this; } @@ -457,7 +455,6 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ SPCircle::SPCircle() : SPGenericEllipse() { - this->citem = this; this->cobject = this; } @@ -520,7 +517,6 @@ gchar* SPCircle::description() { /* element */ SPArc::SPArc() : SPGenericEllipse() { - this->citem = this; this->cobject = this; } -- 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-ellipse.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/sp-ellipse.cpp') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 5efd9ade2..294970fef 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -89,8 +89,6 @@ static double sp_round(double x, double y) static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); SPGenericEllipse::SPGenericEllipse() : SPShape() { - this->cobject = this; - this->cx.unset(); this->cy.unset(); this->rx.unset(); @@ -364,7 +362,6 @@ Inkscape::XML::Node* SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I /* SVG element */ SPEllipse::SPEllipse() : SPGenericEllipse() { - this->cobject = this; } SPEllipse::~SPEllipse() { @@ -455,7 +452,6 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd /* SVG element */ SPCircle::SPCircle() : SPGenericEllipse() { - this->cobject = this; } SPCircle::~SPCircle() { @@ -517,7 +513,6 @@ gchar* SPCircle::description() { /* element */ SPArc::SPArc() : SPGenericEllipse() { - this->cobject = this; } SPArc::~SPArc() { -- cgit v1.2.3