From 34687d3d7470ad131527571cd8d0e8ff60d0c8f7 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 20 Oct 2007 16:20:50 +0000 Subject: LPE: fix undoing changes to pathparameter on-canvas. (bzr r3935) --- src/shape-editor.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/shape-editor.cpp') 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; } -- cgit v1.2.3