From 4fe8e48a2b4917495831464be7ca1280a315e83d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 15 Jul 2009 17:37:41 +0000 Subject: shapeeditor: save separate listerner's repr_keys for KnotHolder and NodePaths, to fix bug #387298 (bzr r8289) --- src/shape-editor.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/shape-editor.cpp') diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index dc1ec1c7e..b44d889e0 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -54,7 +54,8 @@ ShapeEditor::ShapeEditor(SPDesktop *dt) { this->nodepath = NULL; this->knotholder = NULL; this->hit = false; - this->listener_attached_for = NULL; + this->knotholder_listener_attached_for = NULL; + this->nodepath_listener_attached_for = NULL; } ShapeEditor::~ShapeEditor() { @@ -69,10 +70,10 @@ void ShapeEditor::unset_item(SubType type, bool keep_knotholder) { case SH_NODEPATH: if (this->nodepath) { old_repr = this->nodepath->repr; - if (old_repr && old_repr == listener_attached_for) { + if (old_repr && old_repr == nodepath_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - listener_attached_for = NULL; + nodepath_listener_attached_for = NULL; } this->grab_node = -1; @@ -83,10 +84,10 @@ void ShapeEditor::unset_item(SubType type, bool keep_knotholder) { case SH_KNOTHOLDER: if (this->knotholder) { old_repr = this->knotholder->repr; - if (old_repr && old_repr == listener_attached_for) { + if (old_repr && old_repr == knotholder_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - listener_attached_for = NULL; + knotholder_listener_attached_for = NULL; } if (!keep_knotholder) { @@ -256,10 +257,10 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { // setting new listener repr = SP_OBJECT_REPR(item); - if (repr != listener_attached_for) { + if (repr != nodepath_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + nodepath_listener_attached_for = repr; } } break; @@ -273,10 +274,10 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { this->knotholder->update_knots(); // setting new listener repr = this->knotholder->repr; - if (repr != listener_attached_for) { + if (repr != knotholder_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + knotholder_listener_attached_for = repr; } } break; @@ -303,10 +304,10 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject // setting new listener Inkscape::XML::Node *repr = SP_OBJECT_REPR(lpeobject); - if (repr && repr != listener_attached_for) { + if (repr && repr != nodepath_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + nodepath_listener_attached_for = repr; } } } @@ -317,9 +318,6 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject 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 ( (nodepath) && (IS_LIVEPATHEFFECT(nodepath->object)) ) { @@ -327,11 +325,13 @@ void ShapeEditor::reset_item (SubType type, bool keep_knotholder) 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 { + SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(nodepath_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), SH_NODEPATH); } break; case SH_KNOTHOLDER: - if (this->knotholder) { + if ( knotholder ) { + SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), SH_KNOTHOLDER, keep_knotholder); } break; -- cgit v1.2.3 From 65153786612ddeaa63d7ea5fbed0c2698a023fe7 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 15 Oct 2009 06:39:10 +0000 Subject: fix crash: draw two paths, select both, object - clip - set, node tool, edit clippath, drag a clippath node, undo (bzr r8773) --- src/shape-editor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/shape-editor.cpp') diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index b44d889e0..4999eb7cf 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -353,6 +353,9 @@ bool ShapeEditor::is_over_stroke (Geom::Point event_p, bool remember) { const SPItem *item = get_item(SH_NODEPATH); + if (!item || !SP_IS_ITEM(item)) + return false; + //Translate click point into proper coord system this->curvepoint_doc = desktop->w2d(event_p); this->curvepoint_doc *= sp_item_dt2i_affine(item); -- cgit v1.2.3 From 4a5dfe33ac8e20c0a04be6757146bb5767fb0ad9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 21:16:14 +0000 Subject: decrease header dependencies (bzr r8841) --- src/shape-editor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/shape-editor.cpp') diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 4999eb7cf..44ad9dc9e 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -17,6 +17,7 @@ #include "sp-object.h" #include "sp-item.h" +#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" #include "selection.h" #include "desktop.h" -- cgit v1.2.3