summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-01-24 19:45:45 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-01-24 19:45:45 +0000
commit988890b65df3543ea812535feb7a8c5c5e81178e (patch)
tree9214960f6ab838f332c8b2a79b237bbc4add1d70 /src
parentmerge from trunk (r12051) (diff)
parentfix crash (diff)
downloadinkscape-988890b65df3543ea812535feb7a8c5c5e81178e.tar.gz
inkscape-988890b65df3543ea812535feb7a8c5c5e81178e.zip
merge from trunk (r12063)
(bzr r11668.1.49)
Diffstat (limited to 'src')
-rw-r--r--src/arc-context.cpp44
-rw-r--r--src/attribute-rel-util.cpp2
-rw-r--r--src/box3d-side.cpp43
-rw-r--r--src/box3d.cpp51
-rw-r--r--src/dom/css.h14
-rw-r--r--src/dom/dom.h27
-rw-r--r--src/dom/domptr.h2
-rw-r--r--src/dom/stylesheets.h19
-rw-r--r--src/extension/internal/filter/color.h195
-rwxr-xr-xsrc/extension/internal/filter/filter-all.cpp3
-rw-r--r--src/flood-context.cpp40
-rw-r--r--src/id-clash.cpp29
-rw-r--r--src/ink-action.cpp127
-rw-r--r--src/marker.cpp76
-rw-r--r--src/select-context.cpp41
-rw-r--r--src/sp-anchor.cpp46
-rw-r--r--src/sp-clippath.cpp99
-rw-r--r--src/sp-clippath.h16
-rw-r--r--src/sp-defs.cpp74
-rw-r--r--src/sp-defs.h16
-rw-r--r--src/sp-desc.cpp29
-rw-r--r--src/sp-ellipse.cpp164
-rw-r--r--src/sp-ellipse.h4
-rw-r--r--src/sp-flowdiv.cpp233
-rw-r--r--src/sp-flowregion.cpp88
-rw-r--r--src/sp-font-face.cpp60
-rw-r--r--src/sp-font-face.h4
-rw-r--r--src/sp-font.cpp60
-rw-r--r--src/sp-gradient.cpp250
-rw-r--r--src/sp-image.cpp58
-rw-r--r--src/sp-item-group.cpp68
-rw-r--r--src/sp-item.cpp111
-rw-r--r--src/sp-item.h23
-rw-r--r--src/sp-line.cpp103
-rw-r--r--src/sp-line.h21
-rw-r--r--src/sp-namedview.cpp51
-rw-r--r--src/sp-namedview.h4
-rw-r--r--src/sp-polygon.cpp42
-rw-r--r--src/sp-polyline.cpp71
-rw-r--r--src/sp-polyline.h18
-rw-r--r--src/sp-root.cpp71
-rw-r--r--src/sp-script.cpp41
-rw-r--r--src/sp-shape.cpp138
-rw-r--r--src/sp-shape.h27
-rw-r--r--src/sp-skeleton.cpp50
-rw-r--r--src/sp-spiral.cpp53
-rw-r--r--src/sp-star.cpp56
-rw-r--r--src/sp-string.cpp41
-rw-r--r--src/sp-tref.cpp47
-rw-r--r--src/sp-use.cpp52
-rw-r--r--src/spiral-context.cpp40
-rw-r--r--src/spray-context.cpp36
-rw-r--r--src/star-context.cpp40
-rw-r--r--src/syseq.h2
-rw-r--r--src/trace/imagemap-gdk.cpp14
-rw-r--r--src/trace/imagemap-gdk.h4
-rw-r--r--src/ui/dialog/symbols.cpp3
57 files changed, 950 insertions, 2191 deletions
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index c35e0041f..b5bdf58ef 100644
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
@@ -49,8 +49,6 @@
using Inkscape::DocumentUndo;
-static void sp_arc_context_class_init(SPArcContextClass *klass);
-static void sp_arc_context_init(SPArcContext *arc_context);
static void sp_arc_context_dispose(GObject *object);
static void sp_arc_context_setup(SPEventContext *ec);
@@ -62,35 +60,13 @@ static void sp_arc_drag(SPArcContext *ec, Geom::Point pt, guint state);
static void sp_arc_finish(SPArcContext *ec);
static void sp_arc_cancel(SPArcContext *ec);
-static SPEventContextClass *parent_class;
-
-GType sp_arc_context_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPArcContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_arc_context_class_init,
- NULL, NULL,
- sizeof(SPArcContext),
- 4,
- (GInstanceInitFunc) sp_arc_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPArcContext", &info, (GTypeFlags) 0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPArcContext, sp_arc_context, SP_TYPE_EVENT_CONTEXT);
static void sp_arc_context_class_init(SPArcContextClass *klass)
{
-
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_arc_context_dispose;
event_context_class->setup = sp_arc_context_setup;
@@ -127,8 +103,8 @@ static void sp_arc_context_finish(SPEventContext *ec)
sp_arc_finish(ac);
ac->sel_changed_connection.disconnect();
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->finish) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->finish(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->finish) {
+ (SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->finish(ec);
}
}
@@ -152,7 +128,7 @@ static void sp_arc_context_dispose(GObject *object)
delete ac->_message_context;
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_arc_context_parent_class)->dispose(object);
}
/**
@@ -174,8 +150,8 @@ static void sp_arc_context_setup(SPEventContext *ec)
SPArcContext *ac = SP_ARC_CONTEXT(ec);
Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->setup) {
+ (SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->setup(ec);
}
ec->shape_editor = new ShapeEditor(ec->desktop);
@@ -219,8 +195,8 @@ static gint sp_arc_context_item_handler(SPEventContext *event_context, SPItem *i
break;
}
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->item_handler) {
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->item_handler(event_context, item, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->item_handler) {
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->item_handler(event_context, item, event);
}
return ret;
@@ -401,8 +377,8 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler) {
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->root_handler) {
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_arc_context_parent_class))->root_handler(event_context, event);
}
}
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp
index 38327b413..0527dad4e 100644
--- a/src/attribute-rel-util.cpp
+++ b/src/attribute-rel-util.cpp
@@ -209,9 +209,9 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) {
}
// Find parent value for same property (property)
- gchar const * property_p = NULL;
gchar const * value_p = NULL;
if( css_parent != NULL ) {
+ gchar const * property_p = NULL;
for ( List<AttributeRecord const> iter_p = css_parent->attributeList() ; iter_p ; ++iter_p ) {
property_p = g_quark_to_string(iter_p->key);
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index 42268ec83..fc18207b0 100644
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
@@ -26,9 +26,6 @@
struct SPPathClass;
-static void box3d_side_class_init (Box3DSideClass *klass);
-static void box3d_side_init (Box3DSide *side);
-
static void box3d_side_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value);
@@ -38,34 +35,12 @@ static void box3d_side_set_shape (SPShape *shape);
static void box3d_side_compute_corner_ids(Box3DSide *side, unsigned int corners[4]);
-static SPShapeClass *parent_class;
-
-GType
-box3d_side_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (Box3DSideClass),
- NULL, NULL,
- (GClassInitFunc) box3d_side_class_init,
- NULL, NULL,
- sizeof (Box3DSide),
- 16,
- (GInstanceInitFunc) box3d_side_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_SHAPE, "Box3DSide", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(Box3DSide, box3d_side, SP_TYPE_SHAPE);
static void box3d_side_class_init(Box3DSideClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
SPShapeClass *shape_class = reinterpret_cast<SPShapeClass *>(klass);
- parent_class = SP_SHAPE_CLASS(g_type_class_ref (SP_TYPE_SHAPE));
sp_object_class->build = box3d_side_build;
sp_object_class->write = box3d_side_write;
@@ -85,8 +60,8 @@ box3d_side_init (Box3DSide * side)
static void box3d_side_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if ((SP_OBJECT_CLASS(parent_class))->build) {
- (SP_OBJECT_CLASS(parent_class))->build(object, document, repr);
+ if ((SP_OBJECT_CLASS(box3d_side_parent_class))->build) {
+ (SP_OBJECT_CLASS(box3d_side_parent_class))->build(object, document, repr);
}
object->readAttr( "inkscape:box3dsidetype" );
@@ -119,8 +94,8 @@ box3d_side_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::
repr->setAttribute("d", d);
g_free (d);
- if ((SP_OBJECT_CLASS(parent_class))->write)
- (SP_OBJECT_CLASS(parent_class))->write (object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(box3d_side_parent_class))->write)
+ (SP_OBJECT_CLASS(box3d_side_parent_class))->write (object, xml_doc, repr, flags);
return repr;
}
@@ -153,8 +128,8 @@ box3d_side_set (SPObject *object, unsigned int key, const gchar *value)
}
break;
default:
- if ((SP_OBJECT_CLASS(parent_class))->set)
- (SP_OBJECT_CLASS(parent_class))->set (object, key, value);
+ if ((SP_OBJECT_CLASS(box3d_side_parent_class))->set)
+ (SP_OBJECT_CLASS(box3d_side_parent_class))->set (object, key, value);
break;
}
}
@@ -172,8 +147,8 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags)
static_cast<SPShape *>(object)->setShape ();
}
- if ((SP_OBJECT_CLASS(parent_class))->update)
- (SP_OBJECT_CLASS(parent_class))->update (object, ctx, flags);
+ if ((SP_OBJECT_CLASS(box3d_side_parent_class))->update)
+ (SP_OBJECT_CLASS(box3d_side_parent_class))->update (object, ctx, flags);
}
/* Create a new Box3DSide and append it to the parent box */
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 0cb139458..ed0f717d4 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -39,9 +39,6 @@
#include "desktop-handles.h"
#include "macros.h"
-static void box3d_class_init(SPBox3DClass *klass);
-static void box3d_init(SPBox3D *box3d);
-
static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void box3d_release(SPObject *object);
static void box3d_set(SPObject *object, unsigned int key, const gchar *value);
@@ -54,41 +51,15 @@ static void box3d_convert_to_guides(SPItem *item);
static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box);
-static SPGroupClass *parent_class;
-
static gint counter = 0;
-GType
-box3d_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPBox3DClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) box3d_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPBox3D),
- 16, /* n_preallocs */
- (GInstanceInitFunc) box3d_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GROUP, "SPBox3D", &info, (GTypeFlags) 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE(SPBox3D, box3d, SP_TYPE_GROUP);
static void box3d_class_init(SPBox3DClass *klass)
{
SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
SPItemClass *item_class = SP_ITEM_CLASS(klass);
- parent_class = SP_GROUP_CLASS(g_type_class_ref(SP_TYPE_GROUP));
-
sp_object_class->build = box3d_build;
sp_object_class->release = box3d_release;
sp_object_class->set = box3d_set;
@@ -109,8 +80,8 @@ box3d_init(SPBox3D *box)
static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if ((SP_OBJECT_CLASS(parent_class))->build) {
- (SP_OBJECT_CLASS(parent_class))->build(object, document, repr);
+ if ((SP_OBJECT_CLASS(box3d_parent_class))->build) {
+ (SP_OBJECT_CLASS(box3d_parent_class))->build(object, document, repr);
}
SPBox3D *box = SP_BOX3D (object);
@@ -172,8 +143,8 @@ box3d_release(SPObject *object)
*/
}
- if ((SP_OBJECT_CLASS(parent_class))->release)
- (SP_OBJECT_CLASS(parent_class))->release(object);
+ if ((SP_OBJECT_CLASS(box3d_parent_class))->release)
+ (SP_OBJECT_CLASS(box3d_parent_class))->release(object);
}
static void
@@ -224,8 +195,8 @@ box3d_set(SPObject *object, unsigned int key, const gchar *value)
}
break;
default:
- if ((SP_OBJECT_CLASS(parent_class))->set) {
- (SP_OBJECT_CLASS(parent_class))->set(object, key, value);
+ if ((SP_OBJECT_CLASS(box3d_parent_class))->set) {
+ (SP_OBJECT_CLASS(box3d_parent_class))->set(object, key, value);
}
break;
}
@@ -259,8 +230,8 @@ box3d_update(SPObject *object, SPCtx *ctx, guint flags)
}
// Invoke parent method
- if ((SP_OBJECT_CLASS(parent_class))->update)
- (SP_OBJECT_CLASS(parent_class))->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(box3d_parent_class))->update)
+ (SP_OBJECT_CLASS(box3d_parent_class))->update(object, ctx, flags);
}
@@ -306,8 +277,8 @@ static Inkscape::XML::Node * box3d_write(SPObject *object, Inkscape::XML::Docume
box->save_corner7 = box->orig_corner7;
}
- if ((SP_OBJECT_CLASS(parent_class))->write) {
- (SP_OBJECT_CLASS(parent_class))->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(box3d_parent_class))->write) {
+ (SP_OBJECT_CLASS(box3d_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/dom/css.h b/src/dom/css.h
index 2776b6d20..f270b99eb 100644
--- a/src/dom/css.h
+++ b/src/dom/css.h
@@ -269,8 +269,8 @@ public:
*
*/
CSSRuleList(const CSSRuleList &other)
+ : rules (other.rules)
{
- rules = other.rules;
}
/**
@@ -1012,9 +1012,10 @@ public:
/**
*
*/
- CSSFontFaceRule(const CSSFontFaceRule &other) : CSSRule(other)
+ CSSFontFaceRule(const CSSFontFaceRule &other)
+ : CSSRule(other),
+ style (other.style)
{
- style = other.style;
}
/**
@@ -1433,9 +1434,10 @@ public:
/**
*
*/
- CSSValueList(const CSSValueList &other) : CSSValue(other)
+ CSSValueList(const CSSValueList &other)
+ : CSSValue(other),
+ items (other.items)
{
- items = other.items;
}
/**
@@ -2014,8 +2016,8 @@ public:
*
*/
ElementCSSInlineStyle(const ElementCSSInlineStyle &other)
+ : style (other.style)
{
- style = other.style;
}
/**
diff --git a/src/dom/dom.h b/src/dom/dom.h
index c12c02869..22fd09ebf 100644
--- a/src/dom/dom.h
+++ b/src/dom/dom.h
@@ -224,7 +224,8 @@ public:
DOMException(const DOMString &reasonMsg)
- { msg = reasonMsg; }
+ : msg (reasonMsg)
+ { }
DOMException(short theCode)
{
@@ -318,8 +319,8 @@ public:
*
*/
DOMStringList(const DOMStringList &other)
+ : strings (other.strings)
{
- strings = other.strings;
}
/**
@@ -369,14 +370,14 @@ private:
{
public:
NamePair(const DOMString &theNamespaceURI, const DOMString &theName)
+ : namespaceURI (theNamespaceURI),
+ name (theName)
{
- namespaceURI = theNamespaceURI;
- name = theName;
}
NamePair(const NamePair &other)
+ : namespaceURI (other.namespaceURI),
+ name (other.name)
{
- namespaceURI = other.namespaceURI;
- name = other.name;
}
NamePair &operator=(const NamePair &other)
{
@@ -463,8 +464,8 @@ public:
*
*/
NameList(const NameList &other)
+ : namePairs (other.namePairs)
{
- namePairs = other.namePairs;
}
/**
@@ -533,8 +534,8 @@ public:
*
*/
DOMImplementationList(const DOMImplementationList &other)
+ : implementations (other.implementations)
{
- implementations = other.implementations;
}
/**
@@ -1018,8 +1019,8 @@ public:
*
*/
NodeList(const NodeList &other)
+ : nodes (other.nodes)
{
- nodes = other.nodes;
}
/**
@@ -1087,10 +1088,10 @@ private:
NamedNodeMapEntry(const DOMString &theNamespaceURI,
const DOMString &theName,
const NodePtr theNode)
+ : namespaceURI (theNamespaceURI),
+ name (theName),
+ node (theNode)
{
- namespaceURI = theNamespaceURI;
- name = theName;
- node = theNode;
}
NamedNodeMapEntry(const NamedNodeMapEntry &other)
{
@@ -1277,8 +1278,8 @@ public:
*
*/
NamedNodeMap(const NamedNodeMap &other)
+ : entries (other.entries)
{
- entries = other.entries;
}
/**
diff --git a/src/dom/domptr.h b/src/dom/domptr.h
index 5a1299867..aa9d4c208 100644
--- a/src/dom/domptr.h
+++ b/src/dom/domptr.h
@@ -153,7 +153,7 @@ public:
template<class Y> Ptr &operator=(const Y * ref)
{
decrementRefCount(_ref);
- _ref = (Y *) ref;
+ _ref = const_cast<Y *>(ref);
incrementRefCount(_ref);
return *this;
}
diff --git a/src/dom/stylesheets.h b/src/dom/stylesheets.h
index fc1bc9d88..2903b96d9 100644
--- a/src/dom/stylesheets.h
+++ b/src/dom/stylesheets.h
@@ -308,13 +308,14 @@ public:
*
*/
StyleSheet()
+ : type(""),
+ disabled (false),
+ ownerNode (NULL),
+ parentStylesheet (NULL),
+ href (""),
+ title (""),
+ mediaList ()
{
- type = "";
- disabled = false;
- ownerNode = NULL;
- parentStylesheet = NULL;
- href = "";
- title = "";
}
@@ -422,8 +423,8 @@ public:
*
*/
StyleSheetList(const StyleSheetList &other)
+ : sheets (other.sheets)
{
- sheets = other.sheets;
}
/**
@@ -489,8 +490,8 @@ public:
*
*/
LinkStyle(const LinkStyle &other)
+ : sheet (other.sheet)
{
- sheet = other.sheet;
}
/**
@@ -556,8 +557,8 @@ public:
*
*/
DocumentStyle(const DocumentStyle &other)
+ : styleSheets (other.styleSheets)
{
- styleSheets = other.styleSheets;
}
/**
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index 5c1cb673e..09079453f 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -3,7 +3,7 @@
/* Change the 'COLOR' above to be your file name */
/*
- * Copyright (C) 2011 Authors:
+ * Copyright (C) 2013 Authors:
* Ivan Louette (filters)
* Nicolas Dufour (UI) <nicoduf@yahoo.fr>
*
@@ -20,7 +20,8 @@
* Invert
* Lighting
* Lightness-contrast
- * Nudge
+ * Nudge RGB
+ * Nudge CMY
* Quadritone
* Solarize
* Tritone
@@ -1163,31 +1164,25 @@ LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext)
Filter's parameters:
Offsets
* Red
- * x (-100.->100., default -7) -> offset1 (dx)
- * y (-100.->100., default 5) -> offset1 (dy)
+ * x (-100.->100., default -6) -> offset1 (dx)
+ * y (-100.->100., default -6) -> offset1 (dy)
* Green
- * x (-100.->100., default 0) -> offset2 (dx)
- * y (-100.->100., default 10) -> offset2 (dy)
+ * x (-100.->100., default 6) -> offset2 (dx)
+ * y (-100.->100., default 7) -> offset2 (dy)
* Blue
- * x (-100.->100., default 3) -> offset3 (dx)
- * y (-100.->100., default -9) -> offset3 (dy)
+ * x (-100.->100., default 1) -> offset3 (dx)
+ * y (-100.->100., default -16) -> offset3 (dy)
Color
- * Background color (guint, default -1)-> flood (flood-color, flood-opacity)
- * Blend type (enum [normal,multiply and screen], default screen) -> blend1,2,3 (mode)
- * Blend source (enum, default color) ->
- * color: blend1 (in="flood")
- * image: blend1 (in="SourceGraphic")
- * background: blend1 (in="BackgroundImage")
- * Composite (enum [in,over], default over) -> composite (operator)
+ * Background color (guint, default 255)-> flood (flood-color, flood-opacity)
*/
-class Nudge : public Inkscape::Extension::Internal::Filter::Filter {
+class NudgeRGB : public Inkscape::Extension::Internal::Filter::Filter {
protected:
virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
public:
- Nudge ( ) : Filter() { };
- virtual ~Nudge ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
+ NudgeRGB ( ) : Filter() { };
+ virtual ~NudgeRGB ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
static void init (void) {
Inkscape::Extension::build_from_mem(
@@ -1197,31 +1192,17 @@ public:
"<param name=\"tab\" type=\"notebook\">\n"
"<page name=\"offsettab\" _gui-text=\"Offset\">\n"
"<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Red offset") "</_param>\n"
- "<param name=\"rx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-7</param>\n"
- "<param name=\"ry\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">5</param>\n"
+ "<param name=\"rx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<param name=\"ry\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
"<_param name=\"greenOffset\" type=\"description\" appearance=\"header\">" N_("Green offset") "</_param>\n"
- "<param name=\"gx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">0</param>\n"
- "<param name=\"gy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">10</param>\n"
+ "<param name=\"gx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">6</param>\n"
+ "<param name=\"gy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">7</param>\n"
"<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Blue offset") "</_param>\n"
- "<param name=\"bx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">3</param>\n"
- "<param name=\"by\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-9</param>\n"
+ "<param name=\"bx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">1</param>\n"
+ "<param name=\"by\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-16</param>\n"
"</page>\n"
"<page name=\"coltab\" _gui-text=\"Color\">\n"
"<param name=\"color\" gui-text=\"" N_("Background color") "\" type=\"color\">255</param>\n"
- "<param name=\"blend\" gui-text=\"" N_("Blend type:") "\" type=\"enum\">\n"
- "<_item value=\"screen\">" N_("Screen") "</_item>\n"
- "<_item value=\"multiply\">" N_("Multiply") "</_item>\n"
- "<_item value=\"normal\">" N_("Normal") "</_item>\n"
- "</param>\n"
- "<param name=\"source\" gui-text=\"" N_("Blend source:") "\" type=\"enum\">\n"
- "<_item value=\"flood\">" N_("Color") "</_item>\n"
- "<_item value=\"SourceGraphic\">" N_("Image") "</_item>\n"
- "<_item value=\"BackgroundImage\">" N_("Background") "</_item>\n"
- "</param>\n"
- "<param name=\"composite\" gui-text=\"" N_("Composite:") "\" type=\"enum\">\n"
- "<_item value=\"over\">" N_("Over") "</_item>\n"
- "<_item value=\"in\">" N_("In") "</_item>\n"
- "</param>\n"
"</page>\n"
"</param>\n"
"<effect>\n"
@@ -1233,12 +1214,12 @@ public:
"</effects-menu>\n"
"<menu-tip>" N_("Nudge RGB channels separately and blend them to different types of backgrounds") "</menu-tip>\n"
"</effect>\n"
- "</inkscape-extension>\n", new Nudge());
+ "</inkscape-extension>\n", new NudgeRGB());
};
};
gchar const *
-Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
+NudgeRGB::get_filter_text (Inkscape::Extension::Extension * ext)
{
if (_filter != NULL) g_free((void *)_filter);
@@ -1249,10 +1230,6 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
std::ostringstream bx;
std::ostringstream by;
- std::ostringstream blend;
- std::ostringstream source;
- std::ostringstream composite;
-
std::ostringstream a;
std::ostringstream r;
std::ostringstream g;
@@ -1265,10 +1242,6 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
bx << ext->get_param_float("bx");
by << ext->get_param_float("by");
- blend << ext->get_param_enum("blend");
- source << ext->get_param_enum("source");
- composite << ext->get_param_enum("composite");
-
guint32 color = ext->get_param_color("color");
r << ((color >> 24) & 0xff);
g << ((color >> 16) & 0xff);
@@ -1280,25 +1253,135 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext)
"<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 \" result=\"colormatrix1\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset1\" />\n"
- "<feBlend in2=\"%s\" mode=\"%s\" result=\"blend1\" />\n"
+ "<feBlend in2=\"flood\" mode=\"screen\" result=\"blend1\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 \" result=\"colormatrix2\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset2\" />\n"
- "<feBlend in2=\"blend1\" mode=\"%s\" result=\"blend2\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"screen\" result=\"blend2\" />\n"
"<feOffset dy=\"%s\" dx=\"%s\" result=\"offset3\" />\n"
"<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 \" result=\"colormatrix3\" />\n"
- "<feBlend in2=\"offset3\" mode=\"%s\" result=\"blend3\" />\n"
- "<feComposite in2=\"SourceGraphic\" operator=\"%s\" />\n"
+ "<feBlend in2=\"offset3\" mode=\"screen\" result=\"blend3\" />\n"
"</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(),
- rx.str().c_str(), ry.str().c_str(), source.str().c_str(), blend.str().c_str(),
- gx.str().c_str(), gy.str().c_str(), blend.str().c_str(),
- bx.str().c_str(), by.str().c_str(), blend.str().c_str(),
- composite.str().c_str() );
+ rx.str().c_str(), ry.str().c_str(),
+ gx.str().c_str(), gy.str().c_str(),
+ bx.str().c_str(), by.str().c_str() );
return _filter;
}; /* Nudge RGB filter */
/**
+ \brief Custom predefined Nudge CMY filter.
+
+ Nudge CMY channels separately and blend them to different types of backgrounds
+
+ Filter's parameters:
+ Offsets
+ * Cyan
+ * x (-100.->100., default -6) -> offset1 (dx)
+ * y (-100.->100., default -6) -> offset1 (dy)
+ * Magenta
+ * x (-100.->100., default 6) -> offset2 (dx)
+ * y (-100.->100., default 7) -> offset2 (dy)
+ * Yellow
+ * x (-100.->100., default 1) -> offset3 (dx)
+ * y (-100.->100., default -16) -> offset3 (dy)
+ Color
+ * Background color (guint, default -1)-> flood (flood-color, flood-opacity)
+*/
+class NudgeCMY : public Inkscape::Extension::Internal::Filter::Filter {
+protected:
+ virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
+
+public:
+ NudgeCMY ( ) : Filter() { };
+ virtual ~NudgeCMY ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
+
+ static void init (void) {
+ Inkscape::Extension::build_from_mem(
+ "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
+ "<name>" N_("Nudge CMY") "</name>\n"
+ "<id>org.inkscape.effect.filter.NudgeCMY</id>\n"
+ "<param name=\"tab\" type=\"notebook\">\n"
+ "<page name=\"offsettab\" _gui-text=\"Offset\">\n"
+ "<_param name=\"cyanOffset\" type=\"description\" appearance=\"header\">" N_("Cyan offset") "</_param>\n"
+ "<param name=\"cx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<param name=\"cy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-6</param>\n"
+ "<_param name=\"magentaOffset\" type=\"description\" appearance=\"header\">" N_("Magenta offset") "</_param>\n"
+ "<param name=\"mx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">6</param>\n"
+ "<param name=\"my\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">7</param>\n"
+ "<_param name=\"yellowOffset\" type=\"description\" appearance=\"header\">" N_("Yellow offset") "</_param>\n"
+ "<param name=\"yx\" gui-text=\"" N_("X:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">1</param>\n"
+ "<param name=\"yy\" gui-text=\"" N_("Y:") "\" type=\"float\" indent=\"1\" appearance=\"full\" precision=\"2\" min=\"-100.\" max=\"100.\">-16</param>\n"
+ "</page>\n"
+ "<page name=\"coltab\" _gui-text=\"Color\">\n"
+ "<param name=\"color\" gui-text=\"" N_("Background color") "\" type=\"color\">-1</param>\n"
+ "</page>\n"
+ "</param>\n"
+ "<effect>\n"
+ "<object-type>all</object-type>\n"
+ "<effects-menu>\n"
+ "<submenu name=\"" N_("Filters") "\">\n"
+ "<submenu name=\"" N_("Color") "\"/>\n"
+ "</submenu>\n"
+ "</effects-menu>\n"
+ "<menu-tip>" N_("Nudge CMY channels separately and blend them to different types of backgrounds") "</menu-tip>\n"
+ "</effect>\n"
+ "</inkscape-extension>\n", new NudgeCMY());
+ };
+};
+
+gchar const *
+NudgeCMY::get_filter_text (Inkscape::Extension::Extension * ext)
+{
+ if (_filter != NULL) g_free((void *)_filter);
+
+ std::ostringstream cx;
+ std::ostringstream cy;
+ std::ostringstream mx;
+ std::ostringstream my;
+ std::ostringstream yx;
+ std::ostringstream yy;
+
+ std::ostringstream a;
+ std::ostringstream r;
+ std::ostringstream g;
+ std::ostringstream b;
+
+ cx << ext->get_param_float("cx");
+ cy << ext->get_param_float("cy");
+ mx << ext->get_param_float("mx");
+ my << ext->get_param_float("my");
+ yx << ext->get_param_float("yx");
+ yy << ext->get_param_float("yy");
+
+ guint32 color = ext->get_param_color("color");
+ r << ((color >> 24) & 0xff);
+ g << ((color >> 16) & 0xff);
+ b << ((color >> 8) & 0xff);
+ a << (color & 0xff) / 255.0F;
+
+ _filter = g_strdup_printf(
+ "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge CMY\">\n"
+ "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 0 0 1 0 \" result=\"colormatrix1\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset1\" />\n"
+ "<feBlend in2=\"flood\" mode=\"multiply\" result=\"blend1\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 1 0 \" result=\"colormatrix2\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset2\" />\n"
+ "<feBlend in2=\"blend1\" mode=\"multiply\" result=\"blend2\" />\n"
+ "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset3\" />\n"
+ "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -1 1 0 \" result=\"colormatrix3\" />\n"
+ "<feBlend in2=\"offset3\" mode=\"multiply\" result=\"blend3\" />\n"
+ "</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(),
+ cx.str().c_str(), cy.str().c_str(),
+ mx.str().c_str(), my.str().c_str(),
+ yx.str().c_str(), yy.str().c_str() );
+
+ return _filter;
+
+}; /* Nudge CMY filter */
+
+/**
\brief Custom predefined Quadritone filter.
Replace hue by two colors.
diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp
index b5d47ae45..0273d1669 100755
--- a/src/extension/internal/filter/filter-all.cpp
+++ b/src/extension/internal/filter/filter-all.cpp
@@ -64,7 +64,8 @@ Filter::filters_all (void )
Invert::init();
Lighting::init();
LightnessContrast::init();
- Nudge::init();
+ NudgeRGB::init();
+ NudgeCMY::init();
Quadritone::init();
Solarize::init();
Tritone::init();
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 3c656527e..a62be624c 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -75,8 +75,6 @@ using Inkscape::Display::ExtractARGB32;
using Inkscape::Display::ExtractRGB32;
using Inkscape::Display::AssembleARGB32;
-static void sp_flood_context_class_init(SPFloodContextClass *klass);
-static void sp_flood_context_init(SPFloodContext *flood_context);
static void sp_flood_context_dispose(GObject *object);
static void sp_flood_context_setup(SPEventContext *ec);
@@ -86,35 +84,13 @@ static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem
static void sp_flood_finish(SPFloodContext *rc);
-static SPEventContextClass *parent_class;
-
-
-GType sp_flood_context_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPFloodContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_flood_context_class_init,
- NULL, NULL,
- sizeof(SPFloodContext),
- 4,
- (GInstanceInitFunc) sp_flood_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPFloodContext", &info, (GTypeFlags) 0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPFloodContext, sp_flood_context, SP_TYPE_EVENT_CONTEXT);
static void sp_flood_context_class_init(SPFloodContextClass *klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
- parent_class = (SPEventContextClass *) g_type_class_peek_parent(klass);
-
object_class->dispose = sp_flood_context_dispose;
event_context_class->setup = sp_flood_context_setup;
@@ -160,7 +136,7 @@ static void sp_flood_context_dispose(GObject *object)
delete rc->_message_context;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_flood_context_parent_class)->dispose(object);
}
/**
@@ -181,8 +157,8 @@ static void sp_flood_context_setup(SPEventContext *ec)
{
SPFloodContext *rc = SP_FLOOD_CONTEXT(ec);
- if (((SPEventContextClass *) parent_class)->setup) {
- ((SPEventContextClass *) parent_class)->setup(ec);
+ if (((SPEventContextClass *) sp_flood_context_parent_class)->setup) {
+ ((SPEventContextClass *) sp_flood_context_parent_class)->setup(ec);
}
ec->shape_editor = new ShapeEditor(ec->desktop);
@@ -1166,8 +1142,8 @@ static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem
break;
}
- if (((SPEventContextClass *) parent_class)->item_handler) {
- ret = ((SPEventContextClass *) parent_class)->item_handler(event_context, item, event);
+ if (((SPEventContextClass *) sp_flood_context_parent_class)->item_handler) {
+ ret = ((SPEventContextClass *) sp_flood_context_parent_class)->item_handler(event_context, item, event);
}
return ret;
@@ -1274,8 +1250,8 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
}
if (!ret) {
- if (((SPEventContextClass *) parent_class)->root_handler) {
- ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
+ if (((SPEventContextClass *) sp_flood_context_parent_class)->root_handler) {
+ ret = ((SPEventContextClass *) sp_flood_context_parent_class)->root_handler(event_context, event);
}
}
diff --git a/src/id-clash.cpp b/src/id-clash.cpp
index 7a1e000fb..c8eacfe02 100644
--- a/src/id-clash.cpp
+++ b/src/id-clash.cpp
@@ -36,9 +36,9 @@ struct IdReference {
const char *attr; // property or href-like attribute
};
-typedef std::map<std::string, std::list<IdReference> > refmap_type;
+typedef std::map<Glib::ustring, std::list<IdReference> > refmap_type;
-typedef std::pair<SPObject*, std::string> id_changeitem_type;
+typedef std::pair<SPObject*, Glib::ustring> id_changeitem_type;
typedef std::list<id_changeitem_type> id_changelist_type;
const char *href_like_attributes[] = {
@@ -298,7 +298,6 @@ void
change_def_references(SPObject *from_obj, SPObject *to_obj)
{
refmap_type *refmap = new refmap_type;
- id_changelist_type id_changes;
SPDocument *current_doc = from_obj->document;
std::string old_id(from_obj->getId());
@@ -324,9 +323,15 @@ change_def_references(SPObject *from_obj, SPObject *to_obj)
*/
void rename_id(SPObject *elem, Glib::ustring const &new_name)
{
- gchar *id = g_strdup(new_name.c_str());
+ if (new_name.empty()){
+ g_message("Invalid Id, will not change.");
+ return;
+ }
+ gchar *id = g_strdup(new_name.c_str()); //id is not empty here as new_name is check to be not empty
g_strcanon (id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_');
- if (!*id || !isalnum (*id)) {
+ Glib::ustring new_name2 = id; //will not fail as id can not be NULL, see length check on new_name
+ g_free (id);
+ if (!isalnum (new_name2[0])) {
g_message("Invalid Id, will not change.");
return;
}
@@ -337,31 +342,27 @@ void rename_id(SPObject *elem, Glib::ustring const &new_name)
find_references(current_doc->getRoot(), refmap);
std::string old_id(elem->getId());
- std::string new_id(id);
- if (id && current_doc->getObjectById(id)) {
+ if (current_doc->getObjectById(id)) {
// Choose a new ID.
// To try to preserve any meaningfulness that the original ID
// may have had, the new ID is the old ID followed by a hyphen
// and one or more digits.
- new_id += '-';
+ new_name2 += '-';
for (;;) {
- new_id += "0123456789"[std::rand() % 10];
- const char *str = new_id.c_str();
- if (current_doc->getObjectById(str) == NULL)
+ new_name2 += "0123456789"[std::rand() % 10];
+ if (current_doc->getObjectById(new_name2) == NULL)
break;
}
}
// Change to the new ID
- elem->getRepr()->setAttribute("id", new_id.c_str());
+ elem->getRepr()->setAttribute("id", new_name2.c_str());
// Make a note of this change, if we need to fix up refs to it
if (refmap->find(old_id) != refmap->end()) {
id_changes.push_back(id_changeitem_type(elem, old_id));
}
fix_up_refs(refmap, id_changes);
-
- g_free (id);
delete refmap;
}
diff --git a/src/ink-action.cpp b/src/ink-action.cpp
index c79cebd1e..dd1fe5484 100644
--- a/src/ink-action.cpp
+++ b/src/ink-action.cpp
@@ -7,8 +7,6 @@
#include "widgets/button.h"
-static void ink_action_class_init( InkActionClass* klass );
-static void ink_action_init( InkAction* action );
static void ink_action_finalize( GObject* obj );
static void ink_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
static void ink_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
@@ -16,8 +14,6 @@ static void ink_action_set_property( GObject* obj, guint propId, const GValue *v
static GtkWidget* ink_action_create_menu_item( GtkAction* action );
static GtkWidget* ink_action_create_tool_item( GtkAction* action );
-static GtkActionClass* gInkActionParentClass = 0;
-
struct _InkActionPrivate
{
gchar* iconId;
@@ -26,28 +22,7 @@ struct _InkActionPrivate
#define INK_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_ACTION_TYPE, InkActionPrivate ) )
-GType ink_action_get_type( void )
-{
- static GType myType = 0;
- if ( !myType ) {
- static const GTypeInfo myInfo = {
- sizeof( InkActionClass ),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)ink_action_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof( InkAction ),
- 0, /* n_preallocs */
- (GInstanceInitFunc)ink_action_init,
- NULL
- };
-
- myType = g_type_register_static( GTK_TYPE_ACTION, "InkAction", &myInfo, (GTypeFlags)0 );
- }
-
- return myType;
-}
+G_DEFINE_TYPE(InkAction, ink_action, GTK_TYPE_ACTION);
enum {
PROP_INK_ID = 1,
@@ -57,7 +32,6 @@ enum {
static void ink_action_class_init( InkActionClass* klass )
{
if ( klass ) {
- gInkActionParentClass = GTK_ACTION_CLASS( g_type_class_peek_parent( klass ) );
GObjectClass * objClass = G_OBJECT_CLASS( klass );
objClass->finalize = ink_action_finalize;
@@ -203,7 +177,7 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action )
g_free( label );
label = 0;
} else {
- item = gInkActionParentClass->create_menu_item( action );
+ item = GTK_ACTION_CLASS(ink_action_parent_class)->create_menu_item( action );
}
return item;
@@ -212,7 +186,7 @@ static GtkWidget* ink_action_create_menu_item( GtkAction* action )
static GtkWidget* ink_action_create_tool_item( GtkAction* action )
{
InkAction* act = INK_ACTION( action );
- GtkWidget* item = gInkActionParentClass->create_tool_item(action);
+ GtkWidget* item = GTK_ACTION_CLASS(ink_action_parent_class)->create_tool_item(action);
if ( act->private_data->iconId ) {
if ( GTK_IS_TOOL_BUTTON(item) ) {
@@ -241,8 +215,6 @@ static GtkWidget* ink_action_create_tool_item( GtkAction* action )
/* --------------------------------------------------------------- */
-static void ink_toggle_action_class_init( InkToggleActionClass* klass );
-static void ink_toggle_action_init( InkToggleAction* action );
static void ink_toggle_action_finalize( GObject* obj );
static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
static void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
@@ -252,8 +224,6 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action );
static void ink_toggle_action_update_icon( InkToggleAction* action );
-static GtkToggleActionClass* gInkToggleActionParentClass = 0;
-
struct _InkToggleActionPrivate
{
gchar* iconId;
@@ -262,34 +232,11 @@ struct _InkToggleActionPrivate
#define INK_TOGGLE_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_TOGGLE_ACTION_TYPE, InkToggleActionPrivate ) )
-GType ink_toggle_action_get_type( void )
-{
- static GType myType = 0;
- if ( !myType ) {
- static const GTypeInfo myInfo = {
- sizeof( InkToggleActionClass ),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)ink_toggle_action_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof( InkToggleAction ),
- 0, /* n_preallocs */
- (GInstanceInitFunc)ink_toggle_action_init,
- NULL
- };
-
- myType = g_type_register_static( GTK_TYPE_TOGGLE_ACTION, "InkToggleAction", &myInfo, (GTypeFlags)0 );
- }
-
- return myType;
-}
-
+G_DEFINE_TYPE(InkToggleAction, ink_toggle_action, GTK_TYPE_TOGGLE_ACTION);
static void ink_toggle_action_class_init( InkToggleActionClass* klass )
{
if ( klass ) {
- gInkToggleActionParentClass = GTK_TOGGLE_ACTION_CLASS( g_type_class_peek_parent( klass ) );
GObjectClass * objClass = G_OBJECT_CLASS( klass );
objClass->finalize = ink_toggle_action_finalize;
@@ -413,7 +360,7 @@ void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *v
static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action )
{
- GtkWidget* item = gInkToggleActionParentClass->parent_class.create_menu_item(action);
+ GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_menu_item(action);
return item;
}
@@ -422,7 +369,7 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action )
{
InkToggleAction* act = INK_TOGGLE_ACTION( action );
- GtkWidget* item = gInkToggleActionParentClass->parent_class.create_tool_item(action);
+ GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_tool_item(action);
if ( GTK_IS_TOOL_BUTTON(item) ) {
GtkToolButton* button = GTK_TOOL_BUTTON(item);
if ( act->private_data->iconId ) {
@@ -477,8 +424,6 @@ static void ink_toggle_action_update_icon( InkToggleAction* action )
/* --------------------------------------------------------------- */
-static void ink_radio_action_class_init( InkRadioActionClass* klass );
-static void ink_radio_action_init( InkRadioAction* action );
static void ink_radio_action_finalize( GObject* obj );
static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
static void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
@@ -486,8 +431,6 @@ static void ink_radio_action_set_property( GObject* obj, guint propId, const GVa
static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action );
static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action );
-static GtkRadioActionClass* gInkRadioActionParentClass = 0;
-
struct _InkRadioActionPrivate
{
gchar* iconId;
@@ -496,34 +439,11 @@ struct _InkRadioActionPrivate
#define INK_RADIO_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_RADIO_ACTION_TYPE, InkRadioActionPrivate ) )
-GType ink_radio_action_get_type( void )
-{
- static GType myType = 0;
- if ( !myType ) {
- static const GTypeInfo myInfo = {
- sizeof( InkRadioActionClass ),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)ink_radio_action_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof( InkRadioAction ),
- 0, /* n_preallocs */
- (GInstanceInitFunc)ink_radio_action_init,
- NULL
- };
-
- myType = g_type_register_static( GTK_TYPE_RADIO_ACTION, "InkRadioAction", &myInfo, (GTypeFlags)0 );
- }
-
- return myType;
-}
-
+G_DEFINE_TYPE(InkRadioAction, ink_radio_action, GTK_TYPE_RADIO_ACTION);
static void ink_radio_action_class_init( InkRadioActionClass* klass )
{
if ( klass ) {
- gInkRadioActionParentClass = GTK_RADIO_ACTION_CLASS( g_type_class_peek_parent( klass ) );
GObjectClass * objClass = G_OBJECT_CLASS( klass );
objClass->finalize = ink_radio_action_finalize;
@@ -642,7 +562,7 @@ void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *va
static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action )
{
- GtkWidget* item = gInkRadioActionParentClass->parent_class.parent_class.create_menu_item(action);
+ GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_menu_item(action);
return item;
}
@@ -650,7 +570,7 @@ static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action )
static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
{
InkRadioAction* act = INK_RADIO_ACTION( action );
- GtkWidget* item = gInkRadioActionParentClass->parent_class.parent_class.create_tool_item(action);
+ GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_tool_item(action);
if ( act->private_data->iconId ) {
if ( GTK_IS_TOOL_BUTTON(item) ) {
@@ -681,34 +601,7 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
-static void ink_tool_menu_action_init (InkToolMenuAction *tma);
-static void ink_tool_menu_action_class_init (InkToolMenuActionClass *klass);
-
-GType
-ink_tool_menu_action_get_type (void)
-{
- static GType myType = 0;
- if (! myType)
- {
- static const GTypeInfo myInfo =
- {
- sizeof (InkToolMenuActionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ink_tool_menu_action_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (InkToolMenuAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ink_tool_menu_action_init,
- NULL
- };
-
- myType = g_type_register_static( INK_ACTION_TYPE, "InkToolMenuAction", &myInfo, (GTypeFlags)0 );
- }
-
- return myType;
-}
+G_DEFINE_TYPE(InkToolMenuAction, ink_tool_menu_action, INK_ACTION_TYPE);
static void
ink_tool_menu_action_class_init (InkToolMenuActionClass *klass)
diff --git a/src/marker.cpp b/src/marker.cpp
index 8acac805b..ba5cd4b05 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -35,9 +35,6 @@ struct SPMarkerView {
std::vector<Inkscape::DrawingItem *> items;
};
-static void sp_marker_class_init (SPMarkerClass *klass);
-static void sp_marker_init (SPMarker *marker);
-
static void sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_marker_release (SPObject *object);
static void sp_marker_set (SPObject *object, unsigned int key, const gchar *value);
@@ -51,30 +48,7 @@ static void sp_marker_print (SPItem *item, SPPrintContext *ctx);
static void sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destroyitems);
-static SPGroupClass *parent_class = 0;
-
-/**
- * Registers the SPMarker class with Gdk and returns its type number.
- */
-GType
-sp_marker_get_type (void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof (SPMarkerClass),
- NULL, NULL,
- (GClassInitFunc) sp_marker_class_init,
- NULL, NULL,
- sizeof (SPMarker),
- 16,
- (GInstanceInitFunc) sp_marker_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_GROUP, "SPMarker", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPMarker, sp_marker, SP_TYPE_GROUP);
/**
* Initializes a SPMarkerClass object. Establishes the function pointers to the class'
@@ -85,18 +59,16 @@ static void sp_marker_class_init(SPMarkerClass *klass)
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
SPItemClass *sp_item_class = reinterpret_cast<SPItemClass *>(klass);
- parent_class = reinterpret_cast<SPGroupClass *>(g_type_class_ref(SP_TYPE_GROUP));
-
- sp_object_class->build = sp_marker_build;
- sp_object_class->release = sp_marker_release;
- sp_object_class->set = sp_marker_set;
- sp_object_class->update = sp_marker_update;
- sp_object_class->write = sp_marker_write;
+ sp_object_class->build = sp_marker_build;
+ sp_object_class->release = sp_marker_release;
+ sp_object_class->set = sp_marker_set;
+ sp_object_class->update = sp_marker_update;
+ sp_object_class->write = sp_marker_write;
- sp_item_class->show = sp_marker_private_show;
- sp_item_class->hide = sp_marker_private_hide;
- sp_item_class->bbox = sp_marker_bbox;
- sp_item_class->print = sp_marker_print;
+ sp_item_class->show = sp_marker_private_show;
+ sp_item_class->hide = sp_marker_private_hide;
+ sp_item_class->bbox = sp_marker_bbox;
+ sp_item_class->print = sp_marker_print;
}
/**
@@ -132,8 +104,8 @@ static void sp_marker_build(SPObject *object, SPDocument *document, Inkscape::XM
object->readAttr( "viewBox" );
object->readAttr( "preserveAspectRatio" );
- if (reinterpret_cast<SPObjectClass *>(parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(parent_class)->build(object, document, repr);
+ if (reinterpret_cast<SPObjectClass *>(sp_marker_parent_class)->build) {
+ reinterpret_cast<SPObjectClass *>(sp_marker_parent_class)->build(object, document, repr);
}
}
@@ -156,12 +128,12 @@ static void sp_marker_release(SPObject *object)
while (marker->views) {
// Destroy all DrawingItems etc.
// Parent class ::hide method
- reinterpret_cast<SPItemClass *>(parent_class)->hide(marker, marker->views->key);
+ reinterpret_cast<SPItemClass *>(sp_marker_parent_class)->hide(marker, marker->views->key);
sp_marker_view_remove (marker, marker->views, TRUE);
}
- if (reinterpret_cast<SPObjectClass *>(parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_marker_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_marker_parent_class)->release(object);
}
}
@@ -311,8 +283,8 @@ static void sp_marker_set(SPObject *object, unsigned int key, const gchar *value
}
break;
default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set (object, key, value);
+ if (((SPObjectClass *) sp_marker_parent_class)->set)
+ ((SPObjectClass *) sp_marker_parent_class)->set (object, key, value);
break;
}
}
@@ -430,8 +402,8 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags)
}
// And invoke parent method
- if (((SPObjectClass *) (parent_class))->update) {
- ((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags);
+ if (((SPObjectClass *) (sp_marker_parent_class))->update) {
+ ((SPObjectClass *) (sp_marker_parent_class))->update (object, (SPCtx *) &rctx, flags);
}
// As last step set additional transform of drawing group
@@ -503,8 +475,8 @@ sp_marker_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
//XML Tree being used directly here while it shouldn't be....
repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio"));
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_marker_parent_class))->write)
+ ((SPObjectClass *) (sp_marker_parent_class))->write (object, xml_doc, repr, flags);
return repr;
}
@@ -572,7 +544,7 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size)
if (view && (view->items.size() != size)) {
/* Free old view and allocate new */
/* Parent class ::hide method */
- ((SPItemClass *) parent_class)->hide ((SPItem *) marker, key);
+ ((SPItemClass *) sp_marker_parent_class)->hide ((SPItem *) marker, key);
sp_marker_view_remove (marker, view, TRUE);
view = NULL;
}
@@ -611,7 +583,7 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent,
}
if (!v->items[pos]) {
/* Parent class ::show method */
- v->items[pos] = ((SPItemClass *) parent_class)->show ((SPItem *) marker,
+ v->items[pos] = ((SPItemClass *) sp_marker_parent_class)->show ((SPItem *) marker,
parent->drawing(), key,
SP_ITEM_REFERENCE_FLAGS);
if (v->items[pos]) {
@@ -658,7 +630,7 @@ sp_marker_hide (SPMarker *marker, unsigned int key)
next = v->next;
if (v->key == key) {
/* Parent class ::hide method */
- ((SPItemClass *) parent_class)->hide ((SPItem *) marker, key);
+ ((SPItemClass *) sp_marker_parent_class)->hide ((SPItem *) marker, key);
sp_marker_view_remove (marker, v, TRUE);
return;
}
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 5934d615c..2684cbc1e 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -51,9 +51,6 @@
using Inkscape::DocumentUndo;
-
-static void sp_select_context_class_init(SPSelectContextClass *klass);
-static void sp_select_context_init(SPSelectContext *select_context);
static void sp_select_context_dispose(GObject *object);
static void sp_select_context_setup(SPEventContext *ec);
@@ -61,8 +58,6 @@ static void sp_select_context_set(SPEventContext *ec, Inkscape::Preferences::Ent
static gint sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event);
static gint sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
-static SPEventContextClass *parent_class;
-
static GdkCursor *CursorSelectMouseover = NULL;
static GdkCursor *CursorSelectDragging = NULL;
GdkPixbuf *handles[13];
@@ -74,25 +69,7 @@ static gint xp = 0, yp = 0; // where drag started
static gint tolerance = 0;
static bool within_tolerance = false;
-GType
-sp_select_context_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPSelectContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_select_context_class_init,
- NULL, NULL,
- sizeof(SPSelectContext),
- 4,
- (GInstanceInitFunc) sp_select_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPSelectContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPSelectContext, sp_select_context, SP_TYPE_EVENT_CONTEXT);
static void
sp_select_context_class_init(SPSelectContextClass *klass)
@@ -100,8 +77,6 @@ sp_select_context_class_init(SPSelectContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_select_context_dispose;
event_context_class->setup = sp_select_context_setup;
@@ -180,7 +155,7 @@ sp_select_context_dispose(GObject *object)
CursorSelectMouseover = NULL;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_select_context_parent_class)->dispose(object);
}
static void
@@ -188,8 +163,8 @@ sp_select_context_setup(SPEventContext *ec)
{
SPSelectContext *select_context = SP_SELECT_CONTEXT(ec);
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->setup) {
+ (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->setup(ec);
}
SPDesktop *desktop = ec->desktop;
@@ -432,8 +407,8 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->item_handler)
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->item_handler(event_context, item, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->item_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->item_handler(event_context, item, event);
}
return ret;
@@ -1150,8 +1125,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler)
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->root_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->root_handler(event_context, event);
}
return ret;
diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp
index 517512eb2..8b52cf400 100644
--- a/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
@@ -25,9 +25,6 @@
#include "ui/view/view.h"
#include "document.h"
-static void sp_anchor_class_init(SPAnchorClass *ac);
-static void sp_anchor_init(SPAnchor *anchor);
-
static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_anchor_release(SPObject *object);
static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value);
@@ -36,38 +33,13 @@ static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Doc
static gchar *sp_anchor_description(SPItem *item);
static gint sp_anchor_event(SPItem *item, SPEvent *event);
-static SPGroupClass *parent_class;
-
-GType sp_anchor_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPAnchorClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_anchor_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPAnchor),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_anchor_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GROUP, "SPAnchor", &info, (GTypeFlags) 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE(SPAnchor, sp_anchor, SP_TYPE_GROUP);
static void sp_anchor_class_init(SPAnchorClass *ac)
{
SPObjectClass *sp_object_class = (SPObjectClass *) ac;
SPItemClass *item_class = (SPItemClass *) ac;
- parent_class = (SPGroupClass *) g_type_class_ref(SP_TYPE_GROUP);
-
sp_object_class->build = sp_anchor_build;
sp_object_class->release = sp_anchor_release;
sp_object_class->set = sp_anchor_set;
@@ -84,8 +56,8 @@ static void sp_anchor_init(SPAnchor *anchor)
static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (parent_class))->build) {
- ((SPObjectClass *) (parent_class))->build(object, document, repr);
+ if (((SPObjectClass *) (sp_anchor_parent_class))->build) {
+ ((SPObjectClass *) (sp_anchor_parent_class))->build(object, document, repr);
}
object->readAttr( "xlink:type" );
@@ -107,8 +79,8 @@ static void sp_anchor_release(SPObject *object)
anchor->href = NULL;
}
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_anchor_parent_class)->release) {
+ ((SPObjectClass *) sp_anchor_parent_class)->release(object);
}
}
@@ -132,8 +104,8 @@ static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) (parent_class))->set) {
- ((SPObjectClass *) (parent_class))->set(object, key, value);
+ if (((SPObjectClass *) (sp_anchor_parent_class))->set) {
+ ((SPObjectClass *) (sp_anchor_parent_class))->set(object, key, value);
}
break;
}
@@ -164,8 +136,8 @@ static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Doc
COPY_ATTR(repr, object->getRepr(), "target");
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_anchor_parent_class))->write) {
+ ((SPObjectClass *) (sp_anchor_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 47d9be2c1..059cbcf2b 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -37,46 +37,34 @@ struct SPClipPathView {
Geom::OptRect bbox;
};
-SPClipPathView *sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, Inkscape::DrawingItem *arenaitem);
-SPClipPathView *sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
-
-SPObjectGroupClass * SPClipPathClass::static_parent_class = 0;
-
-GType
-SPClipPath::sp_clippath_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPClipPathClass),
- NULL, NULL,
- (GClassInitFunc) SPClipPathClass::sp_clippath_class_init,
- NULL, NULL,
- sizeof(SPClipPath),
- 16,
- (GInstanceInitFunc) SPClipPath::init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECTGROUP, "SPClipPath", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-void SPClipPathClass::sp_clippath_class_init(SPClipPathClass *klass)
+static void sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
+static void sp_clippath_release(SPObject * object);
+static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *value);
+static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
+static void sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags);
+static void sp_clippath_modified(SPObject *object, guint flags);
+static Inkscape::XML::Node* sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+static SPClipPathView* sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, Inkscape::DrawingItem *arenaitem);
+static SPClipPathView* sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
+
+G_DEFINE_TYPE(SPClipPath, sp_clippath, SP_TYPE_OBJECTGROUP);
+
+static void
+sp_clippath_class_init(SPClipPathClass *klass)
{
SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
- static_parent_class = SP_OBJECTGROUP_CLASS(g_type_class_ref(SP_TYPE_OBJECTGROUP));
-
- sp_object_class->build = SPClipPath::build;
- sp_object_class->release = SPClipPath::release;
- sp_object_class->set = SPClipPath::set;
- sp_object_class->child_added = SPClipPath::childAdded;
- sp_object_class->update = SPClipPath::update;
- sp_object_class->modified = SPClipPath::modified;
- sp_object_class->write = SPClipPath::write;
+
+ sp_object_class->build = sp_clippath_build;
+ sp_object_class->release = sp_clippath_release;
+ sp_object_class->set = sp_clippath_set;
+ sp_object_class->child_added = sp_clippath_child_added;
+ sp_object_class->update = sp_clippath_update;
+ sp_object_class->modified = sp_clippath_modified;
+ sp_object_class->write = sp_clippath_write;
}
-void SPClipPath::init(SPClipPath *cp)
+static void
+sp_clippath_init(SPClipPath *cp)
{
cp->clipPathUnits_set = FALSE;
cp->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
@@ -84,10 +72,11 @@ void SPClipPath::init(SPClipPath *cp)
cp->display = NULL;
}
-void SPClipPath::build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+static void
+sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) SPClipPathClass::static_parent_class)->build)
- ((SPObjectClass *) SPClipPathClass::static_parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_clippath_parent_class)->build)
+ ((SPObjectClass *) sp_clippath_parent_class)->build(object, document, repr);
object->readAttr( "style" );
object->readAttr( "clipPathUnits" );
@@ -96,7 +85,8 @@ void SPClipPath::build(SPObject *object, SPDocument *document, Inkscape::XML::No
document->addResource("clipPath", object);
}
-void SPClipPath::release(SPObject * object)
+static void
+sp_clippath_release(SPObject * object)
{
if (object->document) {
// Unregister ourselves
@@ -109,12 +99,13 @@ void SPClipPath::release(SPObject * object)
cp->display = sp_clippath_view_list_remove(cp->display, cp->display);
}
- if (((SPObjectClass *) (SPClipPathClass::static_parent_class))->release) {
- ((SPObjectClass *) SPClipPathClass::static_parent_class)->release(object);
+ if (((SPObjectClass *) (sp_clippath_parent_class))->release) {
+ ((SPObjectClass *) sp_clippath_parent_class)->release(object);
}
}
-void SPClipPath::set(SPObject *object, unsigned int key, gchar const *value)
+static void
+sp_clippath_set(SPObject *object, unsigned int key, gchar const *value)
{
SPClipPath *cp = SP_CLIPPATH(object);
@@ -137,18 +128,19 @@ void SPClipPath::set(SPObject *object, unsigned int key, gchar const *value)
sp_style_read_from_object(object->style, object);
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
} else {
- if (((SPObjectClass *) SPClipPathClass::static_parent_class)->set) {
- ((SPObjectClass *) SPClipPathClass::static_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_clippath_parent_class)->set) {
+ ((SPObjectClass *) sp_clippath_parent_class)->set(object, key, value);
}
}
break;
}
}
-void SPClipPath::childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
+static void
+sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
/* Invoke SPObjectGroup implementation */
- ((SPObjectClass *) (SPClipPathClass::static_parent_class))->child_added(object, child, ref);
+ ((SPObjectClass *) (sp_clippath_parent_class))->child_added(object, child, ref);
/* Show new object */
SPObject *ochild = object->document->getObjectByRepr(child);
@@ -165,7 +157,8 @@ void SPClipPath::childAdded(SPObject *object, Inkscape::XML::Node *child, Inksca
}
}
-void SPClipPath::update(SPObject *object, SPCtx *ctx, guint flags)
+static void
+sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -202,7 +195,8 @@ void SPClipPath::update(SPObject *object, SPCtx *ctx, guint flags)
}
}
-void SPClipPath::modified(SPObject *object, guint flags)
+static void
+sp_clippath_modified(SPObject *object, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -227,14 +221,15 @@ void SPClipPath::modified(SPObject *object, guint flags)
}
}
-Inkscape::XML::Node *SPClipPath::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_clippath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
repr = xml_doc->createElement("svg:clipPath");
}
- if (((SPObjectClass *) (SPClipPathClass::static_parent_class))->write) {
- ((SPObjectClass *) (SPClipPathClass::static_parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_clippath_parent_class))->write) {
+ ((SPObjectClass *) (sp_clippath_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-clippath.h b/src/sp-clippath.h
index 22877c3a9..a77383c63 100644
--- a/src/sp-clippath.h
+++ b/src/sp-clippath.h
@@ -15,7 +15,7 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#define SP_TYPE_CLIPPATH (SPClipPath::sp_clippath_get_type())
+#define SP_TYPE_CLIPPATH (sp_clippath_get_type())
#define SP_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CLIPPATH, SPClipPath))
#define SP_CLIPPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_CLIPPATH, SPClipPathClass))
#define SP_IS_CLIPPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CLIPPATH))
@@ -27,6 +27,7 @@ class SPClipPathView;
#include "uri-references.h"
#include "xml/node.h"
+GType sp_clippath_get_type() G_GNUC_CONST;
namespace Inkscape {
@@ -53,16 +54,6 @@ public:
Geom::OptRect geometricBounds(Geom::Affine const &transform);
private:
- static void init(SPClipPath *clippath);
-
- static void build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
- static void release(SPObject * object);
- static void set(SPObject *object, unsigned int key, gchar const *value);
- static void childAdded(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
- static void update(SPObject *object, SPCtx *ctx, guint flags);
- static void modified(SPObject *object, guint flags);
- static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
friend class SPClipPathClass;
};
@@ -71,9 +62,6 @@ public:
SPObjectGroupClass parent_class;
private:
- static void sp_clippath_class_init(SPClipPathClass *klass);
- static SPObjectGroupClass *static_parent_class;
-
friend class SPClipPath;
};
diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp
index 2737b3f5c..f7a906163 100644
--- a/src/sp-defs.cpp
+++ b/src/sp-defs.cpp
@@ -20,55 +20,45 @@
#include "xml/repr.h"
#include "document.h"
-SPObjectClass * SPDefsClass::static_parent_class = 0;
-
-GType SPDefs::sp_defs_get_type(void)
+static void sp_defs_release (SPObject *object);
+static void sp_defs_update (SPObject *object,
+ SPCtx *ctx,
+ guint flags);
+static void sp_defs_modified(SPObject *object,
+ guint flags);
+static Inkscape::XML::Node* sp_defs_write (SPObject *object,
+ Inkscape::XML::Document *doc,
+ Inkscape::XML::Node *repr,
+ guint flags);
+
+G_DEFINE_TYPE(SPDefs, sp_defs, SP_TYPE_OBJECT);
+
+static void
+sp_defs_class_init(SPDefsClass *dc)
{
- static GType defs_type = 0;
-
- if (!defs_type) {
- GTypeInfo defs_info = {
- sizeof(SPDefsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) SPDefsClass::sp_defs_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPDefs),
- 16, /* n_preallocs */
- (GInstanceInitFunc) init,
- NULL, /* value_table */
- };
- defs_type = g_type_register_static(SP_TYPE_OBJECT, "SPDefs", &defs_info, (GTypeFlags) 0);
- }
-
- return defs_type;
-}
-
-void SPDefsClass::sp_defs_class_init(SPDefsClass *dc)
-{
- static_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
SPObjectClass *sp_object_class = (SPObjectClass *) dc;
- sp_object_class->release = SPDefs::release;
- sp_object_class->update = SPDefs::update;
- sp_object_class->modified = SPDefs::modified;
- sp_object_class->write = SPDefs::write;
+ sp_object_class->release = sp_defs_release;
+ sp_object_class->update = sp_defs_update;
+ sp_object_class->modified = sp_defs_modified;
+ sp_object_class->write = sp_defs_write;
}
-void SPDefs::init(SPDefs */*defs*/)
+static void
+sp_defs_init(SPDefs * /*defs*/)
{
-
}
-void SPDefs::release(SPObject *object)
+static void
+sp_defs_release(SPObject *object)
{
- if (((SPObjectClass *) (SPDefsClass::static_parent_class))->release) {
- ((SPObjectClass *) (SPDefsClass::static_parent_class))->release(object);
+ if (((SPObjectClass *) (sp_defs_parent_class))->release) {
+ ((SPObjectClass *) (sp_defs_parent_class))->release(object);
}
}
-void SPDefs::update(SPObject *object, SPCtx *ctx, guint flags)
+static void
+sp_defs_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -87,7 +77,8 @@ void SPDefs::update(SPObject *object, SPCtx *ctx, guint flags)
}
}
-void SPDefs::modified(SPObject *object, guint flags)
+static void
+sp_defs_modified(SPObject *object, guint flags)
{
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -113,7 +104,8 @@ void SPDefs::modified(SPObject *object, guint flags)
}
}
-Inkscape::XML::Node * SPDefs::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_defs_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
@@ -141,8 +133,8 @@ Inkscape::XML::Node * SPDefs::write(SPObject *object, Inkscape::XML::Document *x
}
}
- if (((SPObjectClass *) (SPDefsClass::static_parent_class))->write) {
- (* ((SPObjectClass *) (SPDefsClass::static_parent_class))->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_defs_parent_class))->write) {
+ (* ((SPObjectClass *) (sp_defs_parent_class))->write)(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-defs.h b/src/sp-defs.h
index 83003f4ad..e1d343979 100644
--- a/src/sp-defs.h
+++ b/src/sp-defs.h
@@ -15,23 +15,16 @@
#include "sp-object.h"
-#define SP_TYPE_DEFS (SPDefs::sp_defs_get_type())
+#define SP_TYPE_DEFS (sp_defs_get_type())
#define SP_DEFS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_DEFS, SPDefs))
#define SP_DEFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_DEFS, SPDefsClass))
#define SP_IS_DEFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_DEFS))
#define SP_IS_DEFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_DEFS))
+GType sp_defs_get_type(void) G_GNUC_CONST;
+
class SPDefs : public SPObject {
-public:
- static GType sp_defs_get_type(void);
-
private:
- static void init(SPDefs *defs);
- static void release(SPObject *object);
- static void update(SPObject *object, SPCtx *ctx, guint flags);
- static void modified(SPObject *object, guint flags);
- static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
friend class SPDefsClass;
};
@@ -40,9 +33,6 @@ public:
SPObjectClass parent_class;
private:
- static void sp_defs_class_init(SPDefsClass *dc);
- static SPObjectClass *static_parent_class;
-
friend class SPDefs;
};
diff --git a/src/sp-desc.cpp b/src/sp-desc.cpp
index bbc47ecbb..9b27c4d17 100644
--- a/src/sp-desc.cpp
+++ b/src/sp-desc.cpp
@@ -16,36 +16,13 @@
#include "sp-desc.h"
#include "xml/repr.h"
-static void sp_desc_class_init(SPDescClass *klass);
-static void sp_desc_init(SPDesc *rect);
static Inkscape::XML::Node *sp_desc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static SPObjectClass *desc_parent_class;
-
-GType sp_desc_get_type (void)
-{
- static GType desc_type = 0;
-
- if (!desc_type) {
- GTypeInfo desc_info = {
- sizeof (SPDescClass),
- NULL, NULL,
- (GClassInitFunc) sp_desc_class_init,
- NULL, NULL,
- sizeof (SPDesc),
- 16,
- (GInstanceInitFunc) sp_desc_init,
- NULL, /* value_table */
- };
- desc_type = g_type_register_static (SP_TYPE_OBJECT, "SPDesc", &desc_info, (GTypeFlags)0);
- }
- return desc_type;
-}
+G_DEFINE_TYPE(SPDesc, sp_desc, SP_TYPE_OBJECT);
static void sp_desc_class_init(SPDescClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *)(klass);
- desc_parent_class = (SPObjectClass *)(g_type_class_ref(SP_TYPE_OBJECT));
sp_object_class->write = sp_desc_write;
}
@@ -63,8 +40,8 @@ static Inkscape::XML::Node *sp_desc_write(SPObject *object, Inkscape::XML::Docum
repr = object->getRepr()->duplicate(doc);
}
- if ((static_cast<SPObjectClass *>(desc_parent_class))->write) {
- (static_cast<SPObjectClass *>(desc_parent_class))->write(object, doc, repr, flags);
+ if ((static_cast<SPObjectClass *>(sp_desc_parent_class))->write) {
+ (static_cast<SPObjectClass *>(sp_desc_parent_class))->write(object, doc, repr, flags);
}
return repr;
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 6fe3a599b..8a9793852 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -64,9 +64,6 @@ static double sp_round(double x, double y)
}
#endif
-static void sp_genericellipse_class_init(SPGenericEllipseClass *klass);
-static void sp_genericellipse_init(SPGenericEllipse *ellipse);
-
static void sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags);
static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
@@ -79,29 +76,7 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::
static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr);
-static SPShapeClass *ge_parent_class;
-
-GType
-sp_genericellipse_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPGenericEllipseClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_genericellipse_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPGenericEllipse),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_genericellipse_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_SHAPE, "SPGenericEllipse", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPGenericEllipse, sp_genericellipse, SP_TYPE_SHAPE);
static void sp_genericellipse_class_init(SPGenericEllipseClass *klass)
{
@@ -110,8 +85,6 @@ static void sp_genericellipse_class_init(SPGenericEllipseClass *klass)
SPLPEItemClass *lpe_item_class = (SPLPEItemClass *) klass;
SPShapeClass *shape_class = (SPShapeClass *) klass;
- ge_parent_class = (SPShapeClass*) g_type_class_ref(SP_TYPE_SHAPE);
-
sp_object_class->update = sp_genericellipse_update;
sp_object_class->write = sp_genericellipse_write;
@@ -154,8 +127,8 @@ sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags)
static_cast<SPShape *>(object)->setShape();
}
- if (((SPObjectClass *) ge_parent_class)->update)
- ((SPObjectClass *) ge_parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_genericellipse_parent_class)->update)
+ ((SPObjectClass *) sp_genericellipse_parent_class)->update(object, ctx, flags);
}
static void
@@ -371,8 +344,8 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::
}
sp_genericellipse_set_shape ((SPShape *) ellipse); // evaluate SPCurve
- if (((SPObjectClass *) ge_parent_class)->write) {
- ((SPObjectClass *) ge_parent_class)->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_genericellipse_parent_class)->write) {
+ ((SPObjectClass *) sp_genericellipse_parent_class)->write(object, xml_doc, repr, flags);
}
return repr;
@@ -380,45 +353,18 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::
/* SVG <ellipse> element */
-static void sp_ellipse_class_init(SPEllipseClass *klass);
-static void sp_ellipse_init(SPEllipse *ellipse);
-
static void sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value);
static gchar *sp_ellipse_description(SPItem *item);
-static SPGenericEllipseClass *ellipse_parent_class;
-
-GType
-sp_ellipse_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPEllipseClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_ellipse_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPEllipse),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_ellipse_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GENERICELLIPSE, "SPEllipse", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPEllipse, sp_ellipse, SP_TYPE_GENERICELLIPSE);
static void sp_ellipse_class_init(SPEllipseClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPItemClass *item_class = (SPItemClass *) klass;
- ellipse_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE);
-
sp_object_class->build = sp_ellipse_build;
sp_object_class->write = sp_ellipse_write;
sp_object_class->set = sp_ellipse_set;
@@ -435,8 +381,8 @@ sp_ellipse_init(SPEllipse */*ellipse*/)
static void
sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) ellipse_parent_class)->build)
- (* ((SPObjectClass *) ellipse_parent_class)->build) (object, document, repr);
+ if (((SPObjectClass *) sp_ellipse_parent_class)->build)
+ (* ((SPObjectClass *) sp_ellipse_parent_class)->build) (object, document, repr);
object->readAttr( "cx" );
object->readAttr( "cy" );
@@ -460,8 +406,8 @@ sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
sp_repr_set_svg_double(repr, "rx", ellipse->rx.computed);
sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed);
- if (((SPObjectClass *) ellipse_parent_class)->write)
- (* ((SPObjectClass *) ellipse_parent_class)->write) (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_ellipse_parent_class)->write)
+ (* ((SPObjectClass *) sp_ellipse_parent_class)->write) (object, xml_doc, repr, flags);
return repr;
}
@@ -495,8 +441,8 @@ sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) ellipse_parent_class)->set)
- ((SPObjectClass *) ellipse_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_ellipse_parent_class)->set)
+ ((SPObjectClass *) sp_ellipse_parent_class)->set(object, key, value);
break;
}
}
@@ -527,37 +473,12 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd
/* SVG <circle> element */
-static void sp_circle_class_init(SPCircleClass *klass);
-static void sp_circle_init(SPCircle *circle);
-
static void sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_circle_set(SPObject *object, unsigned int key, gchar const *value);
static gchar *sp_circle_description(SPItem *item);
-static SPGenericEllipseClass *circle_parent_class;
-
-GType
-sp_circle_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPCircleClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_circle_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPCircle),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_circle_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GENERICELLIPSE, "SPCircle", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPCircle, sp_circle, SP_TYPE_GENERICELLIPSE);
static void
sp_circle_class_init(SPCircleClass *klass)
@@ -565,8 +486,6 @@ sp_circle_class_init(SPCircleClass *klass)
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPItemClass *item_class = (SPItemClass *) klass;
- circle_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE);
-
sp_object_class->build = sp_circle_build;
sp_object_class->write = sp_circle_write;
sp_object_class->set = sp_circle_set;
@@ -583,8 +502,8 @@ sp_circle_init(SPCircle */*circle*/)
static void
sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) circle_parent_class)->build)
- (* ((SPObjectClass *) circle_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_circle_parent_class)->build)
+ (* ((SPObjectClass *) sp_circle_parent_class)->build)(object, document, repr);
object->readAttr( "cx" );
object->readAttr( "cy" );
@@ -606,8 +525,8 @@ sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM
sp_repr_set_svg_double(repr, "cy", ellipse->cy.computed);
sp_repr_set_svg_double(repr, "r", ellipse->rx.computed);
- if (((SPObjectClass *) circle_parent_class)->write)
- ((SPObjectClass *) circle_parent_class)->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_circle_parent_class)->write)
+ ((SPObjectClass *) sp_circle_parent_class)->write(object, xml_doc, repr, flags);
return repr;
}
@@ -636,8 +555,8 @@ sp_circle_set(SPObject *object, unsigned int key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) circle_parent_class)->set)
- ((SPObjectClass *) circle_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_circle_parent_class)->set)
+ ((SPObjectClass *) sp_circle_parent_class)->set(object, key, value);
break;
}
}
@@ -649,9 +568,6 @@ static gchar *sp_circle_description(SPItem */*item*/)
/* <path sodipodi:type="arc"> element */
-static void sp_arc_class_init(SPArcClass *klass);
-static void sp_arc_init(SPArc *arc);
-
static void sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_arc_set(SPObject *object, unsigned int key, gchar const *value);
@@ -659,29 +575,7 @@ static void sp_arc_modified(SPObject *object, guint flags);
static gchar *sp_arc_description(SPItem *item);
-static SPGenericEllipseClass *arc_parent_class;
-
-GType
-sp_arc_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPArcClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_arc_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPArc),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_arc_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GENERICELLIPSE, "SPArc", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPArc, sp_arc, SP_TYPE_GENERICELLIPSE);
static void
sp_arc_class_init(SPArcClass *klass)
@@ -689,8 +583,6 @@ sp_arc_class_init(SPArcClass *klass)
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPItemClass *item_class = (SPItemClass *) klass;
- arc_parent_class = (SPGenericEllipseClass*) g_type_class_ref(SP_TYPE_GENERICELLIPSE);
-
sp_object_class->build = sp_arc_build;
sp_object_class->write = sp_arc_write;
sp_object_class->set = sp_arc_set;
@@ -708,8 +600,8 @@ sp_arc_init(SPArc */*arc*/)
static void
sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) arc_parent_class)->build)
- (* ((SPObjectClass *) arc_parent_class)->build) (object, document, repr);
+ if (((SPObjectClass *) sp_arc_parent_class)->build)
+ (* ((SPObjectClass *) sp_arc_parent_class)->build) (object, document, repr);
object->readAttr( "sodipodi:cx" );
object->readAttr( "sodipodi:cy" );
@@ -797,8 +689,8 @@ sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::
// write d=
sp_arc_set_elliptical_path_attribute(arc, repr);
- if (((SPObjectClass *) arc_parent_class)->write)
- ((SPObjectClass *) arc_parent_class)->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_arc_parent_class)->write)
+ ((SPObjectClass *) sp_arc_parent_class)->write(object, xml_doc, repr, flags);
return repr;
}
@@ -850,8 +742,8 @@ sp_arc_set(SPObject *object, unsigned int key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) arc_parent_class)->set)
- ((SPObjectClass *) arc_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_arc_parent_class)->set)
+ ((SPObjectClass *) sp_arc_parent_class)->set(object, key, value);
break;
}
}
@@ -863,8 +755,8 @@ sp_arc_modified(SPObject *object, guint flags)
((SPShape *) object)->setShape();
}
- if (((SPObjectClass *) arc_parent_class)->modified)
- ((SPObjectClass *) arc_parent_class)->modified(object, flags);
+ if (((SPObjectClass *) sp_arc_parent_class)->modified)
+ ((SPObjectClass *) sp_arc_parent_class)->modified(object, flags);
}
static gchar *sp_arc_description(SPItem *item)
diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h
index 91354ab60..5074be354 100644
--- a/src/sp-ellipse.h
+++ b/src/sp-ellipse.h
@@ -17,6 +17,8 @@
#include "svg/svg-length.h"
#include "sp-shape.h"
+G_BEGIN_DECLS
+
/* Common parent class */
#define SP_TYPE_GENERICELLIPSE (sp_genericellipse_get_type ())
@@ -102,4 +104,6 @@ GType sp_arc_get_type (void);
void sp_arc_position_set (SPArc * arc, gdouble x, gdouble y, gdouble rx, gdouble ry);
Geom::Point sp_arc_get_xy (SPArc *ge, gdouble arg);
+G_END_DECLS
+
#endif
diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp
index 7a0c5e0b8..c588335d8 100644
--- a/src/sp-flowdiv.cpp
+++ b/src/sp-flowdiv.cpp
@@ -14,8 +14,6 @@
#include "sp-string.h"
#include "document.h"
-static void sp_flowdiv_class_init (SPFlowdivClass *klass);
-static void sp_flowdiv_init (SPFlowdiv *group);
static void sp_flowdiv_release (SPObject *object);
static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags);
@@ -23,8 +21,6 @@ static void sp_flowdiv_modified (SPObject *object, guint flags);
static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value);
-static void sp_flowtspan_class_init (SPFlowtspanClass *klass);
-static void sp_flowtspan_init (SPFlowtspan *group);
static void sp_flowtspan_release (SPObject *object);
static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags);
@@ -32,8 +28,6 @@ static void sp_flowtspan_modified (SPObject *object, guint flags);
static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value);
-static void sp_flowpara_class_init (SPFlowparaClass *klass);
-static void sp_flowpara_init (SPFlowpara *group);
static void sp_flowpara_release (SPObject *object);
static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags);
@@ -41,51 +35,20 @@ static void sp_flowpara_modified (SPObject *object, guint flags);
static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value);
-static void sp_flowline_class_init (SPFlowlineClass *klass);
static void sp_flowline_release (SPObject *object);
-static void sp_flowline_init (SPFlowline *group);
static Inkscape::XML::Node *sp_flowline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_flowline_modified (SPObject *object, guint flags);
-static void sp_flowregionbreak_class_init (SPFlowregionbreakClass *klass);
static void sp_flowregionbreak_release (SPObject *object);
-static void sp_flowregionbreak_init (SPFlowregionbreak *group);
static Inkscape::XML::Node *sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_flowregionbreak_modified (SPObject *object, guint flags);
-static SPItemClass * flowdiv_parent_class;
-static SPItemClass * flowtspan_parent_class;
-static SPItemClass * flowpara_parent_class;
-static SPObjectClass * flowline_parent_class;
-static SPObjectClass * flowregionbreak_parent_class;
-
-GType sp_flowdiv_get_type(void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowdivClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowdiv_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowdiv),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowdiv_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowdiv", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, SP_TYPE_ITEM);
static void sp_flowdiv_class_init(SPFlowdivClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- flowdiv_parent_class = reinterpret_cast<SPItemClass *>(g_type_class_ref(SP_TYPE_ITEM));
-
sp_object_class->build = sp_flowdiv_build;
sp_object_class->set = sp_flowdiv_set;
sp_object_class->release = sp_flowdiv_release;
@@ -100,8 +63,8 @@ static void sp_flowdiv_init(SPFlowdiv */*group*/)
static void sp_flowdiv_release(SPObject *object)
{
- if (reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->release(object);
}
}
@@ -110,8 +73,8 @@ static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags)
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->update(object, ctx, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->update) {
+ reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -144,8 +107,8 @@ static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags)
static void sp_flowdiv_modified(SPObject *object, guint flags)
{
- if (reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->modified(object, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->modified) {
+ reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -173,15 +136,15 @@ static void sp_flowdiv_build(SPObject *object, SPDocument *doc, Inkscape::XML::N
{
object->_requireSVGVersion(Inkscape::Version(1, 2));
- if (reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->build(object, doc, repr);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->build) {
+ reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->build(object, doc, repr);
}
}
static void sp_flowdiv_set(SPObject *object, unsigned int key, const gchar *value)
{
- if (reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(flowdiv_parent_class)->set(object, key, value);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->set) {
+ reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->set(object, key, value);
}
}
@@ -222,8 +185,8 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do
}
}
- if (((SPObjectClass *) (flowdiv_parent_class))->write) {
- ((SPObjectClass *) (flowdiv_parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_flowdiv_parent_class))->write) {
+ ((SPObjectClass *) (sp_flowdiv_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -233,35 +196,12 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do
/*
*
*/
-
-GType
-sp_flowtspan_get_type (void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowtspanClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowtspan_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowtspan),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowtspan_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowtspan", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, SP_TYPE_ITEM);
static void sp_flowtspan_class_init(SPFlowtspanClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- flowtspan_parent_class = reinterpret_cast<SPItemClass *>(g_type_class_ref(SP_TYPE_ITEM));
-
sp_object_class->build = sp_flowtspan_build;
sp_object_class->set = sp_flowtspan_set;
sp_object_class->release = sp_flowtspan_release;
@@ -276,8 +216,8 @@ static void sp_flowtspan_init(SPFlowtspan */*group*/)
static void sp_flowtspan_release(SPObject *object)
{
- if (reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->release(object);
}
}
@@ -286,8 +226,8 @@ static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->update(object, ctx, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->update) {
+ reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -320,8 +260,8 @@ static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags
static void sp_flowtspan_modified(SPObject *object, guint flags)
{
- if (reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->modified(object, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->modified) {
+ reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -347,15 +287,15 @@ static void sp_flowtspan_modified(SPObject *object, guint flags)
static void sp_flowtspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
- if (reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->build(object, doc, repr);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->build) {
+ reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->build(object, doc, repr);
}
}
static void sp_flowtspan_set(SPObject *object, unsigned int key, const gchar *value)
{
- if (reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(flowtspan_parent_class)->set(object, key, value);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->set) {
+ reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->set(object, key, value);
}
}
@@ -396,8 +336,8 @@ static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::
}
}
- if (((SPObjectClass *) (flowtspan_parent_class))->write) {
- ((SPObjectClass *) (flowtspan_parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_flowtspan_parent_class))->write) {
+ ((SPObjectClass *) (sp_flowtspan_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -408,35 +348,12 @@ static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::
/*
*
*/
-
-GType
-sp_flowpara_get_type (void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowparaClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowpara_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowpara),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowpara_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowpara", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowpara, sp_flowpara, SP_TYPE_ITEM);
static void sp_flowpara_class_init(SPFlowparaClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- flowpara_parent_class = reinterpret_cast<SPItemClass *>(g_type_class_ref(SP_TYPE_ITEM));
-
sp_object_class->build = sp_flowpara_build;
sp_object_class->set = sp_flowpara_set;
sp_object_class->release = sp_flowpara_release;
@@ -451,8 +368,8 @@ static void sp_flowpara_init (SPFlowpara */*group*/)
static void sp_flowpara_release(SPObject *object)
{
- if (reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->release(object);
}
}
@@ -461,8 +378,8 @@ static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags)
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->update(object, ctx, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->update) {
+ reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -495,8 +412,8 @@ static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags)
static void sp_flowpara_modified(SPObject *object, guint flags)
{
- if (reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->modified(object, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->modified) {
+ reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -522,15 +439,15 @@ static void sp_flowpara_modified(SPObject *object, guint flags)
static void sp_flowpara_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
- if (reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->build(object, doc, repr);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->build) {
+ reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->build(object, doc, repr);
}
}
static void sp_flowpara_set(SPObject *object, unsigned int key, const gchar *value)
{
- if (reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(flowpara_parent_class)->set(object, key, value);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->set) {
+ reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->set(object, key, value);
}
}
@@ -569,8 +486,8 @@ static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::D
}
}
- if (((SPObjectClass *) (flowpara_parent_class))->write) {
- ((SPObjectClass *) (flowpara_parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_flowpara_parent_class))->write) {
+ ((SPObjectClass *) (sp_flowpara_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -579,34 +496,12 @@ static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::D
/*
*
*/
-
-GType sp_flowline_get_type(void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowlineClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowline_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowline),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowline_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_OBJECT, "SPFlowline", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowline, sp_flowline, SP_TYPE_OBJECT);
static void sp_flowline_class_init(SPFlowlineClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- flowline_parent_class = reinterpret_cast<SPObjectClass *>(g_type_class_ref(SP_TYPE_OBJECT));
-
sp_object_class->release = sp_flowline_release;
sp_object_class->write = sp_flowline_write;
sp_object_class->modified = sp_flowline_modified;
@@ -618,15 +513,15 @@ static void sp_flowline_init(SPFlowline */*group*/)
static void sp_flowline_release(SPObject *object)
{
- if (reinterpret_cast<SPObjectClass *>(flowline_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(flowline_parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->release(object);
}
}
static void sp_flowline_modified(SPObject *object, guint flags)
{
- if (reinterpret_cast<SPObjectClass *>(flowline_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(flowline_parent_class)->modified(object, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->modified) {
+ reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -644,8 +539,8 @@ static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::D
} else {
}
- if (reinterpret_cast<SPObjectClass *>(flowline_parent_class)->write) {
- reinterpret_cast<SPObjectClass *>(flowline_parent_class)->write(object, xml_doc, repr, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->write) {
+ reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->write(object, xml_doc, repr, flags);
}
return repr;
@@ -654,34 +549,12 @@ static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::D
/*
*
*/
-
-GType sp_flowregionbreak_get_type(void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowregionbreakClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowregionbreak_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowregionbreak),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowregionbreak_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_OBJECT, "SPFlowregionbreak", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, SP_TYPE_OBJECT);
static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass)
{
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- flowregionbreak_parent_class = reinterpret_cast<SPObjectClass *>(g_type_class_ref(SP_TYPE_OBJECT));
-
sp_object_class->release = sp_flowregionbreak_release;
sp_object_class->write = sp_flowregionbreak_write;
sp_object_class->modified = sp_flowregionbreak_modified;
@@ -693,15 +566,15 @@ static void sp_flowregionbreak_init(SPFlowregionbreak */*group*/)
static void sp_flowregionbreak_release(SPObject *object)
{
- if (reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->release(object);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->release) {
+ reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->release(object);
}
}
static void sp_flowregionbreak_modified(SPObject *object, guint flags)
{
- if (reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->modified(object, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->modified) {
+ reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->modified(object, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -719,8 +592,8 @@ static Inkscape::XML::Node *sp_flowregionbreak_write(SPObject *object, Inkscape:
} else {
}
- if (reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->write) {
- reinterpret_cast<SPObjectClass *>(flowregionbreak_parent_class)->write(object, xml_doc, repr, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->write) {
+ reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 649193c33..a8de68f9b 100644
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -24,8 +24,6 @@
#include "livarot/Path.h"
#include "livarot/Shape.h"
-static void sp_flowregion_class_init (SPFlowregionClass *klass);
-static void sp_flowregion_init (SPFlowregion *group);
static void sp_flowregion_dispose (GObject *object);
static void sp_flowregion_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
@@ -36,10 +34,8 @@ static Inkscape::XML::Node *sp_flowregion_write (SPObject *object, Inkscape::XML
static gchar * sp_flowregion_description (SPItem * item);
-static SPItemClass * flowregion_parent_class;
+G_DEFINE_TYPE(SPFlowregion, sp_flowregion, SP_TYPE_ITEM);
-static void sp_flowregionexclude_class_init (SPFlowregionExcludeClass *klass);
-static void sp_flowregionexclude_init (SPFlowregionExclude *group);
static void sp_flowregionexclude_dispose (GObject *object);
static void sp_flowregionexclude_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
@@ -50,33 +46,9 @@ static Inkscape::XML::Node *sp_flowregionexclude_write (SPObject *object, Inksca
static gchar * sp_flowregionexclude_description (SPItem * item);
-static SPItemClass * flowregionexclude_parent_class;
-
static void GetDest(SPObject* child,Shape **computed);
-GType
-sp_flowregion_get_type (void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowregionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowregion_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowregion),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowregion_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowregion", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
-
static void
sp_flowregion_class_init (SPFlowregionClass *klass)
{
@@ -88,8 +60,6 @@ sp_flowregion_class_init (SPFlowregionClass *klass)
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
- flowregion_parent_class = (SPItemClass *)g_type_class_ref (SP_TYPE_ITEM);
-
object_class->dispose = sp_flowregion_dispose;
sp_object_class->child_added = sp_flowregion_child_added;
@@ -120,8 +90,8 @@ static void sp_flowregion_child_added(SPObject *object, Inkscape::XML::Node *chi
{
SP_ITEM(object);
- if (((SPObjectClass *) (flowregion_parent_class))->child_added) {
- (* ((SPObjectClass *) (flowregion_parent_class))->child_added) (object, child, ref);
+ if (((SPObjectClass *) (sp_flowregion_parent_class))->child_added) {
+ (* ((SPObjectClass *) (sp_flowregion_parent_class))->child_added) (object, child, ref);
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -132,8 +102,8 @@ static void sp_flowregion_child_added(SPObject *object, Inkscape::XML::Node *chi
static void
sp_flowregion_remove_child (SPObject * object, Inkscape::XML::Node * child)
{
- if (((SPObjectClass *) (flowregion_parent_class))->remove_child)
- (* ((SPObjectClass *) (flowregion_parent_class))->remove_child) (object, child);
+ if (((SPObjectClass *) (sp_flowregion_parent_class))->remove_child)
+ (* ((SPObjectClass *) (sp_flowregion_parent_class))->remove_child) (object, child);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
@@ -146,8 +116,8 @@ static void sp_flowregion_update(SPObject *object, SPCtx *ctx, unsigned int flag
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (((SPObjectClass *) (flowregion_parent_class))->update) {
- ((SPObjectClass *) (flowregion_parent_class))->update (object, ctx, flags);
+ if (((SPObjectClass *) (sp_flowregion_parent_class))->update) {
+ ((SPObjectClass *) (sp_flowregion_parent_class))->update (object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -250,8 +220,8 @@ static Inkscape::XML::Node *sp_flowregion_write(SPObject *object, Inkscape::XML:
}
}
- if (((SPObjectClass *) (flowregion_parent_class))->write) {
- ((SPObjectClass *) (flowregion_parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_flowregion_parent_class))->write) {
+ ((SPObjectClass *) (sp_flowregion_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
@@ -268,27 +238,7 @@ static gchar *sp_flowregion_description(SPItem */*item*/)
*
*/
-GType
-sp_flowregionexclude_get_type (void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPFlowregionExcludeClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_flowregionexclude_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPFlowregionExclude),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_flowregionexclude_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_ITEM, "SPFlowregionExclude", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPFlowregionExclude, sp_flowregionexclude, SP_TYPE_ITEM);
static void
sp_flowregionexclude_class_init (SPFlowregionExcludeClass *klass)
@@ -301,8 +251,6 @@ sp_flowregionexclude_class_init (SPFlowregionExcludeClass *klass)
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
- flowregionexclude_parent_class = (SPItemClass *)g_type_class_ref (SP_TYPE_ITEM);
-
object_class->dispose = sp_flowregionexclude_dispose;
sp_object_class->child_added = sp_flowregionexclude_child_added;
@@ -334,8 +282,8 @@ static void sp_flowregionexclude_child_added(SPObject *object, Inkscape::XML::No
{
SP_ITEM(object);
- if (((SPObjectClass *) (flowregionexclude_parent_class))->child_added) {
- (* ((SPObjectClass *) (flowregionexclude_parent_class))->child_added) (object, child, ref);
+ if (((SPObjectClass *) (sp_flowregionexclude_parent_class))->child_added) {
+ (* ((SPObjectClass *) (sp_flowregionexclude_parent_class))->child_added) (object, child, ref);
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -346,8 +294,8 @@ static void sp_flowregionexclude_child_added(SPObject *object, Inkscape::XML::No
static void
sp_flowregionexclude_remove_child (SPObject * object, Inkscape::XML::Node * child)
{
- if (((SPObjectClass *) (flowregionexclude_parent_class))->remove_child)
- (* ((SPObjectClass *) (flowregionexclude_parent_class))->remove_child) (object, child);
+ if (((SPObjectClass *) (sp_flowregionexclude_parent_class))->remove_child)
+ (* ((SPObjectClass *) (sp_flowregionexclude_parent_class))->remove_child) (object, child);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
@@ -360,8 +308,8 @@ static void sp_flowregionexclude_update(SPObject *object, SPCtx *ctx, unsigned i
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (((SPObjectClass *) (flowregionexclude_parent_class))->update) {
- ((SPObjectClass *) (flowregionexclude_parent_class))->update (object, ctx, flags);
+ if (((SPObjectClass *) (sp_flowregionexclude_parent_class))->update) {
+ ((SPObjectClass *) (sp_flowregionexclude_parent_class))->update (object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -458,8 +406,8 @@ static Inkscape::XML::Node *sp_flowregionexclude_write(SPObject *object, Inkscap
}
}
- if (((SPObjectClass *) (flowregionexclude_parent_class))->write) {
- ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_flowregionexclude_parent_class))->write) {
+ ((SPObjectClass *) (sp_flowregionexclude_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp
index e9faabdc6..4288a5d64 100644
--- a/src/sp-font-face.cpp
+++ b/src/sp-font-face.cpp
@@ -261,9 +261,6 @@ static std::vector<FontFaceStretchType> sp_read_fontFaceStretchType(gchar const
return v;
}
-static void sp_fontface_class_init(SPFontFaceClass *fc);
-static void sp_fontface_init(SPFontFace *font);
-
static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_fontface_release(SPObject *object);
static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value);
@@ -273,37 +270,12 @@ static void sp_fontface_child_added(SPObject *object, Inkscape::XML::Node *child
static void sp_fontface_remove_child(SPObject *object, Inkscape::XML::Node *child);
static void sp_fontface_update(SPObject *object, SPCtx *ctx, guint flags);
-static SPObjectClass *parent_class;
-
-GType sp_fontface_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPFontFaceClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_fontface_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPFontFace),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_fontface_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPFontFace", &info, (GTypeFlags) 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE(SPFontFace, sp_fontface, SP_TYPE_OBJECT);
static void sp_fontface_class_init(SPFontFaceClass *fc)
{
SPObjectClass *sp_object_class = (SPObjectClass *) fc;
- parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_fontface_build;
sp_object_class->release = sp_fontface_release;
sp_object_class->set = sp_fontface_set;
@@ -369,8 +341,8 @@ static void sp_fontface_init(SPFontFace *face)
static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (parent_class))->build) {
- ((SPObjectClass *) (parent_class))->build(object, document, repr);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->build) {
+ (SP_OBJECT_CLASS(sp_fontface_parent_class))->build(object, document, repr);
}
object->readAttr( "font-family" );
@@ -420,8 +392,8 @@ sp_fontface_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::
{
SPFontFace *f = SP_FONTFACE(object);
- if (((SPObjectClass *) parent_class)->child_added)
- (* ((SPObjectClass *) parent_class)->child_added)(object, child, ref);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->child_added)
+ (* (SP_OBJECT_CLASS(sp_fontface_parent_class))->child_added)(object, child, ref);
sp_fontface_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -436,8 +408,8 @@ sp_fontface_remove_child(SPObject *object, Inkscape::XML::Node *child)
{
SPFontFace *f = SP_FONTFACE(object);
- if (((SPObjectClass *) parent_class)->remove_child)
- (* ((SPObjectClass *) parent_class)->remove_child)(object, child);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->remove_child)
+ (* (SP_OBJECT_CLASS(sp_fontface_parent_class))->remove_child)(object, child);
sp_fontface_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -445,10 +417,8 @@ sp_fontface_remove_child(SPObject *object, Inkscape::XML::Node *child)
static void sp_fontface_release(SPObject *object)
{
- //SPFontFace *font = SP_FONTFACE(object);
-
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->release) {
+ (SP_OBJECT_CLASS(sp_fontface_parent_class))->release(object);
}
}
@@ -736,8 +706,8 @@ static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *val
break;
}
default:
- if (((SPObjectClass *) (parent_class))->set) {
- ((SPObjectClass *) (parent_class))->set(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->set) {
+ (SP_OBJECT_CLASS(sp_fontface_parent_class))->set(object, key, value);
}
break;
}
@@ -785,8 +755,8 @@ sp_fontface_update(SPObject *object, SPCtx *ctx, guint flags)
object->readAttr( "overline-thickness" );
}
- if (((SPObjectClass *) parent_class)->update) {
- ((SPObjectClass *) parent_class)->update(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->update) {
+ (SP_OBJECT_CLASS(sp_fontface_parent_class))->update(object, ctx, flags);
}
}
@@ -873,8 +843,8 @@ static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::D
COPY_ATTR(repr, object->getRepr(), "overline-thickness");
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_fontface_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_fontface_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-font-face.h b/src/sp-font-face.h
index e492ba091..691c1f883 100644
--- a/src/sp-font-face.h
+++ b/src/sp-font-face.h
@@ -23,6 +23,8 @@
#include "sp-object.h"
+G_BEGIN_DECLS
+
#define SP_TYPE_FONTFACE (sp_fontface_get_type ())
#define SP_FONTFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_FONTFACE, SPFontFace))
#define SP_FONTFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_FONTFACE, SPFontFaceClass))
@@ -115,5 +117,7 @@ struct SPFontFaceClass {
GType sp_fontface_get_type (void);
+G_END_DECLS
+
#endif //#ifndef __SP_FONTFACE_H__
#endif //#ifdef ENABLE_SVG_FONTS
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index 852e6ba5d..6ebbd5218 100644
--- a/src/sp-font.cpp
+++ b/src/sp-font.cpp
@@ -25,9 +25,6 @@
#include "display/nr-svgfonts.h"
-static void sp_font_class_init(SPFontClass *fc);
-static void sp_font_init(SPFont *font);
-
static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_font_release(SPObject *object);
static void sp_font_set(SPObject *object, unsigned int key, const gchar *value);
@@ -37,39 +34,12 @@ static void sp_font_child_added(SPObject *object, Inkscape::XML::Node *child, In
static void sp_font_remove_child(SPObject *object, Inkscape::XML::Node *child);
static void sp_font_update(SPObject *object, SPCtx *ctx, guint flags);
-// static gchar *sp_font_description(SPItem *item);
-
-static SPObjectClass *parent_class;
-
-GType sp_font_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPFontClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_font_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPFont),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_font_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPFont", &info, (GTypeFlags) 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE(SPFont, sp_font, SP_TYPE_OBJECT);
static void sp_font_class_init(SPFontClass *fc)
{
SPObjectClass *sp_object_class = (SPObjectClass *) fc;
- parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_font_build;
sp_object_class->release = sp_font_release;
sp_object_class->set = sp_font_set;
@@ -98,8 +68,8 @@ static void sp_font_init(SPFont *font)
static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (parent_class))->build) {
- ((SPObjectClass *) (parent_class))->build(object, document, repr);
+ if (((SPObjectClass *) (sp_font_parent_class))->build) {
+ ((SPObjectClass *) (sp_font_parent_class))->build(object, document, repr);
}
object->readAttr( "horiz-origin-x" );
@@ -125,8 +95,8 @@ sp_font_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML:
{
SPFont *f = SP_FONT(object);
- if (((SPObjectClass *) parent_class)->child_added)
- (* ((SPObjectClass *) parent_class)->child_added)(object, child, ref);
+ if (((SPObjectClass *) sp_font_parent_class)->child_added)
+ (* ((SPObjectClass *) sp_font_parent_class)->child_added)(object, child, ref);
sp_font_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -141,8 +111,8 @@ sp_font_remove_child(SPObject *object, Inkscape::XML::Node *child)
{
SPFont *f = SP_FONT(object);
- if (((SPObjectClass *) parent_class)->remove_child)
- (* ((SPObjectClass *) parent_class)->remove_child)(object, child);
+ if (((SPObjectClass *) sp_font_parent_class)->remove_child)
+ (* ((SPObjectClass *) sp_font_parent_class)->remove_child)(object, child);
sp_font_children_modified(f);
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -153,8 +123,8 @@ static void sp_font_release(SPObject *object)
//SPFont *font = SP_FONT(object);
object->document->removeResource("font", object);
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_font_parent_class)->release) {
+ ((SPObjectClass *) sp_font_parent_class)->release(object);
}
}
@@ -219,8 +189,8 @@ static void sp_font_set(SPObject *object, unsigned int key, const gchar *value)
break;
}
default:
- if (((SPObjectClass *) (parent_class))->set) {
- ((SPObjectClass *) (parent_class))->set(object, key, value);
+ if (((SPObjectClass *) (sp_font_parent_class))->set) {
+ ((SPObjectClass *) (sp_font_parent_class))->set(object, key, value);
}
break;
}
@@ -241,8 +211,8 @@ sp_font_update(SPObject *object, SPCtx *ctx, guint flags)
object->readAttr( "vert-adv-y" );
}
- if (((SPObjectClass *) parent_class)->update) {
- ((SPObjectClass *) parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_font_parent_class)->update) {
+ ((SPObjectClass *) sp_font_parent_class)->update(object, ctx, flags);
}
}
@@ -274,8 +244,8 @@ static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Docum
COPY_ATTR(repr, object->getRepr(), "vert-adv-y");
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_font_parent_class))->write) {
+ ((SPObjectClass *) (sp_font_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index d7add805d..1f2cfdd41 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -61,36 +61,24 @@
//#define NCOLORS NR_GRADIENT_VECTOR_LENGTH
// SPStop
-static void sp_stop_class_init(SPStopClass *klass);
-static void sp_stop_init(SPStop *stop);
-
static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_stop_set(SPObject *object, unsigned key, gchar const *value);
static Inkscape::XML::Node *sp_stop_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
-static SPObjectClass *stop_parent_class;
+G_DEFINE_TYPE(SPStop, sp_stop, SP_TYPE_OBJECT);
// SPMeshRow
-static void sp_meshrow_class_init(SPMeshRowClass *klass);
-static void sp_meshrow_init(SPMeshRow *meshrow);
-
static void sp_meshrow_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_meshrow_set(SPObject *object, unsigned key, gchar const *value);
static Inkscape::XML::Node *sp_meshrow_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
-static SPObjectClass *meshrow_parent_class;
+G_DEFINE_TYPE(SPMeshRow, sp_meshrow, SP_TYPE_OBJECT);
// SPMeshPatch
-static void sp_meshpatch_class_init(SPMeshPatchClass *klass);
-static void sp_meshpatch_init(SPMeshPatch *meshpatch);
-
static void sp_meshpatch_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_meshpatch_set(SPObject *object, unsigned key, gchar const *value);
static Inkscape::XML::Node *sp_meshpatch_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
-static SPObjectClass *meshpatch_parent_class;
+G_DEFINE_TYPE(SPMeshPatch, sp_meshpatch, SP_TYPE_OBJECT);
class SPGradientImpl
@@ -117,37 +105,12 @@ class SPGradientImpl
};
/**
- * Registers SPStop class and returns its type.
- */
-GType
-sp_stop_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPStopClass),
- NULL, NULL,
- (GClassInitFunc) sp_stop_class_init,
- NULL, NULL,
- sizeof(SPStop),
- 16,
- (GInstanceInitFunc) sp_stop_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPStop", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-/**
* Callback to initialize SPStop vtable.
*/
static void sp_stop_class_init(SPStopClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- stop_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_stop_build;
sp_object_class->set = sp_stop_set;
sp_object_class->write = sp_stop_write;
@@ -170,8 +133,8 @@ sp_stop_init(SPStop *stop)
*/
static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) stop_parent_class)->build)
- (* ((SPObjectClass *) stop_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_stop_parent_class)->build)
+ (* ((SPObjectClass *) sp_stop_parent_class)->build)(object, document, repr);
object->readAttr( "offset" );
object->readAttr( "stop-color" );
@@ -256,8 +219,8 @@ sp_stop_set(SPObject *object, unsigned key, gchar const *value)
break;
}
default: {
- if (((SPObjectClass *) stop_parent_class)->set)
- (* ((SPObjectClass *) stop_parent_class)->set)(object, key, value);
+ if (((SPObjectClass *) sp_stop_parent_class)->set)
+ (* ((SPObjectClass *) sp_stop_parent_class)->set)(object, key, value);
break;
}
}
@@ -278,8 +241,8 @@ sp_stop_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
Glib::ustring colorStr = stop->specified_color.toString();
gfloat opacity = stop->opacity;
- if (((SPObjectClass *) stop_parent_class)->write) {
- (* ((SPObjectClass *) stop_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_stop_parent_class)->write) {
+ (* ((SPObjectClass *) sp_stop_parent_class)->write)(object, xml_doc, repr, flags);
}
// Since we do a hackish style setting here (because SPStyle does not support stop-color and
@@ -410,37 +373,12 @@ sp_stop_get_rgba32(SPStop const *const stop)
*/
/**
- * Registers SPMeshRow class and returns its type.
- */
-GType
-sp_meshrow_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPMeshRowClass),
- NULL, NULL,
- (GClassInitFunc) sp_meshrow_class_init,
- NULL, NULL,
- sizeof(SPMeshRow),
- 16,
- (GInstanceInitFunc) sp_meshrow_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPMeshRow", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-/**
* Callback to initialize SPMeshRow vtable.
*/
static void sp_meshrow_class_init(SPMeshRowClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- meshrow_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_meshrow_build;
sp_object_class->set = sp_meshrow_set;
sp_object_class->write = sp_meshrow_write;
@@ -459,8 +397,8 @@ static void sp_meshrow_init(SPMeshRow * /*meshrow*/)
*/
static void sp_meshrow_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) meshrow_parent_class)->build)
- (* ((SPObjectClass *) meshrow_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_meshrow_parent_class)->build)
+ (* ((SPObjectClass *) sp_meshrow_parent_class)->build)(object, document, repr);
// No attributes
}
@@ -485,8 +423,8 @@ sp_meshrow_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
repr = xml_doc->createElement("svg:meshRow");
}
- if (((SPObjectClass *) meshrow_parent_class)->write) {
- (* ((SPObjectClass *) meshrow_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_meshrow_parent_class)->write) {
+ (* ((SPObjectClass *) sp_meshrow_parent_class)->write)(object, xml_doc, repr, flags);
}
return repr;
@@ -497,37 +435,12 @@ sp_meshrow_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
*/
/**
- * Registers SPMeshPatch class and returns its type.
- */
-GType
-sp_meshpatch_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPMeshPatchClass),
- NULL, NULL,
- (GClassInitFunc) sp_meshpatch_class_init,
- NULL, NULL,
- sizeof(SPMeshPatch),
- 16,
- (GInstanceInitFunc) sp_meshpatch_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPMeshPatch", &info, (GTypeFlags)0);
- }
- return type;
-}
-
-/**
* Callback to initialize SPMeshPatch vtable.
*/
static void sp_meshpatch_class_init(SPMeshPatchClass *klass)
{
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- meshpatch_parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_meshpatch_build;
sp_object_class->set = sp_meshpatch_set;
sp_object_class->write = sp_meshpatch_write;
@@ -546,8 +459,8 @@ static void sp_meshpatch_init(SPMeshPatch * /*meshpatch*/)
*/
static void sp_meshpatch_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) meshpatch_parent_class)->build)
- (* ((SPObjectClass *) meshpatch_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_meshpatch_parent_class)->build)
+ (* ((SPObjectClass *) sp_meshpatch_parent_class)->build)(object, document, repr);
object->readAttr( "tensor" );
}
@@ -586,8 +499,8 @@ sp_meshpatch_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:
repr = xml_doc->createElement("svg:meshPatch");
}
- if (((SPObjectClass *) meshpatch_parent_class)->write) {
- (* ((SPObjectClass *) meshpatch_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_meshpatch_parent_class)->write) {
+ (* ((SPObjectClass *) sp_meshpatch_parent_class)->write)(object, xml_doc, repr, flags);
}
return repr;
@@ -1496,9 +1409,6 @@ sp_gradient_set_gs2d_matrix(SPGradient *gr, Geom::Affine const &ctm,
* Linear Gradient
*/
-static void sp_lineargradient_class_init(SPLinearGradientClass *klass);
-static void sp_lineargradient_init(SPLinearGradient *lg);
-
static void sp_lineargradient_build(SPObject *object,
SPDocument *document,
Inkscape::XML::Node *repr);
@@ -1506,31 +1416,7 @@ static void sp_lineargradient_set(SPObject *object, unsigned key, gchar const *v
static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr,
guint flags);
static cairo_pattern_t *sp_lineargradient_create_pattern(SPPaintServer *ps, cairo_t *ct, Geom::OptRect const &bbox, double opacity);
-
-static SPGradientClass *lg_parent_class;
-
-/**
- * Register SPLinearGradient class and return its type.
- */
-GType
-sp_lineargradient_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPLinearGradientClass),
- NULL, NULL,
- (GClassInitFunc) sp_lineargradient_class_init,
- NULL, NULL,
- sizeof(SPLinearGradient),
- 16,
- (GInstanceInitFunc) sp_lineargradient_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GRADIENT, "SPLinearGradient", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPLinearGradient, sp_lineargradient, SP_TYPE_GRADIENT);
/**
* SPLinearGradient vtable initialization.
@@ -1540,8 +1426,6 @@ static void sp_lineargradient_class_init(SPLinearGradientClass *klass)
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPPaintServerClass *ps_class = (SPPaintServerClass *) klass;
- lg_parent_class = (SPGradientClass*)g_type_class_ref(SP_TYPE_GRADIENT);
-
sp_object_class->build = sp_lineargradient_build;
sp_object_class->set = sp_lineargradient_set;
sp_object_class->write = sp_lineargradient_write;
@@ -1567,8 +1451,8 @@ static void sp_lineargradient_build(SPObject *object,
SPDocument *document,
Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) lg_parent_class)->build)
- (* ((SPObjectClass *) lg_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_lineargradient_parent_class)->build)
+ (* ((SPObjectClass *) sp_lineargradient_parent_class)->build)(object, document, repr);
object->readAttr( "x1" );
object->readAttr( "y1" );
@@ -1602,8 +1486,8 @@ sp_lineargradient_set(SPObject *object, unsigned key, gchar const *value)
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) lg_parent_class)->set)
- (* ((SPObjectClass *) lg_parent_class)->set)(object, key, value);
+ if (((SPObjectClass *) sp_lineargradient_parent_class)->set)
+ (* ((SPObjectClass *) sp_lineargradient_parent_class)->set)(object, key, value);
break;
}
}
@@ -1629,8 +1513,8 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inks
if ((flags & SP_OBJECT_WRITE_ALL) || lg->y2._set)
sp_repr_set_svg_double(repr, "y2", lg->y2.computed);
- if (((SPObjectClass *) lg_parent_class)->write)
- (* ((SPObjectClass *) lg_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_lineargradient_parent_class)->write)
+ (* ((SPObjectClass *) sp_lineargradient_parent_class)->write)(object, xml_doc, repr, flags);
return repr;
}
@@ -1659,9 +1543,6 @@ sp_lineargradient_set_position(SPLinearGradient *lg,
* Radial Gradient
*/
-static void sp_radialgradient_class_init(SPRadialGradientClass *klass);
-static void sp_radialgradient_init(SPRadialGradient *rg);
-
static void sp_radialgradient_build(SPObject *object,
SPDocument *document,
Inkscape::XML::Node *repr);
@@ -1669,31 +1550,7 @@ static void sp_radialgradient_set(SPObject *object, unsigned key, gchar const *v
static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr,
guint flags);
static cairo_pattern_t *sp_radialgradient_create_pattern(SPPaintServer *ps, cairo_t *ct, Geom::OptRect const &bbox, double opacity);
-
-static SPGradientClass *rg_parent_class;
-
-/**
- * Register SPRadialGradient class and return its type.
- */
-GType
-sp_radialgradient_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPRadialGradientClass),
- NULL, NULL,
- (GClassInitFunc) sp_radialgradient_class_init,
- NULL, NULL,
- sizeof(SPRadialGradient),
- 16,
- (GInstanceInitFunc) sp_radialgradient_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GRADIENT, "SPRadialGradient", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPRadialGradient, sp_radialgradient, SP_TYPE_GRADIENT);
/**
* SPRadialGradient vtable initialization.
@@ -1703,8 +1560,6 @@ static void sp_radialgradient_class_init(SPRadialGradientClass *klass)
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPPaintServerClass *ps_class = (SPPaintServerClass *) klass;
- rg_parent_class = (SPGradientClass*)g_type_class_ref(SP_TYPE_GRADIENT);
-
sp_object_class->build = sp_radialgradient_build;
sp_object_class->set = sp_radialgradient_set;
sp_object_class->write = sp_radialgradient_write;
@@ -1731,8 +1586,8 @@ sp_radialgradient_init(SPRadialGradient *rg)
static void
sp_radialgradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) rg_parent_class)->build)
- (* ((SPObjectClass *) rg_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_radialgradient_parent_class)->build)
+ (* ((SPObjectClass *) sp_radialgradient_parent_class)->build)(object, document, repr);
object->readAttr( "cx" );
object->readAttr( "cy" );
@@ -1789,8 +1644,8 @@ sp_radialgradient_set(SPObject *object, unsigned key, gchar const *value)
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) rg_parent_class)->set)
- ((SPObjectClass *) rg_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_radialgradient_parent_class)->set)
+ ((SPObjectClass *) sp_radialgradient_parent_class)->set(object, key, value);
break;
}
}
@@ -1813,8 +1668,8 @@ sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inks
if ((flags & SP_OBJECT_WRITE_ALL) || rg->fx._set) sp_repr_set_svg_double(repr, "fx", rg->fx.computed);
if ((flags & SP_OBJECT_WRITE_ALL) || rg->fy._set) sp_repr_set_svg_double(repr, "fy", rg->fy.computed);
- if (((SPObjectClass *) rg_parent_class)->write)
- (* ((SPObjectClass *) rg_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_radialgradient_parent_class)->write)
+ (* ((SPObjectClass *) sp_radialgradient_parent_class)->write)(object, xml_doc, repr, flags);
return repr;
}
@@ -1845,9 +1700,6 @@ sp_radialgradient_set_position(SPRadialGradient *rg,
//#define MESH_DEBUG
-static void sp_meshgradient_class_init(SPMeshGradientClass *klass);
-static void sp_meshgradient_init(SPMeshGradient *mg);
-
static void sp_meshgradient_build(SPObject *object,
SPDocument *document,
Inkscape::XML::Node *repr);
@@ -1855,31 +1707,7 @@ static void sp_meshgradient_set(SPObject *object, unsigned key, gchar const *val
static Inkscape::XML::Node *sp_meshgradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr,
guint flags);
static cairo_pattern_t *sp_meshgradient_create_pattern(SPPaintServer *ps, cairo_t *ct, Geom::OptRect const &bbox, double opacity);
-
-static SPGradientClass *mg_parent_class;
-
-/**
- * Register SPMeshGradient class and return its type.
- */
-GType
-sp_meshgradient_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPMeshGradientClass),
- NULL, NULL,
- (GClassInitFunc) sp_meshgradient_class_init,
- NULL, NULL,
- sizeof(SPMeshGradient),
- 16,
- (GInstanceInitFunc) sp_meshgradient_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GRADIENT, "SPMeshGradient", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPMeshGradient, sp_meshgradient, SP_TYPE_GRADIENT);
/**
* SPMeshGradient vtable initialization.
@@ -1892,8 +1720,6 @@ static void sp_meshgradient_class_init(SPMeshGradientClass *klass)
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
SPPaintServerClass *ps_class = (SPPaintServerClass *) klass;
- mg_parent_class = (SPGradientClass*)g_type_class_ref(SP_TYPE_GRADIENT);
-
sp_object_class->build = sp_meshgradient_build;
sp_object_class->set = sp_meshgradient_set;
sp_object_class->write = sp_meshgradient_write;
@@ -1918,8 +1744,8 @@ sp_meshgradient_init(SPMeshGradient *mg)
static void
sp_meshgradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) mg_parent_class)->build)
- (* ((SPObjectClass *) mg_parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_meshgradient_parent_class)->build)
+ (* ((SPObjectClass *) sp_meshgradient_parent_class)->build)(object, document, repr);
// Start coordinate of mesh
object->readAttr( "x" );
@@ -1948,8 +1774,8 @@ sp_meshgradient_set(SPObject *object, unsigned key, gchar const *value)
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) mg_parent_class)->set)
- ((SPObjectClass *) mg_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_meshgradient_parent_class)->set)
+ ((SPObjectClass *) sp_meshgradient_parent_class)->set(object, key, value);
break;
}
}
@@ -1973,8 +1799,8 @@ sp_meshgradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inksca
if ((flags & SP_OBJECT_WRITE_ALL) || mg->x._set) sp_repr_set_svg_double(repr, "x", mg->x.computed);
if ((flags & SP_OBJECT_WRITE_ALL) || mg->y._set) sp_repr_set_svg_double(repr, "y", mg->y.computed);
- if (((SPObjectClass *) mg_parent_class)->write)
- (* ((SPObjectClass *) mg_parent_class)->write)(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_meshgradient_parent_class)->write)
+ (* ((SPObjectClass *) sp_meshgradient_parent_class)->write)(object, xml_doc, repr, flags);
return repr;
}
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 7b5d56638..ce8879f70 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -76,9 +76,6 @@
#define MAGIC_EPSILON_TOO 1e-18
// TODO: also check if it is correct to be using two different epsilon values
-static void sp_image_class_init (SPImageClass * klass);
-static void sp_image_init (SPImage * image);
-
static void sp_image_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
static void sp_image_release (SPObject * object);
static void sp_image_set (SPObject *object, unsigned int key, const gchar *value);
@@ -94,7 +91,6 @@ static Inkscape::DrawingItem *sp_image_show (SPItem *item, Inkscape::Drawing &dr
static Geom::Affine sp_image_set_transform (SPItem *item, Geom::Affine const &xform);
static void sp_image_set_curve(SPImage *image);
-
static GdkPixbuf *sp_image_repr_read_image( time_t& modTime, gchar*& pixPath, const gchar *href, const gchar *absref, const gchar *base );
static GdkPixbuf *sp_image_pixbuf_force_rgba (GdkPixbuf * pixbuf);
static void sp_image_update_arenaitem (SPImage *img, Inkscape::DrawingImage *ai);
@@ -102,9 +98,6 @@ static void sp_image_update_canvas_image (SPImage *image);
static GdkPixbuf * sp_image_repr_read_dataURI (const gchar * uri_data);
static GdkPixbuf * sp_image_repr_read_b64 (const gchar * uri_data);
-static SPItemClass *parent_class;
-
-
extern "C"
{
void user_read_data( png_structp png_ptr, png_bytep data, png_size_t length );
@@ -519,33 +512,12 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, GError **error )
}
}
-GType sp_image_get_type(void)
-{
- static GType image_type = 0;
- if (!image_type) {
- GTypeInfo image_info = {
- sizeof (SPImageClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_image_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPImage),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_image_init,
- NULL, /* value_table */
- };
- image_type = g_type_register_static (SPItem::getType (), "SPImage", &image_info, (GTypeFlags)0);
- }
- return image_type;
-}
+G_DEFINE_TYPE(SPImage, sp_image, SP_TYPE_ITEM);
static void sp_image_class_init( SPImageClass * klass )
{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- SPItemClass *item_class = reinterpret_cast<SPItemClass *>(klass);
-
- parent_class = reinterpret_cast<SPItemClass*>(g_type_class_ref(SPItem::getType()));
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
+ SPItemClass *item_class = SP_ITEM_CLASS(klass);
sp_object_class->build = sp_image_build;
sp_object_class->release = sp_image_release;
@@ -586,8 +558,8 @@ static void sp_image_init( SPImage *image )
static void sp_image_build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr )
{
- if (((SPObjectClass *) parent_class)->build) {
- ((SPObjectClass *) parent_class)->build (object, document, repr);
+ if (((SPObjectClass *) sp_image_parent_class)->build) {
+ ((SPObjectClass *) sp_image_parent_class)->build (object, document, repr);
}
object->readAttr( "xlink:href" );
@@ -637,8 +609,8 @@ static void sp_image_release( SPObject *object )
image->curve = image->curve->unref();
}
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release (object);
+ if (((SPObjectClass *) sp_image_parent_class)->release) {
+ ((SPObjectClass *) sp_image_parent_class)->release (object);
}
}
@@ -756,8 +728,8 @@ static void sp_image_set( SPObject *object, unsigned int key, const gchar *value
break;
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
default:
- if (((SPObjectClass *) (parent_class))->set)
- ((SPObjectClass *) (parent_class))->set (object, key, value);
+ if (((SPObjectClass *) (sp_image_parent_class))->set)
+ ((SPObjectClass *) (sp_image_parent_class))->set (object, key, value);
break;
}
@@ -769,8 +741,8 @@ static void sp_image_update( SPObject *object, SPCtx *ctx, unsigned int flags )
SPImage *image = SP_IMAGE(object);
SPDocument *doc = object->document;
- if (((SPObjectClass *) (parent_class))->update) {
- ((SPObjectClass *) (parent_class))->update (object, ctx, flags);
+ if (((SPObjectClass *) (sp_image_parent_class))->update) {
+ ((SPObjectClass *) (sp_image_parent_class))->update (object, ctx, flags);
}
if (flags & SP_IMAGE_HREF_MODIFIED_FLAG) {
@@ -973,8 +945,8 @@ static void sp_image_modified( SPObject *object, unsigned int flags )
{
SPImage *image = SP_IMAGE (object);
- if (((SPObjectClass *) (parent_class))->modified) {
- (* ((SPObjectClass *) (parent_class))->modified) (object, flags);
+ if (((SPObjectClass *) (sp_image_parent_class))->modified) {
+ (* ((SPObjectClass *) (sp_image_parent_class))->modified) (object, flags);
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
@@ -1016,8 +988,8 @@ static Inkscape::XML::Node *sp_image_write( SPObject *object, Inkscape::XML::Doc
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_image_parent_class))->write) {
+ ((SPObjectClass *) (sp_image_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index de2c79ec6..4df20b439 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -53,8 +53,6 @@
using Inkscape::DocumentUndo;
-static void sp_group_class_init (SPGroupClass *klass);
-static void sp_group_init (SPGroup *group);
static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_group_release(SPObject *object);
static void sp_group_dispose(GObject *object);
@@ -77,29 +75,7 @@ static void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapC
static void sp_group_update_patheffect(SPLPEItem *lpeitem, bool write);
static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write);
-static SPLPEItemClass * parent_class;
-
-GType
-sp_group_get_type (void)
-{
- static GType group_type = 0;
- if (!group_type) {
- GTypeInfo group_info = {
- sizeof (SPGroupClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_group_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPGroup),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_group_init,
- NULL, /* value_table */
- };
- group_type = g_type_register_static (SP_TYPE_LPE_ITEM, "SPGroup", &group_info, (GTypeFlags)0);
- }
- return group_type;
-}
+G_DEFINE_TYPE(SPGroup, sp_group, SP_TYPE_LPE_ITEM);
static void
sp_group_class_init (SPGroupClass *klass)
@@ -114,8 +90,6 @@ sp_group_class_init (SPGroupClass *klass)
item_class = (SPItemClass *) klass;
lpe_item_class = (SPLPEItemClass *) klass;
- parent_class = (SPLPEItemClass *)g_type_class_ref (SP_TYPE_LPE_ITEM);
-
object_class->dispose = sp_group_dispose;
sp_object_class->child_added = sp_group_child_added;
@@ -150,8 +124,8 @@ static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML
{
object->readAttr( "inkscape:groupmode" );
- if (((SPObjectClass *)parent_class)->build) {
- ((SPObjectClass *)parent_class)->build(object, document, repr);
+ if (((SPObjectClass *)sp_group_parent_class)->build) {
+ ((SPObjectClass *)sp_group_parent_class)->build(object, document, repr);
}
}
@@ -159,8 +133,8 @@ static void sp_group_release(SPObject *object) {
if ( SP_GROUP(object)->_layer_mode == SPGroup::LAYER ) {
object->document->removeResource("layer", object);
}
- if (((SPObjectClass *)parent_class)->release) {
- ((SPObjectClass *)parent_class)->release(object);
+ if (((SPObjectClass *)sp_group_parent_class)->release) {
+ ((SPObjectClass *)sp_group_parent_class)->release(object);
}
}
@@ -175,8 +149,8 @@ static void sp_group_child_added(SPObject *object, Inkscape::XML::Node *child, I
{
SPGroup *group = SP_GROUP(object);
- if (((SPObjectClass *) (parent_class))->child_added) {
- (* ((SPObjectClass *) (parent_class))->child_added) (object, child, ref);
+ if (((SPObjectClass *) (sp_group_parent_class))->child_added) {
+ (* ((SPObjectClass *) (sp_group_parent_class))->child_added) (object, child, ref);
}
group->group->onChildAdded(child);
@@ -187,8 +161,8 @@ static void sp_group_child_added(SPObject *object, Inkscape::XML::Node *child, I
static void
sp_group_remove_child (SPObject * object, Inkscape::XML::Node * child)
{
- if (((SPObjectClass *) (parent_class))->remove_child)
- (* ((SPObjectClass *) (parent_class))->remove_child) (object, child);
+ if (((SPObjectClass *) (sp_group_parent_class))->remove_child)
+ (* ((SPObjectClass *) (sp_group_parent_class))->remove_child) (object, child);
SP_GROUP(object)->group->onChildRemoved(child);
}
@@ -196,8 +170,8 @@ sp_group_remove_child (SPObject * object, Inkscape::XML::Node * child)
static void
sp_group_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
{
- if (((SPObjectClass *) (parent_class))->order_changed)
- (* ((SPObjectClass *) (parent_class))->order_changed) (object, child, old_ref, new_ref);
+ if (((SPObjectClass *) (sp_group_parent_class))->order_changed)
+ (* ((SPObjectClass *) (sp_group_parent_class))->order_changed) (object, child, old_ref, new_ref);
SP_GROUP(object)->group->onOrderChanged(child, old_ref, new_ref);
}
@@ -205,8 +179,8 @@ sp_group_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::
static void
sp_group_update (SPObject *object, SPCtx *ctx, unsigned int flags)
{
- if (((SPObjectClass *) (parent_class))->update)
- ((SPObjectClass *) (parent_class))->update (object, ctx, flags);
+ if (((SPObjectClass *) (sp_group_parent_class))->update)
+ ((SPObjectClass *) (sp_group_parent_class))->update (object, ctx, flags);
SP_GROUP(object)->group->onUpdate(ctx, flags);
}
@@ -214,8 +188,8 @@ sp_group_update (SPObject *object, SPCtx *ctx, unsigned int flags)
static void
sp_group_modified (SPObject *object, guint flags)
{
- if (((SPObjectClass *) (parent_class))->modified)
- ((SPObjectClass *) (parent_class))->modified (object, flags);
+ if (((SPObjectClass *) (sp_group_parent_class))->modified)
+ ((SPObjectClass *) (sp_group_parent_class))->modified (object, flags);
SP_GROUP(object)->group->onModified(flags);
}
@@ -269,8 +243,8 @@ static Inkscape::XML::Node * sp_group_write(SPObject *object, Inkscape::XML::Doc
repr->setAttribute("inkscape:groupmode", value);
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_group_parent_class))->write) {
+ ((SPObjectClass *) (sp_group_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
@@ -307,8 +281,8 @@ static void sp_group_set(SPObject *object, unsigned key, char const *value) {
}
break;
default: {
- if (((SPObjectClass *) (parent_class))->set) {
- (* ((SPObjectClass *) (parent_class))->set)(object, key, value);
+ if (((SPObjectClass *) (sp_group_parent_class))->set) {
+ (* ((SPObjectClass *) (sp_group_parent_class))->set)(object, key, value);
}
}
}
@@ -787,8 +761,8 @@ void CGroup::hide (unsigned int key) {
l = g_slist_remove (l, o);
}
- if (((SPItemClass *) parent_class)->hide)
- ((SPItemClass *) parent_class)->hide (_group, key);
+ if (((SPItemClass *) sp_group_parent_class)->hide)
+ ((SPItemClass *) sp_group_parent_class)->hide (_group, key);
}
void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *, Inkscape::XML::Node *)
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 559ff80ac..19d71ed44 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -75,53 +75,52 @@
#define noSP_ITEM_DEBUG_IDLE
-SPObjectClass * SPItemClass::static_parent_class=0;
-
-/**
- * Registers SPItem class and returns its type number.
- */
-GType
-SPItem::getType(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPItemClass),
- NULL, NULL,
- (GClassInitFunc) SPItemClass::sp_item_class_init,
- NULL, NULL,
- sizeof(SPItem),
- 16,
- (GInstanceInitFunc) sp_item_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPItem", &info, (GTypeFlags)0);
- }
- return type;
-}
+static void sp_item_build (SPObject *object,
+ SPDocument *document,
+ Inkscape::XML::Node *repr);
+static void sp_item_release(SPObject *object);
+static void sp_item_set (SPObject *object,
+ unsigned key,
+ gchar const *value);
+static void sp_item_update (SPObject *object,
+ SPCtx *ctx,
+ guint flags);
+static Inkscape::XML::Node* sp_item_write (SPObject *object,
+ Inkscape::XML::Document *doc,
+ Inkscape::XML::Node *repr,
+ guint flags);
+
+static SPItemView* sp_item_view_list_remove(SPItemView *list,
+ SPItemView *view);
+
+static gchar *sp_item_private_description(SPItem *item);
+static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+
+G_DEFINE_TYPE(SPItem, sp_item, SP_TYPE_OBJECT);
/**
* SPItem vtable initialization.
*/
-void SPItemClass::sp_item_class_init(SPItemClass *klass)
+static void
+sp_item_class_init(SPItemClass *klass)
{
SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
- static_parent_class = SP_OBJECT_CLASS(g_type_class_ref(SP_TYPE_OBJECT));
- sp_object_class->build = SPItem::sp_item_build;
- sp_object_class->release = SPItem::sp_item_release;
- sp_object_class->set = SPItem::sp_item_set;
- sp_object_class->update = SPItem::sp_item_update;
- sp_object_class->write = SPItem::sp_item_write;
+ sp_object_class->build = sp_item_build;
+ sp_object_class->release = sp_item_release;
+ sp_object_class->set = sp_item_set;
+ sp_object_class->update = sp_item_update;
+ sp_object_class->write = sp_item_write;
- klass->description = SPItem::sp_item_private_description;
- klass->snappoints = SPItem::sp_item_private_snappoints;
+ klass->description = sp_item_private_description;
+ klass->snappoints = sp_item_private_snappoints;
}
/**
* Callback for SPItem object initialization.
*/
-void SPItem::sp_item_init(SPItem *item)
+static void
+sp_item_init(SPItem *item)
{
item->init();
}
@@ -412,7 +411,8 @@ void SPItem::moveTo(SPItem *target, gboolean intoafter) {
}
-void SPItem::sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+static void
+sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
object->readAttr( "style" );
object->readAttr( "transform" );
@@ -425,12 +425,13 @@ void SPItem::sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML
object->readAttr( "inkscape:connector-avoid" );
object->readAttr( "inkscape:connection-points" );
- if ((SP_OBJECT_CLASS(SPItemClass::static_parent_class))->build) {
- (* (SP_OBJECT_CLASS(SPItemClass::static_parent_class))->build)(object, document, repr);
+ if ((SP_OBJECT_CLASS(sp_item_parent_class))->build) {
+ (* (SP_OBJECT_CLASS(sp_item_parent_class))->build)(object, document, repr);
}
}
-void SPItem::sp_item_release(SPObject *object)
+static void
+sp_item_release(SPObject *object)
{
SPItem *item = SP_ITEM(object);
@@ -445,8 +446,8 @@ void SPItem::sp_item_release(SPObject *object)
delete item->clip_ref;
delete item->mask_ref;
- if ((SP_OBJECT_CLASS(SPItemClass::static_parent_class))->release) {
- (SP_OBJECT_CLASS(SPItemClass::static_parent_class))->release(object);
+ if ((SP_OBJECT_CLASS(sp_item_parent_class))->release) {
+ (SP_OBJECT_CLASS(sp_item_parent_class))->release(object);
}
while (item->display) {
@@ -456,7 +457,8 @@ void SPItem::sp_item_release(SPObject *object)
item->_transformed_signal.~signal();
}
-void SPItem::sp_item_set(SPObject *object, unsigned key, gchar const *value)
+static void
+sp_item_set(SPObject *object, unsigned key, gchar const *value)
{
SPItem *item = SP_ITEM(object);
@@ -539,8 +541,8 @@ void SPItem::sp_item_set(SPObject *object, unsigned key, gchar const *value)
sp_style_read_from_object(object->style, object);
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
} else {
- if ((SP_OBJECT_CLASS(SPItemClass::static_parent_class))->set) {
- (* (SP_OBJECT_CLASS(SPItemClass::static_parent_class))->set)(object, key, value);
+ if ((SP_OBJECT_CLASS(sp_item_parent_class))->set) {
+ (* (SP_OBJECT_CLASS(sp_item_parent_class))->set)(object, key, value);
}
}
break;
@@ -597,12 +599,13 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
}
}
-void SPItem::sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
+static void
+sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
{
SPItem *item = SP_ITEM(object);
- if ((SP_OBJECT_CLASS(SPItemClass::static_parent_class))->update) {
- (* (SP_OBJECT_CLASS(SPItemClass::static_parent_class))->update)(object, ctx, flags);
+ if ((SP_OBJECT_CLASS(sp_item_parent_class))->update) {
+ (* (SP_OBJECT_CLASS(sp_item_parent_class))->update)(object, ctx, flags);
}
// any of the modifications defined in sp-object.h might change bbox,
@@ -657,7 +660,8 @@ void SPItem::sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
item->avoidRef->handleSettingChange();
}
-Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPItem *item = SP_ITEM(object);
@@ -717,8 +721,8 @@ Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML
}
}
- if ((SP_OBJECT_CLASS(SPItemClass::static_parent_class))->write) {
- (SP_OBJECT_CLASS(SPItemClass::static_parent_class))->write(object, xml_doc, repr, flags);
+ if ((SP_OBJECT_CLASS(sp_item_parent_class))->write) {
+ (SP_OBJECT_CLASS(sp_item_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -898,7 +902,8 @@ unsigned SPItem::pos_in_parent()
return 0;
}
-void SPItem::sp_item_private_snappoints(SPItem const * /*item*/, std::vector<Inkscape::SnapCandidatePoint> &/*p*/, Inkscape::SnapPreferences const * /*snapprefs*/)
+static void
+sp_item_private_snappoints(SPItem const * /*item*/, std::vector<Inkscape::SnapCandidatePoint> &/*p*/, Inkscape::SnapPreferences const * /*snapprefs*/)
{
/* This will only be called if the derived class doesn't override this.
* see for example sp_genericellipse_snappoints in sp-ellipse.cpp
@@ -966,7 +971,8 @@ void SPItem::invoke_print(SPPrintContext *ctx)
}
}
-gchar *SPItem::sp_item_private_description(SPItem */*item*/)
+static gchar*
+sp_item_private_description(SPItem * /*item*/)
{
return g_strdup(_("Object"));
}
@@ -1558,7 +1564,8 @@ SPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, uns
return new_view;
}
-SPItemView *SPItem::sp_item_view_list_remove(SPItemView *list, SPItemView *view)
+static SPItemView*
+sp_item_view_list_remove(SPItemView *list, SPItemView *view)
{
SPItemView *ret = list;
if (view == list) {
diff --git a/src/sp-item.h b/src/sp-item.h
index 2c7bd5a5d..85ef3531e 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -101,16 +101,16 @@ public:
class SPItem;
class SPItemClass;
-#define SP_TYPE_ITEM (SPItem::getType ())
+#define SP_TYPE_ITEM (sp_item_get_type ())
#define SP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ITEM, SPItem))
#define SP_ITEM_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_ITEM, SPItemClass))
#define SP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ITEM))
+GType sp_item_get_type() G_GNUC_CONST;
/** Abstract base class for all visible shapes. */
class SPItem : public SPObject {
public:
- static GType getType();
enum BBoxType {
// legacy behavior: includes crude stroke, markers; excludes long miters, blur margin; is known to be wrong for caps
APPROXIMATE_BBOX,
@@ -227,19 +227,7 @@ private:
mutable bool _is_evaluated;
mutable EvaluatedStatus _evaluated_status;
- static void sp_item_init(SPItem *item);
-
- static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
- static void sp_item_release(SPObject *object);
- static void sp_item_set(SPObject *object, unsigned key, gchar const *value);
- static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags);
- static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static gchar *sp_item_private_description(SPItem *item);
- static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-
static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *arenaitem);
- static SPItemView *sp_item_view_list_remove(SPItemView *list, SPItemView *view);
static void clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
static void mask_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item);
@@ -278,11 +266,8 @@ public:
/** Emit event, if applicable */
gint (* event) (SPItem *item, SPEvent *event);
- private:
- static SPObjectClass *static_parent_class;
- static void sp_item_class_init(SPItemClass *klass);
-
- friend class SPItem;
+private:
+ friend class SPItem;
};
// Utility
diff --git a/src/sp-line.cpp b/src/sp-line.cpp
index 06604a1d6..218d0c3b1 100644
--- a/src/sp-line.cpp
+++ b/src/sp-line.cpp
@@ -24,51 +24,38 @@
#include "document.h"
#include "inkscape.h"
-SPShapeClass * SPLineClass::static_parent_class = 0;
-
-GType SPLine::sp_line_get_type(void)
-{
- static GType line_type = 0;
-
- if (!line_type) {
- GTypeInfo line_info = {
- sizeof(SPLineClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) SPLineClass::sp_line_class_init,
- NULL, /* klass_finalize */
- NULL, /* klass_data */
- sizeof(SPLine),
- 16, /* n_preallocs */
- (GInstanceInitFunc) init,
- NULL, /* value_table */
- };
- line_type = g_type_register_static(SP_TYPE_SHAPE, "SPLine", &line_info,(GTypeFlags)0);
- }
- return line_type;
-}
-
-void SPLineClass::sp_line_class_init(SPLineClass *klass)
+static void sp_line_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
+static void sp_line_set(SPObject *object, unsigned int key, const gchar *value);
+static Inkscape::XML::Node* sp_line_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+static void sp_line_update(SPObject *object, SPCtx *ctx, guint flags);
+static gchar* sp_line_get_description(SPItem * item);
+static Geom::Affine sp_line_set_transform(SPItem *item, Geom::Affine const &xform);
+static void sp_line_set_shape(SPShape *shape);
+static void sp_line_convert_to_guides(SPItem *item);
+
+G_DEFINE_TYPE(SPLine, sp_line, SP_TYPE_SHAPE);
+
+static void
+sp_line_class_init(SPLineClass *klass)
{
- SPLineClass::static_parent_class = (SPShapeClass *) g_type_class_ref(SP_TYPE_SHAPE);
-
SPObjectClass *sp_object_class = (SPObjectClass *) klass;
- sp_object_class->build = SPLine::build;
- sp_object_class->set = SPLine::set;
- sp_object_class->write = SPLine::write;
+ SPItemClass *item_class = (SPItemClass *) klass;
+ SPShapeClass *shape_class = (SPShapeClass *) klass;
- SPItemClass *item_class = (SPItemClass *) klass;
- item_class->description = SPLine::getDescription;
- item_class->set_transform = SPLine::setTransform;
- item_class->convert_to_guides = SPLine::convertToGuides;
+ sp_object_class->build = sp_line_build;
+ sp_object_class->set = sp_line_set;
+ sp_object_class->write = sp_line_write;
+ sp_object_class->update = sp_line_update;
- sp_object_class->update = SPLine::update;
+ item_class->description = sp_line_get_description;
+ item_class->set_transform = sp_line_set_transform;
+ item_class->convert_to_guides = sp_line_convert_to_guides;
- SPShapeClass *shape_class = (SPShapeClass *) klass;
- shape_class->set_shape = SPLine::setShape;
+ shape_class->set_shape = sp_line_set_shape;
}
-void SPLine::init(SPLine * line)
+static void
+sp_line_init(SPLine * line)
{
line->x1.unset();
line->y1.unset();
@@ -77,10 +64,11 @@ void SPLine::init(SPLine * line)
}
-void SPLine::build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
+static void
+sp_line_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if (((SPObjectClass *) SPLineClass::static_parent_class)->build) {
- ((SPObjectClass *) SPLineClass::static_parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_line_parent_class)->build) {
+ ((SPObjectClass *) sp_line_parent_class)->build(object, document, repr);
}
object->readAttr( "x1" );
@@ -89,7 +77,8 @@ void SPLine::build(SPObject * object, SPDocument * document, Inkscape::XML::Node
object->readAttr( "y2" );
}
-void SPLine::set(SPObject *object, unsigned int key, const gchar *value)
+static void
+sp_line_set(SPObject *object, unsigned int key, const gchar *value)
{
SPLine * line = SP_LINE(object);
@@ -113,14 +102,15 @@ void SPLine::set(SPObject *object, unsigned int key, const gchar *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) SPLineClass::static_parent_class)->set) {
- ((SPObjectClass *) SPLineClass::static_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_line_parent_class)->set) {
+ ((SPObjectClass *) sp_line_parent_class)->set(object, key, value);
}
break;
}
}
-void SPLine::update(SPObject *object, SPCtx *ctx, guint flags)
+static void
+sp_line_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
SPLine *line = SP_LINE(object);
@@ -139,13 +129,14 @@ void SPLine::update(SPObject *object, SPCtx *ctx, guint flags)
((SPShape *) object)->setShape();
}
- if (((SPObjectClass *) SPLineClass::static_parent_class)->update) {
- ((SPObjectClass *) SPLineClass::static_parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_line_parent_class)->update) {
+ ((SPObjectClass *) sp_line_parent_class)->update(object, ctx, flags);
}
}
-Inkscape::XML::Node * SPLine::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_line_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPLine *line = SP_LINE(object);
@@ -162,19 +153,21 @@ Inkscape::XML::Node * SPLine::write(SPObject *object, Inkscape::XML::Document *x
sp_repr_set_svg_double(repr, "x2", line->x2.computed);
sp_repr_set_svg_double(repr, "y2", line->y2.computed);
- if (((SPObjectClass *) (SPLineClass::static_parent_class))->write) {
- ((SPObjectClass *) (SPLineClass::static_parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_line_parent_class))->write) {
+ ((SPObjectClass *) (sp_line_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
}
-gchar * SPLine::getDescription(SPItem */*item*/)
+static gchar*
+sp_line_get_description(SPItem * /*item*/)
{
return g_strdup(_("<b>Line</b>"));
}
-void SPLine::convertToGuides(SPItem *item)
+static void
+sp_line_convert_to_guides(SPItem *item)
{
SPLine *line = SP_LINE(item);
Geom::Point points[2];
@@ -187,7 +180,8 @@ void SPLine::convertToGuides(SPItem *item)
SPGuide::createSPGuide(item->document, points[0], points[1]);
}
-Geom::Affine SPLine::setTransform(SPItem *item, Geom::Affine const &xform)
+static Geom::Affine
+sp_line_set_transform(SPItem *item, Geom::Affine const &xform)
{
SPLine *line = SP_LINE(item);
Geom::Point points[2];
@@ -210,7 +204,8 @@ Geom::Affine SPLine::setTransform(SPItem *item, Geom::Affine const &xform)
return Geom::identity();
}
-void SPLine::setShape(SPShape *shape)
+static void
+sp_line_set_shape(SPShape *shape)
{
SPLine *line = SP_LINE(shape);
diff --git a/src/sp-line.h b/src/sp-line.h
index 182f85a5c..836b2df67 100644
--- a/src/sp-line.h
+++ b/src/sp-line.h
@@ -19,7 +19,7 @@
-#define SP_TYPE_LINE (SPLine::sp_line_get_type())
+#define SP_TYPE_LINE (sp_line_get_type())
#define SP_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_LINE, SPLine))
#define SP_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_LINE, SPLineClass))
#define SP_IS_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_LINE))
@@ -28,28 +28,16 @@
class SPLine;
class SPLineClass;
+GType sp_line_get_type(void) G_GNUC_CONST;
+
class SPLine : public SPShape {
public:
SVGLength x1;
SVGLength y1;
SVGLength x2;
SVGLength y2;
- static GType sp_line_get_type(void);
private:
- static void init(SPLine *line);
-
- static void build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void set(SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static gchar *getDescription(SPItem * item);
- static Geom::Affine setTransform(SPItem *item, Geom::Affine const &xform);
-
- static void update(SPObject *object, SPCtx *ctx, guint flags);
- static void setShape(SPShape *shape);
- static void convertToGuides(SPItem *item);
-
friend class SPLineClass;
};
@@ -58,9 +46,6 @@ public:
SPShapeClass parent_class;
private:
- static SPShapeClass *static_parent_class;
- static void sp_line_class_init(SPLineClass *klass);
-
friend class SPLine;
};
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 2f158df9d..f417dd275 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -49,9 +49,6 @@ using Inkscape::DocumentUndo;
#define DEFAULTBORDERCOLOR 0x000000ff
#define DEFAULTPAGECOLOR 0xffffff00
-static void sp_namedview_class_init(SPNamedViewClass *klass);
-static void sp_namedview_init(SPNamedView *namedview);
-
static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_namedview_release(SPObject *object);
static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value);
@@ -65,35 +62,11 @@ static void sp_namedview_show_single_guide(SPGuide* guide, bool show);
static gboolean sp_str_to_bool(const gchar *str);
static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color);
-static SPObjectGroupClass * parent_class;
-
-GType
-sp_namedview_get_type()
-{
- static GType namedview_type = 0;
- if (!namedview_type) {
- GTypeInfo namedview_info = {
- sizeof(SPNamedViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_namedview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPNamedView),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_namedview_init,
- NULL, /* value_table */
- };
- namedview_type = g_type_register_static(SP_TYPE_OBJECTGROUP, "SPNamedView", &namedview_info, (GTypeFlags)0);
- }
- return namedview_type;
-}
+G_DEFINE_TYPE(SPNamedView, sp_namedview, SP_TYPE_OBJECTGROUP);
static void sp_namedview_class_init(SPNamedViewClass * klass)
{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
-
- parent_class = reinterpret_cast<SPObjectGroupClass *>(g_type_class_ref(SP_TYPE_OBJECTGROUP));
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
sp_object_class->build = sp_namedview_build;
sp_object_class->release = sp_namedview_release;
@@ -215,8 +188,8 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
SPNamedView *nv = (SPNamedView *) object;
SPObjectGroup *og = (SPObjectGroup *) object;
- if (((SPObjectClass *) (parent_class))->build) {
- (* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
+ if (((SPObjectClass *) (sp_namedview_parent_class))->build) {
+ (* ((SPObjectClass *) (sp_namedview_parent_class))->build)(object, document, repr);
}
object->readAttr( "inkscape:document-units" );
@@ -303,8 +276,8 @@ static void sp_namedview_release(SPObject *object)
namedview->grids = g_slist_remove_link(namedview->grids, namedview->grids); // deletes first entry
}
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_namedview_parent_class)->release) {
+ ((SPObjectClass *) sp_namedview_parent_class)->release(object);
}
namedview->snap_manager.~SnapManager();
@@ -624,8 +597,8 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
break;
}
default:
- if (((SPObjectClass *) (parent_class))->set) {
- ((SPObjectClass *) (parent_class))->set(object, key, value);
+ if (((SPObjectClass *) (sp_namedview_parent_class))->set) {
+ ((SPObjectClass *) (sp_namedview_parent_class))->set(object, key, value);
}
break;
}
@@ -676,8 +649,8 @@ static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *chil
{
SPNamedView *nv = (SPNamedView *) object;
- if (((SPObjectClass *) (parent_class))->child_added) {
- (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);
+ if (((SPObjectClass *) (sp_namedview_parent_class))->child_added) {
+ (* ((SPObjectClass *) (sp_namedview_parent_class))->child_added)(object, child, ref);
}
if (!strcmp(child->name(), "inkscape:grid")) {
@@ -730,8 +703,8 @@ static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *chi
}
}
- if (((SPObjectClass *) (parent_class))->remove_child) {
- (* ((SPObjectClass *) (parent_class))->remove_child)(object, child);
+ if (((SPObjectClass *) (sp_namedview_parent_class))->remove_child) {
+ (* ((SPObjectClass *) (sp_namedview_parent_class))->remove_child)(object, child);
}
}
diff --git a/src/sp-namedview.h b/src/sp-namedview.h
index e83ead69e..8191ef6d6 100644
--- a/src/sp-namedview.h
+++ b/src/sp-namedview.h
@@ -25,6 +25,8 @@
#include "snap.h"
#include "document.h"
+G_BEGIN_DECLS
+
struct SPUnit;
namespace Inkscape {
@@ -112,6 +114,8 @@ void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document);
Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview);
+G_END_DECLS
+
#endif /* !INKSCAPE_SP_NAMEDVIEW_H */
diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp
index eee8d50bc..94000cc9d 100644
--- a/src/sp-polygon.cpp
+++ b/src/sp-polygon.cpp
@@ -25,46 +25,18 @@
#include "xml/repr.h"
#include "document.h"
-static void sp_polygon_class_init(SPPolygonClass *pc);
-static void sp_polygon_init(SPPolygon *polygon);
-
static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static gchar *sp_polygon_description(SPItem *item);
-static SPShapeClass *parent_class;
-
-GType sp_polygon_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof(SPPolygonClass),
- 0, // base_init
- 0, // base_finalize
- (GClassInitFunc)sp_polygon_class_init,
- 0, // class_finalize
- 0, // class_data
- sizeof(SPPolygon),
- 0, // n_preallocs
- (GInstanceInitFunc)sp_polygon_init,
- 0 // value_table
- };
- type = g_type_register_static(SP_TYPE_SHAPE, "SPPolygon", &info, static_cast<GTypeFlags>(0));
- }
-
- return type;
-}
+G_DEFINE_TYPE(SPPolygon, sp_polygon, SP_TYPE_SHAPE);
static void sp_polygon_class_init(SPPolygonClass *pc)
{
SPObjectClass *sp_object_class = (SPObjectClass *) pc;
SPItemClass *item_class = (SPItemClass *) pc;
- parent_class = (SPShapeClass *) g_type_class_ref(SP_TYPE_SHAPE);
-
sp_object_class->build = sp_polygon_build;
sp_object_class->write = sp_polygon_write;
sp_object_class->set = sp_polygon_set;
@@ -79,8 +51,8 @@ static void sp_polygon_init(SPPolygon */*polygon*/)
static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) parent_class)->build) {
- ((SPObjectClass *) parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_polygon_parent_class)->build) {
+ ((SPObjectClass *) sp_polygon_parent_class)->build(object, document, repr);
}
object->readAttr( "points" );
@@ -126,8 +98,8 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Do
repr->setAttribute("points", str);
g_free(str);
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_polygon_parent_class))->write) {
+ ((SPObjectClass *) (sp_polygon_parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
@@ -213,8 +185,8 @@ void sp_polygon_set(SPObject *object, unsigned int key, const gchar *value)
break;
}
default:
- if (((SPObjectClass *) parent_class)->set) {
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_polygon_parent_class)->set) {
+ ((SPObjectClass *) sp_polygon_parent_class)->set(object, key, value);
}
break;
}
diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp
index 8dbed2a22..e5d89a802 100644
--- a/src/sp-polyline.cpp
+++ b/src/sp-polyline.cpp
@@ -20,61 +20,44 @@
#include "xml/repr.h"
#include "document.h"
-SPShapeClass * SPPolyLineClass::static_parent_class=0;
+static void sp_polyline_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
+static void sp_polyline_set(SPObject *object, unsigned int key, const gchar *value);
+static Inkscape::XML::Node* sp_polyline_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+static gchar* sp_polyline_get_description(SPItem * item);
-GType SPPolyLine::sp_polyline_get_type(void)
-{
- static GType polyline_type = 0;
-
- if (!polyline_type) {
- GTypeInfo polyline_info = {
- sizeof (SPPolyLineClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) SPPolyLineClass::sp_polyline_class_init,
- NULL, /* klass_finalize */
- NULL, /* klass_data */
- sizeof (SPPolyLine),
- 16, /* n_preallocs */
- (GInstanceInitFunc) SPPolyLine::init,
- NULL, /* value_table */
- };
- polyline_type = g_type_register_static (SP_TYPE_SHAPE, "SPPolyLine", &polyline_info, (GTypeFlags)0);
- }
- return polyline_type;
-}
-void SPPolyLineClass::sp_polyline_class_init(SPPolyLineClass *klass)
+G_DEFINE_TYPE(SPPolyLine, sp_polyline, SP_TYPE_SHAPE);
+
+static void
+sp_polyline_class_init(SPPolyLineClass *klass)
{
- //GObjectClass * gobject_class = (GObjectClass *) klass;
SPObjectClass * sp_object_class = (SPObjectClass *) klass;
SPItemClass * item_class = (SPItemClass *) klass;
- static_parent_class = (SPShapeClass *)g_type_class_ref(SP_TYPE_SHAPE);
-
- sp_object_class->build = SPPolyLine::build;
- sp_object_class->set = SPPolyLine::set;
- sp_object_class->write = SPPolyLine::write;
+ sp_object_class->build = sp_polyline_build;
+ sp_object_class->set = sp_polyline_set;
+ sp_object_class->write = sp_polyline_write;
- item_class->description = SPPolyLine::getDescription;
+ item_class->description = sp_polyline_get_description;
}
-void SPPolyLine::init(SPPolyLine * /*polyline*/)
+static void
+sp_polyline_init(SPPolyLine * /*polyline*/)
{
- /* Nothing here */
}
-void SPPolyLine::build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
+static void
+sp_polyline_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
-
- if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->build) {
- ((SPObjectClass *) SPPolyLineClass::static_parent_class)->build (object, document, repr);
+ if (((SPObjectClass *) sp_polyline_parent_class)->build) {
+ ((SPObjectClass *) sp_polyline_parent_class)->build (object, document, repr);
}
object->readAttr( "points" );
}
-void SPPolyLine::set(SPObject *object, unsigned int key, const gchar *value)
+static void
+sp_polyline_set(SPObject *object, unsigned int key, const gchar *value)
{
SPPolyLine *polyline = SP_POLYLINE(object);
@@ -125,14 +108,15 @@ void SPPolyLine::set(SPObject *object, unsigned int key, const gchar *value)
break;
}
default:
- if (((SPObjectClass *) SPPolyLineClass::static_parent_class)->set) {
- ((SPObjectClass *) SPPolyLineClass::static_parent_class)->set (object, key, value);
+ if (((SPObjectClass *) sp_polyline_parent_class)->set) {
+ ((SPObjectClass *) sp_polyline_parent_class)->set (object, key, value);
}
break;
}
}
-Inkscape::XML::Node *SPPolyLine::write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_polyline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SP_POLYLINE(object);
@@ -144,14 +128,15 @@ Inkscape::XML::Node *SPPolyLine::write(SPObject *object, Inkscape::XML::Document
repr->mergeFrom(object->getRepr(), "id");
}
- if (((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write) {
- ((SPObjectClass *) (SPPolyLineClass::static_parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_polyline_parent_class))->write) {
+ ((SPObjectClass *) (sp_polyline_parent_class))->write (object, xml_doc, repr, flags);
}
return repr;
}
-gchar *SPPolyLine::getDescription(SPItem * /*item*/)
+static gchar*
+sp_polyline_get_description(SPItem * /*item*/)
{
return g_strdup(_("<b>Polyline</b>"));
}
diff --git a/src/sp-polyline.h b/src/sp-polyline.h
index 277529b49..047868692 100644
--- a/src/sp-polyline.h
+++ b/src/sp-polyline.h
@@ -5,7 +5,7 @@
-#define SP_TYPE_POLYLINE (SPPolyLine::sp_polyline_get_type ())
+#define SP_TYPE_POLYLINE (sp_polyline_get_type ())
#define SP_POLYLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_POLYLINE, SPPolyLine))
#define SP_POLYLINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_POLYLINE, SPPolyLineClass))
#define SP_IS_POLYLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_POLYLINE))
@@ -14,19 +14,10 @@
class SPPolyLine;
class SPPolyLineClass;
-class SPPolyLine : public SPShape {
-public:
- static GType sp_polyline_get_type (void);
+GType sp_polyline_get_type (void) G_GNUC_CONST;
+class SPPolyLine : public SPShape {
private:
- static void init(SPPolyLine *polyline);
-
- static void build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void set(SPObject *object, unsigned int key, const gchar *value);
- static Inkscape::XML::Node *write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static gchar * getDescription(SPItem * item);
-
friend class SPPolyLineClass;
};
@@ -35,9 +26,6 @@ public:
SPShapeClass parent_class;
private:
- static SPShapeClass *static_parent_class;
- static void sp_polyline_class_init (SPPolyLineClass *klass);
-
friend class SPPolyLine;
};
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 393c70895..e9ae6dff4 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -31,11 +31,6 @@
#include "svg/svg.h"
#include "xml/repr.h"
-class SPDesktop;
-
-static void sp_root_class_init(SPRootClass *klass);
-static void sp_root_init(SPRoot *root);
-
static void sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_root_release(SPObject *object);
static void sp_root_set(SPObject *object, unsigned int key, gchar const *value);
@@ -48,29 +43,7 @@ static Inkscape::XML::Node *sp_root_write(SPObject *object, Inkscape::XML::Docum
static Inkscape::DrawingItem *sp_root_show(SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
static void sp_root_print(SPItem *item, SPPrintContext *ctx);
-static SPGroupClass *parent_class;
-
-/**
- * Returns the type info of sp_root, including its class sizes and initialization routines.
- */
-GType sp_root_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPRootClass),
- NULL, NULL,
- (GClassInitFunc) sp_root_class_init,
- NULL, NULL,
- sizeof(SPRoot),
- 16,
- (GInstanceInitFunc) sp_root_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_GROUP, "SPRoot", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPRoot, sp_root, SP_TYPE_GROUP);
/**
* Initializes an SPRootClass object by setting its class and parent class objects, and registering
@@ -81,8 +54,6 @@ static void sp_root_class_init(SPRootClass *klass)
SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
SPItemClass *sp_item_class = reinterpret_cast<SPItemClass *>(klass);
- parent_class = reinterpret_cast<SPGroupClass *>(g_type_class_ref(SP_TYPE_GROUP));
-
sp_object_class->build = sp_root_build;
sp_object_class->release = sp_root_release;
sp_object_class->set = sp_root_set;
@@ -147,8 +118,8 @@ static void sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML:
object->readAttr( "preserveAspectRatio" );
object->readAttr( "onload" );
- if (((SPObjectClass *) parent_class)->build)
- (* ((SPObjectClass *) parent_class)->build) (object, document, repr);
+ if (((SPObjectClass *) sp_root_parent_class)->build)
+ (* ((SPObjectClass *) sp_root_parent_class)->build) (object, document, repr);
// Search for first <defs> node
for (SPObject *o = group->firstChild() ; o ; o = o->getNext() ) {
@@ -171,8 +142,8 @@ static void sp_root_release(SPObject *object)
SPRoot *root = (SPRoot *) object;
root->defs = NULL;
- if (((SPObjectClass *) parent_class)->release)
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_root_parent_class)->release)
+ ((SPObjectClass *) sp_root_parent_class)->release(object);
}
/**
@@ -315,8 +286,8 @@ static void sp_root_set(SPObject *object, unsigned int key, gchar const *value)
break;
default:
/* Pass the set event to the parent */
- if (((SPObjectClass *) parent_class)->set) {
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_root_parent_class)->set) {
+ ((SPObjectClass *) sp_root_parent_class)->set(object, key, value);
}
break;
}
@@ -331,8 +302,8 @@ static void sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, In
SPRoot *root = (SPRoot *) object;
SPGroup *group = (SPGroup *) object;
- if (((SPObjectClass *) (parent_class))->child_added) {
- (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref);
+ if (((SPObjectClass *) (sp_root_parent_class))->child_added) {
+ (* ((SPObjectClass *) (sp_root_parent_class))->child_added)(object, child, ref);
}
SPObject *co = object->document->getObjectByRepr(child);
@@ -371,8 +342,8 @@ static void sp_root_remove_child(SPObject *object, Inkscape::XML::Node *child)
}
}
- if (((SPObjectClass *) (parent_class))->remove_child) {
- (* ((SPObjectClass *) (parent_class))->remove_child)(object, child);
+ if (((SPObjectClass *) (sp_root_parent_class))->remove_child) {
+ (* ((SPObjectClass *) (sp_root_parent_class))->remove_child)(object, child);
}
}
@@ -508,8 +479,8 @@ static void sp_root_update(SPObject *object, SPCtx *ctx, guint flags)
rctx.i2vp = Geom::identity();
/* And invoke parent method */
- if (((SPObjectClass *) (parent_class))->update)
- ((SPObjectClass *) (parent_class))->update(object, (SPCtx *) &rctx, flags);
+ if (((SPObjectClass *) (sp_root_parent_class))->update)
+ ((SPObjectClass *) (sp_root_parent_class))->update(object, (SPCtx *) &rctx, flags);
/* As last step set additional transform of drawing group */
for (SPItemView *v = root->display; v != NULL; v = v->next) {
@@ -527,8 +498,8 @@ static void sp_root_modified(SPObject *object, guint flags)
{
SPRoot *root = SP_ROOT(object);
- if (((SPObjectClass *) (parent_class))->modified)
- (* ((SPObjectClass *) (parent_class))->modified)(object, flags);
+ if (((SPObjectClass *) (sp_root_parent_class))->modified)
+ (* ((SPObjectClass *) (sp_root_parent_class))->modified)(object, flags);
/* fixme: (Lauris) */
if (!object->parent && (flags & SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
@@ -576,8 +547,8 @@ sp_root_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
repr->setAttribute("viewBox", os.str().c_str());
}
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_root_parent_class))->write)
+ ((SPObjectClass *) (sp_root_parent_class))->write(object, xml_doc, repr, flags);
return repr;
}
@@ -591,8 +562,8 @@ sp_root_show(SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigne
SPRoot *root = SP_ROOT(item);
Inkscape::DrawingItem *ai;
- if (((SPItemClass *) (parent_class))->show) {
- ai = ((SPItemClass *) (parent_class))->show(item, drawing, key, flags);
+ if (((SPItemClass *) (sp_root_parent_class))->show) {
+ ai = ((SPItemClass *) (sp_root_parent_class))->show(item, drawing, key, flags);
if (ai) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(ai);
g->setChildTransform(root->c2p);
@@ -613,8 +584,8 @@ static void sp_root_print(SPItem *item, SPPrintContext *ctx)
sp_print_bind(ctx, root->c2p, 1.0);
- if (((SPItemClass *) (parent_class))->print) {
- ((SPItemClass *) (parent_class))->print(item, ctx);
+ if (((SPItemClass *) (sp_root_parent_class))->print) {
+ ((SPItemClass *) (sp_root_parent_class))->print(item, ctx);
}
sp_print_release(ctx);
diff --git a/src/sp-script.cpp b/src/sp-script.cpp
index f18d231b0..736ddb4c9 100644
--- a/src/sp-script.cpp
+++ b/src/sp-script.cpp
@@ -16,9 +16,6 @@
#include <cstring>
#include "document.h"
-static void sp_script_class_init(SPScriptClass *sc);
-static void sp_script_init(SPScript *script);
-
static void sp_script_release(SPObject *object);
static void sp_script_update(SPObject *object, SPCtx *ctx, guint flags);
static void sp_script_modified(SPObject *object, guint flags);
@@ -26,34 +23,10 @@ static void sp_script_set(SPObject *object, unsigned int key, gchar const *value
static void sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_script_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static SPObjectClass *parent_class;
-
-GType sp_script_get_type(void)
-{
- static GType script_type = 0;
-
- if (!script_type) {
- GTypeInfo script_info = {
- sizeof(SPScriptClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_script_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPScript),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_script_init,
- NULL, /* value_table */
- };
- script_type = g_type_register_static(SP_TYPE_OBJECT, "SPScript", &script_info, (GTypeFlags) 0);
- }
-
- return script_type;
-}
+G_DEFINE_TYPE(SPScript, sp_script, SP_TYPE_OBJECT);
static void sp_script_class_init(SPScriptClass *sc)
{
- parent_class = (SPObjectClass *) g_type_class_ref(SP_TYPE_OBJECT);
SPObjectClass *sp_object_class = (SPObjectClass *) sc;
sp_object_class->build = sp_script_build;
@@ -78,8 +51,8 @@ static void sp_script_init(SPScript */*script*/)
static void
sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) parent_class)->build) {
- ((SPObjectClass *) parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_script_parent_class)->build) {
+ ((SPObjectClass *) sp_script_parent_class)->build(object, document, repr);
}
//Read values of key attributes from XML nodes into object.
@@ -95,8 +68,8 @@ static void sp_script_release(SPObject *object)
object->document->removeResource("script", object);
}
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_script_parent_class)->release) {
+ ((SPObjectClass *) sp_script_parent_class)->release(object);
}
}
@@ -120,8 +93,8 @@ sp_script_set(SPObject *object, unsigned int key, gchar const *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_script_parent_class)->set)
+ ((SPObjectClass *) sp_script_parent_class)->set(object, key, value);
break;
}
}
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index d5556ba9e..4037b302c 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -54,58 +54,47 @@
#define noSHAPE_VERBOSE
void sp_shape_print (SPItem * item, SPPrintContext * ctx);
-
-SPLPEItemClass * SPShapeClass::parent_class = 0;
-
-/**
- * Registers the SPShape class with Gdk and returns its type number.
- */
-GType SPShape::getType(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof (SPShapeClass),
- NULL, NULL,
- (GClassInitFunc) SPShapeClass::sp_shape_class_init,
- NULL, NULL,
- sizeof (SPShape),
- 16,
- (GInstanceInitFunc) sp_shape_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_LPE_ITEM, "SPShape", &info, (GTypeFlags)0);
- }
- return type;
-}
+static void sp_shape_finalize (GObject *object);
+static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
+static void sp_shape_release (SPObject *object);
+static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
+static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
+static void sp_shape_modified (SPObject *object, unsigned int flags);
+static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
+static Geom::OptRect sp_shape_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type);
+static Inkscape::DrawingItem *sp_shape_show (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
+static void sp_shape_hide (SPItem *item, unsigned int key);
+static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+static void sp_shape_update_marker_view (SPShape *shape, Inkscape::DrawingItem *ai);
+
+G_DEFINE_TYPE(SPShape, sp_shape, SP_TYPE_LPE_ITEM);
/**
* Initializes a SPShapeClass object. Establishes the function pointers to the class'
* member routines in the class vtable, and sets pointers to parent classes.
*/
-void SPShapeClass::sp_shape_class_init(SPShapeClass *klass)
+static void
+sp_shape_class_init(SPShapeClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
SPItemClass * item_class = SP_ITEM_CLASS(klass);
SPLPEItemClass * lpe_item_class = SP_LPE_ITEM_CLASS(klass);
- parent_class = (SPLPEItemClass *)g_type_class_peek_parent (klass);
-
- gobject_class->finalize = SPShape::sp_shape_finalize;
+ gobject_class->finalize = sp_shape_finalize;
- sp_object_class->build = SPShape::sp_shape_build;
- sp_object_class->release = SPShape::sp_shape_release;
- sp_object_class->set = SPShape::sp_shape_set;
- sp_object_class->update = SPShape::sp_shape_update;
- sp_object_class->modified = SPShape::sp_shape_modified;
- sp_object_class->write = SPShape::sp_shape_write;
+ sp_object_class->build = sp_shape_build;
+ sp_object_class->release = sp_shape_release;
+ sp_object_class->set = sp_shape_set;
+ sp_object_class->update = sp_shape_update;
+ sp_object_class->modified = sp_shape_modified;
+ sp_object_class->write = sp_shape_write;
- item_class->bbox = SPShape::sp_shape_bbox;
+ item_class->bbox = sp_shape_bbox;
item_class->print = sp_shape_print;
- item_class->show = SPShape::sp_shape_show;
- item_class->hide = SPShape::sp_shape_hide;
- item_class->snappoints = SPShape::sp_shape_snappoints;
+ item_class->show = sp_shape_show;
+ item_class->hide = sp_shape_hide;
+ item_class->snappoints = sp_shape_snappoints;
lpe_item_class->update_patheffect = NULL;
klass->set_shape = NULL;
@@ -114,7 +103,8 @@ void SPShapeClass::sp_shape_class_init(SPShapeClass *klass)
/**
* Initializes an SPShape object.
*/
-void SPShape::sp_shape_init(SPShape *shape)
+static void
+sp_shape_init(SPShape *shape)
{
for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) {
new (&shape->_release_connect[i]) sigc::connection();
@@ -125,7 +115,8 @@ void SPShape::sp_shape_init(SPShape *shape)
shape->_curve_before_lpe = NULL;
}
-void SPShape::sp_shape_finalize(GObject *object)
+static void
+sp_shape_finalize(GObject *object)
{
SPShape *shape=(SPShape *)object;
@@ -136,8 +127,8 @@ void SPShape::sp_shape_finalize(GObject *object)
shape->_modified_connect[i].~connection();
}
- if (((GObjectClass *) (SPShapeClass::parent_class))->finalize) {
- (* ((GObjectClass *) (SPShapeClass::parent_class))->finalize)(object);
+ if (((GObjectClass *) (sp_shape_parent_class))->finalize) {
+ (* ((GObjectClass *) (sp_shape_parent_class))->finalize)(object);
}
}
@@ -148,10 +139,11 @@ void SPShape::sp_shape_finalize(GObject *object)
*
* \see SPObject::build()
*/
-void SPShape::sp_shape_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+static void
+sp_shape_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) (SPShapeClass::parent_class))->build) {
- (*((SPObjectClass *) (SPShapeClass::parent_class))->build) (object, document, repr);
+ if (((SPObjectClass *) (sp_shape_parent_class))->build) {
+ (*((SPObjectClass *) (sp_shape_parent_class))->build) (object, document, repr);
}
for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
@@ -169,7 +161,8 @@ void SPShape::sp_shape_build(SPObject *object, SPDocument *document, Inkscape::X
*
* \see SPObject::release()
*/
-void SPShape::sp_shape_release(SPObject *object)
+static void
+sp_shape_release(SPObject *object)
{
SPItem *item;
SPShape *shape;
@@ -196,24 +189,24 @@ void SPShape::sp_shape_release(SPObject *object)
shape->_curve_before_lpe = shape->_curve_before_lpe->unref();
}
- if (((SPObjectClass *) SPShapeClass::parent_class)->release) {
- ((SPObjectClass *) SPShapeClass::parent_class)->release (object);
+ if (((SPObjectClass *) sp_shape_parent_class)->release) {
+ ((SPObjectClass *) sp_shape_parent_class)->release (object);
}
}
-
-
-void SPShape::sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
+static void
+sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
{
- if (((SPObjectClass *) SPShapeClass::parent_class)->set) {
- ((SPObjectClass *) SPShapeClass::parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_shape_parent_class)->set) {
+ ((SPObjectClass *) sp_shape_parent_class)->set(object, key, value);
}
}
-Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node*
+sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
- if (((SPObjectClass *)(SPShapeClass::parent_class))->write) {
- ((SPObjectClass *)(SPShapeClass::parent_class))->write(object, doc, repr, flags);
+ if (((SPObjectClass *)(sp_shape_parent_class))->write) {
+ ((SPObjectClass *)(sp_shape_parent_class))->write(object, doc, repr, flags);
}
return repr;
@@ -223,12 +216,13 @@ Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::D
* Updates the shape when its attributes have changed. Also establishes
* marker objects to match the style settings.
*/
-void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
+static void
+sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags)
{
SPShape *shape = (SPShape *) object;
- if (((SPObjectClass *) (SPShapeClass::parent_class))->update) {
- (* ((SPObjectClass *) (SPShapeClass::parent_class))->update) (object, ctx, flags);
+ if (((SPObjectClass *) (sp_shape_parent_class))->update) {
+ (* ((SPObjectClass *) (sp_shape_parent_class))->update) (object, ctx, flags);
}
/* This stanza checks that an object's marker style agrees with
@@ -372,7 +366,8 @@ Geom::Affine sp_shape_marker_get_transform_at_end(Geom::Curve const & c)
*
* @todo figure out what to do when both 'marker' and for instance 'marker-end' are set.
*/
-void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai)
+static void
+sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai)
{
SPStyle *style = ((SPObject *) shape)->style;
@@ -482,12 +477,13 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem
/**
* Sets modified flag for all sub-item views.
*/
-void SPShape::sp_shape_modified(SPObject *object, unsigned int flags)
+static void
+sp_shape_modified(SPObject *object, unsigned int flags)
{
SPShape *shape = SP_SHAPE (object);
- if (((SPObjectClass *) (SPShapeClass::parent_class))->modified) {
- (* ((SPObjectClass *) (SPShapeClass::parent_class))->modified) (object, flags);
+ if (((SPObjectClass *) (sp_shape_parent_class))->modified) {
+ (* ((SPObjectClass *) (sp_shape_parent_class))->modified) (object, flags);
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
@@ -502,7 +498,8 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags)
* Calculates the bounding box for item, storing it into bbox.
* This also includes the bounding boxes of any markers included in the shape.
*/
-Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType bboxtype)
+static Geom::OptRect
+sp_shape_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType bboxtype)
{
SPShape const *shape = SP_SHAPE (item);
Geom::OptRect bbox;
@@ -792,7 +789,8 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
/**
* Sets style, path, and paintbox. Updates marker views, including dimensions.
*/
-Inkscape::DrawingItem * SPShape::sp_shape_show(SPItem *item, Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/)
+static Inkscape::DrawingItem*
+sp_shape_show(SPItem *item, Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/)
{
SPObject *object = item;
SPShape *shape = SP_SHAPE(item);
@@ -835,7 +833,8 @@ Inkscape::DrawingItem * SPShape::sp_shape_show(SPItem *item, Inkscape::Drawing &
/**
* Hides/removes marker views from the shape.
*/
-void SPShape::sp_shape_hide(SPItem *item, unsigned int key)
+static void
+sp_shape_hide(SPItem *item, unsigned int key)
{
SPShape *shape;
SPItemView *v;
@@ -854,8 +853,8 @@ void SPShape::sp_shape_hide(SPItem *item, unsigned int key)
}
}
- if (((SPItemClass *) SPShapeClass::parent_class)->hide) {
- ((SPItemClass *) SPShapeClass::parent_class)->hide (item, key);
+ if (((SPItemClass *) sp_shape_parent_class)->hide) {
+ ((SPItemClass *) sp_shape_parent_class)->hide (item, key);
}
}
@@ -1110,7 +1109,8 @@ void SPShape::setCurveInsync(SPCurve *new_curve, unsigned int owner)
/**
* Return all nodes in a path that are to be considered for snapping
*/
-void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
+static void
+sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
{
g_assert(item != NULL);
g_assert(SP_IS_SHAPE(item));
diff --git a/src/sp-shape.h b/src/sp-shape.h
index 453750946..422281cae 100644
--- a/src/sp-shape.h
+++ b/src/sp-shape.h
@@ -22,7 +22,7 @@
#include <stddef.h>
#include <sigc++/connection.h>
-#define SP_TYPE_SHAPE (SPShape::getType ())
+#define SP_TYPE_SHAPE (sp_shape_get_type ())
#define SP_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SHAPE, SPShape))
#define SP_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SHAPE, SPShapeClass))
#define SP_IS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SHAPE))
@@ -32,13 +32,13 @@
class SPDesktop;
namespace Inkscape { class DrawingItem; }
+GType sp_shape_get_type (void) G_GNUC_CONST;
/**
* Base class for shapes, including <path> element
*/
class SPShape : public SPLPEItem {
public:
- static GType getType (void);
void setShape ();
SPCurve * getCurve () const;
SPCurve * getCurveBeforeLPE () const;
@@ -58,26 +58,6 @@ public:
sigc::connection _modified_connect [SP_MARKER_LOC_QTY];
private:
- static void sp_shape_init (SPShape *shape);
- static void sp_shape_finalize (GObject *object);
-
- static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
- static void sp_shape_release (SPObject *object);
-
- static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
- static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
- static void sp_shape_modified (SPObject *object, unsigned int flags);
- static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-
- static Geom::OptRect sp_shape_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type);
- static Inkscape::DrawingItem *sp_shape_show (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
- static void sp_shape_hide (SPItem *item, unsigned int key);
- static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
-
- static void sp_shape_update_marker_view (SPShape *shape, Inkscape::DrawingItem *ai);
-
-
-
friend class SPShapeClass;
};
@@ -89,9 +69,6 @@ public:
void (* set_shape) (SPShape *shape);
private:
- static SPLPEItemClass *parent_class;
- static void sp_shape_class_init (SPShapeClass *klass);
-
friend class SPShape;
};
diff --git a/src/sp-skeleton.cpp b/src/sp-skeleton.cpp
index 8910613f3..b0f5bc91f 100644
--- a/src/sp-skeleton.cpp
+++ b/src/sp-skeleton.cpp
@@ -39,47 +39,19 @@
#endif
/* Skeleton base class */
-
-static void sp_skeleton_class_init(SPSkeletonClass *klass);
-static void sp_skeleton_init(SPSkeleton *skeleton);
-
static void sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_skeleton_release(SPObject *object);
static void sp_skeleton_set(SPObject *object, unsigned int key, gchar const *value);
static void sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags);
static Inkscape::XML::Node *sp_skeleton_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static SPObjectClass *skeleton_parent_class;
-
-GType
-sp_skeleton_get_type()
-{
- static GType skeleton_type = 0;
-
- if (!skeleton_type) {
- GTypeInfo skeleton_info = {
- sizeof(SPSkeletonClass),
- NULL, NULL,
- (GClassInitFunc) sp_skeleton_class_init,
- NULL, NULL,
- sizeof(SPSkeleton),
- 16,
- (GInstanceInitFunc) sp_skeleton_init,
- NULL, /* value_table */
- };
- skeleton_type = g_type_register_static(SP_TYPE_OBJECT, "SPSkeleton", &skeleton_info, (GTypeFlags)0);
- }
- return skeleton_type;
-}
+G_DEFINE_TYPE(SPSkeleton, sp_skeleton, SP_TYPE_OBJECT);
static void
sp_skeleton_class_init(SPSkeletonClass *klass)
{
- //GObjectClass *gobject_class = (GObjectClass *)klass;
SPObjectClass *sp_object_class = (SPObjectClass *)klass;
- skeleton_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
-
sp_object_class->build = sp_skeleton_build;
sp_object_class->release = sp_skeleton_release;
sp_object_class->write = sp_skeleton_write;
@@ -102,8 +74,8 @@ static void
sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
debug("0x%p",object);
- if (((SPObjectClass *) skeleton_parent_class)->build) {
- ((SPObjectClass *) skeleton_parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_skeleton_parent_class)->build) {
+ ((SPObjectClass *) sp_skeleton_parent_class)->build(object, document, repr);
}
/*
@@ -134,8 +106,8 @@ sp_skeleton_release(SPObject *object)
/* deal with our children and our selves here */
- if (((SPObjectClass *) skeleton_parent_class)->release)
- ((SPObjectClass *) skeleton_parent_class)->release(object);
+ if (((SPObjectClass *) sp_skeleton_parent_class)->release)
+ ((SPObjectClass *) sp_skeleton_parent_class)->release(object);
}
/**
@@ -149,8 +121,8 @@ sp_skeleton_set(SPObject *object, unsigned int key, gchar const *value)
//SPSkeleton *skeleton = SP_SKELETON(object);
/* See if any parents need this value. */
- if (((SPObjectClass *) skeleton_parent_class)->set) {
- ((SPObjectClass *) skeleton_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_skeleton_parent_class)->set) {
+ ((SPObjectClass *) sp_skeleton_parent_class)->set(object, key, value);
}
}
@@ -170,8 +142,8 @@ sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags)
}
- if (((SPObjectClass *) skeleton_parent_class)->update) {
- ((SPObjectClass *) skeleton_parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_skeleton_parent_class)->update) {
+ ((SPObjectClass *) sp_skeleton_parent_class)->update(object, ctx, flags);
}
}
@@ -194,8 +166,8 @@ sp_skeleton_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML:
}
}
- if (((SPObjectClass *) skeleton_parent_class)->write) {
- ((SPObjectClass *) skeleton_parent_class)->write(object, doc, repr, flags);
+ if (((SPObjectClass *) sp_skeleton_parent_class)->write) {
+ ((SPObjectClass *) sp_skeleton_parent_class)->write(object, doc, repr, flags);
}
return repr;
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index fd2672388..43e552d68 100644
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -28,9 +28,6 @@
#include "sp-spiral.h"
-static void sp_spiral_class_init (SPSpiralClass *klass);
-static void sp_spiral_init (SPSpiral *spiral);
-
static void sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_spiral_set (SPObject *object, unsigned int key, const gchar *value);
@@ -44,33 +41,7 @@ static void sp_spiral_update_patheffect (SPLPEItem *lpeitem, bool write);
static Geom::Point sp_spiral_get_tangent (SPSpiral const *spiral, gdouble t);
-static SPShapeClass *parent_class;
-
-/**
- * Register SPSpiral class and return its type number.
- */
-GType
-sp_spiral_get_type (void)
-{
- static GType spiral_type = 0;
-
- if (!spiral_type) {
- GTypeInfo spiral_info = {
- sizeof (SPSpiralClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_spiral_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (SPSpiral),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_spiral_init,
- NULL, /* value_table */
- };
- spiral_type = g_type_register_static (SP_TYPE_SHAPE, "SPSpiral", &spiral_info, (GTypeFlags)0);
- }
- return spiral_type;
-}
+G_DEFINE_TYPE(SPSpiral, sp_spiral, SP_TYPE_SHAPE);
/**
* SPSpiral vtable initialization.
@@ -82,8 +53,6 @@ static void sp_spiral_class_init(SPSpiralClass *klass)
SPLPEItemClass *lpe_item_class = reinterpret_cast<SPLPEItemClass *>(klass);
SPShapeClass *shape_class = reinterpret_cast<SPShapeClass *>(klass);
- parent_class = reinterpret_cast<SPShapeClass *>(g_type_class_ref(SP_TYPE_SHAPE));
-
sp_object_class->build = sp_spiral_build;
sp_object_class->write = sp_spiral_write;
sp_object_class->set = sp_spiral_set;
@@ -117,8 +86,8 @@ sp_spiral_init (SPSpiral * spiral)
*/
static void sp_spiral_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if (reinterpret_cast<SPObjectClass *>(parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(parent_class)->build(object, document, repr);
+ if (reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->build) {
+ reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->build(object, document, repr);
}
object->readAttr( "sodipodi:cx" );
@@ -168,8 +137,8 @@ sp_spiral_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
repr->setAttribute("d", d);
g_free (d);
- if (reinterpret_cast<SPObjectClass *>(parent_class)->write) {
- reinterpret_cast<SPObjectClass *>(parent_class)->write(object, xml_doc, repr, flags | SP_SHAPE_WRITE_PATH);
+ if (reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->write) {
+ reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->write(object, xml_doc, repr, flags | SP_SHAPE_WRITE_PATH);
}
return repr;
@@ -260,8 +229,8 @@ static void sp_spiral_set(SPObject *object, unsigned int key, const gchar *value
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (reinterpret_cast<SPObjectClass *>(parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(parent_class)->set(object, key, value);
+ if (reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->set) {
+ reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->set(object, key, value);
}
break;
}
@@ -276,8 +245,8 @@ static void sp_spiral_update(SPObject *object, SPCtx *ctx, guint flags)
reinterpret_cast<SPShape *>(object)->setShape();
}
- if (reinterpret_cast<SPObjectClass *>(parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(parent_class)->update(object, ctx, flags);
+ if (reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->update) {
+ reinterpret_cast<SPObjectClass *>(sp_spiral_parent_class)->update(object, ctx, flags);
}
}
@@ -510,8 +479,8 @@ static void sp_spiral_snappoints(SPItem const *item, std::vector<Inkscape::SnapC
Inkscape::SnapPreferences local_snapprefs = *snapprefs;
local_snapprefs.setTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT, false);
- if ((reinterpret_cast<SPItemClass *>(parent_class))->snappoints) {
- (reinterpret_cast<SPItemClass *>(parent_class))->snappoints (item, p, &local_snapprefs);
+ if ((reinterpret_cast<SPItemClass *>(sp_spiral_parent_class))->snappoints) {
+ (reinterpret_cast<SPItemClass *>(sp_spiral_parent_class))->snappoints (item, p, &local_snapprefs);
}
if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) {
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index 08de1732b..af2420340 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -32,9 +32,6 @@
#include "sp-star.h"
-static void sp_star_class_init (SPStarClass *klass);
-static void sp_star_init (SPStar *star);
-
static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_star_set (SPObject *object, unsigned int key, const gchar *value);
@@ -46,37 +43,14 @@ static void sp_star_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
static void sp_star_set_shape (SPShape *shape);
static void sp_star_update_patheffect (SPLPEItem *lpeitem, bool write);
-static SPShapeClass *parent_class;
-
-GType
-sp_star_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (SPStarClass),
- NULL, NULL,
- (GClassInitFunc) sp_star_class_init,
- NULL, NULL,
- sizeof (SPStar),
- 16,
- (GInstanceInitFunc) sp_star_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_SHAPE, "SPStar", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPStar, sp_star, SP_TYPE_SHAPE);
static void sp_star_class_init(SPStarClass *klass)
{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- SPItemClass *item_class = reinterpret_cast<SPItemClass *>(klass);
- SPLPEItemClass *lpe_item_class = reinterpret_cast<SPLPEItemClass *>(klass);
- SPShapeClass *shape_class = reinterpret_cast<SPShapeClass *>(klass);
-
- parent_class = reinterpret_cast<SPShapeClass *>(g_type_class_ref(SP_TYPE_SHAPE));
+ SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass);
+ SPItemClass *item_class = SP_ITEM_CLASS(klass);
+ SPLPEItemClass *lpe_item_class = SP_LPE_ITEM_CLASS(klass);
+ SPShapeClass *shape_class = SP_SHAPE_CLASS(klass);
sp_object_class->build = sp_star_build;
sp_object_class->write = sp_star_write;
@@ -107,8 +81,8 @@ sp_star_init (SPStar * star)
static void
sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
- if (((SPObjectClass *) parent_class)->build)
- ((SPObjectClass *) parent_class)->build (object, document, repr);
+ if (((SPObjectClass *) sp_star_parent_class)->build)
+ ((SPObjectClass *) sp_star_parent_class)->build (object, document, repr);
object->readAttr( "sodipodi:cx" );
object->readAttr( "sodipodi:cy" );
@@ -150,8 +124,8 @@ sp_star_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML
repr->setAttribute("d", d);
g_free (d);
- if (((SPObjectClass *) (parent_class))->write)
- ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_star_parent_class))->write)
+ ((SPObjectClass *) (sp_star_parent_class))->write (object, xml_doc, repr, flags);
return repr;
}
@@ -250,8 +224,8 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value)
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
break;
default:
- if (((SPObjectClass *) parent_class)->set)
- ((SPObjectClass *) parent_class)->set (object, key, value);
+ if (((SPObjectClass *) sp_star_parent_class)->set)
+ ((SPObjectClass *) sp_star_parent_class)->set (object, key, value);
break;
}
}
@@ -265,8 +239,8 @@ sp_star_update (SPObject *object, SPCtx *ctx, guint flags)
((SPShape *) object)->setShape ();
}
- if (((SPObjectClass *) parent_class)->update)
- ((SPObjectClass *) parent_class)->update (object, ctx, flags);
+ if (((SPObjectClass *) sp_star_parent_class)->update)
+ ((SPObjectClass *) sp_star_parent_class)->update (object, ctx, flags);
}
static void
@@ -544,8 +518,8 @@ static void sp_star_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan
Inkscape::SnapPreferences local_snapprefs = *snapprefs;
local_snapprefs.setTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT, false);
- if (((SPItemClass *) parent_class)->snappoints) {
- ((SPItemClass *) parent_class)->snappoints (item, p, &local_snapprefs);
+ if (((SPItemClass *) sp_star_parent_class)->snappoints) {
+ ((SPItemClass *) sp_star_parent_class)->snappoints (item, p, &local_snapprefs);
}
if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) {
diff --git a/src/sp-string.cpp b/src/sp-string.cpp
index 3512aa45a..2fe84ac6a 100644
--- a/src/sp-string.cpp
+++ b/src/sp-string.cpp
@@ -37,37 +37,12 @@
# SPSTRING
#####################################################*/
-static void sp_string_class_init(SPStringClass *classname);
-static void sp_string_init(SPString *string);
-
static void sp_string_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_string_release(SPObject *object);
static void sp_string_read_content(SPObject *object);
static void sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags);
-static SPObjectClass *string_parent_class;
-
-GType
-sp_string_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPStringClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_string_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPString),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_string_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_OBJECT, "SPString", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPString, sp_string, SP_TYPE_OBJECT);
static void
sp_string_class_init(SPStringClass *classname)
@@ -76,8 +51,6 @@ sp_string_class_init(SPStringClass *classname)
sp_object_class = (SPObjectClass *) classname;
- string_parent_class = (SPObjectClass*)g_type_class_ref(SP_TYPE_OBJECT);
-
sp_object_class->build = sp_string_build;
sp_object_class->release = sp_string_release;
sp_object_class->read_content = sp_string_read_content;
@@ -95,8 +68,8 @@ sp_string_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
sp_string_read_content(object);
- if (((SPObjectClass *) string_parent_class)->build)
- ((SPObjectClass *) string_parent_class)->build(object, doc, repr);
+ if (((SPObjectClass *) sp_string_parent_class)->build)
+ ((SPObjectClass *) sp_string_parent_class)->build(object, doc, repr);
}
static void
@@ -106,8 +79,8 @@ sp_string_release(SPObject *object)
string->string.~ustring();
- if (((SPObjectClass *) string_parent_class)->release)
- ((SPObjectClass *) string_parent_class)->release(object);
+ if (((SPObjectClass *) sp_string_parent_class)->release)
+ ((SPObjectClass *) sp_string_parent_class)->release(object);
}
static void
@@ -156,8 +129,8 @@ sp_string_read_content(SPObject *object)
static void
sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags)
{
- if (((SPObjectClass *) string_parent_class)->update)
- ((SPObjectClass *) string_parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_string_parent_class)->update)
+ ((SPObjectClass *) sp_string_parent_class)->update(object, ctx, flags);
if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG)) {
/* Parent style or we ourselves changed, so recalculate */
diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp
index 938b7c7cc..deee590af 100644
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
@@ -52,8 +52,6 @@ static void build_string_from_root(Inkscape::XML::Node *root, Glib::ustring *ret
/* TRef base class */
-static void sp_tref_class_init(SPTRefClass *tref_class);
-static void sp_tref_init(SPTRef *tref);
static void sp_tref_finalize(GObject *obj);
static void sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
@@ -69,28 +67,7 @@ static gchar *sp_tref_description(SPItem *item);
static void sp_tref_href_changed(SPObject *old_ref, SPObject *ref, SPTRef *tref);
static void sp_tref_delete_self(SPObject *deleted, SPTRef *self);
-static SPObjectClass *tref_parent_class;
-
-GType
-sp_tref_get_type()
-{
- static GType tref_type = 0;
-
- if (!tref_type) {
- GTypeInfo tref_info = {
- sizeof(SPTRefClass),
- NULL, NULL,
- (GClassInitFunc) sp_tref_class_init,
- NULL, NULL,
- sizeof(SPTRef),
- 16,
- (GInstanceInitFunc) sp_tref_init,
- NULL, /* value_table */
- };
- tref_type = g_type_register_static(SP_TYPE_ITEM, "SPTRef", &tref_info, (GTypeFlags)0);
- }
- return tref_type;
-}
+G_DEFINE_TYPE(SPTRef, sp_tref, SP_TYPE_ITEM);
static void
sp_tref_class_init(SPTRefClass *tref_class)
@@ -98,8 +75,6 @@ sp_tref_class_init(SPTRefClass *tref_class)
GObjectClass *gobject_class = (GObjectClass *) tref_class;
SPObjectClass *sp_object_class = (SPObjectClass *)tref_class;
- tref_parent_class = (SPObjectClass*)g_type_class_peek_parent(tref_class);
-
sp_object_class->build = sp_tref_build;
sp_object_class->release = sp_tref_release;
sp_object_class->write = sp_tref_write;
@@ -148,8 +123,8 @@ sp_tref_finalize(GObject *obj)
static void
sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) tref_parent_class)->build) {
- ((SPObjectClass *) tref_parent_class)->build(object, document, repr);
+ if (((SPObjectClass *) sp_tref_parent_class)->build) {
+ ((SPObjectClass *) sp_tref_parent_class)->build(object, document, repr);
}
object->readAttr( "xlink:href" );
@@ -178,8 +153,8 @@ sp_tref_release(SPObject *object)
tref->uriOriginalRef->detach();
- if (((SPObjectClass *) tref_parent_class)->release)
- ((SPObjectClass *) tref_parent_class)->release(object);
+ if (((SPObjectClass *) sp_tref_parent_class)->release)
+ ((SPObjectClass *) sp_tref_parent_class)->release(object);
}
/**
@@ -225,8 +200,8 @@ sp_tref_set(SPObject *object, unsigned int key, gchar const *value)
}
} else { // default
- if (((SPObjectClass *) tref_parent_class)->set) {
- ((SPObjectClass *) tref_parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_tref_parent_class)->set) {
+ ((SPObjectClass *) sp_tref_parent_class)->set(object, key, value);
}
}
@@ -243,8 +218,8 @@ sp_tref_update(SPObject *object, SPCtx *ctx, guint flags)
SPTRef *tref = SP_TREF(object);
- if (((SPObjectClass *) tref_parent_class)->update) {
- ((SPObjectClass *) tref_parent_class)->update(object, ctx, flags);
+ if (((SPObjectClass *) sp_tref_parent_class)->update) {
+ ((SPObjectClass *) sp_tref_parent_class)->update(object, ctx, flags);
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -307,8 +282,8 @@ sp_tref_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
g_free(uri_string);
}
- if (((SPObjectClass *) tref_parent_class)->write) {
- ((SPObjectClass *) tref_parent_class)->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) sp_tref_parent_class)->write) {
+ ((SPObjectClass *) sp_tref_parent_class)->write(object, xml_doc, repr, flags);
}
return repr;
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 0f45f5444..d5b3c004a 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -38,8 +38,6 @@
/* fixme: */
-static void sp_use_class_init(SPUseClass *classname);
-static void sp_use_init(SPUse *use);
static void sp_use_finalize(GObject *obj);
static void sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
@@ -60,32 +58,10 @@ static void sp_use_href_changed(SPObject *old_ref, SPObject *ref, SPUse *use);
static void sp_use_delete_self(SPObject *deleted, SPUse *self);
-static SPItemClass *parent_class;
-
//void m_print(gchar *say, Geom::Affine m)
//{ g_print("%s %g %g %g %g %g %g\n", say, m[0], m[1], m[2], m[3], m[4], m[5]); }
-GType
-sp_use_get_type(void)
-{
- static GType use_type = 0;
- if (!use_type) {
- GTypeInfo use_info = {
- sizeof(SPUseClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) sp_use_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(SPUse),
- 16, /* n_preallocs */
- (GInstanceInitFunc) sp_use_init,
- NULL, /* value_table */
- };
- use_type = g_type_register_static(SP_TYPE_ITEM, "SPUse", &use_info, (GTypeFlags)0);
- }
- return use_type;
-}
+G_DEFINE_TYPE(SPUse, sp_use, SP_TYPE_ITEM);
static void
sp_use_class_init(SPUseClass *classname)
@@ -94,8 +70,6 @@ sp_use_class_init(SPUseClass *classname)
SPObjectClass *sp_object_class = (SPObjectClass *) classname;
SPItemClass *item_class = (SPItemClass *) classname;
- parent_class = (SPItemClass*) g_type_class_ref(SP_TYPE_ITEM);
-
gobject_class->finalize = sp_use_finalize;
sp_object_class->build = sp_use_build;
@@ -155,8 +129,8 @@ sp_use_finalize(GObject *obj)
static void
sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
- if (((SPObjectClass *) parent_class)->build) {
- (* ((SPObjectClass *) parent_class)->build)(object, document, repr);
+ if (((SPObjectClass *) sp_use_parent_class)->build) {
+ (* ((SPObjectClass *) sp_use_parent_class)->build)(object, document, repr);
}
object->readAttr( "x" );
@@ -189,8 +163,8 @@ sp_use_release(SPObject *object)
use->ref->detach();
- if (((SPObjectClass *) parent_class)->release) {
- ((SPObjectClass *) parent_class)->release(object);
+ if (((SPObjectClass *) sp_use_parent_class)->release) {
+ ((SPObjectClass *) sp_use_parent_class)->release(object);
}
}
@@ -242,8 +216,8 @@ sp_use_set(SPObject *object, unsigned key, gchar const *value)
}
default:
- if (((SPObjectClass *) parent_class)->set) {
- ((SPObjectClass *) parent_class)->set(object, key, value);
+ if (((SPObjectClass *) sp_use_parent_class)->set) {
+ ((SPObjectClass *) sp_use_parent_class)->set(object, key, value);
}
break;
}
@@ -258,8 +232,8 @@ sp_use_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::
repr = xml_doc->createElement("svg:use");
}
- if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
+ if (((SPObjectClass *) (sp_use_parent_class))->write) {
+ ((SPObjectClass *) (sp_use_parent_class))->write(object, xml_doc, repr, flags);
}
sp_repr_set_svg_double(repr, "x", use->x.computed);
@@ -380,8 +354,8 @@ sp_use_hide(SPItem *item, unsigned key)
SP_ITEM(use->child)->invoke_hide(key);
}
- if (((SPItemClass *) parent_class)->hide) {
- ((SPItemClass *) parent_class)->hide(item, key);
+ if (((SPItemClass *) sp_use_parent_class)->hide) {
+ ((SPItemClass *) sp_use_parent_class)->hide(item, key);
}
}
@@ -585,8 +559,8 @@ sp_use_update(SPObject *object, SPCtx *ctx, unsigned flags)
SPItemCtx *ictx = (SPItemCtx *) ctx;
SPItemCtx cctx = *ictx;
- if (((SPObjectClass *) (parent_class))->update)
- ((SPObjectClass *) (parent_class))->update(object, ctx, flags);
+ if (((SPObjectClass *) (sp_use_parent_class))->update)
+ ((SPObjectClass *) (sp_use_parent_class))->update(object, ctx, flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 404b0ec1c..459a56161 100644
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
@@ -46,8 +46,6 @@
using Inkscape::DocumentUndo;
-static void sp_spiral_context_class_init(SPSpiralContextClass * klass);
-static void sp_spiral_context_init(SPSpiralContext *spiral_context);
static void sp_spiral_context_dispose(GObject *object);
static void sp_spiral_context_setup(SPEventContext *ec);
static void sp_spiral_context_finish(SPEventContext *ec);
@@ -59,27 +57,7 @@ static void sp_spiral_drag(SPSpiralContext *sc, Geom::Point const &p, guint stat
static void sp_spiral_finish(SPSpiralContext *sc);
static void sp_spiral_cancel(SPSpiralContext *sc);
-static SPEventContextClass *parent_class;
-
-GType
-sp_spiral_context_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPSpiralContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_spiral_context_class_init,
- NULL, NULL,
- sizeof(SPSpiralContext),
- 4,
- (GInstanceInitFunc) sp_spiral_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPSpiralContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPSpiralContext, sp_spiral_context, SP_TYPE_EVENT_CONTEXT);
static void
sp_spiral_context_class_init(SPSpiralContextClass *klass)
@@ -87,8 +65,6 @@ sp_spiral_context_class_init(SPSpiralContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_spiral_context_dispose;
event_context_class->setup = sp_spiral_context_setup;
@@ -129,8 +105,8 @@ static void sp_spiral_context_finish(SPEventContext *ec)
sp_spiral_finish(sc);
sc->sel_changed_connection.disconnect();
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->finish) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->finish(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->finish) {
+ (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->finish(ec);
}
}
@@ -155,7 +131,7 @@ sp_spiral_context_dispose(GObject *object)
delete sc->_message_context;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_spiral_context_parent_class)->dispose(object);
}
/**
@@ -177,8 +153,8 @@ sp_spiral_context_setup(SPEventContext *ec)
{
SPSpiralContext *sc = SP_SPIRAL_CONTEXT(ec);
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup)
- (SP_EVENT_CONTEXT_CLASS(parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->setup)
+ (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->setup(ec);
sp_event_context_read(ec, "expansion");
sp_event_context_read(ec, "revolution");
@@ -398,8 +374,8 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler)
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->root_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->root_handler(event_context, event);
}
return ret;
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index 8d74477c3..694e3a500 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -78,16 +78,13 @@ using namespace std;
#define DDC_RED_RGBA 0xff0000ff
#define DYNA_MIN_WIDTH 1.0e-6
-static void sp_spray_context_class_init(SPSprayContextClass *klass);
-static void sp_spray_context_init(SPSprayContext *ddc);
static void sp_spray_context_dispose(GObject *object);
static void sp_spray_context_setup(SPEventContext *ec);
static void sp_spray_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val);
static gint sp_spray_context_root_handler(SPEventContext *ec, GdkEvent *event);
-static SPEventContextClass *parent_class = 0;
-
+G_DEFINE_TYPE(SPSprayContext, sp_spray_context, SP_TYPE_EVENT_CONTEXT);
/**
* This function returns pseudo-random numbers from a normal distribution
@@ -100,32 +97,11 @@ inline double NormalDistribution(double mu, double sigma)
return mu + sigma * sqrt( -2.0 * log(g_random_double_range(0, 1)) ) * cos( 2.0*M_PI*g_random_double_range(0, 1) );
}
-GType sp_spray_context_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPSprayContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_spray_context_class_init,
- NULL, NULL,
- sizeof(SPSprayContext),
- 4,
- (GInstanceInitFunc) sp_spray_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPSprayContext", &info, (GTypeFlags)0);
- }
- return type;
-}
-
static void sp_spray_context_class_init(SPSprayContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass));
-
object_class->dispose = sp_spray_context_dispose;
event_context_class->setup = sp_spray_context_setup;
@@ -204,7 +180,7 @@ static void sp_spray_context_dispose(GObject *object)
delete tc->_message_context;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_spray_context_parent_class)->dispose(object);
}
static bool is_transform_modes(gint mode)
@@ -251,8 +227,8 @@ static void sp_spray_context_setup(SPEventContext *ec)
{
SPSprayContext *tc = SP_SPRAY_CONTEXT(ec);
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spray_context_parent_class))->setup) {
+ (SP_EVENT_CONTEXT_CLASS(sp_spray_context_parent_class))->setup(ec);
}
{
@@ -926,8 +902,8 @@ gint sp_spray_context_root_handler(SPEventContext *event_context, GdkEvent *even
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler) {
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spray_context_parent_class))->root_handler) {
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_spray_context_parent_class))->root_handler(event_context, event);
}
}
diff --git a/src/star-context.cpp b/src/star-context.cpp
index ae12e8c35..e2d6961f0 100644
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -50,8 +50,6 @@
using Inkscape::DocumentUndo;
-static void sp_star_context_class_init (SPStarContextClass * klass);
-static void sp_star_context_init (SPStarContext * star_context);
static void sp_star_context_dispose (GObject *object);
static void sp_star_context_setup (SPEventContext *ec);
@@ -63,27 +61,7 @@ static void sp_star_drag (SPStarContext * sc, Geom::Point p, guint state);
static void sp_star_finish (SPStarContext * sc);
static void sp_star_cancel(SPStarContext * sc);
-static SPEventContextClass * parent_class;
-
-GType
-sp_star_context_get_type (void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof (SPStarContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_star_context_class_init,
- NULL, NULL,
- sizeof (SPStarContext),
- 4,
- (GInstanceInitFunc) sp_star_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static (SP_TYPE_EVENT_CONTEXT, "SPStarContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPStarContext, sp_star_context, SP_TYPE_EVENT_CONTEXT);
static void
sp_star_context_class_init (SPStarContextClass * klass)
@@ -91,8 +69,6 @@ sp_star_context_class_init (SPStarContextClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS(klass);
SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
- parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent (klass));
-
object_class->dispose = sp_star_context_dispose;
event_context_class->setup = sp_star_context_setup;
@@ -134,8 +110,8 @@ static void sp_star_context_finish(SPEventContext *ec)
sp_star_finish(sc);
sc->sel_changed_connection.disconnect();
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->finish) {
- (SP_EVENT_CONTEXT_CLASS(parent_class))->finish(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->finish) {
+ (SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->finish(ec);
}
}
@@ -161,7 +137,7 @@ sp_star_context_dispose (GObject *object)
delete sc->_message_context;
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (sp_star_context_parent_class)->dispose (object);
}
/**
@@ -187,8 +163,8 @@ sp_star_context_setup (SPEventContext *ec)
{
SPStarContext *sc = SP_STAR_CONTEXT (ec);
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->setup)
- (SP_EVENT_CONTEXT_CLASS(parent_class))->setup (ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->setup)
+ (SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->setup (ec);
sp_event_context_read (ec, "magnitude");
sp_event_context_read (ec, "proportion");
@@ -413,8 +389,8 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
}
if (!ret) {
- if ((SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler)
- ret = (SP_EVENT_CONTEXT_CLASS(parent_class))->root_handler (event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->root_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_star_context_parent_class))->root_handler (event_context, event);
}
return ret;
diff --git a/src/syseq.h b/src/syseq.h
index 5c7702268..029f27a91 100644
--- a/src/syseq.h
+++ b/src/syseq.h
@@ -279,7 +279,7 @@ template <int S, int T> SolutionKind gaussjord_solve (double A[S][T], double x[T
// we need to adapt the value if we we are in the "projective case" (see above)
double val_new = (proj ? projectify<S,T>(cols, B, x, index, val) : val);
- if (index != -1 && index >= 0 && index < T) {
+ if (index >= 0 && index < T) {
// we want the specified coefficient of the solution vector to have a given value
x[index] = val_new;
}
diff --git a/src/trace/imagemap-gdk.cpp b/src/trace/imagemap-gdk.cpp
index e5ff23ad0..06f355de7 100644
--- a/src/trace/imagemap-gdk.cpp
+++ b/src/trace/imagemap-gdk.cpp
@@ -58,7 +58,7 @@ GdkPixbuf *grayMapToGdkPixbuf(GrayMap *grayMap)
GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB,
0, 8, grayMap->width, grayMap->height,
- rowstride, NULL, NULL);
+ rowstride, (GdkPixbufDestroyNotify)g_free, NULL);
//### Fill in the odd cells with RGB values
int x,y;
@@ -122,7 +122,7 @@ PackedPixelMap *gdkPixbufToPackedPixelMap(GdkPixbuf *buf)
return ppMap;
}
-GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap)
+/*GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap)
{
if (!ppMap)
return NULL;
@@ -137,7 +137,7 @@ GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap)
GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB,
0, 8, ppMap->width, ppMap->height,
- rowstride, NULL, NULL);
+ rowstride, NULL, NULL); //first NULL: replace by (GdkPixbufDestroyNotify)g_free ??
//### Fill in the cells with RGB values
int x,y;
@@ -158,7 +158,7 @@ GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap)
return buf;
}
-
+*/
/*#########################################################################
@@ -203,6 +203,7 @@ RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf)
return rgbMap;
}
+/*
GdkPixbuf *rgbMapToGdkPixbuf(RgbMap *rgbMap)
{
if (!rgbMap)
@@ -218,7 +219,7 @@ GdkPixbuf *rgbMapToGdkPixbuf(RgbMap *rgbMap)
GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB,
0, 8, rgbMap->width, rgbMap->height,
- rowstride, NULL, NULL);
+ rowstride, NULL, NULL); //first NULL: replace by (GdkPixbufDestroyNotify)g_free ??
//### Fill in the cells with RGB values
int x,y;
@@ -239,6 +240,7 @@ GdkPixbuf *rgbMapToGdkPixbuf(RgbMap *rgbMap)
return buf;
}
+*/
/*#########################################################################
## I N D E X E D M A P
@@ -260,7 +262,7 @@ GdkPixbuf *indexedMapToGdkPixbuf(IndexedMap *iMap)
GdkPixbuf *buf = gdk_pixbuf_new_from_data(pixdata, GDK_COLORSPACE_RGB,
0, 8, iMap->width, iMap->height,
- rowstride, NULL, NULL);
+ rowstride, (GdkPixbufDestroyNotify)g_free, NULL);
//### Fill in the cells with RGB values
int x,y;
diff --git a/src/trace/imagemap-gdk.h b/src/trace/imagemap-gdk.h
index d04a84d8e..3b4631f50 100644
--- a/src/trace/imagemap-gdk.h
+++ b/src/trace/imagemap-gdk.h
@@ -29,11 +29,11 @@ GdkPixbuf *grayMapToGdkPixbuf(GrayMap *grayMap);
PackedPixelMap *gdkPixbufToPackedPixelMap(GdkPixbuf *buf);
-GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap);
+//GdkPixbuf *packedPixelMapToGdkPixbuf(PackedPixelMap *ppMap);
RgbMap *gdkPixbufToRgbMap(GdkPixbuf *buf);
-GdkPixbuf *rgbMapToGdkPixbuf(RgbMap *rgbMap);
+//GdkPixbuf *rgbMapToGdkPixbuf(RgbMap *rgbMap);
GdkPixbuf *indexedMapToGdkPixbuf(IndexedMap *iMap);
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 71674368b..97d8b0523 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -432,6 +432,9 @@ void SymbolsDialog::get_symbols() {
GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l)
{
+ if (!r) {
+ return l;
+ }
// Stop multiple counting of same symbol
if( SP_IS_USE(r) ) {