diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
| commit | a168040d5a452544328a1e6ad35aaac351f94d44 (patch) | |
| tree | fae1ba829f543a473da281bd5fa6e4deabbf6912 /src/sp-flowdiv.cpp | |
| parent | Removed function pointers from SPObject and subclasses. (diff) | |
| parent | Dutch translation update (diff) | |
| download | inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip | |
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/sp-flowdiv.cpp')
| -rw-r--r-- | src/sp-flowdiv.cpp | 337 |
1 files changed, 15 insertions, 322 deletions
diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index ca1e1db3c..93bc4f1ec 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -14,84 +14,16 @@ #include "sp-string.h" #include "document.h" -static void sp_flowdiv_class_init (SPFlowdivClass *klass); static void sp_flowdiv_init (SPFlowdiv *group); -static void sp_flowdiv_release (SPObject *object); -static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags); -static void sp_flowdiv_modified (SPObject *object, guint flags); -static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); -static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value); - -static void sp_flowtspan_class_init (SPFlowtspanClass *klass); static void sp_flowtspan_init (SPFlowtspan *group); -static void sp_flowtspan_release (SPObject *object); -static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags); -static void sp_flowtspan_modified (SPObject *object, guint flags); -static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); -static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value); - -static void sp_flowpara_class_init (SPFlowparaClass *klass); static void sp_flowpara_init (SPFlowpara *group); -static void sp_flowpara_release (SPObject *object); -static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags); -static void sp_flowpara_modified (SPObject *object, guint flags); -static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); -static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value); - -static void sp_flowline_class_init (SPFlowlineClass *klass); -static void sp_flowline_release (SPObject *object); static void sp_flowline_init (SPFlowline *group); -static Inkscape::XML::Node *sp_flowline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowline_modified (SPObject *object, guint flags); - -static void sp_flowregionbreak_class_init (SPFlowregionbreakClass *klass); -static void sp_flowregionbreak_release (SPObject *object); static void sp_flowregionbreak_init (SPFlowregionbreak *group); -static Inkscape::XML::Node *sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowregionbreak_modified (SPObject *object, guint flags); -static SPItemClass * flowdiv_parent_class; -static SPItemClass * flowtspan_parent_class; -static SPItemClass * flowpara_parent_class; -static SPObjectClass * flowline_parent_class; -static SPObjectClass * flowregionbreak_parent_class; - -GType sp_flowdiv_get_type(void) -{ - static GType group_type = 0; - if (!group_type) { - GTypeInfo group_info = { - sizeof (SPFlowdivClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_flowdiv_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPFlowdiv), - 16, /* n_preallocs */ - (GInstanceInitFunc) sp_flowdiv_init, - NULL, /* value_table */ - }; - group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowdiv", &group_info, (GTypeFlags)0); - } - return group_type; -} +G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, SP_TYPE_ITEM); static void sp_flowdiv_class_init(SPFlowdivClass *klass) { - SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass); - - flowdiv_parent_class = reinterpret_cast<SPItemClass *>(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; } CFlowdiv::CFlowdiv(SPFlowdiv* flowdiv) : CItem(flowdiv) { @@ -104,6 +36,8 @@ CFlowdiv::~CFlowdiv() { static void sp_flowdiv_init(SPFlowdiv *group) { group->cflowdiv = new CFlowdiv(group); + + delete group->citem; group->citem = group->cflowdiv; group->cobject = group->cflowdiv; } @@ -112,11 +46,6 @@ void CFlowdiv::onRelease() { CItem::onRelease(); } -// CPPIFY: remove -static void sp_flowdiv_release(SPObject *object) -{ - ((SPFlowdiv*)object)->cflowdiv->onRelease(); -} void CFlowdiv::onUpdate(SPCtx *ctx, unsigned int flags) { SPFlowdiv* object = this->spflowdiv; @@ -153,12 +82,6 @@ void CFlowdiv::onUpdate(SPCtx *ctx, unsigned int flags) { } } -// CPPIFY: remove -static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags) -{ - ((SPFlowdiv*)object)->cflowdiv->onUpdate(ctx, flags); -} - void CFlowdiv::onModified(unsigned int flags) { SPFlowdiv* object = this->spflowdiv; @@ -185,11 +108,6 @@ void CFlowdiv::onModified(unsigned int 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; @@ -199,21 +117,10 @@ void CFlowdiv::onBuild(SPDocument *doc, Inkscape::XML::Node *repr) { CItem::onBuild(doc, repr); } -// CPPIFY: remove -static void sp_flowdiv_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) -{ - ((SPFlowdiv*)object)->cflowdiv->onBuild(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) -{ - ((SPFlowdiv*)object)->cflowdiv->onSet(key, value); -} Inkscape::XML::Node* CFlowdiv::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowdiv* object = this->spflowdiv; @@ -258,51 +165,14 @@ Inkscape::XML::Node* CFlowdiv::onWrite(Inkscape::XML::Document *xml_doc, Inkscap 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); -} - /* * */ - -GType -sp_flowtspan_get_type (void) -{ - static GType group_type = 0; - if (!group_type) { - GTypeInfo group_info = { - sizeof (SPFlowtspanClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_flowtspan_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPFlowtspan), - 16, /* n_preallocs */ - (GInstanceInitFunc) sp_flowtspan_init, - NULL, /* value_table */ - }; - group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowtspan", &group_info, (GTypeFlags)0); - } - return group_type; -} +G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, SP_TYPE_ITEM); static void sp_flowtspan_class_init(SPFlowtspanClass *klass) { - SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass); - - flowtspan_parent_class = reinterpret_cast<SPItemClass *>(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; } CFlowtspan::CFlowtspan(SPFlowtspan* flowtspan) : CItem(flowtspan) { @@ -315,6 +185,8 @@ CFlowtspan::~CFlowtspan() { static void sp_flowtspan_init(SPFlowtspan *group) { group->cflowtspan = new CFlowtspan(group); + + delete group->citem; group->citem = group->cflowtspan; group->cobject = group->cflowtspan; } @@ -323,12 +195,6 @@ void CFlowtspan::onRelease() { CItem::onRelease(); } -// CPPIFY: remove -static void sp_flowtspan_release(SPObject *object) -{ - ((SPFlowtspan*)object)->cflowtspan->onRelease(); -} - void CFlowtspan::onUpdate(SPCtx *ctx, unsigned int flags) { SPFlowtspan* object = this->spflowtspan; @@ -365,12 +231,6 @@ void CFlowtspan::onUpdate(SPCtx *ctx, unsigned int flags) { } } -// CPPIFY: remove -static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags) -{ - ((SPFlowtspan*)object)->cflowtspan->onUpdate(ctx, flags); -} - void CFlowtspan::onModified(unsigned int flags) { SPFlowtspan* object = this->spflowtspan; @@ -397,33 +257,16 @@ void CFlowtspan::onModified(unsigned int 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) -{ - ((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) -{ - ((SPFlowtspan*)object)->cflowtspan->onSet(key, value); -} - Inkscape::XML::Node *CFlowtspan::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowtspan* object = this->spflowtspan; @@ -468,52 +311,16 @@ Inkscape::XML::Node *CFlowtspan::onWrite(Inkscape::XML::Document *xml_doc, Inksc 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); -} /* * */ - -GType -sp_flowpara_get_type (void) -{ - static GType group_type = 0; - if (!group_type) { - GTypeInfo group_info = { - sizeof (SPFlowparaClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_flowpara_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPFlowpara), - 16, /* n_preallocs */ - (GInstanceInitFunc) sp_flowpara_init, - NULL, /* value_table */ - }; - group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowpara", &group_info, (GTypeFlags)0); - } - return group_type; -} +G_DEFINE_TYPE(SPFlowpara, sp_flowpara, SP_TYPE_ITEM); static void sp_flowpara_class_init(SPFlowparaClass *klass) { - SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass); - - flowpara_parent_class = reinterpret_cast<SPItemClass *>(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; } CFlowpara::CFlowpara(SPFlowpara* flowpara) : CItem(flowpara) { @@ -526,6 +333,8 @@ CFlowpara::~CFlowpara() { static void sp_flowpara_init (SPFlowpara *group) { group->cflowpara = new CFlowpara(group); + + delete group->citem; group->citem = group->cflowpara; group->cobject = group->cflowpara; } @@ -534,11 +343,6 @@ void CFlowpara::onRelease() { CItem::onRelease(); } -// CPPIFY: remove -static void sp_flowpara_release(SPObject *object) -{ - ((SPFlowpara*)object)->cflowpara->onRelease(); -} void CFlowpara::onUpdate(SPCtx *ctx, unsigned int flags) { @@ -577,12 +381,6 @@ void CFlowpara::onUpdate(SPCtx *ctx, unsigned int flags) } } -// CPPIFY: remove -static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags) -{ - ((SPFlowpara*)object)->cflowpara->onUpdate(ctx, flags); -} - void CFlowpara::onModified(unsigned int flags) { SPFlowpara* object = this->spflowpara; @@ -609,33 +407,16 @@ void CFlowpara::onModified(unsigned int 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) -{ - ((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) -{ - ((SPFlowpara*)object)->cflowpara->onSet(key, value); -} - Inkscape::XML::Node *CFlowpara::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFlowpara* object = this->spflowpara; @@ -678,46 +459,14 @@ Inkscape::XML::Node *CFlowpara::onWrite(Inkscape::XML::Document *xml_doc, Inksca 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); -} /* * */ - -GType sp_flowline_get_type(void) -{ - static GType group_type = 0; - if (!group_type) { - GTypeInfo group_info = { - sizeof (SPFlowlineClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_flowline_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPFlowline), - 16, /* n_preallocs */ - (GInstanceInitFunc) sp_flowline_init, - NULL, /* value_table */ - }; - group_type = g_type_register_static (SP_TYPE_OBJECT, "SPFlowline", &group_info, (GTypeFlags)0); - } - return group_type; -} +G_DEFINE_TYPE(SPFlowline, sp_flowline, SP_TYPE_OBJECT); static void sp_flowline_class_init(SPFlowlineClass *klass) { - SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass); - - flowline_parent_class = reinterpret_cast<SPObjectClass *>(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; } CFlowline::CFlowline(SPFlowline* flowline) : CObject(flowline) { @@ -730,6 +479,8 @@ CFlowline::~CFlowline() { static void sp_flowline_init(SPFlowline *group) { group->cflowline = new CFlowline(group); + + delete group->cobject; group->cobject = group->cflowline; } @@ -737,11 +488,6 @@ void CFlowline::onRelease() { CObject::onRelease(); } -// CPPIFY: remove -static void sp_flowline_release(SPObject *object) -{ - ((SPFlowline*)object)->cflowline->onRelease(); -} void CFlowline::onModified(unsigned int flags) { CObject::onModified(flags); @@ -752,12 +498,6 @@ void CFlowline::onModified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -// CPPIFY: remove -static void sp_flowline_modified(SPObject *object, guint flags) -{ - ((SPFlowline*)object)->cflowline->onModified(flags); -} - Inkscape::XML::Node *CFlowline::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { @@ -772,46 +512,14 @@ Inkscape::XML::Node *CFlowline::onWrite(Inkscape::XML::Document *xml_doc, Inksca 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); -} /* * */ - -GType sp_flowregionbreak_get_type(void) -{ - static GType group_type = 0; - if (!group_type) { - GTypeInfo group_info = { - sizeof (SPFlowregionbreakClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) sp_flowregionbreak_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (SPFlowregionbreak), - 16, /* n_preallocs */ - (GInstanceInitFunc) sp_flowregionbreak_init, - NULL, /* value_table */ - }; - group_type = g_type_register_static (SP_TYPE_OBJECT, "SPFlowregionbreak", &group_info, (GTypeFlags)0); - } - return group_type; -} +G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, SP_TYPE_OBJECT); static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass) { - SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass); - - flowregionbreak_parent_class = reinterpret_cast<SPObjectClass *>(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; } CFlowregionbreak::CFlowregionbreak(SPFlowregionbreak* flowregionbreak) : CObject(flowregionbreak) { @@ -824,6 +532,8 @@ CFlowregionbreak::~CFlowregionbreak() { static void sp_flowregionbreak_init(SPFlowregionbreak *group) { group->cflowregionbreak = new CFlowregionbreak(group); + + delete group->cobject; group->cobject = group->cflowregionbreak; } @@ -831,12 +541,6 @@ void CFlowregionbreak::onRelease() { CObject::onRelease(); } -// CPPIFY: remove -static void sp_flowregionbreak_release(SPObject *object) -{ - ((SPFlowregionbreak*)object)->cflowregionbreak->onRelease(); -} - void CFlowregionbreak::onModified(unsigned int flags) { CObject::onModified(flags); @@ -846,12 +550,6 @@ void CFlowregionbreak::onModified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; } -// CPPIFY: remove -static void sp_flowregionbreak_modified(SPObject *object, guint flags) -{ - ((SPFlowregionbreak*)object)->cflowregionbreak->onModified(flags); -} - Inkscape::XML::Node *CFlowregionbreak::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { @@ -866,11 +564,6 @@ Inkscape::XML::Node *CFlowregionbreak::onWrite(Inkscape::XML::Document *xml_doc, 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: |
