From b403c428afe0c33b95d8d0d36eac42fd01ba31fd Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sun, 19 Aug 2012 21:31:33 +0200 Subject: Added "virtual pad" to - SPFlowdiv - SPFlowtspan - SPFlowpara - SPFlowline - SPFlowregionbreak (bzr r11608.1.23) --- src/sp-flowdiv.cpp | 350 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 248 insertions(+), 102 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 7a0c5e0b8..976746770 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -94,25 +94,36 @@ static void sp_flowdiv_class_init(SPFlowdivClass *klass) sp_object_class->modified = sp_flowdiv_modified; } -static void sp_flowdiv_init(SPFlowdiv */*group*/) +CFlowdiv::CFlowdiv(SPFlowdiv* flowdiv) : CItem(flowdiv) { + this->spflowdiv = flowdiv; +} + +CFlowdiv::~CFlowdiv() { +} + +static void sp_flowdiv_init(SPFlowdiv *group) { + group->cflowdiv = new CFlowdiv(group); + group->citem = group->cflowdiv; + group->cobject = group->cflowdiv; +} + +void CFlowdiv::onRelease() { + CItem::onRelease(); } +// CPPIFY: remove static void sp_flowdiv_release(SPObject *object) { - if (reinterpret_cast(flowdiv_parent_class)->release) { - reinterpret_cast(flowdiv_parent_class)->release(object); - } + ((SPFlowdiv*)object)->cflowdiv->onRelease(); } -static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags) -{ +void CFlowdiv::onUpdate(SPCtx *ctx, unsigned int flags) { + SPFlowdiv* object = this->spflowdiv; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - if (reinterpret_cast(flowdiv_parent_class)->update) { - reinterpret_cast(flowdiv_parent_class)->update(object, ctx, flags); - } + CItem::onUpdate(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -142,11 +153,16 @@ static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags) } } -static void sp_flowdiv_modified(SPObject *object, guint flags) +// CPPIFY: remove +static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags) { - if (reinterpret_cast(flowdiv_parent_class)->modified) { - reinterpret_cast(flowdiv_parent_class)->modified(object, flags); - } + ((SPFlowdiv*)object)->cflowdiv->onUpdate(ctx, flags); +} + +void CFlowdiv::onModified(unsigned int flags) { + SPFlowdiv* object = this->spflowdiv; + + CItem::onModified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -169,24 +185,39 @@ static void sp_flowdiv_modified(SPObject *object, guint flags) } } +// CPPIFY: remove +static void sp_flowdiv_modified(SPObject *object, guint flags) +{ + ((SPFlowdiv*)object)->cflowdiv->onModified(flags); +} + +void CFlowdiv::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) { + SPFlowdiv* object = this->spflowdiv; + + object->_requireSVGVersion(Inkscape::Version(1, 2)); + + CItem::onBuild(doc, repr); +} + +// CPPIFY: remove static void sp_flowdiv_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { - object->_requireSVGVersion(Inkscape::Version(1, 2)); + ((SPFlowdiv*)object)->cflowdiv->onBuild(doc, repr); +} - if (reinterpret_cast(flowdiv_parent_class)->build) { - reinterpret_cast(flowdiv_parent_class)->build(object, doc, repr); - } +void CFlowdiv::onSet(unsigned int key, const gchar* value) { + CItem::onSet(key, value); } +// CPPIFY: remove static void sp_flowdiv_set(SPObject *object, unsigned int key, const gchar *value) { - if (reinterpret_cast(flowdiv_parent_class)->set) { - reinterpret_cast(flowdiv_parent_class)->set(object, key, value); - } + ((SPFlowdiv*)object)->cflowdiv->onSet(key, value); } -static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ +Inkscape::XML::Node* CFlowdiv::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPFlowdiv* object = this->spflowdiv; + if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowDiv"); @@ -222,13 +253,17 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do } } - if (((SPObjectClass *) (flowdiv_parent_class))->write) { - ((SPObjectClass *) (flowdiv_parent_class))->write(object, xml_doc, repr, flags); - } + CItem::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPFlowdiv*)object)->cflowdiv->onWrite(xml_doc, repr, flags); +} + /* * @@ -270,25 +305,37 @@ static void sp_flowtspan_class_init(SPFlowtspanClass *klass) sp_object_class->modified = sp_flowtspan_modified; } -static void sp_flowtspan_init(SPFlowtspan */*group*/) +CFlowtspan::CFlowtspan(SPFlowtspan* flowtspan) : CItem(flowtspan) { + this->spflowtspan = flowtspan; +} + +CFlowtspan::~CFlowtspan() { +} + +static void sp_flowtspan_init(SPFlowtspan *group) { + group->cflowtspan = new CFlowtspan(group); + group->citem = group->cflowtspan; + group->cobject = group->cflowtspan; +} + +void CFlowtspan::onRelease() { + CItem::onRelease(); } +// CPPIFY: remove static void sp_flowtspan_release(SPObject *object) { - if (reinterpret_cast(flowtspan_parent_class)->release) { - reinterpret_cast(flowtspan_parent_class)->release(object); - } + ((SPFlowtspan*)object)->cflowtspan->onRelease(); } -static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags) -{ +void CFlowtspan::onUpdate(SPCtx *ctx, unsigned int flags) { + SPFlowtspan* object = this->spflowtspan; + SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - if (reinterpret_cast(flowtspan_parent_class)->update) { - reinterpret_cast(flowtspan_parent_class)->update(object, ctx, flags); - } + CItem::onUpdate(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -318,11 +365,16 @@ static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags } } -static void sp_flowtspan_modified(SPObject *object, guint flags) +// CPPIFY: remove +static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags) { - if (reinterpret_cast(flowtspan_parent_class)->modified) { - reinterpret_cast(flowtspan_parent_class)->modified(object, flags); - } + ((SPFlowtspan*)object)->cflowtspan->onUpdate(ctx, flags); +} + +void CFlowtspan::onModified(unsigned int flags) { + SPFlowtspan* object = this->spflowtspan; + + CItem::onModified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -345,22 +397,37 @@ static void sp_flowtspan_modified(SPObject *object, guint flags) } } +// CPPIFY: remove +static void sp_flowtspan_modified(SPObject *object, guint flags) +{ + ((SPFlowtspan*)object)->cflowtspan->onModified(flags); +} + +void CFlowtspan::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) +{ + CItem::onBuild(doc, repr); +} + +// CPPIFY: remove static void sp_flowtspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { - if (reinterpret_cast(flowtspan_parent_class)->build) { - reinterpret_cast(flowtspan_parent_class)->build(object, doc, repr); - } + ((SPFlowtspan*)object)->cflowtspan->onBuild(doc, repr); +} + +void CFlowtspan::onSet(unsigned int key, const gchar* value) { + CItem::onSet(key, value); } +// CPPIFY: remove static void sp_flowtspan_set(SPObject *object, unsigned int key, const gchar *value) { - if (reinterpret_cast(flowtspan_parent_class)->set) { - reinterpret_cast(flowtspan_parent_class)->set(object, key, value); - } + ((SPFlowtspan*)object)->cflowtspan->onSet(key, value); } -static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowtspan::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPFlowtspan* object = this->spflowtspan; + if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowSpan"); @@ -396,13 +463,17 @@ static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML:: } } - if (((SPObjectClass *) (flowtspan_parent_class))->write) { - ((SPObjectClass *) (flowtspan_parent_class))->write(object, xml_doc, repr, flags); - } + CItem::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPFlowtspan*)object)->cflowtspan->onWrite(xml_doc, repr, flags); +} + /* @@ -445,25 +516,38 @@ static void sp_flowpara_class_init(SPFlowparaClass *klass) sp_object_class->modified = sp_flowpara_modified; } -static void sp_flowpara_init (SPFlowpara */*group*/) +CFlowpara::CFlowpara(SPFlowpara* flowpara) : CItem(flowpara) { + this->spflowpara = flowpara; +} + +CFlowpara::~CFlowpara() { +} + +static void sp_flowpara_init (SPFlowpara *group) { + group->cflowpara = new CFlowpara(group); + group->citem = group->cflowpara; + group->cobject = group->cflowpara; +} + +void CFlowpara::onRelease() { + CItem::onRelease(); } +// CPPIFY: remove static void sp_flowpara_release(SPObject *object) { - if (reinterpret_cast(flowpara_parent_class)->release) { - reinterpret_cast(flowpara_parent_class)->release(object); - } + ((SPFlowpara*)object)->cflowpara->onRelease(); } -static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags) +void CFlowpara::onUpdate(SPCtx *ctx, unsigned int flags) { + SPFlowpara* object = this->spflowpara; + SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - if (reinterpret_cast(flowpara_parent_class)->update) { - reinterpret_cast(flowpara_parent_class)->update(object, ctx, flags); - } + CItem::onUpdate(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -493,11 +577,16 @@ static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags) } } -static void sp_flowpara_modified(SPObject *object, guint flags) +// CPPIFY: remove +static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags) { - if (reinterpret_cast(flowpara_parent_class)->modified) { - reinterpret_cast(flowpara_parent_class)->modified(object, flags); - } + ((SPFlowpara*)object)->cflowpara->onUpdate(ctx, flags); +} + +void CFlowpara::onModified(unsigned int flags) { + SPFlowpara* object = this->spflowpara; + + CItem::onModified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -520,22 +609,37 @@ static void sp_flowpara_modified(SPObject *object, guint flags) } } +// CPPIFY: remove +static void sp_flowpara_modified(SPObject *object, guint flags) +{ + ((SPFlowpara*)object)->cflowpara->onModified(flags); +} + +void CFlowpara::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) +{ + CItem::onBuild(doc, repr); +} + +// CPPIFY: remove static void sp_flowpara_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { - if (reinterpret_cast(flowpara_parent_class)->build) { - reinterpret_cast(flowpara_parent_class)->build(object, doc, repr); - } + ((SPFlowpara*)object)->cflowpara->onBuild(doc, repr); } +void CFlowpara::onSet(unsigned int key, const gchar* value) { + CItem::onSet(key, value); +} + +// CPPIFY: remove static void sp_flowpara_set(SPObject *object, unsigned int key, const gchar *value) { - if (reinterpret_cast(flowpara_parent_class)->set) { - reinterpret_cast(flowpara_parent_class)->set(object, key, value); - } + ((SPFlowpara*)object)->cflowpara->onSet(key, value); } -static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowpara::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPFlowpara* object = this->spflowpara; + if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara"); GSList *l = NULL; @@ -569,13 +673,17 @@ static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::D } } - if (((SPObjectClass *) (flowpara_parent_class))->write) { - ((SPObjectClass *) (flowpara_parent_class))->write(object, xml_doc, repr, flags); - } + CItem::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPFlowpara*)object)->cflowpara->onWrite(xml_doc, repr, flags); +} + /* * */ @@ -612,30 +720,45 @@ static void sp_flowline_class_init(SPFlowlineClass *klass) sp_object_class->modified = sp_flowline_modified; } -static void sp_flowline_init(SPFlowline */*group*/) +CFlowline::CFlowline(SPFlowline* flowline) : CObject(flowline) { + this->spflowline = flowline; +} + +CFlowline::~CFlowline() { +} + +static void sp_flowline_init(SPFlowline *group) { + group->cflowline = new CFlowline(group); + group->cobject = group->cflowline; } +void CFlowline::onRelease() { + CObject::onRelease(); +} + +// CPPIFY: remove static void sp_flowline_release(SPObject *object) { - if (reinterpret_cast(flowline_parent_class)->release) { - reinterpret_cast(flowline_parent_class)->release(object); - } + ((SPFlowline*)object)->cflowline->onRelease(); } +void CFlowline::onModified(unsigned int flags) { + CObject::onModified(flags); + + if (flags & SP_OBJECT_MODIFIED_FLAG) { + flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + } + flags &= SP_OBJECT_MODIFIED_CASCADE; +} + +// CPPIFY: remove static void sp_flowline_modified(SPObject *object, guint flags) { - if (reinterpret_cast(flowline_parent_class)->modified) { - reinterpret_cast(flowline_parent_class)->modified(object, flags); - } - - if (flags & SP_OBJECT_MODIFIED_FLAG) { - flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; - } - flags &= SP_OBJECT_MODIFIED_CASCADE; + ((SPFlowline*)object)->cflowline->onModified(flags); } -static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowline::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -644,13 +767,17 @@ static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::D } else { } - if (reinterpret_cast(flowline_parent_class)->write) { - reinterpret_cast(flowline_parent_class)->write(object, xml_doc, repr, flags); - } + CObject::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPFlowline*)object)->cflowline->onWrite(xml_doc, repr, flags); +} + /* * */ @@ -687,30 +814,45 @@ static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass) sp_object_class->modified = sp_flowregionbreak_modified; } -static void sp_flowregionbreak_init(SPFlowregionbreak */*group*/) +CFlowregionbreak::CFlowregionbreak(SPFlowregionbreak* flowregionbreak) : CObject(flowregionbreak) { + this->spflowregionbreak = flowregionbreak; +} + +CFlowregionbreak::~CFlowregionbreak() { +} + +static void sp_flowregionbreak_init(SPFlowregionbreak *group) { + group->cflowregionbreak = new CFlowregionbreak(group); + group->cobject = group->cflowregionbreak; } +void CFlowregionbreak::onRelease() { + CObject::onRelease(); +} + +// CPPIFY: remove static void sp_flowregionbreak_release(SPObject *object) { - if (reinterpret_cast(flowregionbreak_parent_class)->release) { - reinterpret_cast(flowregionbreak_parent_class)->release(object); - } + ((SPFlowregionbreak*)object)->cflowregionbreak->onRelease(); } +void CFlowregionbreak::onModified(unsigned int flags) { + CObject::onModified(flags); + + if (flags & SP_OBJECT_MODIFIED_FLAG) { + flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + } + flags &= SP_OBJECT_MODIFIED_CASCADE; +} + +// CPPIFY: remove static void sp_flowregionbreak_modified(SPObject *object, guint flags) { - if (reinterpret_cast(flowregionbreak_parent_class)->modified) { - reinterpret_cast(flowregionbreak_parent_class)->modified(object, flags); - } - - if (flags & SP_OBJECT_MODIFIED_FLAG) { - flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; - } - flags &= SP_OBJECT_MODIFIED_CASCADE; + ((SPFlowregionbreak*)object)->cflowregionbreak->onModified(flags); } -static Inkscape::XML::Node *sp_flowregionbreak_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowregionbreak::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -719,13 +861,17 @@ static Inkscape::XML::Node *sp_flowregionbreak_write(SPObject *object, Inkscape: } else { } - if (reinterpret_cast(flowregionbreak_parent_class)->write) { - reinterpret_cast(flowregionbreak_parent_class)->write(object, xml_doc, repr, flags); - } + CObject::onWrite(xml_doc, repr, flags); return repr; } +// CPPIFY: remove +static Inkscape::XML::Node *sp_flowregionbreak_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +{ + return ((SPFlowregionbreak*)object)->cflowregionbreak->onWrite(xml_doc, repr, flags); +} + /* Local Variables: mode:c++ -- 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-flowdiv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 976746770..556abfdf0 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -86,7 +86,7 @@ static void sp_flowdiv_class_init(SPFlowdivClass *klass) flowdiv_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); - sp_object_class->build = sp_flowdiv_build; + //sp_object_class->build = sp_flowdiv_build; sp_object_class->set = sp_flowdiv_set; sp_object_class->release = sp_flowdiv_release; sp_object_class->write = sp_flowdiv_write; @@ -297,7 +297,7 @@ static void sp_flowtspan_class_init(SPFlowtspanClass *klass) flowtspan_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); - sp_object_class->build = sp_flowtspan_build; + //sp_object_class->build = sp_flowtspan_build; sp_object_class->set = sp_flowtspan_set; sp_object_class->release = sp_flowtspan_release; sp_object_class->write = sp_flowtspan_write; @@ -508,7 +508,7 @@ static void sp_flowpara_class_init(SPFlowparaClass *klass) flowpara_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); - sp_object_class->build = sp_flowpara_build; + //sp_object_class->build = sp_flowpara_build; sp_object_class->set = sp_flowpara_set; sp_object_class->release = sp_flowpara_release; sp_object_class->write = sp_flowpara_write; -- 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-flowdiv.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 556abfdf0..ca1e1db3c 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -87,11 +87,11 @@ static void sp_flowdiv_class_init(SPFlowdivClass *klass) flowdiv_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); //sp_object_class->build = sp_flowdiv_build; - sp_object_class->set = sp_flowdiv_set; - sp_object_class->release = sp_flowdiv_release; - sp_object_class->write = sp_flowdiv_write; - sp_object_class->update = sp_flowdiv_update; - sp_object_class->modified = sp_flowdiv_modified; +// sp_object_class->set = sp_flowdiv_set; +// sp_object_class->release = sp_flowdiv_release; +// sp_object_class->write = sp_flowdiv_write; +// sp_object_class->update = sp_flowdiv_update; +// sp_object_class->modified = sp_flowdiv_modified; } CFlowdiv::CFlowdiv(SPFlowdiv* flowdiv) : CItem(flowdiv) { @@ -298,11 +298,11 @@ static void sp_flowtspan_class_init(SPFlowtspanClass *klass) flowtspan_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); //sp_object_class->build = sp_flowtspan_build; - sp_object_class->set = sp_flowtspan_set; - sp_object_class->release = sp_flowtspan_release; - sp_object_class->write = sp_flowtspan_write; - sp_object_class->update = sp_flowtspan_update; - sp_object_class->modified = sp_flowtspan_modified; +// sp_object_class->set = sp_flowtspan_set; +// sp_object_class->release = sp_flowtspan_release; +// sp_object_class->write = sp_flowtspan_write; +// sp_object_class->update = sp_flowtspan_update; +// sp_object_class->modified = sp_flowtspan_modified; } CFlowtspan::CFlowtspan(SPFlowtspan* flowtspan) : CItem(flowtspan) { @@ -509,11 +509,11 @@ static void sp_flowpara_class_init(SPFlowparaClass *klass) flowpara_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_ITEM)); //sp_object_class->build = sp_flowpara_build; - sp_object_class->set = sp_flowpara_set; - sp_object_class->release = sp_flowpara_release; - sp_object_class->write = sp_flowpara_write; - sp_object_class->update = sp_flowpara_update; - sp_object_class->modified = sp_flowpara_modified; +// sp_object_class->set = sp_flowpara_set; +// sp_object_class->release = sp_flowpara_release; +// sp_object_class->write = sp_flowpara_write; +// sp_object_class->update = sp_flowpara_update; +// sp_object_class->modified = sp_flowpara_modified; } CFlowpara::CFlowpara(SPFlowpara* flowpara) : CItem(flowpara) { @@ -715,9 +715,9 @@ static void sp_flowline_class_init(SPFlowlineClass *klass) flowline_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_OBJECT)); - sp_object_class->release = sp_flowline_release; - sp_object_class->write = sp_flowline_write; - sp_object_class->modified = sp_flowline_modified; +// sp_object_class->release = sp_flowline_release; +// sp_object_class->write = sp_flowline_write; +// sp_object_class->modified = sp_flowline_modified; } CFlowline::CFlowline(SPFlowline* flowline) : CObject(flowline) { @@ -809,9 +809,9 @@ static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass) flowregionbreak_parent_class = reinterpret_cast(g_type_class_ref(SP_TYPE_OBJECT)); - sp_object_class->release = sp_flowregionbreak_release; - sp_object_class->write = sp_flowregionbreak_write; - sp_object_class->modified = sp_flowregionbreak_modified; +// sp_object_class->release = sp_flowregionbreak_release; +// sp_object_class->write = sp_flowregionbreak_write; +// sp_object_class->modified = sp_flowregionbreak_modified; } CFlowregionbreak::CFlowregionbreak(SPFlowregionbreak* flowregionbreak) : CObject(flowregionbreak) { -- 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-flowdiv.cpp | 96 +++++++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 93bc4f1ec..90c0e8795 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -42,17 +42,17 @@ static void sp_flowdiv_init(SPFlowdiv *group) group->cobject = group->cflowdiv; } -void CFlowdiv::onRelease() { - CItem::onRelease(); +void CFlowdiv::release() { + CItem::release(); } -void CFlowdiv::onUpdate(SPCtx *ctx, unsigned int flags) { +void CFlowdiv::update(SPCtx *ctx, unsigned int flags) { SPFlowdiv* object = this->spflowdiv; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::onUpdate(ctx, flags); + CItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -82,10 +82,10 @@ void CFlowdiv::onUpdate(SPCtx *ctx, unsigned int flags) { } } -void CFlowdiv::onModified(unsigned int flags) { +void CFlowdiv::modified(unsigned int flags) { SPFlowdiv* object = this->spflowdiv; - CItem::onModified(flags); + CItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -109,20 +109,20 @@ void CFlowdiv::onModified(unsigned int flags) { } -void CFlowdiv::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) { +void CFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) { SPFlowdiv* object = this->spflowdiv; object->_requireSVGVersion(Inkscape::Version(1, 2)); - CItem::onBuild(doc, repr); + CItem::build(doc, repr); } -void CFlowdiv::onSet(unsigned int key, const gchar* value) { - CItem::onSet(key, value); +void CFlowdiv::set(unsigned int key, const gchar* value) { + CItem::set(key, value); } -Inkscape::XML::Node* CFlowdiv::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { +Inkscape::XML::Node* CFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowdiv* object = this->spflowdiv; if ( flags & SP_OBJECT_WRITE_BUILD ) { @@ -160,7 +160,7 @@ Inkscape::XML::Node* CFlowdiv::onWrite(Inkscape::XML::Document *xml_doc, Inkscap } } - CItem::onWrite(xml_doc, repr, flags); + CItem::write(xml_doc, repr, flags); return repr; } @@ -191,17 +191,17 @@ static void sp_flowtspan_init(SPFlowtspan *group) group->cobject = group->cflowtspan; } -void CFlowtspan::onRelease() { - CItem::onRelease(); +void CFlowtspan::release() { + CItem::release(); } -void CFlowtspan::onUpdate(SPCtx *ctx, unsigned int flags) { +void CFlowtspan::update(SPCtx *ctx, unsigned int flags) { SPFlowtspan* object = this->spflowtspan; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::onUpdate(ctx, flags); + CItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -231,10 +231,10 @@ void CFlowtspan::onUpdate(SPCtx *ctx, unsigned int flags) { } } -void CFlowtspan::onModified(unsigned int flags) { +void CFlowtspan::modified(unsigned int flags) { SPFlowtspan* object = this->spflowtspan; - CItem::onModified(flags); + CItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -258,16 +258,16 @@ void CFlowtspan::onModified(unsigned int flags) { } -void CFlowtspan::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) +void CFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) { - CItem::onBuild(doc, repr); + CItem::build(doc, repr); } -void CFlowtspan::onSet(unsigned int key, const gchar* value) { - CItem::onSet(key, value); +void CFlowtspan::set(unsigned int key, const gchar* value) { + CItem::set(key, value); } -Inkscape::XML::Node *CFlowtspan::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowtspan* object = this->spflowtspan; @@ -306,7 +306,7 @@ Inkscape::XML::Node *CFlowtspan::onWrite(Inkscape::XML::Document *xml_doc, Inksc } } - CItem::onWrite(xml_doc, repr, flags); + CItem::write(xml_doc, repr, flags); return repr; } @@ -339,19 +339,19 @@ static void sp_flowpara_init (SPFlowpara *group) group->cobject = group->cflowpara; } -void CFlowpara::onRelease() { - CItem::onRelease(); +void CFlowpara::release() { + CItem::release(); } -void CFlowpara::onUpdate(SPCtx *ctx, unsigned int flags) +void CFlowpara::update(SPCtx *ctx, unsigned int flags) { SPFlowpara* object = this->spflowpara; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::onUpdate(ctx, flags); + CItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -381,10 +381,10 @@ void CFlowpara::onUpdate(SPCtx *ctx, unsigned int flags) } } -void CFlowpara::onModified(unsigned int flags) { +void CFlowpara::modified(unsigned int flags) { SPFlowpara* object = this->spflowpara; - CItem::onModified(flags); + CItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -408,16 +408,16 @@ void CFlowpara::onModified(unsigned int flags) { } -void CFlowpara::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) +void CFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) { - CItem::onBuild(doc, repr); + CItem::build(doc, repr); } -void CFlowpara::onSet(unsigned int key, const gchar* value) { - CItem::onSet(key, value); +void CFlowpara::set(unsigned int key, const gchar* value) { + CItem::set(key, value); } -Inkscape::XML::Node *CFlowpara::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowpara* object = this->spflowpara; @@ -454,7 +454,7 @@ Inkscape::XML::Node *CFlowpara::onWrite(Inkscape::XML::Document *xml_doc, Inksca } } - CItem::onWrite(xml_doc, repr, flags); + CItem::write(xml_doc, repr, flags); return repr; } @@ -484,13 +484,13 @@ static void sp_flowline_init(SPFlowline *group) group->cobject = group->cflowline; } -void CFlowline::onRelease() { - CObject::onRelease(); +void CFlowline::release() { + CObject::release(); } -void CFlowline::onModified(unsigned int flags) { - CObject::onModified(flags); +void CFlowline::modified(unsigned int flags) { + CObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -498,7 +498,7 @@ void CFlowline::onModified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *CFlowline::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -507,7 +507,7 @@ Inkscape::XML::Node *CFlowline::onWrite(Inkscape::XML::Document *xml_doc, Inksca } else { } - CObject::onWrite(xml_doc, repr, flags); + CObject::write(xml_doc, repr, flags); return repr; } @@ -537,12 +537,12 @@ static void sp_flowregionbreak_init(SPFlowregionbreak *group) group->cobject = group->cflowregionbreak; } -void CFlowregionbreak::onRelease() { - CObject::onRelease(); +void CFlowregionbreak::release() { + CObject::release(); } -void CFlowregionbreak::onModified(unsigned int flags) { - CObject::onModified(flags); +void CFlowregionbreak::modified(unsigned int flags) { + CObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -550,7 +550,7 @@ void CFlowregionbreak::onModified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *CFlowregionbreak::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *CFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -559,7 +559,7 @@ Inkscape::XML::Node *CFlowregionbreak::onWrite(Inkscape::XML::Document *xml_doc, } else { } - 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-flowdiv.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 90c0e8795..ee387e88f 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -36,6 +36,7 @@ CFlowdiv::~CFlowdiv() { static void sp_flowdiv_init(SPFlowdiv *group) { group->cflowdiv = new CFlowdiv(group); + group->typeHierarchy.insert(typeid(SPFlowdiv)); delete group->citem; group->citem = group->cflowdiv; @@ -185,6 +186,7 @@ CFlowtspan::~CFlowtspan() { static void sp_flowtspan_init(SPFlowtspan *group) { group->cflowtspan = new CFlowtspan(group); + group->typeHierarchy.insert(typeid(SPFlowtspan)); delete group->citem; group->citem = group->cflowtspan; @@ -333,6 +335,7 @@ CFlowpara::~CFlowpara() { static void sp_flowpara_init (SPFlowpara *group) { group->cflowpara = new CFlowpara(group); + group->typeHierarchy.insert(typeid(SPFlowpara)); delete group->citem; group->citem = group->cflowpara; @@ -479,6 +482,7 @@ CFlowline::~CFlowline() { static void sp_flowline_init(SPFlowline *group) { group->cflowline = new CFlowline(group); + group->typeHierarchy.insert(typeid(SPFlowline)); delete group->cobject; group->cobject = group->cflowline; @@ -532,6 +536,7 @@ CFlowregionbreak::~CFlowregionbreak() { static void sp_flowregionbreak_init(SPFlowregionbreak *group) { group->cflowregionbreak = new CFlowregionbreak(group); + group->typeHierarchy.insert(typeid(SPFlowregionbreak)); delete group->cobject; group->cobject = group->cflowregionbreak; -- cgit v1.2.3 From 7eb077e4097aed62c11e5b4e97ff4b16039e73fa Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Mon, 1 Apr 2013 23:04:54 +0200 Subject: Replaced calls to g_object_(un)ref with sp_object_(un)ref. (bzr r11608.1.65) --- src/sp-flowdiv.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index ee387e88f..f9520c8e6 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -62,7 +62,7 @@ void CFlowdiv::update(SPCtx *ctx, unsigned int flags) { GSList* l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse(l); @@ -79,7 +79,7 @@ void CFlowdiv::update(SPCtx *ctx, unsigned int flags) { child->updateDisplay(ctx, flags); } } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } @@ -95,7 +95,7 @@ void CFlowdiv::modified(unsigned int flags) { GSList *l = NULL; for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse (l); @@ -105,7 +105,7 @@ void CFlowdiv::modified(unsigned int flags) { if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } @@ -212,7 +212,7 @@ void CFlowtspan::update(SPCtx *ctx, unsigned int flags) { GSList* l = NULL; for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse (l); @@ -229,7 +229,7 @@ void CFlowtspan::update(SPCtx *ctx, unsigned int flags) { child->updateDisplay(ctx, flags); } } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } @@ -245,7 +245,7 @@ void CFlowtspan::modified(unsigned int flags) { GSList *l = NULL; for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse (l); @@ -255,7 +255,7 @@ void CFlowtspan::modified(unsigned int flags) { if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } @@ -363,7 +363,7 @@ void CFlowpara::update(SPCtx *ctx, unsigned int flags) GSList* l = NULL; for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse (l); @@ -380,7 +380,7 @@ void CFlowpara::update(SPCtx *ctx, unsigned int flags) child->updateDisplay(ctx, flags); } } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } @@ -396,7 +396,7 @@ void CFlowpara::modified(unsigned int flags) { GSList *l = NULL; for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - g_object_ref( G_OBJECT(child) ); + sp_object_ref(child); l = g_slist_prepend(l, child); } l = g_slist_reverse (l); @@ -406,7 +406,7 @@ void CFlowpara::modified(unsigned int flags) { if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - g_object_unref( G_OBJECT(child) ); + sp_object_unref(child); } } -- 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-flowdiv.cpp | 60 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index f9520c8e6..329391352 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -20,7 +20,7 @@ static void sp_flowpara_init (SPFlowpara *group); static void sp_flowline_init (SPFlowline *group); static void sp_flowregionbreak_init (SPFlowregionbreak *group); -G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, SP_TYPE_ITEM); +G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, G_TYPE_OBJECT); static void sp_flowdiv_class_init(SPFlowdivClass *klass) { @@ -33,8 +33,9 @@ CFlowdiv::CFlowdiv(SPFlowdiv* flowdiv) : CItem(flowdiv) { CFlowdiv::~CFlowdiv() { } -static void sp_flowdiv_init(SPFlowdiv *group) -{ +SPFlowdiv::SPFlowdiv() : SPItem() { + SPFlowdiv* group = this; + group->cflowdiv = new CFlowdiv(group); group->typeHierarchy.insert(typeid(SPFlowdiv)); @@ -43,6 +44,11 @@ static void sp_flowdiv_init(SPFlowdiv *group) group->cobject = group->cflowdiv; } +static void sp_flowdiv_init(SPFlowdiv *group) +{ + new (group) SPFlowdiv(); +} + void CFlowdiv::release() { CItem::release(); } @@ -170,7 +176,7 @@ Inkscape::XML::Node* CFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape: /* * */ -G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, SP_TYPE_ITEM); +G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, G_TYPE_OBJECT); static void sp_flowtspan_class_init(SPFlowtspanClass *klass) { @@ -183,8 +189,9 @@ CFlowtspan::CFlowtspan(SPFlowtspan* flowtspan) : CItem(flowtspan) { CFlowtspan::~CFlowtspan() { } -static void sp_flowtspan_init(SPFlowtspan *group) -{ +SPFlowtspan::SPFlowtspan() : SPItem() { + SPFlowtspan* group = this; + group->cflowtspan = new CFlowtspan(group); group->typeHierarchy.insert(typeid(SPFlowtspan)); @@ -193,6 +200,11 @@ static void sp_flowtspan_init(SPFlowtspan *group) group->cobject = group->cflowtspan; } +static void sp_flowtspan_init(SPFlowtspan *group) +{ + new (group) SPFlowtspan(); +} + void CFlowtspan::release() { CItem::release(); } @@ -319,7 +331,7 @@ Inkscape::XML::Node *CFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscap /* * */ -G_DEFINE_TYPE(SPFlowpara, sp_flowpara, SP_TYPE_ITEM); +G_DEFINE_TYPE(SPFlowpara, sp_flowpara, G_TYPE_OBJECT); static void sp_flowpara_class_init(SPFlowparaClass *klass) { @@ -332,8 +344,9 @@ CFlowpara::CFlowpara(SPFlowpara* flowpara) : CItem(flowpara) { CFlowpara::~CFlowpara() { } -static void sp_flowpara_init (SPFlowpara *group) -{ +SPFlowpara::SPFlowpara() : SPItem() { + SPFlowpara* group = this; + group->cflowpara = new CFlowpara(group); group->typeHierarchy.insert(typeid(SPFlowpara)); @@ -342,6 +355,11 @@ static void sp_flowpara_init (SPFlowpara *group) group->cobject = group->cflowpara; } +static void sp_flowpara_init (SPFlowpara *group) +{ + new (group) SPFlowpara(); +} + void CFlowpara::release() { CItem::release(); } @@ -466,7 +484,7 @@ Inkscape::XML::Node *CFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape /* * */ -G_DEFINE_TYPE(SPFlowline, sp_flowline, SP_TYPE_OBJECT); +G_DEFINE_TYPE(SPFlowline, sp_flowline, G_TYPE_OBJECT); static void sp_flowline_class_init(SPFlowlineClass *klass) { @@ -479,8 +497,9 @@ CFlowline::CFlowline(SPFlowline* flowline) : CObject(flowline) { CFlowline::~CFlowline() { } -static void sp_flowline_init(SPFlowline *group) -{ +SPFlowline::SPFlowline() : SPObject() { + SPFlowline* group = this; + group->cflowline = new CFlowline(group); group->typeHierarchy.insert(typeid(SPFlowline)); @@ -488,6 +507,11 @@ static void sp_flowline_init(SPFlowline *group) group->cobject = group->cflowline; } +static void sp_flowline_init(SPFlowline *group) +{ + new (group) SPFlowline(); +} + void CFlowline::release() { CObject::release(); } @@ -520,7 +544,7 @@ Inkscape::XML::Node *CFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape /* * */ -G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, SP_TYPE_OBJECT); +G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, G_TYPE_OBJECT); static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass) { @@ -533,8 +557,9 @@ CFlowregionbreak::CFlowregionbreak(SPFlowregionbreak* flowregionbreak) : CObject CFlowregionbreak::~CFlowregionbreak() { } -static void sp_flowregionbreak_init(SPFlowregionbreak *group) -{ +SPFlowregionbreak::SPFlowregionbreak() : SPObject() { + SPFlowregionbreak* group = this; + group->cflowregionbreak = new CFlowregionbreak(group); group->typeHierarchy.insert(typeid(SPFlowregionbreak)); @@ -542,6 +567,11 @@ static void sp_flowregionbreak_init(SPFlowregionbreak *group) group->cobject = group->cflowregionbreak; } +static void sp_flowregionbreak_init(SPFlowregionbreak *group) +{ + new (group) SPFlowregionbreak(); +} + void CFlowregionbreak::release() { CObject::release(); } -- 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-flowdiv.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 329391352..6c8f2c4e2 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -20,6 +20,36 @@ static void sp_flowpara_init (SPFlowpara *group); static void sp_flowline_init (SPFlowline *group); static void sp_flowregionbreak_init (SPFlowregionbreak *group); +#include "sp-factory.h" + +namespace { + SPObject* createFlowdiv() { + return new SPFlowdiv(); + } + + SPObject* createFlowtspan() { + return new SPFlowtspan(); + } + + SPObject* createFlowpara() { + return new SPFlowpara(); + } + + SPObject* createFlowline() { + return new SPFlowline(); + } + + SPObject* createFlowregionbreak() { + return new SPFlowregionbreak(); + } + + bool flowdivRegistered = SPFactory::instance().registerObject("svg:flowDiv", createFlowdiv); + bool flowtspanRegistered = SPFactory::instance().registerObject("svg:flowSpan", createFlowtspan); + bool flowparaRegistered = SPFactory::instance().registerObject("svg:flowPara", createFlowpara); + bool flowlineRegistered = SPFactory::instance().registerObject("svg:flowLine", createFlowline); + bool flowregionbreakRegistered = SPFactory::instance().registerObject("svg:flowRegionBreak", createFlowregionbreak); +} + G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, G_TYPE_OBJECT); static void sp_flowdiv_class_init(SPFlowdivClass *klass) -- cgit v1.2.3 From 61003d31ea058fdf94f4f80c753c3e38426f35e4 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 5 Apr 2013 21:07:38 +0200 Subject: Merged FlowX classes. (bzr r11608.1.79) --- src/sp-flowdiv.cpp | 220 ++++++++++++++--------------------------------------- 1 file changed, 57 insertions(+), 163 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 6c8f2c4e2..d99657bed 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -14,12 +14,6 @@ #include "sp-string.h" #include "document.h" -static void sp_flowdiv_init (SPFlowdiv *group); -static void sp_flowtspan_init (SPFlowtspan *group); -static void sp_flowpara_init (SPFlowpara *group); -static void sp_flowline_init (SPFlowline *group); -static void sp_flowregionbreak_init (SPFlowregionbreak *group); - #include "sp-factory.h" namespace { @@ -50,42 +44,21 @@ namespace { bool flowregionbreakRegistered = SPFactory::instance().registerObject("svg:flowRegionBreak", createFlowregionbreak); } -G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, G_TYPE_OBJECT); - -static void sp_flowdiv_class_init(SPFlowdivClass *klass) -{ -} - -CFlowdiv::CFlowdiv(SPFlowdiv* flowdiv) : CItem(flowdiv) { - this->spflowdiv = flowdiv; -} - -CFlowdiv::~CFlowdiv() { +SPFlowdiv::SPFlowdiv() : SPItem(), CItem(this) { + delete this->citem; + this->citem = this; + this->cobject = this; } -SPFlowdiv::SPFlowdiv() : SPItem() { - SPFlowdiv* group = this; - - group->cflowdiv = new CFlowdiv(group); - group->typeHierarchy.insert(typeid(SPFlowdiv)); - - delete group->citem; - group->citem = group->cflowdiv; - group->cobject = group->cflowdiv; +SPFlowdiv::~SPFlowdiv() { } -static void sp_flowdiv_init(SPFlowdiv *group) -{ - new (group) SPFlowdiv(); -} - -void CFlowdiv::release() { +void SPFlowdiv::release() { CItem::release(); } - -void CFlowdiv::update(SPCtx *ctx, unsigned int flags) { - SPFlowdiv* object = this->spflowdiv; +void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { + SPFlowdiv* object = this; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -119,8 +92,8 @@ void CFlowdiv::update(SPCtx *ctx, unsigned int flags) { } } -void CFlowdiv::modified(unsigned int flags) { - SPFlowdiv* object = this->spflowdiv; +void SPFlowdiv::modified(unsigned int flags) { + SPFlowdiv* object = this; CItem::modified(flags); @@ -146,21 +119,21 @@ void CFlowdiv::modified(unsigned int flags) { } -void CFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) { - SPFlowdiv* object = this->spflowdiv; +void SPFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) { + SPFlowdiv* object = this; object->_requireSVGVersion(Inkscape::Version(1, 2)); CItem::build(doc, repr); } -void CFlowdiv::set(unsigned int key, const gchar* value) { +void SPFlowdiv::set(unsigned int key, const gchar* value) { CItem::set(key, value); } -Inkscape::XML::Node* CFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPFlowdiv* object = this->spflowdiv; +Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPFlowdiv* object = this; if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -206,41 +179,22 @@ Inkscape::XML::Node* CFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape: /* * */ -G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, G_TYPE_OBJECT); - -static void sp_flowtspan_class_init(SPFlowtspanClass *klass) -{ -} - -CFlowtspan::CFlowtspan(SPFlowtspan* flowtspan) : CItem(flowtspan) { - this->spflowtspan = flowtspan; -} - -CFlowtspan::~CFlowtspan() { -} - -SPFlowtspan::SPFlowtspan() : SPItem() { - SPFlowtspan* group = this; - group->cflowtspan = new CFlowtspan(group); - group->typeHierarchy.insert(typeid(SPFlowtspan)); - - delete group->citem; - group->citem = group->cflowtspan; - group->cobject = group->cflowtspan; +SPFlowtspan::SPFlowtspan() : SPItem(), CItem(this) { + delete this->citem; + this->citem = this; + this->cobject = this; } -static void sp_flowtspan_init(SPFlowtspan *group) -{ - new (group) SPFlowtspan(); +SPFlowtspan::~SPFlowtspan() { } -void CFlowtspan::release() { +void SPFlowtspan::release() { CItem::release(); } -void CFlowtspan::update(SPCtx *ctx, unsigned int flags) { - SPFlowtspan* object = this->spflowtspan; +void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { + SPFlowtspan* object = this; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -275,8 +229,8 @@ void CFlowtspan::update(SPCtx *ctx, unsigned int flags) { } } -void CFlowtspan::modified(unsigned int flags) { - SPFlowtspan* object = this->spflowtspan; +void SPFlowtspan::modified(unsigned int flags) { + SPFlowtspan* object = this; CItem::modified(flags); @@ -302,18 +256,18 @@ void CFlowtspan::modified(unsigned int flags) { } -void CFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) +void SPFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) { CItem::build(doc, repr); } -void CFlowtspan::set(unsigned int key, const gchar* value) { +void SPFlowtspan::set(unsigned int key, const gchar* value) { CItem::set(key, value); } -Inkscape::XML::Node *CFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPFlowtspan* object = this->spflowtspan; + SPFlowtspan* object = this; if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -361,43 +315,22 @@ Inkscape::XML::Node *CFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscap /* * */ -G_DEFINE_TYPE(SPFlowpara, sp_flowpara, G_TYPE_OBJECT); - -static void sp_flowpara_class_init(SPFlowparaClass *klass) -{ -} - -CFlowpara::CFlowpara(SPFlowpara* flowpara) : CItem(flowpara) { - this->spflowpara = flowpara; -} - -CFlowpara::~CFlowpara() { +SPFlowpara::SPFlowpara() : SPItem(), CItem(this) { + delete this->citem; + this->citem = this; + this->cobject = this; } -SPFlowpara::SPFlowpara() : SPItem() { - SPFlowpara* group = this; - - group->cflowpara = new CFlowpara(group); - group->typeHierarchy.insert(typeid(SPFlowpara)); - - delete group->citem; - group->citem = group->cflowpara; - group->cobject = group->cflowpara; +SPFlowpara::~SPFlowpara() { } -static void sp_flowpara_init (SPFlowpara *group) -{ - new (group) SPFlowpara(); -} - -void CFlowpara::release() { +void SPFlowpara::release() { CItem::release(); } - -void CFlowpara::update(SPCtx *ctx, unsigned int flags) +void SPFlowpara::update(SPCtx *ctx, unsigned int flags) { - SPFlowpara* object = this->spflowpara; + SPFlowpara* object = this; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -432,8 +365,8 @@ void CFlowpara::update(SPCtx *ctx, unsigned int flags) } } -void CFlowpara::modified(unsigned int flags) { - SPFlowpara* object = this->spflowpara; +void SPFlowpara::modified(unsigned int flags) { + SPFlowpara* object = this; CItem::modified(flags); @@ -459,18 +392,18 @@ void CFlowpara::modified(unsigned int flags) { } -void CFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) +void SPFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) { CItem::build(doc, repr); } -void CFlowpara::set(unsigned int key, const gchar* value) { +void SPFlowpara::set(unsigned int key, const gchar* value) { CItem::set(key, value); } -Inkscape::XML::Node *CFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPFlowpara* object = this->spflowpara; + SPFlowpara* object = this; if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara"); @@ -514,40 +447,20 @@ Inkscape::XML::Node *CFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape /* * */ -G_DEFINE_TYPE(SPFlowline, sp_flowline, G_TYPE_OBJECT); - -static void sp_flowline_class_init(SPFlowlineClass *klass) -{ -} - -CFlowline::CFlowline(SPFlowline* flowline) : CObject(flowline) { - this->spflowline = flowline; -} - -CFlowline::~CFlowline() { -} -SPFlowline::SPFlowline() : SPObject() { - SPFlowline* group = this; - - group->cflowline = new CFlowline(group); - group->typeHierarchy.insert(typeid(SPFlowline)); - - delete group->cobject; - group->cobject = group->cflowline; +SPFlowline::SPFlowline() : SPObject(), CObject(this) { + delete this->cobject; + this->cobject = this; } -static void sp_flowline_init(SPFlowline *group) -{ - new (group) SPFlowline(); +SPFlowline::~SPFlowline() { } -void CFlowline::release() { +void SPFlowline::release() { CObject::release(); } - -void CFlowline::modified(unsigned int flags) { +void SPFlowline::modified(unsigned int flags) { CObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { @@ -556,7 +469,7 @@ void CFlowline::modified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *CFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { @@ -574,39 +487,20 @@ Inkscape::XML::Node *CFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape /* * */ -G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, G_TYPE_OBJECT); - -static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass) -{ -} -CFlowregionbreak::CFlowregionbreak(SPFlowregionbreak* flowregionbreak) : CObject(flowregionbreak) { - this->spflowregionbreak = flowregionbreak; +SPFlowregionbreak::SPFlowregionbreak() : SPObject(), CObject(this) { + delete this->cobject; + this->cobject = this; } -CFlowregionbreak::~CFlowregionbreak() { -} - -SPFlowregionbreak::SPFlowregionbreak() : SPObject() { - SPFlowregionbreak* group = this; - - group->cflowregionbreak = new CFlowregionbreak(group); - group->typeHierarchy.insert(typeid(SPFlowregionbreak)); - - delete group->cobject; - group->cobject = group->cflowregionbreak; -} - -static void sp_flowregionbreak_init(SPFlowregionbreak *group) -{ - new (group) SPFlowregionbreak(); +SPFlowregionbreak::~SPFlowregionbreak() { } -void CFlowregionbreak::release() { +void SPFlowregionbreak::release() { CObject::release(); } -void CFlowregionbreak::modified(unsigned int flags) { +void SPFlowregionbreak::modified(unsigned int flags) { CObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { @@ -615,7 +509,7 @@ void CFlowregionbreak::modified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *CFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { -- 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-flowdiv.cpp | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index d99657bed..1052b4a64 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -44,9 +44,7 @@ namespace { bool flowregionbreakRegistered = SPFactory::instance().registerObject("svg:flowRegionBreak", createFlowregionbreak); } -SPFlowdiv::SPFlowdiv() : SPItem(), CItem(this) { - delete this->citem; - this->citem = this; +SPFlowdiv::SPFlowdiv() : SPItem() { this->cobject = this; } @@ -54,7 +52,7 @@ SPFlowdiv::~SPFlowdiv() { } void SPFlowdiv::release() { - CItem::release(); + SPItem::release(); } void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { @@ -62,7 +60,7 @@ void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::update(ctx, flags); + SPItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -95,7 +93,7 @@ void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { void SPFlowdiv::modified(unsigned int flags) { SPFlowdiv* object = this; - CItem::modified(flags); + SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -124,11 +122,11 @@ void SPFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) { object->_requireSVGVersion(Inkscape::Version(1, 2)); - CItem::build(doc, repr); + SPItem::build(doc, repr); } void SPFlowdiv::set(unsigned int key, const gchar* value) { - CItem::set(key, value); + SPItem::set(key, value); } @@ -170,7 +168,7 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape } } - CItem::write(xml_doc, repr, flags); + SPItem::write(xml_doc, repr, flags); return repr; } @@ -180,9 +178,7 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape * */ -SPFlowtspan::SPFlowtspan() : SPItem(), CItem(this) { - delete this->citem; - this->citem = this; +SPFlowtspan::SPFlowtspan() : SPItem() { this->cobject = this; } @@ -190,7 +186,7 @@ SPFlowtspan::~SPFlowtspan() { } void SPFlowtspan::release() { - CItem::release(); + SPItem::release(); } void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { @@ -199,7 +195,7 @@ void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::update(ctx, flags); + SPItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -232,7 +228,7 @@ void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { void SPFlowtspan::modified(unsigned int flags) { SPFlowtspan* object = this; - CItem::modified(flags); + SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -258,11 +254,11 @@ void SPFlowtspan::modified(unsigned int flags) { void SPFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) { - CItem::build(doc, repr); + SPItem::build(doc, repr); } void SPFlowtspan::set(unsigned int key, const gchar* value) { - CItem::set(key, value); + SPItem::set(key, value); } Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) @@ -304,7 +300,7 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca } } - CItem::write(xml_doc, repr, flags); + SPItem::write(xml_doc, repr, flags); return repr; } @@ -315,9 +311,7 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca /* * */ -SPFlowpara::SPFlowpara() : SPItem(), CItem(this) { - delete this->citem; - this->citem = this; +SPFlowpara::SPFlowpara() : SPItem() { this->cobject = this; } @@ -325,7 +319,7 @@ SPFlowpara::~SPFlowpara() { } void SPFlowpara::release() { - CItem::release(); + SPItem::release(); } void SPFlowpara::update(SPCtx *ctx, unsigned int flags) @@ -335,7 +329,7 @@ void SPFlowpara::update(SPCtx *ctx, unsigned int flags) SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; - CItem::update(ctx, flags); + SPItem::update(ctx, flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -368,7 +362,7 @@ void SPFlowpara::update(SPCtx *ctx, unsigned int flags) void SPFlowpara::modified(unsigned int flags) { SPFlowpara* object = this; - CItem::modified(flags); + SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -394,11 +388,11 @@ void SPFlowpara::modified(unsigned int flags) { void SPFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) { - CItem::build(doc, repr); + SPItem::build(doc, repr); } void SPFlowpara::set(unsigned int key, const gchar* value) { - CItem::set(key, value); + SPItem::set(key, value); } Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) @@ -438,7 +432,7 @@ Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscap } } - CItem::write(xml_doc, repr, flags); + SPItem::write(xml_doc, repr, flags); return 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-flowdiv.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 1052b4a64..13233748d 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -45,7 +45,6 @@ namespace { } SPFlowdiv::SPFlowdiv() : SPItem() { - this->cobject = this; } SPFlowdiv::~SPFlowdiv() { @@ -179,7 +178,6 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape */ SPFlowtspan::SPFlowtspan() : SPItem() { - this->cobject = this; } SPFlowtspan::~SPFlowtspan() { @@ -312,7 +310,6 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca * */ SPFlowpara::SPFlowpara() : SPItem() { - this->cobject = this; } SPFlowpara::~SPFlowpara() { @@ -442,20 +439,18 @@ Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscap * */ -SPFlowline::SPFlowline() : SPObject(), CObject(this) { - delete this->cobject; - this->cobject = this; +SPFlowline::SPFlowline() : SPObject() { } SPFlowline::~SPFlowline() { } void SPFlowline::release() { - CObject::release(); + SPObject::release(); } void SPFlowline::modified(unsigned int flags) { - CObject::modified(flags); + SPObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -472,7 +467,7 @@ Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscap } else { } - CObject::write(xml_doc, repr, flags); + SPObject::write(xml_doc, repr, flags); return repr; } @@ -482,20 +477,18 @@ Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscap * */ -SPFlowregionbreak::SPFlowregionbreak() : SPObject(), CObject(this) { - delete this->cobject; - this->cobject = this; +SPFlowregionbreak::SPFlowregionbreak() : SPObject() { } SPFlowregionbreak::~SPFlowregionbreak() { } void SPFlowregionbreak::release() { - CObject::release(); + SPObject::release(); } void SPFlowregionbreak::modified(unsigned int flags) { - CObject::modified(flags); + SPObject::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; @@ -512,7 +505,7 @@ Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, } else { } - CObject::write(xml_doc, repr, flags); + SPObject::write(xml_doc, repr, flags); return repr; } -- cgit v1.2.3 From 49c324545e713c1ca375b7e559418e02ebe52945 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Thu, 1 Aug 2013 01:06:31 +0200 Subject: Replacement of unnecessary variables. (bzr r11608.1.114) --- src/sp-flowdiv.cpp | 125 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 55 deletions(-) (limited to 'src/sp-flowdiv.cpp') diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 13233748d..867e68441 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -6,10 +6,6 @@ #endif #include "xml/repr.h" -//#include "svg/svg.h" - -//#include "style.h" - #include "sp-flowdiv.h" #include "sp-string.h" #include "document.h" @@ -55,7 +51,6 @@ void SPFlowdiv::release() { } void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { - SPFlowdiv* object = this; SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -64,17 +59,21 @@ void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for (SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse(l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { if (SP_IS_ITEM(child)) { SPItem const &chi = *SP_ITEM(child); @@ -85,41 +84,43 @@ void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) { child->updateDisplay(ctx, flags); } } + sp_object_unref(child); } } void SPFlowdiv::modified(unsigned int flags) { - SPFlowdiv* object = this; - SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList *l = NULL; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse (l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } + sp_object_unref(child); } } void SPFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) { - SPFlowdiv* object = this; - - object->_requireSVGVersion(Inkscape::Version(1, 2)); + this->_requireSVGVersion(Inkscape::Version(1, 2)); SPItem::build(doc, repr); } @@ -130,15 +131,16 @@ void SPFlowdiv::set(unsigned int key, const gchar* value) { Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPFlowdiv* object = this; - if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowDiv"); } + GSList *l = NULL; - for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) { + + for (SPObject* child = this->firstChild() ; child ; child = child->getNext() ) { Inkscape::XML::Node* c_repr = NULL; + if ( SP_IS_FLOWTSPAN (child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -146,17 +148,19 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } + if ( c_repr ) { l = g_slist_prepend (l, c_repr); } } + while ( l ) { repr->addChild((Inkscape::XML::Node *) l->data, NULL); Inkscape::GC::release((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() ) { if ( SP_IS_FLOWTSPAN (child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -188,8 +192,6 @@ void SPFlowtspan::release() { } void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { - SPFlowtspan* object = this; - SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -198,17 +200,21 @@ void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse (l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { if (SP_IS_ITEM(child)) { SPItem const &chi = *SP_ITEM(child); @@ -219,39 +225,42 @@ void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) { child->updateDisplay(ctx, flags); } } + sp_object_unref(child); } } void SPFlowtspan::modified(unsigned int flags) { - SPFlowtspan* object = this; - SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList *l = NULL; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse (l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } + sp_object_unref(child); } } -void SPFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) -{ +void SPFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) { SPItem::build(doc, repr); } @@ -259,17 +268,17 @@ void SPFlowtspan::set(unsigned int key, const gchar* value) { SPItem::set(key, value); } -Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - SPFlowtspan* object = this; - +Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowSpan"); } + GSList *l = NULL; - for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) { + + for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) { Inkscape::XML::Node* c_repr = NULL; + if ( SP_IS_FLOWTSPAN(child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -277,17 +286,19 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } + if ( c_repr ) { l = g_slist_prepend(l, c_repr); } } + while ( l ) { repr->addChild((Inkscape::XML::Node *) l->data, NULL); Inkscape::GC::release((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() ) { if ( SP_IS_FLOWTSPAN(child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -304,8 +315,6 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca } - - /* * */ @@ -319,10 +328,7 @@ void SPFlowpara::release() { SPItem::release(); } -void SPFlowpara::update(SPCtx *ctx, unsigned int flags) -{ - SPFlowpara* object = this; - +void SPFlowpara::update(SPCtx *ctx, unsigned int flags) { SPItemCtx *ictx = reinterpret_cast(ctx); SPItemCtx cctx = *ictx; @@ -331,17 +337,21 @@ void SPFlowpara::update(SPCtx *ctx, unsigned int flags) if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse (l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { if (SP_IS_ITEM(child)) { SPItem const &chi = *SP_ITEM(child); @@ -352,39 +362,42 @@ void SPFlowpara::update(SPCtx *ctx, unsigned int flags) child->updateDisplay(ctx, flags); } } + sp_object_unref(child); } } void SPFlowpara::modified(unsigned int flags) { - SPFlowpara* object = this; - SPItem::modified(flags); if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; GSList *l = NULL; - for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { + for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { sp_object_ref(child); l = g_slist_prepend(l, child); } + l = g_slist_reverse (l); + while (l) { SPObject *child = SP_OBJECT(l->data); l = g_slist_remove(l, child); + if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } + sp_object_unref(child); } } -void SPFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) -{ +void SPFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) { SPItem::build(doc, repr); } @@ -392,15 +405,17 @@ void SPFlowpara::set(unsigned int key, const gchar* value) { SPItem::set(key, value); } -Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - SPFlowpara* object = this; - +Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara"); + if ( repr == NULL ) { + repr = xml_doc->createElement("svg:flowPara"); + } + GSList *l = NULL; - for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) { + + for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) { Inkscape::XML::Node* c_repr = NULL; + if ( SP_IS_FLOWTSPAN(child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -408,17 +423,19 @@ Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscap } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } + if ( c_repr ) { l = g_slist_prepend(l, c_repr); } } + while ( l ) { repr->addChild((Inkscape::XML::Node *) l->data, NULL); Inkscape::GC::release((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() ) { if ( SP_IS_FLOWTSPAN(child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -455,16 +472,15 @@ void SPFlowline::modified(unsigned int flags) { if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ +Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowLine"); } - } else { } SPObject::write(xml_doc, repr, flags); @@ -493,16 +509,15 @@ void SPFlowregionbreak::modified(unsigned int flags) { if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } + flags &= SP_OBJECT_MODIFIED_CASCADE; } -Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ +Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) { repr = xml_doc->createElement("svg:flowLine"); } - } else { } SPObject::write(xml_doc, repr, flags); -- cgit v1.2.3