summaryrefslogtreecommitdiffstats
path: root/src/filters
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-04-06 20:16:05 +0000
committerMarkus Engel <markus.engel@tum.de>2013-04-06 20:16:05 +0000
commit7b7e0294b0c06a8d3ec19b73486a91e12cf67adf (patch)
tree842fb9e8768d87c73b35c0e10f5c69f10c154e09 /src/filters
parentMerged ObjectGroup and subclasses. (diff)
downloadinkscape-7b7e0294b0c06a8d3ec19b73486a91e12cf67adf.tar.gz
inkscape-7b7e0294b0c06a8d3ec19b73486a91e12cf67adf.zip
Merged more classes.
(bzr r11608.1.84)
Diffstat (limited to 'src/filters')
-rw-r--r--src/filters/componenttransfer-funcnode.cpp157
-rw-r--r--src/filters/componenttransfer-funcnode.h43
-rw-r--r--src/filters/distantlight.cpp60
-rw-r--r--src/filters/distantlight.h25
-rw-r--r--src/filters/mergenode.cpp50
-rw-r--r--src/filters/mergenode.h25
-rw-r--r--src/filters/pointlight.cpp61
-rw-r--r--src/filters/pointlight.h26
-rw-r--r--src/filters/spotlight.cpp85
-rw-r--r--src/filters/spotlight.h24
10 files changed, 133 insertions, 423 deletions
diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp
index 2b5e3f99d..26e92bf15 100644
--- a/src/filters/componenttransfer-funcnode.cpp
+++ b/src/filters/componenttransfer-funcnode.cpp
@@ -31,133 +31,20 @@
#include "macros.h"
/* FeFuncNode class */
-
-static void sp_fefuncnode_class_init(SPFeFuncNodeClass *klass);
-static void sp_fefuncnode_init(SPFeFuncNode *fefuncnode);
-
-static SPObjectClass *feFuncNode_parent_class;
-
-GType
-sp_fefuncR_get_type()
-{
- static GType fefuncnode_type = 0;
-
- if (!fefuncnode_type) {
- GTypeInfo fefuncnode_info = {
- sizeof(SPFeFuncNodeClass),
- NULL, NULL,
- 0,//(GClassInitFunc) sp_fefuncnode_class_init,
- NULL, NULL,
- sizeof(SPFeFuncNode),
- 16,
- (GInstanceInitFunc) sp_fefuncnode_init,
- NULL, /* value_table */
- };
- fefuncnode_type = g_type_register_static(G_TYPE_OBJECT, "SPFeFuncR", &fefuncnode_info, (GTypeFlags)0);
- }
- return fefuncnode_type;
-}
-
-GType
-sp_fefuncG_get_type()
-{
- static GType fefuncnode_type = 0;
-
- if (!fefuncnode_type) {
- GTypeInfo fefuncnode_info = {
- sizeof(SPFeFuncNodeClass),
- NULL, NULL,
- 0,//(GClassInitFunc) sp_fefuncnode_class_init,
- NULL, NULL,
- sizeof(SPFeFuncNode),
- 16,
- (GInstanceInitFunc) sp_fefuncnode_init,
- NULL, /* value_table */
- };
- fefuncnode_type = g_type_register_static(G_TYPE_OBJECT, "SPFeFuncG", &fefuncnode_info, (GTypeFlags)0);
- }
- return fefuncnode_type;
-}
-
-GType
-sp_fefuncB_get_type()
-{
- static GType fefuncnode_type = 0;
-
- if (!fefuncnode_type) {
- GTypeInfo fefuncnode_info = {
- sizeof(SPFeFuncNodeClass),
- NULL, NULL,
- 0,//(GClassInitFunc) sp_fefuncnode_class_init,
- NULL, NULL,
- sizeof(SPFeFuncNode),
- 16,
- (GInstanceInitFunc) sp_fefuncnode_init,
- NULL, /* value_table */
- };
- fefuncnode_type = g_type_register_static(G_TYPE_OBJECT, "SPFeFuncB", &fefuncnode_info, (GTypeFlags)0);
- }
- return fefuncnode_type;
-}
-
-GType
-sp_fefuncA_get_type()
-{
- static GType fefuncnode_type = 0;
-
- if (!fefuncnode_type) {
- GTypeInfo fefuncnode_info = {
- sizeof(SPFeFuncNodeClass),
- NULL, NULL,
- 0,//(GClassInitFunc) sp_fefuncnode_class_init,
- NULL, NULL,
- sizeof(SPFeFuncNode),
- 16,
- (GInstanceInitFunc) sp_fefuncnode_init,
- NULL, /* value_table */
- };
- fefuncnode_type = g_type_register_static(G_TYPE_OBJECT, "SPFeFuncA", &fefuncnode_info, (GTypeFlags)0);
- }
- return fefuncnode_type;
-}
-
-static void
-sp_fefuncnode_class_init(SPFeFuncNodeClass *klass)
-{
- SPObjectClass *sp_object_class = (SPObjectClass *)klass;
-
- feFuncNode_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
-}
-
-CFeFuncNode::CFeFuncNode(SPFeFuncNode* funcnode) : CObject(funcnode) {
- this->spfefuncnode = funcnode;
-}
-
-CFeFuncNode::~CFeFuncNode() {
-}
-
-SPFeFuncNode::SPFeFuncNode() : SPObject() {
- SPFeFuncNode* fefuncnode = this;
-
- fefuncnode->cfefuncnode = new CFeFuncNode(fefuncnode);
- fefuncnode->typeHierarchy.insert(typeid(SPFeFuncNode));
-
- delete fefuncnode->cobject;
- fefuncnode->cobject = fefuncnode->cfefuncnode;
-
- fefuncnode->type = Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY;
- //fefuncnode->tableValues = NULL;
- fefuncnode->slope = 1;
- fefuncnode->intercept = 0;
- fefuncnode->amplitude = 1;
- fefuncnode->exponent = 1;
- fefuncnode->offset = 0;
+SPFeFuncNode::SPFeFuncNode() : SPObject(), CObject(this) {
+ delete this->cobject;
+ this->cobject = this;
+
+ this->type = Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY;
+ //this->tableValues = NULL;
+ this->slope = 1;
+ this->intercept = 0;
+ this->amplitude = 1;
+ this->exponent = 1;
+ this->offset = 0;
}
-static void
-sp_fefuncnode_init(SPFeFuncNode *fefuncnode)
-{
- new (fefuncnode) SPFeFuncNode();
+SPFeFuncNode::~SPFeFuncNode() {
}
/**
@@ -165,10 +52,10 @@ sp_fefuncnode_init(SPFeFuncNode *fefuncnode)
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
-void CFeFuncNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
+void SPFeFuncNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
CObject::build(document, repr);
- SPFeFuncNode* object = this->spfefuncnode;
+ SPFeFuncNode* object = this;
//Read values of key attributes from XML nodes into object.
object->readAttr( "type" );
@@ -187,8 +74,8 @@ void CFeFuncNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
/**
* Drops any allocated memory.
*/
-void CFeFuncNode::release() {
- SPFeFuncNode* object = this->spfefuncnode;
+void SPFeFuncNode::release() {
+ SPFeFuncNode* object = this;
//SPFeFuncNode *fefuncnode = SP_FEFUNCNODE(object);
if ( object->document ) {
@@ -224,8 +111,8 @@ static Inkscape::Filters::FilterComponentTransferType sp_feComponenttransfer_rea
/**
* Sets a specific value in the SPFeFuncNode.
*/
-void CFeFuncNode::set(unsigned int key, gchar const *value) {
- SPFeFuncNode* object = this->spfefuncnode;
+void SPFeFuncNode::set(unsigned int key, gchar const *value) {
+ SPFeFuncNode* object = this;
SPFeFuncNode *feFuncNode = SP_FEFUNCNODE(object);
Inkscape::Filters::FilterComponentTransferType type;
@@ -290,8 +177,8 @@ void CFeFuncNode::set(unsigned int key, gchar const *value) {
/**
* * Receives update notifications.
* */
-void CFeFuncNode::update(SPCtx *ctx, guint flags) {
- SPFeFuncNode* object = this->spfefuncnode;
+void SPFeFuncNode::update(SPCtx *ctx, guint flags) {
+ SPFeFuncNode* object = this;
SPFeFuncNode *feFuncNode = SP_FEFUNCNODE(object);
(void)feFuncNode;
@@ -309,8 +196,8 @@ void CFeFuncNode::update(SPCtx *ctx, guint flags) {
/**
* Writes its settings to an incoming repr object, if any.
*/
-Inkscape::XML::Node* CFeFuncNode::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFeFuncNode* object = this->spfefuncnode;
+Inkscape::XML::Node* SPFeFuncNode::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
+ SPFeFuncNode* object = this;
SPFeFuncNode *fefuncnode = SP_FEFUNCNODE(object);
if (!repr) {
diff --git a/src/filters/componenttransfer-funcnode.h b/src/filters/componenttransfer-funcnode.h
index 9e358a923..b23e52324 100644
--- a/src/filters/componenttransfer-funcnode.h
+++ b/src/filters/componenttransfer-funcnode.h
@@ -18,10 +18,10 @@
#include "sp-object.h"
#include "display/nr-filter-component-transfer.h"
-#define SP_TYPE_FEFUNCR (sp_fefuncR_get_type())
-#define SP_TYPE_FEFUNCG (sp_fefuncG_get_type())
-#define SP_TYPE_FEFUNCB (sp_fefuncB_get_type())
-#define SP_TYPE_FEFUNCA (sp_fefuncA_get_type())
+//#define SP_TYPE_FEFUNCR (sp_fefuncR_get_type())
+//#define SP_TYPE_FEFUNCG (sp_fefuncG_get_type())
+//#define SP_TYPE_FEFUNCB (sp_fefuncB_get_type())
+//#define SP_TYPE_FEFUNCA (sp_fefuncA_get_type())
// CPPIFY: Casting macros buggy, as these aren't classes.
//#define SP_IS_FEFUNCR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEFUNCR))
@@ -31,17 +31,20 @@
#define SP_FEFUNCNODE(obj) ((SPFeFuncNode*)obj)
-#define SP_IS_FEFUNCR(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
-#define SP_IS_FEFUNCG(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
-#define SP_IS_FEFUNCB(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
-#define SP_IS_FEFUNCA(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
+//#define SP_IS_FEFUNCR(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
+//#define SP_IS_FEFUNCG(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
+//#define SP_IS_FEFUNCB(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
+//#define SP_IS_FEFUNCA(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode)))
-class CFeFuncNode;
+#define SP_IS_FEFUNCR(obj) (dynamic_cast<const SPFeFuncNode*>((SPObject*)obj))
+#define SP_IS_FEFUNCG(obj) (dynamic_cast<const SPFeFuncNode*>((SPObject*)obj))
+#define SP_IS_FEFUNCB(obj) (dynamic_cast<const SPFeFuncNode*>((SPObject*)obj))
+#define SP_IS_FEFUNCA(obj) (dynamic_cast<const SPFeFuncNode*>((SPObject*)obj))
-class SPFeFuncNode : public SPObject {
+class SPFeFuncNode : public SPObject, public CObject {
public:
SPFeFuncNode();
- CFeFuncNode* cfefuncnode;
+ virtual ~SPFeFuncNode();
Inkscape::Filters::FilterComponentTransferType type;
std::vector<double> tableValues;
@@ -50,12 +53,6 @@ public:
double amplitude;
double exponent;
double offset;
-};
-
-class CFeFuncNode : public CObject {
-public:
- CFeFuncNode(SPFeFuncNode* funcnode);
- virtual ~CFeFuncNode();
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -65,20 +62,8 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- SPFeFuncNode* spfefuncnode;
};
-struct SPFeFuncNodeClass {
- SPObjectClass parent_class;
-};
-
-GType sp_fefuncR_get_type();
-GType sp_fefuncG_get_type();
-GType sp_fefuncB_get_type();
-GType sp_fefuncA_get_type();
-
#endif /* !SP_FECOMPONENTTRANSFER_FUNCNODE_H_SEEN */
/*
diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp
index 541b19cec..4aef86034 100644
--- a/src/filters/distantlight.cpp
+++ b/src/filters/distantlight.cpp
@@ -29,39 +29,17 @@
#define SP_MACROS_SILENT
#include "macros.h"
-G_DEFINE_TYPE(SPFeDistantLight, sp_fedistantlight, G_TYPE_OBJECT);
-
-static void
-sp_fedistantlight_class_init(SPFeDistantLightClass *klass)
-{
-}
-
-CFeDistantLight::CFeDistantLight(SPFeDistantLight* distantlight) : CObject(distantlight) {
- this->spfedistantlight = distantlight;
-}
-
-CFeDistantLight::~CFeDistantLight() {
-}
-
-SPFeDistantLight::SPFeDistantLight() : SPObject() {
- SPFeDistantLight* fedistantlight = this;
-
- fedistantlight->cfedistantlight = new CFeDistantLight(fedistantlight);
- fedistantlight->typeHierarchy.insert(typeid(SPFeDistantLight));
-
- delete fedistantlight->cobject;
- fedistantlight->cobject = fedistantlight->cfedistantlight;
-
- fedistantlight->azimuth = 0;
- fedistantlight->elevation = 0;
- fedistantlight->azimuth_set = FALSE;
- fedistantlight->elevation_set = FALSE;
+SPFeDistantLight::SPFeDistantLight() : SPObject(), CObject(this) {
+ delete this->cobject;
+ this->cobject = this;
+
+ this->azimuth = 0;
+ this->elevation = 0;
+ this->azimuth_set = FALSE;
+ this->elevation_set = FALSE;
}
-static void
-sp_fedistantlight_init(SPFeDistantLight *fedistantlight)
-{
- new (fedistantlight) SPFeDistantLight();
+SPFeDistantLight::~SPFeDistantLight() {
}
/**
@@ -69,10 +47,10 @@ sp_fedistantlight_init(SPFeDistantLight *fedistantlight)
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
-void CFeDistantLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
+void SPFeDistantLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
CObject::build(document, repr);
- SPFeDistantLight* object = this->spfedistantlight;
+ SPFeDistantLight* object = this;
//Read values of key attributes from XML nodes into object.
object->readAttr( "azimuth" );
@@ -85,8 +63,8 @@ void CFeDistantLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
/**
* Drops any allocated memory.
*/
-void CFeDistantLight::release() {
- SPFeDistantLight* object = this->spfedistantlight;
+void SPFeDistantLight::release() {
+ SPFeDistantLight* object = this;
//SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object);
@@ -101,8 +79,8 @@ void CFeDistantLight::release() {
/**
* Sets a specific value in the SPFeDistantLight.
*/
-void CFeDistantLight::set(unsigned int key, gchar const *value) {
- SPFeDistantLight* object = this->spfedistantlight;
+void SPFeDistantLight::set(unsigned int key, gchar const *value) {
+ SPFeDistantLight* object = this;
SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object);
gchar *end_ptr;
switch (key) {
@@ -152,8 +130,8 @@ void CFeDistantLight::set(unsigned int key, gchar const *value) {
/**
* * Receives update notifications.
* */
-void CFeDistantLight::update(SPCtx *ctx, guint flags) {
- SPFeDistantLight* object = this->spfedistantlight;
+void SPFeDistantLight::update(SPCtx *ctx, guint flags) {
+ SPFeDistantLight* object = this;
SPFeDistantLight *feDistantLight = SP_FEDISTANTLIGHT(object);
(void)feDistantLight;
@@ -169,8 +147,8 @@ void CFeDistantLight::update(SPCtx *ctx, guint flags) {
/**
* Writes its settings to an incoming repr object, if any.
*/
-Inkscape::XML::Node* CFeDistantLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFeDistantLight* object = this->spfedistantlight;
+Inkscape::XML::Node* SPFeDistantLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
+ SPFeDistantLight* object = this;
SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object);
if (!repr) {
diff --git a/src/filters/distantlight.h b/src/filters/distantlight.h
index d8d2fae17..21ece336d 100644
--- a/src/filters/distantlight.h
+++ b/src/filters/distantlight.h
@@ -17,18 +17,14 @@
#include "sp-object.h"
-#define SP_TYPE_FEDISTANTLIGHT (sp_fedistantlight_get_type())
#define SP_FEDISTANTLIGHT(obj) ((SPFeDistantLight*)obj)
-#define SP_IS_FEDISTANTLIGHT(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeDistantLight)))
+#define SP_IS_FEDISTANTLIGHT(obj) (dynamic_cast<const SPFeDistantLight*>((SPObject*)obj))
/* Distant light class */
-
-class CFeDistantLight;
-
-class SPFeDistantLight : public SPObject {
+class SPFeDistantLight : public SPObject, public CObject {
public:
SPFeDistantLight();
- CFeDistantLight* cfedistantlight;
+ virtual ~SPFeDistantLight();
/** azimuth attribute */
gfloat azimuth;
@@ -36,12 +32,6 @@ public:
/** elevation attribute */
gfloat elevation;
guint elevation_set : 1;
-};
-
-class CFeDistantLight : public CObject {
-public:
- CFeDistantLight(SPFeDistantLight* distantlight);
- virtual ~CFeDistantLight();
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -51,17 +41,8 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- SPFeDistantLight* spfedistantlight;
-};
-
-struct SPFeDistantLightClass {
- SPObjectClass parent_class;
};
-GType
-sp_fedistantlight_get_type();
#endif /* !SP_FEDISTANTLIGHT_H_SEEN */
/*
diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp
index fbdcc9277..478a9f9a8 100644
--- a/src/filters/mergenode.cpp
+++ b/src/filters/mergenode.cpp
@@ -33,36 +33,14 @@ namespace {
bool mergeNodeRegistered = SPFactory::instance().registerObject("svg:feMergeNode", createMergeNode);
}
-G_DEFINE_TYPE(SPFeMergeNode, sp_feMergeNode, G_TYPE_OBJECT);
+SPFeMergeNode::SPFeMergeNode() : SPObject(), CObject(this) {
+ delete this->cobject;
+ this->cobject = this;
-static void
-sp_feMergeNode_class_init(SPFeMergeNodeClass *klass)
-{
+ this->input = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
}
-CFeMergeNode::CFeMergeNode(SPFeMergeNode* mergenode) : CObject(mergenode) {
- this->spfemergenode = mergenode;
-}
-
-CFeMergeNode::~CFeMergeNode() {
-}
-
-SPFeMergeNode::SPFeMergeNode() : SPObject() {
- SPFeMergeNode* feMergeNode = this;
-
- feMergeNode->cfemergenode = new CFeMergeNode(feMergeNode);
- feMergeNode->typeHierarchy.insert(typeid(SPFeMergeNode));
-
- delete feMergeNode->cobject;
- feMergeNode->cobject = feMergeNode->cfemergenode;
-
- feMergeNode->input = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
-}
-
-static void
-sp_feMergeNode_init(SPFeMergeNode *feMergeNode)
-{
- new (feMergeNode) SPFeMergeNode();
+SPFeMergeNode::~SPFeMergeNode() {
}
/**
@@ -70,23 +48,23 @@ sp_feMergeNode_init(SPFeMergeNode *feMergeNode)
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
-void CFeMergeNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
- SPFeMergeNode* object = this->spfemergenode;
+void SPFeMergeNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
+ SPFeMergeNode* object = this;
object->readAttr( "in" );
}
/**
* Drops any allocated memory.
*/
-void CFeMergeNode::release() {
+void SPFeMergeNode::release() {
CObject::release();
}
/**
* Sets a specific value in the SPFeMergeNode.
*/
-void CFeMergeNode::set(unsigned int key, gchar const *value) {
- SPFeMergeNode* object = this->spfemergenode;
+void SPFeMergeNode::set(unsigned int key, gchar const *value) {
+ SPFeMergeNode* object = this;
SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object);
SPFeMerge *parent = SP_FEMERGE(object->parent);
@@ -105,8 +83,8 @@ void CFeMergeNode::set(unsigned int key, gchar const *value) {
/**
* Receives update notifications.
*/
-void CFeMergeNode::update(SPCtx *ctx, guint flags) {
- SPFeMergeNode* object = this->spfemergenode;
+void SPFeMergeNode::update(SPCtx *ctx, guint flags) {
+ SPFeMergeNode* object = this;
//SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -119,8 +97,8 @@ void CFeMergeNode::update(SPCtx *ctx, guint flags) {
/**
* Writes its settings to an incoming repr object, if any.
*/
-Inkscape::XML::Node* CFeMergeNode::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFeMergeNode* object = this->spfemergenode;
+Inkscape::XML::Node* SPFeMergeNode::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
+ SPFeMergeNode* object = this;
//SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object);
// Inkscape-only object, not copied during an "plain SVG" dump:
diff --git a/src/filters/mergenode.h b/src/filters/mergenode.h
index 758891155..0b533c4c2 100644
--- a/src/filters/mergenode.h
+++ b/src/filters/mergenode.h
@@ -17,24 +17,15 @@
#include "sp-object.h"
-#define SP_TYPE_FEMERGENODE (sp_feMergeNode_get_type())
#define SP_FEMERGENODE(obj) ((SPFeMergeNode*)obj)
-#define SP_IS_FEMERGENODE(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeMergeNode)))
+#define SP_IS_FEMERGENODE(obj) (dynamic_cast<const SPFeMergeNode*>((SPObject*)obj))
-class CFeMergeNode;
-
-class SPFeMergeNode : public SPObject {
+class SPFeMergeNode : public SPObject, public CObject {
public:
SPFeMergeNode();
- CFeMergeNode* cfemergenode;
+ virtual ~SPFeMergeNode();
int input;
-};
-
-class CFeMergeNode : public CObject {
-public:
- CFeMergeNode(SPFeMergeNode* mergenode);
- virtual ~CFeMergeNode();
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -44,18 +35,8 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- SPFeMergeNode* spfemergenode;
};
-struct SPFeMergeNodeClass {
- SPObjectClass parent_class;
-};
-
-GType sp_feMergeNode_get_type();
-
-
#endif /* !SP_FEMERGENODE_H_SEEN */
/*
diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp
index 659727d5f..2e09151ac 100644
--- a/src/filters/pointlight.cpp
+++ b/src/filters/pointlight.cpp
@@ -39,53 +39,32 @@ namespace {
bool pointLightRegistered = SPFactory::instance().registerObject("svg:fePointLight", createPointLight);
}
-G_DEFINE_TYPE(SPFePointLight, sp_fepointlight, G_TYPE_OBJECT);
+SPFePointLight::SPFePointLight() : SPObject(), CObject(this) {
+ delete this->cobject;
+ this->cobject = this;
-static void
-sp_fepointlight_class_init(SPFePointLightClass *klass)
-{
-}
-
-CFePointLight::CFePointLight(SPFePointLight* pointlight) : CObject(pointlight) {
- this->spfepointlight = pointlight;
-}
+ this->x = 0;
+ this->y = 0;
+ this->z = 0;
-CFePointLight::~CFePointLight() {
+ this->x_set = FALSE;
+ this->y_set = FALSE;
+ this->z_set = FALSE;
}
-SPFePointLight::SPFePointLight() : SPObject() {
- SPFePointLight* fepointlight = this;
-
- fepointlight->cfepointlight = new CFePointLight(fepointlight);
- fepointlight->typeHierarchy.insert(typeid(SPFePointLight));
-
- delete fepointlight->cobject;
- fepointlight->cobject = fepointlight->cfepointlight;
-
- fepointlight->x = 0;
- fepointlight->y = 0;
- fepointlight->z = 0;
-
- fepointlight->x_set = FALSE;
- fepointlight->y_set = FALSE;
- fepointlight->z_set = FALSE;
+SPFePointLight::~SPFePointLight() {
}
-static void
-sp_fepointlight_init(SPFePointLight *fepointlight)
-{
- new (fepointlight) SPFePointLight();
-}
/**
* Reads the Inkscape::XML::Node, and initializes SPPointLight variables. For this to get called,
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
-void CFePointLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
+void SPFePointLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
CObject::build(document, repr);
- SPFePointLight* object = this->spfepointlight;
+ SPFePointLight* object = this;
//Read values of key attributes from XML nodes into object.
object->readAttr( "x" );
@@ -99,8 +78,8 @@ void CFePointLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
/**
* Drops any allocated memory.
*/
-void CFePointLight::release() {
- SPFePointLight* object = this->spfepointlight;
+void SPFePointLight::release() {
+ SPFePointLight* object = this;
//SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object);
if ( object->document ) {
@@ -114,8 +93,8 @@ void CFePointLight::release() {
/**
* Sets a specific value in the SPFePointLight.
*/
-void CFePointLight::set(unsigned int key, gchar const *value) {
- SPFePointLight* object = this->spfepointlight;
+void SPFePointLight::set(unsigned int key, gchar const *value) {
+ SPFePointLight* object = this;
SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object);
gchar *end_ptr;
@@ -184,8 +163,8 @@ void CFePointLight::set(unsigned int key, gchar const *value) {
/**
* * Receives update notifications.
* */
-void CFePointLight::update(SPCtx *ctx, guint flags) {
- SPFePointLight* object = this->spfepointlight;
+void SPFePointLight::update(SPCtx *ctx, guint flags) {
+ SPFePointLight* object = this;
SPFePointLight *fePointLight = SP_FEPOINTLIGHT(object);
(void)fePointLight;
@@ -203,8 +182,8 @@ void CFePointLight::update(SPCtx *ctx, guint flags) {
/**
* Writes its settings to an incoming repr object, if any.
*/
-Inkscape::XML::Node* CFePointLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFePointLight* object = this->spfepointlight;
+Inkscape::XML::Node* SPFePointLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
+ SPFePointLight* object = this;
SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object);
if (!repr) {
diff --git a/src/filters/pointlight.h b/src/filters/pointlight.h
index f749722d6..ac065d7fd 100644
--- a/src/filters/pointlight.h
+++ b/src/filters/pointlight.h
@@ -17,16 +17,13 @@
#include "sp-object.h"
-#define SP_TYPE_FEPOINTLIGHT (sp_fepointlight_get_type())
#define SP_FEPOINTLIGHT(obj) ((SPFePointLight*)obj)
-#define SP_IS_FEPOINTLIGHT(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFePointLight)))
+#define SP_IS_FEPOINTLIGHT(obj) (dynamic_cast<const SPFePointLight*>((SPObject*)obj))
-class CFePointLight;
-
-class SPFePointLight : public SPObject {
+class SPFePointLight : public SPObject, public CObject {
public:
SPFePointLight();
- CFePointLight* cfepointlight;
+ virtual ~SPFePointLight();
/** x coordinate of the light source */
gfloat x;
@@ -38,14 +35,6 @@ public:
gfloat z;
guint z_set : 1;
- //other fields
-};
-
-class CFePointLight : public CObject {
-public:
- CFePointLight(SPFePointLight* pointlight);
- virtual ~CFePointLight();
-
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -54,17 +43,8 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- SPFePointLight* spfepointlight;
-};
-
-struct SPFePointLightClass {
- SPObjectClass parent_class;
};
-GType
-sp_fepointlight_get_type();
#endif /* !SP_FEPOINTLIGHT_H_SEEN */
/*
diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp
index 9e89139e3..13a45bbb8 100644
--- a/src/filters/spotlight.cpp
+++ b/src/filters/spotlight.cpp
@@ -39,63 +39,42 @@ namespace {
bool spotLightRegistered = SPFactory::instance().registerObject("svg:feSpotLight", createSpotLight);
}
-G_DEFINE_TYPE(SPFeSpotLight, sp_fespotlight, G_TYPE_OBJECT);
-
-static void
-sp_fespotlight_class_init(SPFeSpotLightClass *klass)
-{
-}
-
-CFeSpotLight::CFeSpotLight(SPFeSpotLight* spotlight) : CObject(spotlight) {
- this->spfespotlight = spotlight;
+SPFeSpotLight::SPFeSpotLight() : SPObject(), CObject(this) {
+ delete this->cobject;
+ this->cobject = this;
+
+ this->x = 0;
+ this->y = 0;
+ this->z = 0;
+ this->pointsAtX = 0;
+ this->pointsAtY = 0;
+ this->pointsAtZ = 0;
+ this->specularExponent = 1;
+ this->limitingConeAngle = 90;
+
+ this->x_set = FALSE;
+ this->y_set = FALSE;
+ this->z_set = FALSE;
+ this->pointsAtX_set = FALSE;
+ this->pointsAtY_set = FALSE;
+ this->pointsAtZ_set = FALSE;
+ this->specularExponent_set = FALSE;
+ this->limitingConeAngle_set = FALSE;
}
-CFeSpotLight::~CFeSpotLight() {
+SPFeSpotLight::~SPFeSpotLight() {
}
-SPFeSpotLight::SPFeSpotLight() : SPObject() {
- SPFeSpotLight* fespotlight = this;
-
- fespotlight->cfespotlight = new CFeSpotLight(fespotlight);
- fespotlight->typeHierarchy.insert(typeid(SPFeSpotLight));
-
- delete fespotlight->cobject;
- fespotlight->cobject = fespotlight->cfespotlight;
-
- fespotlight->x = 0;
- fespotlight->y = 0;
- fespotlight->z = 0;
- fespotlight->pointsAtX = 0;
- fespotlight->pointsAtY = 0;
- fespotlight->pointsAtZ = 0;
- fespotlight->specularExponent = 1;
- fespotlight->limitingConeAngle = 90;
-
- fespotlight->x_set = FALSE;
- fespotlight->y_set = FALSE;
- fespotlight->z_set = FALSE;
- fespotlight->pointsAtX_set = FALSE;
- fespotlight->pointsAtY_set = FALSE;
- fespotlight->pointsAtZ_set = FALSE;
- fespotlight->specularExponent_set = FALSE;
- fespotlight->limitingConeAngle_set = FALSE;
-}
-
-static void
-sp_fespotlight_init(SPFeSpotLight *fespotlight)
-{
- new (fespotlight) SPFeSpotLight();
-}
/**
* Reads the Inkscape::XML::Node, and initializes SPPointLight variables. For this to get called,
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
-void CFeSpotLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
+void SPFeSpotLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
CObject::build(document, repr);
- SPFeSpotLight* object = this->spfespotlight;
+ SPFeSpotLight* object = this;
//Read values of key attributes from XML nodes into object.
object->readAttr( "x" );
@@ -114,8 +93,8 @@ void CFeSpotLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
/**
* Drops any allocated memory.
*/
-void CFeSpotLight::release() {
- SPFeSpotLight* object = this->spfespotlight;
+void SPFeSpotLight::release() {
+ SPFeSpotLight* object = this;
//SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object);
if ( object->document ) {
@@ -129,8 +108,8 @@ void CFeSpotLight::release() {
/**
* Sets a specific value in the SPFeSpotLight.
*/
-void CFeSpotLight::set(unsigned int key, gchar const *value) {
- SPFeSpotLight* object = this->spfespotlight;
+void SPFeSpotLight::set(unsigned int key, gchar const *value) {
+ SPFeSpotLight* object = this;
SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object);
gchar *end_ptr;
@@ -282,8 +261,8 @@ void CFeSpotLight::set(unsigned int key, gchar const *value) {
/**
* * Receives update notifications.
* */
-void CFeSpotLight::update(SPCtx *ctx, guint flags) {
- SPFeSpotLight* object = this->spfespotlight;
+void SPFeSpotLight::update(SPCtx *ctx, guint flags) {
+ SPFeSpotLight* object = this;
SPFeSpotLight *feSpotLight = SP_FESPOTLIGHT(object);
(void)feSpotLight;
@@ -306,8 +285,8 @@ void CFeSpotLight::update(SPCtx *ctx, guint flags) {
/**
* Writes its settings to an incoming repr object, if any.
*/
-Inkscape::XML::Node* CFeSpotLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFeSpotLight* object = this->spfespotlight;
+Inkscape::XML::Node* SPFeSpotLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
+ SPFeSpotLight* object = this;
SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object);
if (!repr) {
diff --git a/src/filters/spotlight.h b/src/filters/spotlight.h
index 6849c8e82..69c36e2d7 100644
--- a/src/filters/spotlight.h
+++ b/src/filters/spotlight.h
@@ -17,16 +17,13 @@
#include "sp-object.h"
-#define SP_TYPE_FESPOTLIGHT (sp_fespotlight_get_type())
#define SP_FESPOTLIGHT(obj) ((SPFeSpotLight*)obj)
-#define SP_IS_FESPOTLIGHT(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeSpotLight)))
+#define SP_IS_FESPOTLIGHT(obj) (dynamic_cast<const SPFeSpotLight*>((SPObject*)obj))
-class CFeSpotLight;
-
-class SPFeSpotLight : public SPObject {
+class SPFeSpotLight : public SPObject, public CObject {
public:
SPFeSpotLight();
- CFeSpotLight* cfespotlight;
+ virtual ~SPFeSpotLight();
/** x coordinate of the light source */
gfloat x;
@@ -53,12 +50,6 @@ public:
gfloat limitingConeAngle;
guint limitingConeAngle_set : 1;
//other fields
-};
-
-class CFeSpotLight : public CObject {
-public:
- CFeSpotLight(SPFeSpotLight* spotlight);
- virtual ~CFeSpotLight();
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -68,17 +59,8 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
-
-private:
- SPFeSpotLight* spfespotlight;
-};
-
-struct SPFeSpotLightClass {
- SPObjectClass parent_class;
};
-GType
-sp_fespotlight_get_type();
#endif /* !SP_FESPOTLIGHT_H_SEEN */
/*