From 02509d33241966ae5eff5c4d15a12ae460ec0e32 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sat, 20 Oct 2007 16:20:50 +0000 Subject: [PATCH] LPE: fix undoing changes to pathparameter on-canvas. --- src/shape-editor.cpp | 27 ++++++++++++++++++--------- src/shape-editor.h | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index abffeefc4..00e7c61b1 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -137,19 +137,12 @@ static void shapeeditor_event_attr_changed(Inkscape::XML::Node *repr, gchar cons gchar const *old_value, gchar const *new_value, bool is_interactive, gpointer data) { - SPItem *item = NULL; gboolean changed = FALSE; g_assert(data); ShapeEditor *sh = ((ShapeEditor *) data); - item = sh->get_item(); - - if ( ( (sh->has_nodepath()) - && ( !strcmp(name, "d") // With paths, we only need to act if one of the path-affecting attributes has changed. - || !strcmp(name, "sodipodi:nodetypes") - || !strcmp(name, "inkscape:original-d") ) ) - || sh->has_knotholder() ) + if ( sh->has_nodepath() || sh->has_knotholder() ) { changed = !sh->has_local_change(); sh->decrement_local_change(); @@ -161,7 +154,7 @@ static void shapeeditor_event_attr_changed(Inkscape::XML::Node *repr, gchar cons saved = sh->save_nodepath_selection(); } - sh->set_item (item); + sh->reset_item (); if (sh->has_nodepath() && saved) { sh->restore_nodepath_selection(saved); @@ -237,6 +230,22 @@ void ShapeEditor::set_item_livepatheffect_parameter(SPItem *item, SPObject *lpeo } } +/** FIXME: think about this. Is this thing only called when the item needs to be updated? + Why not make a reload function in NodePath and in KnotHolder? */ +void ShapeEditor::reset_item () +{ + 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_livepatheffect_parameter(item, obj, key); + g_free(key); + } else { + SPItem * item = get_item(); + set_item(item); + } +} + void ShapeEditor::nodepath_destroyed () { this->nodepath = NULL; } diff --git a/src/shape-editor.h b/src/shape-editor.h index 2df1bb0e0..8f4895be6 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -37,6 +37,7 @@ public: void set_item (SPItem *item); void set_item_livepatheffect_parameter(SPItem *item, SPObject *lpeobject, const char * key); + void reset_item (); void unset_item (); SPItem *get_item (); -- 2.30.2