From: mental Date: Sun, 5 Mar 2006 21:53:38 +0000 (+0000) Subject: Add signal for notification of object position changes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bfbf4f7827ccde4fb862c8e6380ec5857968f860;p=inkscape.git Add signal for notification of object position changes --- diff --git a/ChangeLog b/ChangeLog index 622e817e5..8edea42d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-05 MenTaLguY + + * src/sp-object.h, src/sp-object.cpp: + + Add signal for notification of object position changes. + 2006-03-05 MenTaLguY * src/Makefile_insert, src/document-subset.cpp, src/document-subset.h: diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 4a1a2e09e..fd368dd61 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -192,6 +192,7 @@ sp_object_init(SPObject *object) object->_collection_policy = SPObject::COLLECT_WITH_PARENT; new (&object->_delete_signal) sigc::signal(); + new (&object->_position_changed_signal) sigc::signal(); object->_successor = NULL; object->_label = NULL; @@ -221,6 +222,7 @@ sp_object_finalize(GObject *object) } spobject->_delete_signal.~signal(); + spobject->_position_changed_signal.~signal(); } namespace { @@ -771,6 +773,7 @@ static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child g_return_if_fail(ochild != NULL); SPObject *prev = new_ref ? sp_object_get_child_by_repr(object, new_ref) : NULL; sp_object_reorder(ochild, prev); + ochild->_position_changed_signal.emit(ochild); } /** diff --git a/src/sp-object.h b/src/sp-object.h index 767f8b978..e853de097 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -322,6 +322,10 @@ struct SPObject : public GObject { return _delete_signal.connect(slot); } + sigc::connection connectPositionChanged(sigc::slot slot) { + return _position_changed_signal.connect(slot); + } + /** @brief Returns the object which supercedes this one (if any). * * This is mainly useful for ensuring we can correctly perform a series of moves or deletes, @@ -442,6 +446,7 @@ struct SPObject : public GObject { void _requireSVGVersion(Inkscape::Version version); sigc::signal _delete_signal; + sigc::signal _position_changed_signal; SPObject *_successor; CollectionPolicy _collection_policy; gchar *_label;