summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-07-31 20:51:23 +0000
committerMarkus Engel <markus.engel@tum.de>2013-07-31 20:51:23 +0000
commitbeecbea1b415d5b9536f2309c4f30fc258e346f5 (patch)
treec7e2df507bb1f06e8bdf237f07c3fd4e5bc2fcce /src
parentFixed SPObject ctor and dtor; removed singleton.h; some smaller changes. (diff)
downloadinkscape-beecbea1b415d5b9536f2309c4f30fc258e346f5.tar.gz
inkscape-beecbea1b415d5b9536f2309c4f30fc258e346f5.zip
Cleaned up a bit; fixed struct vs. class forward declarations.
(bzr r11608.1.111)
Diffstat (limited to '')
-rw-r--r--src/color-profile.cpp158
-rw-r--r--src/color-profile.h4
-rw-r--r--src/context-fns.h2
-rw-r--r--src/desktop-handles.h4
-rw-r--r--src/desktop.h4
-rw-r--r--src/display/canvas-axonomgrid.h2
-rw-r--r--src/display/canvas-grid.h2
-rw-r--r--src/display/nr-filter-diffuselighting.h6
-rw-r--r--src/display/nr-filter-specularlighting.h6
-rw-r--r--src/display/nr-light.h6
-rw-r--r--src/display/nr-style.h2
-rw-r--r--src/display/nr-svgfonts.h6
-rw-r--r--src/document.h4
-rw-r--r--src/event-context.h2
-rw-r--r--src/filter-chemistry.h4
-rw-r--r--src/filters/componenttransfer-funcnode.cpp131
-rw-r--r--src/filters/componenttransfer-funcnode.h1
-rw-r--r--src/filters/distantlight.cpp90
-rw-r--r--src/filters/distantlight.h1
-rw-r--r--src/filters/mergenode.cpp29
-rw-r--r--src/filters/mergenode.h1
-rw-r--r--src/filters/pointlight.cpp119
-rw-r--r--src/filters/pointlight.h1
-rw-r--r--src/filters/spotlight.cpp296
-rw-r--r--src/filters/spotlight.h1
-rw-r--r--src/gradient-drag.h8
-rw-r--r--src/guide-snapper.h2
-rw-r--r--src/inkscape.h2
-rw-r--r--src/live_effects/lpeobject.cpp70
-rw-r--r--src/live_effects/lpeobject.h2
-rw-r--r--src/object-snapper.h2
-rw-r--r--src/persp3d.cpp27
-rw-r--r--src/persp3d.h1
-rw-r--r--src/snap.h2
-rw-r--r--src/sp-defs.cpp14
-rw-r--r--src/sp-defs.h1
-rw-r--r--src/sp-desc.cpp11
-rw-r--r--src/sp-desc.h1
-rw-r--r--src/sp-filter-primitive.cpp4
-rw-r--r--src/sp-filter-primitive.h4
-rw-r--r--src/sp-filter-reference.h2
-rw-r--r--src/sp-filter.cpp176
-rw-r--r--src/sp-filter.h3
-rw-r--r--src/sp-gradient.h2
-rw-r--r--src/sp-mesh-array.h2
-rw-r--r--src/sp-object.cpp66
-rw-r--r--src/sp-paint-server-reference.h2
-rw-r--r--src/sp-pattern.h2
-rw-r--r--src/trace/trace.h2
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h6
-rw-r--r--src/ui/tool/control-point.h2
-rw-r--r--src/ui/view/view-widget.h2
-rw-r--r--src/widgets/gradient-vector.h2
-rw-r--r--src/widgets/paint-selector.h2
-rw-r--r--src/widgets/toolbox.h2
55 files changed, 592 insertions, 714 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 8e51ea6de..61442b11a 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -207,40 +207,37 @@ ColorProfile::~ColorProfile() {
* Callback: free object
*/
void ColorProfile::release() {
- ColorProfile* object = this;
-
// Unregister ourselves
- if ( object->document ) {
- object->document->removeResource("iccprofile", object);
+ if ( this->document ) {
+ this->document->removeResource("iccprofile", this);
}
- ColorProfile *cprof = COLORPROFILE(object);
- if ( cprof->href ) {
- g_free( cprof->href );
- cprof->href = 0;
+ if ( this->href ) {
+ g_free( this->href );
+ this->href = 0;
}
- if ( cprof->local ) {
- g_free( cprof->local );
- cprof->local = 0;
+ if ( this->local ) {
+ g_free( this->local );
+ this->local = 0;
}
- if ( cprof->name ) {
- g_free( cprof->name );
- cprof->name = 0;
+ if ( this->name ) {
+ g_free( this->name );
+ this->name = 0;
}
- if ( cprof->intentStr ) {
- g_free( cprof->intentStr );
- cprof->intentStr = 0;
+ if ( this->intentStr ) {
+ g_free( this->intentStr );
+ this->intentStr = 0;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- cprof->impl->_clearProfile();
+ this->impl->_clearProfile();
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- delete cprof->impl;
- cprof->impl = 0;
+ delete this->impl;
+ this->impl = 0;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -271,24 +268,21 @@ void ColorProfileImpl::_clearProfile()
* Callback: set attributes from associated repr.
*/
void ColorProfile::build(SPDocument *document, Inkscape::XML::Node *repr) {
- ColorProfile* object = this;
-
- ColorProfile *cprof = COLORPROFILE(object);
- g_assert(cprof->href == 0);
- g_assert(cprof->local == 0);
- g_assert(cprof->name == 0);
- g_assert(cprof->intentStr == 0);
+ g_assert(this->href == 0);
+ g_assert(this->local == 0);
+ g_assert(this->name == 0);
+ g_assert(this->intentStr == 0);
SPObject::build(document, repr);
- object->readAttr( "xlink:href" );
- object->readAttr( "local" );
- object->readAttr( "name" );
- object->readAttr( "rendering-intent" );
+ this->readAttr( "xlink:href" );
+ this->readAttr( "local" );
+ this->readAttr( "name" );
+ this->readAttr( "rendering-intent" );
// Register
if ( document ) {
- document->addResource( "iccprofile", object );
+ document->addResource( "iccprofile", this );
}
}
@@ -297,19 +291,15 @@ void ColorProfile::build(SPDocument *document, Inkscape::XML::Node *repr) {
* Callback: set attribute.
*/
void ColorProfile::set(unsigned key, gchar const *value) {
- ColorProfile* object = this;
-
- ColorProfile *cprof = COLORPROFILE(object);
-
switch (key) {
case SP_ATTR_XLINK_HREF:
- if ( cprof->href ) {
- g_free( cprof->href );
- cprof->href = 0;
+ if ( this->href ) {
+ g_free( this->href );
+ this->href = 0;
}
if ( value ) {
- cprof->href = g_strdup( value );
- if ( *cprof->href ) {
+ this->href = g_strdup( value );
+ if ( *this->href ) {
#if HAVE_LIBLCMS1
cmsErrorAction( LCMS_ERROR_SHOW );
#endif
@@ -320,10 +310,10 @@ void ColorProfile::set(unsigned key, gchar const *value) {
//LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize);
// Try to open relative
- SPDocument *doc = object->document;
+ SPDocument *doc = this->document;
if (!doc) {
doc = SP_ACTIVE_DOCUMENT;
- g_warning("object has no document. using active");
+ g_warning("this has no document. using active");
}
//# 1. Get complete URI of document
gchar const *docbase = doc->getURI();
@@ -333,7 +323,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
docbase = "";
}
- gchar* escaped = g_uri_escape_string(cprof->href, "!*'();:@=+$,/?#[]", TRUE);
+ gchar* escaped = g_uri_escape_string(this->href, "!*'();:@=+$,/?#[]", TRUE);
//g_message("docbase:%s\n", docbase);
org::w3c::dom::URI docUri(docbase);
@@ -343,67 +333,67 @@ void ColorProfile::set(unsigned key, gchar const *value) {
// the w3c specs. All absolute and relative issues are considered
org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
gchar* fullname = g_uri_unescape_string(cprofUri.getNativePath().c_str(), "");
- cprof->impl->_clearProfile();
- cprof->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
- if ( cprof->impl->_profHandle ) {
- cprof->impl->_profileSpace = cmsGetColorSpace( cprof->impl->_profHandle );
- cprof->impl->_profileClass = cmsGetDeviceClass( cprof->impl->_profHandle );
+ this->impl->_clearProfile();
+ this->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
+ if ( this->impl->_profHandle ) {
+ this->impl->_profileSpace = cmsGetColorSpace( this->impl->_profHandle );
+ this->impl->_profileClass = cmsGetDeviceClass( this->impl->_profHandle );
}
- DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->impl->_profHandle );
+ DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle );
g_free(escaped);
escaped = 0;
g_free(fullname);
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
}
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_LOCAL:
- if ( cprof->local ) {
- g_free( cprof->local );
- cprof->local = 0;
+ if ( this->local ) {
+ g_free( this->local );
+ this->local = 0;
}
- cprof->local = g_strdup( value );
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->local = g_strdup( value );
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_NAME:
- if ( cprof->name ) {
- g_free( cprof->name );
- cprof->name = 0;
+ if ( this->name ) {
+ g_free( this->name );
+ this->name = 0;
}
- cprof->name = g_strdup( value );
- DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", cprof->name );
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->name = g_strdup( value );
+ DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", this->name );
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_RENDERING_INTENT:
- if ( cprof->intentStr ) {
- g_free( cprof->intentStr );
- cprof->intentStr = 0;
+ if ( this->intentStr ) {
+ g_free( this->intentStr );
+ this->intentStr = 0;
}
- cprof->intentStr = g_strdup( value );
+ this->intentStr = g_strdup( value );
if ( value ) {
if ( strcmp( value, "auto" ) == 0 ) {
- cprof->rendering_intent = RENDERING_INTENT_AUTO;
+ this->rendering_intent = RENDERING_INTENT_AUTO;
} else if ( strcmp( value, "perceptual" ) == 0 ) {
- cprof->rendering_intent = RENDERING_INTENT_PERCEPTUAL;
+ this->rendering_intent = RENDERING_INTENT_PERCEPTUAL;
} else if ( strcmp( value, "relative-colorimetric" ) == 0 ) {
- cprof->rendering_intent = RENDERING_INTENT_RELATIVE_COLORIMETRIC;
+ this->rendering_intent = RENDERING_INTENT_RELATIVE_COLORIMETRIC;
} else if ( strcmp( value, "saturation" ) == 0 ) {
- cprof->rendering_intent = RENDERING_INTENT_SATURATION;
+ this->rendering_intent = RENDERING_INTENT_SATURATION;
} else if ( strcmp( value, "absolute-colorimetric" ) == 0 ) {
- cprof->rendering_intent = RENDERING_INTENT_ABSOLUTE_COLORIMETRIC;
+ this->rendering_intent = RENDERING_INTENT_ABSOLUTE_COLORIMETRIC;
} else {
- cprof->rendering_intent = RENDERING_INTENT_UNKNOWN;
+ this->rendering_intent = RENDERING_INTENT_UNKNOWN;
}
} else {
- cprof->rendering_intent = RENDERING_INTENT_UNKNOWN;
+ this->rendering_intent = RENDERING_INTENT_UNKNOWN;
}
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
@@ -416,28 +406,24 @@ void ColorProfile::set(unsigned key, gchar const *value) {
* Callback: write attributes to associated repr.
*/
Inkscape::XML::Node* ColorProfile::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
- ColorProfile* object = this;
-
- ColorProfile *cprof = COLORPROFILE(object);
-
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("svg:color-profile");
}
- if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->href ) {
- repr->setAttribute( "xlink:href", cprof->href );
+ if ( (flags & SP_OBJECT_WRITE_ALL) || this->href ) {
+ repr->setAttribute( "xlink:href", this->href );
}
- if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->local ) {
- repr->setAttribute( "local", cprof->local );
+ if ( (flags & SP_OBJECT_WRITE_ALL) || this->local ) {
+ repr->setAttribute( "local", this->local );
}
- if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->name ) {
- repr->setAttribute( "name", cprof->name );
+ if ( (flags & SP_OBJECT_WRITE_ALL) || this->name ) {
+ repr->setAttribute( "name", this->name );
}
- if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->intentStr ) {
- repr->setAttribute( "rendering-intent", cprof->intentStr );
+ if ( (flags & SP_OBJECT_WRITE_ALL) || this->intentStr ) {
+ repr->setAttribute( "rendering-intent", this->intentStr );
}
SPObject::write(xml_doc, repr, flags);
diff --git a/src/color-profile.h b/src/color-profile.h
index 152e61f57..2da757b91 100644
--- a/src/color-profile.h
+++ b/src/color-profile.h
@@ -55,7 +55,7 @@ public:
gchar* intentStr;
guint rendering_intent;
-public:
+protected:
ColorProfileImpl *impl;
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
@@ -68,7 +68,7 @@ public:
} // namespace Inkscape
-#define COLORPROFILE_TYPE (Inkscape::colorprofile_get_type())
+//#define COLORPROFILE_TYPE (Inkscape::colorprofile_get_type())
#define COLORPROFILE(obj) ((Inkscape::ColorProfile*)obj)
#define IS_COLORPROFILE(obj) (dynamic_cast<const Inkscape::ColorProfile*>((SPObject*)obj))
diff --git a/src/context-fns.h b/src/context-fns.h
index 12d6e6194..43a45e4c7 100644
--- a/src/context-fns.h
+++ b/src/context-fns.h
@@ -16,7 +16,7 @@
class SPDesktop;
class SPItem;
-struct SPEventContext;
+class SPEventContext;
const double goldenratio = 1.61803398874989484820; // golden ratio
diff --git a/src/desktop-handles.h b/src/desktop-handles.h
index 7cd903b83..9413f075b 100644
--- a/src/desktop-handles.h
+++ b/src/desktop-handles.h
@@ -16,8 +16,8 @@
class SPDesktop;
class SPDocument;
-struct SPEventContext;
-struct SPNamedView;
+class SPEventContext;
+class SPNamedView;
struct SPCanvas;
struct SPCanvasGroup;
struct SPCanvasItem;
diff --git a/src/desktop.h b/src/desktop.h
index 3d4513425..938c2153a 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -41,9 +41,9 @@ class SPCSSAttr;
struct SPCanvas;
struct SPCanvasItem;
struct SPCanvasGroup;
-struct SPEventContext;
+class SPEventContext;
class SPItem;
-struct SPNamedView;
+class SPNamedView;
class SPObject;
struct SPStyle;
typedef struct _DocumentInterface DocumentInterface;//struct DocumentInterface;
diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h
index f58ea3aca..4e5af863d 100644
--- a/src/display/canvas-axonomgrid.h
+++ b/src/display/canvas-axonomgrid.h
@@ -14,7 +14,7 @@
struct SPCanvasBuf;
class SPDesktop;
-struct SPNamedView;
+class SPNamedView;
namespace Inkscape {
namespace XML {
diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h
index 7eaef407f..09c261e0d 100644
--- a/src/display/canvas-grid.h
+++ b/src/display/canvas-grid.h
@@ -13,7 +13,7 @@
#include "line-snapper.h"
class SPDesktop;
-struct SPNamedView;
+class SPNamedView;
struct SPCanvasBuf;
class SPDocument;
diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h
index 15cc8e1ff..043a5eb39 100644
--- a/src/display/nr-filter-diffuselighting.h
+++ b/src/display/nr-filter-diffuselighting.h
@@ -19,9 +19,9 @@
#include "display/nr-filter-slot.h"
#include "display/nr-filter-units.h"
-struct SPFeDistantLight;
-struct SPFePointLight;
-struct SPFeSpotLight;
+class SPFeDistantLight;
+class SPFePointLight;
+class SPFeSpotLight;
struct SVGICCColor;
namespace Inkscape {
diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h
index 0d1c0644f..c57e3a9ff 100644
--- a/src/display/nr-filter-specularlighting.h
+++ b/src/display/nr-filter-specularlighting.h
@@ -17,9 +17,9 @@
#include "display/nr-light-types.h"
#include "display/nr-filter-primitive.h"
-struct SPFeDistantLight;
-struct SPFePointLight;
-struct SPFeSpotLight;
+class SPFeDistantLight;
+class SPFePointLight;
+class SPFeSpotLight;
struct SVGICCColor;
namespace Inkscape {
diff --git a/src/display/nr-light.h b/src/display/nr-light.h
index 022243bfc..0c1235483 100644
--- a/src/display/nr-light.h
+++ b/src/display/nr-light.h
@@ -13,9 +13,9 @@
#include "display/nr-light-types.h"
#include <2geom/forward.h>
-struct SPFeDistantLight;
-struct SPFePointLight;
-struct SPFeSpotLight;
+class SPFeDistantLight;
+class SPFePointLight;
+class SPFeSpotLight;
namespace Inkscape {
namespace Filters {
diff --git a/src/display/nr-style.h b/src/display/nr-style.h
index cd0bd208f..43df6f8f1 100644
--- a/src/display/nr-style.h
+++ b/src/display/nr-style.h
@@ -16,7 +16,7 @@
#include <2geom/rect.h>
#include "color.h"
-struct SPPaintServer;
+class SPPaintServer;
struct SPStyle;
namespace Inkscape {
diff --git a/src/display/nr-svgfonts.h b/src/display/nr-svgfonts.h
index 1101f93f2..e1bb047bb 100644
--- a/src/display/nr-svgfonts.h
+++ b/src/display/nr-svgfonts.h
@@ -17,9 +17,9 @@
#include <sigc++/connection.h>
class SvgFont;
-struct SPFont;
-struct SPGlyph;
-struct SPMissingGlyph;
+class SPFont;
+class SPGlyph;
+class SPMissingGlyph;
struct _GdkEventExpose;
typedef _GdkEventExpose GdkEventExpose;
diff --git a/src/document.h b/src/document.h
index d49067250..423dd2aba 100644
--- a/src/document.h
+++ b/src/document.h
@@ -33,8 +33,8 @@ class Router;
class SPItem;
class SPObject;
-struct SPGroup;
-struct SPRoot;
+class SPGroup;
+class SPRoot;
struct SPUnit;
namespace Inkscape {
diff --git a/src/event-context.h b/src/event-context.h
index 51c49b123..c2c9b023d 100644
--- a/src/event-context.h
+++ b/src/event-context.h
@@ -23,7 +23,7 @@ class GrDrag;
class SPDesktop;
class SPItem;
class ShapeEditor;
-struct SPEventContext;
+class SPEventContext;
namespace Inkscape {
class MessageContext;
diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h
index b00e33bcc..2ac3ebe8f 100644
--- a/src/filter-chemistry.h
+++ b/src/filter-chemistry.h
@@ -19,8 +19,8 @@
#include "display/nr-filter-types.h"
class SPDocument;
-struct SPFilter;
-struct SPFilterPrimitive;
+class SPFilter;
+class SPFilterPrimitive;
class SPItem;
class SPObject;
diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp
index 8b5a8a3ab..7c5191700 100644
--- a/src/filters/componenttransfer-funcnode.cpp
+++ b/src/filters/componenttransfer-funcnode.cpp
@@ -31,14 +31,9 @@
#include "macros.h"
/* FeFuncNode class */
-SPFeFuncNode::SPFeFuncNode() : SPObject() {
- 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;
+SPFeFuncNode::SPFeFuncNode()
+ : SPObject(), type(Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY),
+ slope(1), intercept(0), amplitude(1), exponent(1), offset(0) {
}
SPFeFuncNode::~SPFeFuncNode() {
@@ -52,56 +47,65 @@ SPFeFuncNode::~SPFeFuncNode() {
void SPFeFuncNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPObject::build(document, repr);
- SPFeFuncNode* object = this;
-
//Read values of key attributes from XML nodes into object.
- object->readAttr( "type" );
- object->readAttr( "tableValues" );
- object->readAttr( "slope" );
- object->readAttr( "intercept" );
- object->readAttr( "amplitude" );
- object->readAttr( "exponent" );
- object->readAttr( "offset" );
+ this->readAttr( "type" );
+ this->readAttr( "tableValues" );
+ this->readAttr( "slope" );
+ this->readAttr( "intercept" );
+ this->readAttr( "amplitude" );
+ this->readAttr( "exponent" );
+ this->readAttr( "offset" );
//is this necessary?
- document->addResource("fefuncnode", object); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
+ document->addResource("fefuncnode", this); //maybe feFuncR, fefuncG, feFuncB and fefuncA ?
}
/**
* Drops any allocated memory.
*/
void SPFeFuncNode::release() {
- SPFeFuncNode* object = this;
- //SPFeFuncNode *fefuncnode = SP_FEFUNCNODE(object);
-
- if ( object->document ) {
+ if ( this->document ) {
// Unregister ourselves
- object->document->removeResource("fefuncnode", object);
+ this->document->removeResource("fefuncnode", this);
}
//TODO: release resources here
}
static Inkscape::Filters::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){
- if (!value) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
+ if (!value) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
+ }
+
switch(value[0]){
case 'i':
- if (strncmp(value, "identity", 8) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY;
+ if (strncmp(value, "identity", 8) == 0) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY;
+ }
break;
case 't':
- if (strncmp(value, "table", 5) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_TABLE;
+ if (strncmp(value, "table", 5) == 0) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_TABLE;
+ }
break;
case 'd':
- if (strncmp(value, "discrete", 8) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_DISCRETE;
+ if (strncmp(value, "discrete", 8) == 0) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_DISCRETE;
+ }
break;
case 'l':
- if (strncmp(value, "linear", 6) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_LINEAR;
+ if (strncmp(value, "linear", 6) == 0) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_LINEAR;
+ }
break;
case 'g':
- if (strncmp(value, "gamma", 5) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_GAMMA;
+ if (strncmp(value, "gamma", 5) == 0) {
+ return Inkscape::Filters::COMPONENTTRANSFER_TYPE_GAMMA;
+ }
break;
}
+
return Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED.
}
@@ -109,63 +113,65 @@ static Inkscape::Filters::FilterComponentTransferType sp_feComponenttransfer_rea
* Sets a specific value in the SPFeFuncNode.
*/
void SPFeFuncNode::set(unsigned int key, gchar const *value) {
- SPFeFuncNode* object = this;
-
- SPFeFuncNode *feFuncNode = SP_FEFUNCNODE(object);
Inkscape::Filters::FilterComponentTransferType type;
double read_num;
+
switch(key) {
case SP_ATTR_TYPE:
type = sp_feComponenttransfer_read_type(value);
- if(type != feFuncNode->type) {
- feFuncNode->type = type;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if(type != this->type) {
+ this->type = type;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_TABLEVALUES:
if (value){
- feFuncNode->tableValues = helperfns_read_vector(value);
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->tableValues = helperfns_read_vector(value);
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_SLOPE:
read_num = value ? helperfns_read_number(value) : 1;
- if (read_num != feFuncNode->slope) {
- feFuncNode->slope = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (read_num != this->slope) {
+ this->slope = read_num;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_INTERCEPT:
read_num = value ? helperfns_read_number(value) : 0;
- if (read_num != feFuncNode->intercept) {
- feFuncNode->intercept = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (read_num != this->intercept) {
+ this->intercept = read_num;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_AMPLITUDE:
read_num = value ? helperfns_read_number(value) : 1;
- if (read_num != feFuncNode->amplitude) {
- feFuncNode->amplitude = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (read_num != this->amplitude) {
+ this->amplitude = read_num;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_EXPONENT:
read_num = value ? helperfns_read_number(value) : 1;
- if (read_num != feFuncNode->exponent) {
- feFuncNode->exponent = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (read_num != this->exponent) {
+ this->exponent = read_num;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_OFFSET:
read_num = value ? helperfns_read_number(value) : 0;
- if (read_num != feFuncNode->offset) {
- feFuncNode->offset = read_num;
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (read_num != this->offset) {
+ this->offset = read_num;
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
default:
-// if (((SPObjectClass *) feFuncNode_parent_class)->set)
-// ((SPObjectClass *) feFuncNode_parent_class)->set(object, key, value);
SPObject::set(key, value);
break;
}
@@ -175,16 +181,11 @@ void SPFeFuncNode::set(unsigned int key, gchar const *value) {
* * Receives update notifications.
* */
void SPFeFuncNode::update(SPCtx *ctx, guint flags) {
- SPFeFuncNode* object = this;
-
- SPFeFuncNode *feFuncNode = SP_FEFUNCNODE(object);
- (void)feFuncNode;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
//TODO
- //object->readAttr( "azimuth" );
- //object->readAttr( "elevation" );
+ //this->readAttr( "azimuth" );
+ //this->readAttr( "elevation" );
}
SPObject::update(ctx, flags);
@@ -194,16 +195,12 @@ void SPFeFuncNode::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
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) {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
}
- (void)fefuncnode;
/*
-TODO: I'm not sure what to do here...
+ TODO: I'm not sure what to do here...
if (fefuncnode->azimuth_set)
sp_repr_set_css_double(repr, "azimuth", fefuncnode->azimuth);
diff --git a/src/filters/componenttransfer-funcnode.h b/src/filters/componenttransfer-funcnode.h
index deed46839..873baa196 100644
--- a/src/filters/componenttransfer-funcnode.h
+++ b/src/filters/componenttransfer-funcnode.h
@@ -54,6 +54,7 @@ public:
double exponent;
double offset;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp
index 763ddbe7a..8b6ef023b 100644
--- a/src/filters/distantlight.cpp
+++ b/src/filters/distantlight.cpp
@@ -29,11 +29,8 @@
#define SP_MACROS_SILENT
#include "macros.h"
-SPFeDistantLight::SPFeDistantLight() : SPObject() {
- this->azimuth = 0;
- this->elevation = 0;
- this->azimuth_set = FALSE;
- this->elevation_set = FALSE;
+SPFeDistantLight::SPFeDistantLight()
+ : SPObject(), azimuth(0), azimuth_set(FALSE), elevation(0), elevation_set(FALSE) {
}
SPFeDistantLight::~SPFeDistantLight() {
@@ -47,27 +44,21 @@ SPFeDistantLight::~SPFeDistantLight() {
void SPFeDistantLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPObject::build(document, repr);
- SPFeDistantLight* object = this;
-
//Read values of key attributes from XML nodes into object.
- object->readAttr( "azimuth" );
- object->readAttr( "elevation" );
+ this->readAttr( "azimuth" );
+ this->readAttr( "elevation" );
//is this necessary?
- document->addResource("fedistantlight", object);
+ document->addResource("fedistantlight", this);
}
/**
* Drops any allocated memory.
*/
void SPFeDistantLight::release() {
- SPFeDistantLight* object = this;
-
- //SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object);
-
- if ( object->document ) {
+ if ( this->document ) {
// Unregister ourselves
- object->document->removeResource("fedistantlight", object);
+ this->document->removeResource("fedistantlight", this);
}
//TODO: release resources here
@@ -77,44 +68,51 @@ void SPFeDistantLight::release() {
* Sets a specific value in the SPFeDistantLight.
*/
void SPFeDistantLight::set(unsigned int key, gchar const *value) {
- SPFeDistantLight* object = this;
- SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object);
gchar *end_ptr;
+
switch (key) {
case SP_ATTR_AZIMUTH:
end_ptr =NULL;
+
if (value) {
- fedistantlight->azimuth = g_ascii_strtod(value, &end_ptr);
+ this->azimuth = g_ascii_strtod(value, &end_ptr);
+
if (end_ptr) {
- fedistantlight->azimuth_set = TRUE;
+ this->azimuth_set = TRUE;
}
}
+
if (!value || !end_ptr) {
- fedistantlight->azimuth_set = FALSE;
- fedistantlight->azimuth = 0;
+ this->azimuth_set = FALSE;
+ this->azimuth = 0;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_ELEVATION:
end_ptr =NULL;
+
if (value) {
- fedistantlight->elevation = g_ascii_strtod(value, &end_ptr);
+ this->elevation = g_ascii_strtod(value, &end_ptr);
+
if (end_ptr) {
- fedistantlight->elevation_set = TRUE;
+ this->elevation_set = TRUE;
}
}
+
if (!value || !end_ptr) {
- fedistantlight->elevation_set = FALSE;
- fedistantlight->elevation = 0;
+ this->elevation_set = FALSE;
+ this->elevation = 0;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
default:
@@ -128,14 +126,10 @@ void SPFeDistantLight::set(unsigned int key, gchar const *value) {
* * Receives update notifications.
* */
void SPFeDistantLight::update(SPCtx *ctx, guint flags) {
- SPFeDistantLight* object = this;
- SPFeDistantLight *feDistantLight = SP_FEDISTANTLIGHT(object);
- (void)feDistantLight;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- object->readAttr( "azimuth" );
- object->readAttr( "elevation" );
+ this->readAttr( "azimuth" );
+ this->readAttr( "elevation" );
}
SPObject::update(ctx, flags);
@@ -145,17 +139,17 @@ void SPFeDistantLight::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
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) {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
+ }
+
+ if (this->azimuth_set) {
+ sp_repr_set_css_double(repr, "azimuth", this->azimuth);
}
- if (fedistantlight->azimuth_set)
- sp_repr_set_css_double(repr, "azimuth", fedistantlight->azimuth);
- if (fedistantlight->elevation_set)
- sp_repr_set_css_double(repr, "elevation", fedistantlight->elevation);
+ if (this->elevation_set) {
+ sp_repr_set_css_double(repr, "elevation", this->elevation);
+ }
SPObject::write(doc, repr, flags);
diff --git a/src/filters/distantlight.h b/src/filters/distantlight.h
index b808eb279..ad9c8f53c 100644
--- a/src/filters/distantlight.h
+++ b/src/filters/distantlight.h
@@ -33,6 +33,7 @@ public:
gfloat elevation;
guint elevation_set : 1;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp
index e356ac771..1b06db706 100644
--- a/src/filters/mergenode.cpp
+++ b/src/filters/mergenode.cpp
@@ -33,8 +33,8 @@ namespace {
bool mergeNodeRegistered = SPFactory::instance().registerObject("svg:feMergeNode", createMergeNode);
}
-SPFeMergeNode::SPFeMergeNode() : SPObject() {
- this->input = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
+SPFeMergeNode::SPFeMergeNode()
+ : SPObject(), input(Inkscape::Filters::NR_FILTER_SLOT_NOT_SET) {
}
SPFeMergeNode::~SPFeMergeNode() {
@@ -46,8 +46,7 @@ SPFeMergeNode::~SPFeMergeNode() {
* sp-object-repr.cpp's repr_name_entries array.
*/
void SPFeMergeNode::build(SPDocument *document, Inkscape::XML::Node *repr) {
- SPFeMergeNode* object = this;
- object->readAttr( "in" );
+ this->readAttr( "in" );
}
/**
@@ -61,15 +60,13 @@ void SPFeMergeNode::release() {
* Sets a specific value in the SPFeMergeNode.
*/
void SPFeMergeNode::set(unsigned int key, gchar const *value) {
- SPFeMergeNode* object = this;
- SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object);
- SPFeMerge *parent = SP_FEMERGE(object->parent);
+ SPFeMerge *parent = SP_FEMERGE(this->parent);
if (key == SP_ATTR_IN) {
int input = sp_filter_primitive_read_in(parent, value);
- if (input != feMergeNode->input) {
- feMergeNode->input = input;
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ if (input != this->input) {
+ this->input = input;
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
}
@@ -81,11 +78,8 @@ void SPFeMergeNode::set(unsigned int key, gchar const *value) {
* Receives update notifications.
*/
void SPFeMergeNode::update(SPCtx *ctx, guint flags) {
- SPFeMergeNode* object = this;
- //SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object);
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
SPObject::update(ctx, flags);
@@ -95,16 +89,13 @@ void SPFeMergeNode::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
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:
+ // Inkscape-only this, not copied during an "plain SVG" dump:
if (flags & SP_OBJECT_WRITE_EXT) {
if (repr) {
// is this sane?
//repr->mergeFrom(object->getRepr(), "id");
} else {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
}
}
diff --git a/src/filters/mergenode.h b/src/filters/mergenode.h
index 346d8da24..9182780ca 100644
--- a/src/filters/mergenode.h
+++ b/src/filters/mergenode.h
@@ -27,6 +27,7 @@ public:
int input;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp
index ab0b1b582..1c7532b4e 100644
--- a/src/filters/pointlight.cpp
+++ b/src/filters/pointlight.cpp
@@ -39,14 +39,8 @@ namespace {
bool pointLightRegistered = SPFactory::instance().registerObject("svg:fePointLight", createPointLight);
}
-SPFePointLight::SPFePointLight() : SPObject() {
- this->x = 0;
- this->y = 0;
- this->z = 0;
-
- this->x_set = FALSE;
- this->y_set = FALSE;
- this->z_set = FALSE;
+SPFePointLight::SPFePointLight()
+ : SPObject(), x(0), x_set(FALSE), y(0), y_set(FALSE), z(0), z_set(FALSE) {
}
SPFePointLight::~SPFePointLight() {
@@ -61,27 +55,22 @@ SPFePointLight::~SPFePointLight() {
void SPFePointLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPObject::build(document, repr);
- SPFePointLight* object = this;
-
//Read values of key attributes from XML nodes into object.
- object->readAttr( "x" );
- object->readAttr( "y" );
- object->readAttr( "z" );
+ this->readAttr( "x" );
+ this->readAttr( "y" );
+ this->readAttr( "z" );
//is this necessary?
- document->addResource("fepointlight", object);
+ document->addResource("fepointlight", this);
}
/**
* Drops any allocated memory.
*/
void SPFePointLight::release() {
- SPFePointLight* object = this;
- //SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object);
-
- if ( object->document ) {
+ if ( this->document ) {
// Unregister ourselves
- object->document->removeResource("fepointlight", object);
+ this->document->removeResource("fepointlight", this);
}
//TODO: release resources here
@@ -91,63 +80,73 @@ void SPFePointLight::release() {
* Sets a specific value in the SPFePointLight.
*/
void SPFePointLight::set(unsigned int key, gchar const *value) {
- SPFePointLight* object = this;
-
- SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object);
gchar *end_ptr;
+
switch (key) {
case SP_ATTR_X:
end_ptr = NULL;
+
if (value) {
- fepointlight->x = g_ascii_strtod(value, &end_ptr);
+ this->x = g_ascii_strtod(value, &end_ptr);
+
if (end_ptr) {
- fepointlight->x_set = TRUE;
+ this->x_set = TRUE;
}
}
+
if (!value || !end_ptr) {
- fepointlight->x = 0;
- fepointlight->x_set = FALSE;
+ this->x = 0;
+ this->x_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_Y:
end_ptr = NULL;
+
if (value) {
- fepointlight->y = g_ascii_strtod(value, &end_ptr);
+ this->y = g_ascii_strtod(value, &end_ptr);
+
if (end_ptr) {
- fepointlight->y_set = TRUE;
+ this->y_set = TRUE;
}
}
+
if (!value || !end_ptr) {
- fepointlight->y = 0;
- fepointlight->y_set = FALSE;
+ this->y = 0;
+ this->y_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_Z:
end_ptr = NULL;
+
if (value) {
- fepointlight->z = g_ascii_strtod(value, &end_ptr);
+ this->z = g_ascii_strtod(value, &end_ptr);
+
if (end_ptr) {
- fepointlight->z_set = TRUE;
+ this->z_set = TRUE;
}
}
+
if (!value || !end_ptr) {
- fepointlight->z = 0;
- fepointlight->z_set = FALSE;
+ this->z = 0;
+ this->z_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
default:
@@ -161,16 +160,11 @@ void SPFePointLight::set(unsigned int key, gchar const *value) {
* * Receives update notifications.
* */
void SPFePointLight::update(SPCtx *ctx, guint flags) {
- SPFePointLight* object = this;
-
- SPFePointLight *fePointLight = SP_FEPOINTLIGHT(object);
- (void)fePointLight;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- object->readAttr( "x" );
- object->readAttr( "y" );
- object->readAttr( "z" );
+ this->readAttr( "x" );
+ this->readAttr( "y" );
+ this->readAttr( "z" );
}
SPObject::update(ctx, flags);
@@ -180,19 +174,16 @@ void SPFePointLight::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
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) {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
}
- if (fepointlight->x_set)
- sp_repr_set_css_double(repr, "x", fepointlight->x);
- if (fepointlight->y_set)
- sp_repr_set_css_double(repr, "y", fepointlight->y);
- if (fepointlight->z_set)
- sp_repr_set_css_double(repr, "z", fepointlight->z);
+ if (this->x_set)
+ sp_repr_set_css_double(repr, "x", this->x);
+ if (this->y_set)
+ sp_repr_set_css_double(repr, "y", this->y);
+ if (this->z_set)
+ sp_repr_set_css_double(repr, "z", this->z);
SPObject::write(doc, repr, flags);
diff --git a/src/filters/pointlight.h b/src/filters/pointlight.h
index 96bef8945..2379167b6 100644
--- a/src/filters/pointlight.h
+++ b/src/filters/pointlight.h
@@ -35,6 +35,7 @@ public:
gfloat z;
guint z_set : 1;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp
index 1942c7710..c0344067c 100644
--- a/src/filters/spotlight.cpp
+++ b/src/filters/spotlight.cpp
@@ -39,24 +39,12 @@ namespace {
bool spotLightRegistered = SPFactory::instance().registerObject("svg:feSpotLight", createSpotLight);
}
-SPFeSpotLight::SPFeSpotLight() : SPObject() {
- 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;
+SPFeSpotLight::SPFeSpotLight()
+ : SPObject(), x(0), x_set(FALSE), y(0), y_set(FALSE), z(0), z_set(FALSE), pointsAtX(0), pointsAtX_set(FALSE),
+ pointsAtY(0), pointsAtY_set(FALSE), pointsAtZ(0), pointsAtZ_set(FALSE),
+ specularExponent(1), specularExponent_set(FALSE), limitingConeAngle(90),
+ limitingConeAngle_set(FALSE)
+{
}
SPFeSpotLight::~SPFeSpotLight() {
@@ -71,32 +59,27 @@ SPFeSpotLight::~SPFeSpotLight() {
void SPFeSpotLight::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPObject::build(document, repr);
- SPFeSpotLight* object = this;
-
//Read values of key attributes from XML nodes into object.
- object->readAttr( "x" );
- object->readAttr( "y" );
- object->readAttr( "z" );
- object->readAttr( "pointsAtX" );
- object->readAttr( "pointsAtY" );
- object->readAttr( "pointsAtZ" );
- object->readAttr( "specularExponent" );
- object->readAttr( "limitingConeAngle" );
+ this->readAttr( "x" );
+ this->readAttr( "y" );
+ this->readAttr( "z" );
+ this->readAttr( "pointsAtX" );
+ this->readAttr( "pointsAtY" );
+ this->readAttr( "pointsAtZ" );
+ this->readAttr( "specularExponent" );
+ this->readAttr( "limitingConeAngle" );
//is this necessary?
- document->addResource("fespotlight", object);
+ document->addResource("fespotlight", this);
}
/**
* Drops any allocated memory.
*/
void SPFeSpotLight::release() {
- SPFeSpotLight* object = this;
- //SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object);
-
- if ( object->document ) {
+ if ( this->document ) {
// Unregister ourselves
- object->document->removeResource("fespotlight", object);
+ this->document->removeResource("fespotlight", this);
}
//TODO: release resources here
@@ -106,146 +89,183 @@ void SPFeSpotLight::release() {
* Sets a specific value in the SPFeSpotLight.
*/
void SPFeSpotLight::set(unsigned int key, gchar const *value) {
- SPFeSpotLight* object = this;
-
- SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object);
gchar *end_ptr;
switch (key) {
case SP_ATTR_X:
end_ptr = NULL;
+
if (value) {
- fespotlight->x = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->x_set = TRUE;
+ this->x = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->x_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->x = 0;
- fespotlight->x_set = FALSE;
+ this->x = 0;
+ this->x_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_Y:
end_ptr = NULL;
+
if (value) {
- fespotlight->y = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->y_set = TRUE;
+ this->y = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->y_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->y = 0;
- fespotlight->y_set = FALSE;
+ this->y = 0;
+ this->y_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_Z:
end_ptr = NULL;
+
if (value) {
- fespotlight->z = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->z_set = TRUE;
+ this->z = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->z_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->z = 0;
- fespotlight->z_set = FALSE;
+ this->z = 0;
+ this->z_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_POINTSATX:
end_ptr = NULL;
+
if (value) {
- fespotlight->pointsAtX = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->pointsAtX_set = TRUE;
+ this->pointsAtX = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->pointsAtX_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->pointsAtX = 0;
- fespotlight->pointsAtX_set = FALSE;
+ this->pointsAtX = 0;
+ this->pointsAtX_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_POINTSATY:
end_ptr = NULL;
+
if (value) {
- fespotlight->pointsAtY = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->pointsAtY_set = TRUE;
+ this->pointsAtY = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->pointsAtY_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->pointsAtY = 0;
- fespotlight->pointsAtY_set = FALSE;
+ this->pointsAtY = 0;
+ this->pointsAtY_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_POINTSATZ:
end_ptr = NULL;
+
if (value) {
- fespotlight->pointsAtZ = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->pointsAtZ_set = TRUE;
+ this->pointsAtZ = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->pointsAtZ_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->pointsAtZ = 0;
- fespotlight->pointsAtZ_set = FALSE;
+ this->pointsAtZ = 0;
+ this->pointsAtZ_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_SPECULAREXPONENT:
end_ptr = NULL;
+
if (value) {
- fespotlight->specularExponent = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->specularExponent_set = TRUE;
+ this->specularExponent = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->specularExponent_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->specularExponent = 1;
- fespotlight->specularExponent_set = FALSE;
+ this->specularExponent = 1;
+ this->specularExponent_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
case SP_ATTR_LIMITINGCONEANGLE:
end_ptr = NULL;
+
if (value) {
- fespotlight->limitingConeAngle = g_ascii_strtod(value, &end_ptr);
- if (end_ptr)
- fespotlight->limitingConeAngle_set = TRUE;
+ this->limitingConeAngle = g_ascii_strtod(value, &end_ptr);
+
+ if (end_ptr) {
+ this->limitingConeAngle_set = TRUE;
+ }
}
+
if(!value || !end_ptr) {
- fespotlight->limitingConeAngle = 90;
- fespotlight->limitingConeAngle_set = FALSE;
+ this->limitingConeAngle = 90;
+ this->limitingConeAngle_set = FALSE;
}
- if (object->parent &&
- (SP_IS_FEDIFFUSELIGHTING(object->parent) ||
- SP_IS_FESPECULARLIGHTING(object->parent))) {
- object->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ if (this->parent &&
+ (SP_IS_FEDIFFUSELIGHTING(this->parent) ||
+ SP_IS_FESPECULARLIGHTING(this->parent))) {
+ this->parent->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
default:
@@ -259,21 +279,16 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
* * Receives update notifications.
* */
void SPFeSpotLight::update(SPCtx *ctx, guint flags) {
- SPFeSpotLight* object = this;
-
- SPFeSpotLight *feSpotLight = SP_FESPOTLIGHT(object);
- (void)feSpotLight;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
- object->readAttr( "x" );
- object->readAttr( "y" );
- object->readAttr( "z" );
- object->readAttr( "pointsAtX" );
- object->readAttr( "pointsAtY" );
- object->readAttr( "pointsAtZ" );
- object->readAttr( "specularExponent" );
- object->readAttr( "limitingConeAngle" );
+ this->readAttr( "x" );
+ this->readAttr( "y" );
+ this->readAttr( "z" );
+ this->readAttr( "pointsAtX" );
+ this->readAttr( "pointsAtY" );
+ this->readAttr( "pointsAtZ" );
+ this->readAttr( "specularExponent" );
+ this->readAttr( "limitingConeAngle" );
}
SPObject::update(ctx, flags);
@@ -283,29 +298,26 @@ void SPFeSpotLight::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
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) {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
}
- if (fespotlight->x_set)
- sp_repr_set_css_double(repr, "x", fespotlight->x);
- if (fespotlight->y_set)
- sp_repr_set_css_double(repr, "y", fespotlight->y);
- if (fespotlight->z_set)
- sp_repr_set_css_double(repr, "z", fespotlight->z);
- if (fespotlight->pointsAtX_set)
- sp_repr_set_css_double(repr, "pointsAtX", fespotlight->pointsAtX);
- if (fespotlight->pointsAtY_set)
- sp_repr_set_css_double(repr, "pointsAtY", fespotlight->pointsAtY);
- if (fespotlight->pointsAtZ_set)
- sp_repr_set_css_double(repr, "pointsAtZ", fespotlight->pointsAtZ);
- if (fespotlight->specularExponent_set)
- sp_repr_set_css_double(repr, "specularExponent", fespotlight->specularExponent);
- if (fespotlight->limitingConeAngle_set)
- sp_repr_set_css_double(repr, "limitingConeAngle", fespotlight->limitingConeAngle);
+ if (this->x_set)
+ sp_repr_set_css_double(repr, "x", this->x);
+ if (this->y_set)
+ sp_repr_set_css_double(repr, "y", this->y);
+ if (this->z_set)
+ sp_repr_set_css_double(repr, "z", this->z);
+ if (this->pointsAtX_set)
+ sp_repr_set_css_double(repr, "pointsAtX", this->pointsAtX);
+ if (this->pointsAtY_set)
+ sp_repr_set_css_double(repr, "pointsAtY", this->pointsAtY);
+ if (this->pointsAtZ_set)
+ sp_repr_set_css_double(repr, "pointsAtZ", this->pointsAtZ);
+ if (this->specularExponent_set)
+ sp_repr_set_css_double(repr, "specularExponent", this->specularExponent);
+ if (this->limitingConeAngle_set)
+ sp_repr_set_css_double(repr, "limitingConeAngle", this->limitingConeAngle);
SPObject::write(doc, repr, flags);
diff --git a/src/filters/spotlight.h b/src/filters/spotlight.h
index 9ea73a800..b273f72b7 100644
--- a/src/filters/spotlight.h
+++ b/src/filters/spotlight.h
@@ -51,6 +51,7 @@ public:
guint limitingConeAngle_set : 1;
//other fields
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/gradient-drag.h b/src/gradient-drag.h
index 2a2465590..c92a5c22f 100644
--- a/src/gradient-drag.h
+++ b/src/gradient-drag.h
@@ -33,12 +33,12 @@ struct SPKnot;
class SPDesktop;
class SPCSSAttr;
-struct SPLinearGradient;
-struct SPMeshGradient;
+class SPLinearGradient;
+class SPMeshGradient;
class SPItem;
class SPObject;
-struct SPRadialGradient;
-struct SPStop;
+class SPRadialGradient;
+class SPStop;
namespace Inkscape {
class Selection;
diff --git a/src/guide-snapper.h b/src/guide-snapper.h
index aa0c45320..7aea2988b 100644
--- a/src/guide-snapper.h
+++ b/src/guide-snapper.h
@@ -13,7 +13,7 @@
#include "line-snapper.h"
-struct SPNamedView;
+class SPNamedView;
namespace Inkscape
{
diff --git a/src/inkscape.h b/src/inkscape.h
index 234b98d2c..0effc3c38 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -17,7 +17,7 @@
class SPDesktop;
class SPDocument;
-struct SPEventContext;
+class SPEventContext;
namespace Inkscape {
class ActionContext;
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp
index b708a36cd..d61f2b2fa 100644
--- a/src/live_effects/lpeobject.cpp
+++ b/src/live_effects/lpeobject.cpp
@@ -41,15 +41,13 @@ static Inkscape::XML::NodeEventVector const livepatheffect_repr_events = {
};
-LivePathEffectObject::LivePathEffectObject() : SPObject() {
+LivePathEffectObject::LivePathEffectObject()
+ : SPObject(), effecttype(Inkscape::LivePathEffect::INVALID_LPE), effecttype_set(false),
+ lpe(NULL)
+{
#ifdef LIVEPATHEFFECT_VERBOSE
g_message("Init livepatheffectobject");
#endif
-
- this->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
- this->lpe = NULL;
-
- this->effecttype_set = false;
}
LivePathEffectObject::~LivePathEffectObject() {
@@ -59,17 +57,15 @@ LivePathEffectObject::~LivePathEffectObject() {
* Virtual build: set livepatheffect attributes from its associated XML node.
*/
void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
- LivePathEffectObject* object = this;
-
- g_assert(object != NULL);
- g_assert(SP_IS_OBJECT(object));
+ g_assert(this != NULL);
+ g_assert(SP_IS_OBJECT(this));
SPObject::build(document, repr);
- object->readAttr( "effect" );
+ this->readAttr( "effect" );
if (repr) {
- repr->addListener (&livepatheffect_repr_events, object);
+ repr->addListener (&livepatheffect_repr_events, this);
}
/* Register ourselves, is this necessary? */
@@ -80,12 +76,7 @@ void LivePathEffectObject::build(SPDocument *document, Inkscape::XML::Node *repr
* Virtual release of livepatheffect members before destruction.
*/
void LivePathEffectObject::release() {
- LivePathEffectObject* object = this;
-
- LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
-
- object->getRepr()->removeListenerByData(object);
-
+ this->getRepr()->removeListenerByData(this);
/*
if (object->document) {
@@ -101,14 +92,14 @@ void LivePathEffectObject::release() {
}
gradient->modified_connection.~connection();
-
*/
- if (lpeobj->lpe) {
- delete lpeobj->lpe;
- lpeobj->lpe = NULL;
+ if (this->lpe) {
+ delete this->lpe;
+ this->lpe = NULL;
}
- lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
+
+ this->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
SPObject::release();
}
@@ -117,28 +108,27 @@ void LivePathEffectObject::release() {
* Virtual set: set attribute to value.
*/
void LivePathEffectObject::set(unsigned key, gchar const *value) {
- LivePathEffectObject* object = this;
-
- LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
#ifdef LIVEPATHEFFECT_VERBOSE
g_print("Set livepatheffect");
#endif
+
switch (key) {
case SP_PROP_PATH_EFFECT:
- if (lpeobj->lpe) {
- delete lpeobj->lpe;
- lpeobj->lpe = NULL;
+ if (this->lpe) {
+ delete this->lpe;
+ this->lpe = NULL;
}
if ( value && Inkscape::LivePathEffect::LPETypeConverter.is_valid_key(value) ) {
- lpeobj->effecttype = Inkscape::LivePathEffect::LPETypeConverter.get_id_from_key(value);
- lpeobj->lpe = Inkscape::LivePathEffect::Effect::New(lpeobj->effecttype, lpeobj);
- lpeobj->effecttype_set = true;
+ this->effecttype = Inkscape::LivePathEffect::LPETypeConverter.get_id_from_key(value);
+ this->lpe = Inkscape::LivePathEffect::Effect::New(this->effecttype, this);
+ this->effecttype_set = true;
} else {
- lpeobj->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
- lpeobj->effecttype_set = false;
+ this->effecttype = Inkscape::LivePathEffect::INVALID_LPE;
+ this->effecttype_set = false;
}
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
@@ -149,18 +139,14 @@ void LivePathEffectObject::set(unsigned key, gchar const *value) {
* Virtual write: write object attributes to repr.
*/
Inkscape::XML::Node* LivePathEffectObject::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
- LivePathEffectObject* object = this;
-
- LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
-
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("inkscape:path-effect");
}
- if ((flags & SP_OBJECT_WRITE_ALL) || lpeobj->lpe) {
- repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(lpeobj->effecttype).c_str());
+ if ((flags & SP_OBJECT_WRITE_ALL) || this->lpe) {
+ repr->setAttribute("effect", Inkscape::LivePathEffect::LPETypeConverter.get_key(this->effecttype).c_str());
- lpeobj->lpe->writeParamsToSVG();
+ this->lpe->writeParamsToSVG();
}
SPObject::write(xml_doc, repr, flags);
diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h
index 28ed93f1a..534a12897 100644
--- a/src/live_effects/lpeobject.h
+++ b/src/live_effects/lpeobject.h
@@ -40,9 +40,9 @@ public:
* So one should always check whether the returned value is NULL or not */
Inkscape::LivePathEffect::Effect * get_lpe() { return lpe; };
-//private:
Inkscape::LivePathEffect::Effect *lpe; // this can be NULL in a valid LivePathEffectObject
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/object-snapper.h b/src/object-snapper.h
index 31e1ee501..c0dab5c58 100644
--- a/src/object-snapper.h
+++ b/src/object-snapper.h
@@ -15,7 +15,7 @@
#include "splivarot.h"
#include "snap-candidate.h"
-struct SPNamedView;
+class SPNamedView;
class SPItem;
class SPObject;
diff --git a/src/persp3d.cpp b/src/persp3d.cpp
index 5188821e8..a0e6f1c02 100644
--- a/src/persp3d.cpp
+++ b/src/persp3d.cpp
@@ -76,15 +76,13 @@ Persp3D::~Persp3D() {
void Persp3D::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPObject::build(document, repr);
- Persp3D* object = this;
-
- object->readAttr( "inkscape:vp_x" );
- object->readAttr( "inkscape:vp_y" );
- object->readAttr( "inkscape:vp_z" );
- object->readAttr( "inkscape:persp3d-origin" );
+ this->readAttr( "inkscape:vp_x" );
+ this->readAttr( "inkscape:vp_y" );
+ this->readAttr( "inkscape:vp_z" );
+ this->readAttr( "inkscape:persp3d-origin" );
if (repr) {
- repr->addListener (&persp3d_repr_events, object);
+ repr->addListener (&persp3d_repr_events, this);
}
}
@@ -92,11 +90,8 @@ void Persp3D::build(SPDocument *document, Inkscape::XML::Node *repr) {
* Virtual release of Persp3D members before destruction.
*/
void Persp3D::release() {
- Persp3D* object = this;
-
- Persp3D *persp = SP_PERSP3D(object);
- delete persp->perspective_impl;
- object->getRepr()->removeListenerByData(object);
+ delete this->perspective_impl;
+ this->getRepr()->removeListenerByData(this);
}
@@ -106,9 +101,7 @@ void Persp3D::release() {
// FIXME: Currently we only read the finite positions of vanishing points;
// should we move VPs into their own repr (as it's done for SPStop, e.g.)?
void Persp3D::set(unsigned key, gchar const *value) {
- Persp3D* object = this;
-
- Persp3DImpl *persp_impl = SP_PERSP3D(object)->perspective_impl;
+ Persp3DImpl *persp_impl = this->perspective_impl;
switch (key) {
case SP_ATTR_INKSCAPE_PERSP3D_VP_X: {
@@ -223,9 +216,7 @@ Persp3D *persp3d_document_first_persp(SPDocument *document)
* Virtual write: write object attributes to repr.
*/
Inkscape::XML::Node* Persp3D::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
- Persp3D* object = this;
-
- Persp3DImpl *persp_impl = SP_PERSP3D(object)->perspective_impl;
+ Persp3DImpl *persp_impl = this->perspective_impl;
if ((flags & SP_OBJECT_WRITE_BUILD & SP_OBJECT_WRITE_EXT) && !repr) {
// this is where we end up when saving as plain SVG (also in other circumstances?);
diff --git a/src/persp3d.h b/src/persp3d.h
index 2ef467cc4..e0c742123 100644
--- a/src/persp3d.h
+++ b/src/persp3d.h
@@ -50,6 +50,7 @@ public:
Persp3DImpl *perspective_impl;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/snap.h b/src/snap.h
index 6a87d95cc..67af20063 100644
--- a/src/snap.h
+++ b/src/snap.h
@@ -31,7 +31,7 @@ enum SPGuideDragType { // used both here and in desktop-events.cpp
};
class SPGuide;
-struct SPNamedView;
+class SPNamedView;
/**
* Class to coordinate snapping operations.
diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp
index b60c830e6..334570076 100644
--- a/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
@@ -41,15 +41,13 @@ void SPDefs::release() {
}
void SPDefs::update(SPCtx *ctx, guint flags) {
- SPDefs* object = this;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
flags &= SP_OBJECT_MODIFIED_CASCADE;
- GSList *l = g_slist_reverse(object->childList(true));
+ GSList *l = g_slist_reverse(this->childList(true));
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
@@ -61,8 +59,6 @@ void SPDefs::update(SPCtx *ctx, guint flags) {
}
void SPDefs::modified(unsigned int flags) {
- SPDefs* object = this;
-
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
@@ -70,7 +66,7 @@ void SPDefs::modified(unsigned int flags) {
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);
}
@@ -88,8 +84,6 @@ void SPDefs::modified(unsigned int flags) {
}
Inkscape::XML::Node* SPDefs::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
- SPDefs* object = this;
-
if (flags & SP_OBJECT_WRITE_BUILD) {
if (!repr) {
@@ -97,7 +91,7 @@ Inkscape::XML::Node* SPDefs::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
GSList *l = NULL;
- for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
+ for ( SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
if (crepr) {
l = g_slist_prepend(l, crepr);
@@ -111,7 +105,7 @@ Inkscape::XML::Node* SPDefs::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
} else {
- for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
+ for ( SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
diff --git a/src/sp-defs.h b/src/sp-defs.h
index ece6cd46a..415aa4cd2 100644
--- a/src/sp-defs.h
+++ b/src/sp-defs.h
@@ -23,6 +23,7 @@ public:
SPDefs();
virtual ~SPDefs();
+protected:
virtual void release();
virtual void update(SPCtx* ctx, unsigned int flags);
virtual void modified(unsigned int flags);
diff --git a/src/sp-desc.cpp b/src/sp-desc.cpp
index c8e0f16e4..199ae0176 100644
--- a/src/sp-desc.cpp
+++ b/src/sp-desc.cpp
@@ -32,18 +32,15 @@ SPDesc::SPDesc() : SPObject() {
SPDesc::~SPDesc() {
}
+/**
+ * Writes it's settings to an incoming repr object, if any.
+ */
Inkscape::XML::Node* SPDesc::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) {
- SPDesc* object = this;
-
if (!repr) {
- repr = object->getRepr()->duplicate(doc);
+ repr = this->getRepr()->duplicate(doc);
}
SPObject::write(doc, repr, flags);
return repr;
}
-
-/**
- * Writes it's settings to an incoming repr object, if any.
- */
diff --git a/src/sp-desc.h b/src/sp-desc.h
index 224e3eab1..ac8fc564f 100644
--- a/src/sp-desc.h
+++ b/src/sp-desc.h
@@ -22,6 +22,7 @@ public:
SPDesc();
virtual ~SPDesc();
+protected:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
};
diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp
index bf264011a..f6b89bc21 100644
--- a/src/sp-filter-primitive.cpp
+++ b/src/sp-filter-primitive.cpp
@@ -29,9 +29,9 @@
// CPPIFY: Make pure virtual.
-void SPFilterPrimitive::build_renderer(Inkscape::Filters::Filter* filter) {
+//void SPFilterPrimitive::build_renderer(Inkscape::Filters::Filter* filter) {
// throw;
-}
+//}
SPFilterPrimitive::SPFilterPrimitive() : SPObject() {
this->image_in = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET;
diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h
index fbb4dbe29..1026937ff 100644
--- a/src/sp-filter-primitive.h
+++ b/src/sp-filter-primitive.h
@@ -36,6 +36,7 @@ public:
/* filter primitive subregion */
SVGLength x, y, height, width;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -45,7 +46,8 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
- virtual void build_renderer(Inkscape::Filters::Filter* filter);
+public:
+ virtual void build_renderer(Inkscape::Filters::Filter* filter) = 0;
};
/* Common initialization for filter primitives */
diff --git a/src/sp-filter-reference.h b/src/sp-filter-reference.h
index 7a335aed4..5901dca07 100644
--- a/src/sp-filter-reference.h
+++ b/src/sp-filter-reference.h
@@ -5,7 +5,7 @@
class SPObject;
class SPDocument;
-struct SPFilter;
+class SPFilter;
class SPFilterReference : public Inkscape::URIReference {
public:
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 2a566efa2..91389bf7d 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -51,7 +51,12 @@ namespace {
bool filterRegistered = SPFactory::instance().registerObject("svg:filter", createFilter);
}
-SPFilter::SPFilter() : SPObject() {
+SPFilter::SPFilter()
+ : SPObject(), filterUnits(SP_FILTER_UNITS_OBJECTBOUNDINGBOX), filterUnits_set(FALSE),
+ primitiveUnits(SP_FILTER_UNITS_USERSPACEONUSE), primitiveUnits_set(FALSE),
+ filterRes(NumberOptNumber()),
+ _renderer(NULL), _image_name(new std::map<gchar *, int, ltstr>), _image_number_next(0)
+{
this->href = new SPFilterReference(this);
this->href->changedSignal().connect(sigc::bind(sigc::ptr_fun(filter_ref_changed), this));
@@ -60,20 +65,7 @@ SPFilter::SPFilter() : SPObject() {
this->width = 0;
this->height = 0;
- this->filterUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
- this->primitiveUnits = SP_FILTER_UNITS_USERSPACEONUSE;
- this->filterUnits_set = FALSE;
- this->primitiveUnits_set = FALSE;
-
- this->_renderer = NULL;
-
- this->_image_name = new std::map<gchar *, int, ltstr>;
this->_image_name->clear();
- this->_image_number_next = 0;
-
- this->filterRes = NumberOptNumber();
-
- new (&this->modified_connection) sigc::connection();
}
SPFilter::~SPFilter() {
@@ -86,49 +78,43 @@ SPFilter::~SPFilter() {
* sp-object-repr.cpp's repr_name_entries array.
*/
void SPFilter::build(SPDocument *document, Inkscape::XML::Node *repr) {
- SPFilter* object = this;
-
//Read values of key attributes from XML nodes into object.
- object->readAttr( "style" ); // struct not derived from SPItem, we need to do this ourselves.
- object->readAttr( "filterUnits" );
- object->readAttr( "primitiveUnits" );
- object->readAttr( "x" );
- object->readAttr( "y" );
- object->readAttr( "width" );
- object->readAttr( "height" );
- object->readAttr( "filterRes" );
- object->readAttr( "xlink:href" );
+ this->readAttr( "style" ); // struct not derived from SPItem, we need to do this ourselves.
+ this->readAttr( "filterUnits" );
+ this->readAttr( "primitiveUnits" );
+ this->readAttr( "x" );
+ this->readAttr( "y" );
+ this->readAttr( "width" );
+ this->readAttr( "height" );
+ this->readAttr( "filterRes" );
+ this->readAttr( "xlink:href" );
SPObject::build(document, repr);
//is this necessary?
- document->addResource("filter", object);
+ document->addResource("filter", this);
}
/**
* Drops any allocated memory.
*/
void SPFilter::release() {
- SPFilter* object = this;
- SPFilter *filter = SP_FILTER(object);
-
- if (object->document) {
+ if (this->document) {
// Unregister ourselves
- object->document->removeResource("filter", object);
+ this->document->removeResource("filter", this);
}
//TODO: release resources here
//release href
- if (filter->href) {
- filter->modified_connection.disconnect();
- filter->href->detach();
- delete filter->href;
- filter->href = NULL;
+ if (this->href) {
+ this->modified_connection.disconnect();
+ this->href->detach();
+ delete this->href;
+ this->href = NULL;
}
- filter->modified_connection.~connection();
- delete filter->_image_name;
+ delete this->_image_name;
SPObject::release();
}
@@ -137,68 +123,69 @@ void SPFilter::release() {
* Sets a specific value in the SPFilter.
*/
void SPFilter::set(unsigned int key, gchar const *value) {
- SPFilter* object = this;
- SPFilter *filter = SP_FILTER(object);
-
switch (key) {
case SP_ATTR_FILTERUNITS:
if (value) {
if (!strcmp(value, "userSpaceOnUse")) {
- filter->filterUnits = SP_FILTER_UNITS_USERSPACEONUSE;
+ this->filterUnits = SP_FILTER_UNITS_USERSPACEONUSE;
} else {
- filter->filterUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
+ this->filterUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
}
- filter->filterUnits_set = TRUE;
+
+ this->filterUnits_set = TRUE;
} else {
- filter->filterUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
- filter->filterUnits_set = FALSE;
+ this->filterUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
+ this->filterUnits_set = FALSE;
}
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_PRIMITIVEUNITS:
if (value) {
if (!strcmp(value, "objectBoundingBox")) {
- filter->primitiveUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
+ this->primitiveUnits = SP_FILTER_UNITS_OBJECTBOUNDINGBOX;
} else {
- filter->primitiveUnits = SP_FILTER_UNITS_USERSPACEONUSE;
+ this->primitiveUnits = SP_FILTER_UNITS_USERSPACEONUSE;
}
- filter->primitiveUnits_set = TRUE;
+
+ this->primitiveUnits_set = TRUE;
} else {
- filter->primitiveUnits = SP_FILTER_UNITS_USERSPACEONUSE;
- filter->primitiveUnits_set = FALSE;
+ this->primitiveUnits = SP_FILTER_UNITS_USERSPACEONUSE;
+ this->primitiveUnits_set = FALSE;
}
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_X:
- filter->x.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->x.readOrUnset(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_Y:
- filter->y.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->y.readOrUnset(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_WIDTH:
- filter->width.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->width.readOrUnset(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_HEIGHT:
- filter->height.readOrUnset(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->height.readOrUnset(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_FILTERRES:
- filter->filterRes.set(value);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->filterRes.set(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_XLINK_HREF:
if (value) {
try {
- filter->href->attach(Inkscape::URI(value));
+ this->href->attach(Inkscape::URI(value));
} catch (Inkscape::BadURIException &e) {
g_warning("%s", e.what());
- filter->href->detach();
+ this->href->detach();
}
} else {
- filter->href->detach();
+ this->href->detach();
}
break;
default:
@@ -212,8 +199,6 @@ void SPFilter::set(unsigned int key, gchar const *value) {
* Receives update notifications.
*/
void SPFilter::update(SPCtx *ctx, guint flags) {
- //SPFilter *filter = SP_FILTER(object);
-
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG |
SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
@@ -228,34 +213,34 @@ void SPFilter::update(SPCtx *ctx, guint flags) {
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
- SPFilter* object = this;
- SPFilter *filter = SP_FILTER(object);
-
// Original from sp-item-group.cpp
if (flags & SP_OBJECT_WRITE_BUILD) {
if (!repr) {
- repr = doc->createElement("svg:filter");
+ repr = doc->createElement("svg:this");
}
+
GSList *l = NULL;
- for ( SPObject *child = object->firstChild(); child; child = child->getNext() ) {
+ for ( SPObject *child = this->firstChild(); child; child = child->getNext() ) {
Inkscape::XML::Node *crepr = child->updateRepr(doc, NULL, flags);
+
if (crepr) {
l = g_slist_prepend (l, crepr);
}
}
+
while (l) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove (l, l->data);
}
} else {
- for ( SPObject *child = object->firstChild() ; child; child = child->getNext() ) {
+ for ( SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
child->updateRepr(flags);
}
}
- if ((flags & SP_OBJECT_WRITE_ALL) || filter->filterUnits_set) {
- switch (filter->filterUnits) {
+ if ((flags & SP_OBJECT_WRITE_ALL) || this->filterUnits_set) {
+ switch (this->filterUnits) {
case SP_FILTER_UNITS_USERSPACEONUSE:
repr->setAttribute("filterUnits", "userSpaceOnUse");
break;
@@ -265,8 +250,8 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
}
}
- if ((flags & SP_OBJECT_WRITE_ALL) || filter->primitiveUnits_set) {
- switch (filter->primitiveUnits) {
+ if ((flags & SP_OBJECT_WRITE_ALL) || this->primitiveUnits_set) {
+ switch (this->primitiveUnits) {
case SP_FILTER_UNITS_OBJECTBOUNDINGBOX:
repr->setAttribute("primitiveUnits", "objectBoundingBox");
break;
@@ -276,40 +261,40 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
}
}
- if (filter->x._set) {
- sp_repr_set_svg_double(repr, "x", filter->x.computed);
+ if (this->x._set) {
+ sp_repr_set_svg_double(repr, "x", this->x.computed);
} else {
repr->setAttribute("x", NULL);
}
- if (filter->y._set) {
- sp_repr_set_svg_double(repr, "y", filter->y.computed);
+ if (this->y._set) {
+ sp_repr_set_svg_double(repr, "y", this->y.computed);
} else {
repr->setAttribute("y", NULL);
}
- if (filter->width._set) {
- sp_repr_set_svg_double(repr, "width", filter->width.computed);
+ if (this->width._set) {
+ sp_repr_set_svg_double(repr, "width", this->width.computed);
} else {
repr->setAttribute("width", NULL);
}
- if (filter->height._set) {
- sp_repr_set_svg_double(repr, "height", filter->height.computed);
+ if (this->height._set) {
+ sp_repr_set_svg_double(repr, "height", this->height.computed);
} else {
repr->setAttribute("height", NULL);
}
- if (filter->filterRes.getNumber()>=0) {
- gchar *tmp = filter->filterRes.getValueString();
+ if (this->filterRes.getNumber()>=0) {
+ gchar *tmp = this->filterRes.getValueString();
repr->setAttribute("filterRes", tmp);
g_free(tmp);
} else {
repr->setAttribute("filterRes", NULL);
}
- if (filter->href->getURI()) {
- gchar *uri_string = filter->href->getURI()->toString();
+ if (this->href->getURI()) {
+ gchar *uri_string = this->href->getURI()->toString();
repr->setAttribute("xlink:href", uri_string);
g_free(uri_string);
}
@@ -329,6 +314,7 @@ filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter)
if (old_ref) {
filter->modified_connection.disconnect();
}
+
if ( SP_IS_FILTER(ref)
&& ref != filter )
{
@@ -348,24 +334,18 @@ static void filter_ref_modified(SPObject */*href*/, guint /*flags*/, SPFilter *f
* Callback for child_added event.
*/
void SPFilter::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
- SPFilter* object = this;
- //SPFilter *f = SP_FILTER(object);
-
SPObject::child_added(child, ref);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
/**
* Callback for remove_child event.
*/
void SPFilter::remove_child(Inkscape::XML::Node *child) {
- SPFilter* object = this;
- // SPFilter *f = SP_FILTER(object);
-
SPObject::remove_child(child);
- object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter)
diff --git a/src/sp-filter.h b/src/sp-filter.h
index 8af400367..e1e56be2c 100644
--- a/src/sp-filter.h
+++ b/src/sp-filter.h
@@ -33,7 +33,7 @@ class Filter;
} }
class SPFilterReference;
-struct SPFilterPrimitive;
+class SPFilterPrimitive;
struct ltstr {
bool operator()(const char* s1, const char* s2) const;
@@ -61,6 +61,7 @@ public:
std::map<gchar *, int, ltstr>* _image_name;
int _image_number_next;
+protected:
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
diff --git a/src/sp-gradient.h b/src/sp-gradient.h
index 8a03d59e6..27a652377 100644
--- a/src/sp-gradient.h
+++ b/src/sp-gradient.h
@@ -39,7 +39,7 @@
//struct SPMeshGradient;
class SPGradientReference;
-struct SPStop;
+class SPStop;
#define SP_GRADIENT(obj) ((SPGradient*)obj)
#define SP_IS_GRADIENT(obj) (dynamic_cast<const SPGradient*>((SPObject*)obj))
diff --git a/src/sp-mesh-array.h b/src/sp-mesh-array.h
index 5a852f003..b10974e7e 100644
--- a/src/sp-mesh-array.h
+++ b/src/sp-mesh-array.h
@@ -127,7 +127,7 @@ public:
void setOpacity( guint i, gdouble o );
};
-struct SPMeshGradient;
+class SPMeshGradient;
// An array of mesh nodes.
class SPMeshNodeArray {
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 08ed9fc8d..95a28dd7b 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -104,44 +104,25 @@ public:
static gchar *sp_object_get_unique_id(SPObject *object,
gchar const *defid);
-SPObject::SPObject() {
+SPObject::SPObject()
+ : cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),
+ document(NULL), parent(NULL), children(NULL), _last_child(NULL),
+ next(NULL), id(NULL), repr(NULL), refCount(1),
+ _successor(NULL), _collection_policy(SPObject::COLLECT_WITH_PARENT),
+ _label(NULL), _default_label(NULL)
+{
debug("id=%x, typename=%s",this, g_type_name_from_instance((GTypeInstance*)object));
- this->refCount = 1;
-
- this->repr = NULL;
- this->mflags = 0;
- this->id = NULL;
- this->cloned = 0;
- this->uflags = 0;
-
- this->hrefcount = 0;
- this->_total_hrefcount = 0;
- this->document = NULL;
- this->children = this->_last_child = NULL;
- this->parent = this->next = NULL;
-
//used XML Tree here.
this->getRepr(); // TODO check why this call is made
SPObjectImpl::setIdNull(this);
- this->_collection_policy = SPObject::COLLECT_WITH_PARENT;
-
- //new (&this->_release_signal) sigc::signal<void, SPObject *>();
- //new (&this->_modified_signal) sigc::signal<void, SPObject *, unsigned int>();
- //new (&this->_delete_signal) sigc::signal<void, SPObject *>();
- //new (&this->_position_changed_signal) sigc::signal<void, SPObject *>();
- this->_successor = NULL;
-
// FIXME: now we create style for all objects, but per SVG, only the following can have style attribute:
// vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline,
// polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient,
// stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject
this->style = sp_style_new_from_object(this);
-
- this->_label = NULL;
- this->_default_label = NULL;
}
SPObject::~SPObject() {
@@ -155,11 +136,6 @@ SPObject::~SPObject() {
sp_object_unref(this->_successor, NULL);
this->_successor = NULL;
}
-
- //this->_release_signal.~signal();
- //this->_modified_signal.~signal();
- //this->_delete_signal.~signal();
- //this->_position_changed_signal.~signal();
}
// CPPIFY: make pure virtual
@@ -209,34 +185,6 @@ public:
}
-
-
-
-
-
-//#include <stdexcept>
-//#include <exception>
-//
-//void log_exception(std::exception_ptr exception) {
-// try {
-// std::rethrow_exception(exception);
-// } catch (const std::exception& e) {
-// std::cerr << "Caught Exception of type " << std::string(typeid(e).name()) << '\n';
-// std::cerr << "Message: " << std::string(e.what()) << '\n';
-//
-// try {
-// std::rethrow_if_nested(e);
-// } catch (...) {
-// std::cerr << "Inner Exception: \n";
-// log_exception(std::current_exception());
-// }
-// }
-//}
-
-
-
-
-
gchar const* SPObject::getId() const {
return id;
}
diff --git a/src/sp-paint-server-reference.h b/src/sp-paint-server-reference.h
index 5561af1a3..e08694c2f 100644
--- a/src/sp-paint-server-reference.h
+++ b/src/sp-paint-server-reference.h
@@ -18,7 +18,7 @@
#include "sp-object.h"
#include "uri-references.h"
-struct SPPaintServer;
+class SPPaintServer;
class SPPaintServerReference : public Inkscape::URIReference {
public:
diff --git a/src/sp-pattern.h b/src/sp-pattern.h
index a2cef6068..78bd1549a 100644
--- a/src/sp-pattern.h
+++ b/src/sp-pattern.h
@@ -20,7 +20,7 @@
#define SP_PATTERN(obj) ((SPPattern*)obj)
#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj))
-struct SPPatternReference;
+class SPPatternReference;
#include "svg/svg-length.h"
#include "sp-paint-server.h"
diff --git a/src/trace/trace.h b/src/trace/trace.h
index 9f9f44b14..662b2537e 100644
--- a/src/trace/trace.h
+++ b/src/trace/trace.h
@@ -26,7 +26,7 @@
#include <vector>
#include <sp-shape.h>
-struct SPImage;
+class SPImage;
class SPItem;
namespace Inkscape {
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index 01f70654a..e5c4631e4 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -34,8 +34,8 @@ class HScale;
#endif
}
-struct SPGlyph;
-struct SPGlyphKerning;
+class SPGlyph;
+class SPGlyphKerning;
class SvgFont;
class SvgFontDrawingArea : Gtk::DrawingArea{
@@ -52,7 +52,7 @@ private:
bool on_expose_event (GdkEventExpose *event);
};
-struct SPFont;
+class SPFont;
namespace Inkscape {
namespace UI {
diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h
index 27a0f8074..30efe8a27 100644
--- a/src/ui/tool/control-point.h
+++ b/src/ui/tool/control-point.h
@@ -23,7 +23,7 @@
#include "enums.h"
class SPDesktop;
-struct SPEventContext;
+class SPEventContext;
namespace Inkscape {
namespace UI {
diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h
index 295e7932b..668f9d19a 100644
--- a/src/ui/view/view-widget.h
+++ b/src/ui/view/view-widget.h
@@ -23,7 +23,7 @@ class View;
} // namespace Inkscape
class SPViewWidget;
-struct SPNamedView;
+class SPNamedView;
#define SP_TYPE_VIEW_WIDGET (sp_view_widget_get_type ())
#define SP_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget))
diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h
index 64e40a35b..b63120a6e 100644
--- a/src/widgets/gradient-vector.h
+++ b/src/widgets/gradient-vector.h
@@ -40,7 +40,7 @@
class SPDocument;
class SPObject;
class SPGradient;
-struct SPStop;
+class SPStop;
struct SPGradientVectorSelector {
GtkVBox vbox;
diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h
index a66758434..d3b3f4116 100644
--- a/src/widgets/paint-selector.h
+++ b/src/widgets/paint-selector.h
@@ -22,7 +22,7 @@
class SPGradient;
class SPDesktop;
-struct SPPattern;
+class SPPattern;
struct SPStyle;
#define SP_TYPE_PAINT_SELECTOR (sp_paint_selector_get_type ())
diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h
index 9c839a8fe..d520d393d 100644
--- a/src/widgets/toolbox.h
+++ b/src/widgets/toolbox.h
@@ -23,7 +23,7 @@
#define TOOLBAR_SLIDER_HINT "full"
class SPDesktop;
-struct SPEventContext;
+class SPEventContext;
namespace Inkscape {
namespace UI {