summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c3e6f3)
raw | patch | inline | side by side (parent: 6c3e6f3)
author | mental <mental@users.sourceforge.net> | |
Fri, 28 Jul 2006 03:08:10 +0000 (03:08 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Fri, 28 Jul 2006 03:08:10 +0000 (03:08 +0000) |
ChangeLog | patch | blob | history | |
src/sp-shape.cpp | patch | blob | history | |
src/sp-shape.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 6b6adff27f8c7b45adf48ff78221861820af8f3a..8f8d200e9a96bcb4702de7ec9863ff89b65f6079 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-06-27 MenTaLguY <mental@rydia.net>
+
+ * src/sp-shape.cpp, src/sp-shape.h:
+
+ switch to sigc++ SPObject signals for SPShape
+
2006-07-26 MenTaLguY <mental@rydia.net>
* src/dialogs/object-attributes.cpp:
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 153d1fa517a4496b28961eb87f767f8cc26682d8..f72a0da340162c1efd4afa7666f2a3d9f35fe309 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
#include <libnr/nr-matrix-translate-ops.h>
#include <libnr/nr-scale-matrix-ops.h>
+#include <sigc++/functors/ptr_fun.h>
+#include <sigc++/adaptors/bind.h>
#include "macros.h"
#include "display/nr-arena-shape.h"
static void sp_shape_class_init (SPShapeClass *klass);
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_class_init (SPShapeClass *klass)
{
+ GObjectClass *gobject_class;
SPObjectClass *sp_object_class;
SPItemClass * item_class;
SPPathClass * path_class;
+ gobject_class = (GObjectClass *) klass;
sp_object_class = (SPObjectClass *) klass;
item_class = (SPItemClass *) klass;
path_class = (SPPathClass *) klass;
parent_class = (SPItemClass *)g_type_class_peek_parent (klass);
+ gobject_class->finalize = sp_shape_finalize;
+
sp_object_class->build = sp_shape_build;
sp_object_class->release = sp_shape_release;
sp_object_class->update = sp_shape_update;
}
/**
- * Initializes an SPShape object. Nothing particular is needed to initialize
- * an SPShape object; this is just here as a stub.
+ * Initializes an SPShape object.
*/
static void
sp_shape_init (SPShape *shape)
{
- /* Nothing here */
+ for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) {
+ new (&shape->release_connect[i]) sigc::connection();
+ new (&shape->modified_connect[i]) sigc::connection();
+ }
+}
+
+static void
+sp_shape_finalize (GObject *object)
+{
+ SPShape *shape=(SPShape *)object;
+
+ for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) {
+ shape->release_connect[i].disconnect();
+ shape->release_connect[i].~connection();
+ shape->modified_connect[i].disconnect();
+ shape->modified_connect[i].~connection();
+ }
+
+ if (((GObjectClass *) (parent_class))->finalize) {
+ (* ((GObjectClass *) (parent_class))->finalize)(object);
+ }
}
/**
SPItemView *v;
/* Detach marker */
- g_signal_handler_disconnect (shape->marker[key], shape->release_connect[key]);
- g_signal_handler_disconnect (shape->marker[key], shape->modified_connect[key]);
+ shape->release_connect[key].disconnect();
+ shape->modified_connect[key].disconnect();
/* Hide marker */
for (v = item->display; v != NULL; v = v->next) {
}
if (SP_IS_MARKER (mrk)) {
shape->marker[key] = sp_object_href (mrk, object);
- shape->release_connect[key] = g_signal_connect (G_OBJECT (shape->marker[key]), "release",
- G_CALLBACK (sp_shape_marker_release), shape);
- shape->modified_connect[key] = g_signal_connect (G_OBJECT (shape->marker[key]), "modified",
- G_CALLBACK (sp_shape_marker_modified), shape);
+ shape->release_connect[key] = mrk->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_shape_marker_release), shape));
+ shape->modified_connect[key] = mrk->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_shape_marker_modified), shape));
}
}
}
diff --git a/src/sp-shape.h b/src/sp-shape.h
index 32774f60315abab3321bfbca0cfc41087037628e..2b265fdaaf6b397c8c4247098dbf3ee7354c9068 100644 (file)
--- a/src/sp-shape.h
+++ b/src/sp-shape.h
#include "sp-item.h"
#include "sp-marker-loc.h"
-
+#include <sigc++/connection.h>
#define SP_TYPE_SHAPE (sp_shape_get_type ())
#define SP_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SHAPE, SPShape))
SPCurve *curve;
SPObject *marker[SP_MARKER_LOC_QTY];
- gulong release_connect [SP_MARKER_LOC_QTY];
- gulong modified_connect [SP_MARKER_LOC_QTY];
+ sigc::connection release_connect [SP_MARKER_LOC_QTY];
+ sigc::connection modified_connect [SP_MARKER_LOC_QTY];
};
struct SPShapeClass {