diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 1b81e1a83acbefdda643ae52a4ad912ffea62500..dc1ec1c7e2f7b8623c3aaa6a0325ac0e1660dc5b 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
#include "live_effects/lpeobject.h"
#include "selection.h"
#include "desktop.h"
+#include "document.h"
#include "desktop-handles.h"
#include "knotholder.h"
#include "live_effects/parameter/point.h"
/** Please note that this function only works for path parameters.
* All other parameters probably will crash Inkscape!
*/
-void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, const char * key)
+void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject *lpeobject, const char * key)
{
unset_item(SH_NODEPATH);
@@ -316,23 +317,22 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject,
Why not make a reload function in NodePath and in KnotHolder? */
void ShapeEditor::reset_item (SubType type, bool keep_knotholder)
{
+ /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject.
+ SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(listener_attached_for);
+
switch (type) {
case SH_NODEPATH:
- if ( (this->nodepath) && (IS_LIVEPATHEFFECT(this->nodepath->object)) ) {
- SPItem * item = this->nodepath->item;
- SPObject *obj = this->nodepath->object;
- char * key = g_strdup(this->nodepath->repr_key);
- set_item_lpe_path_parameter(item, obj, key); // the above checks for nodepath, so it is indeed a path that we are editing
+ if ( (nodepath) && (IS_LIVEPATHEFFECT(nodepath->object)) ) {
+ char * key = g_strdup(nodepath->repr_key);
+ set_item_lpe_path_parameter(nodepath->item, LIVEPATHEFFECT(nodepath->object), key); // the above checks for nodepath, so it is indeed a path that we are editing
g_free(key);
} else {
- SPItem * item = (SPItem *) get_item(SH_NODEPATH);
- set_item(item, SH_NODEPATH);
- }
+ set_item(SP_ITEM(obj), SH_NODEPATH);
+ }
break;
case SH_KNOTHOLDER:
if (this->knotholder) {
- SPItem * item = (SPItem *) get_item(SH_KNOTHOLDER);
- set_item(item, SH_KNOTHOLDER, keep_knotholder);
+ set_item(SP_ITEM(obj), SH_KNOTHOLDER, keep_knotholder);
}
break;
}