From: cilix42 Date: Tue, 29 Jul 2008 14:55:17 +0000 (+0000) Subject: Update helperpaths live also when any of the item's LPEs is modified X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b2b2d102f63f1f7eeb8353146d0b2bc75938acbc;p=inkscape.git Update helperpaths live also when any of the item's LPEs is modified --- diff --git a/src/nodepath.cpp b/src/nodepath.cpp index f6f9ef0d1..f210b275c 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -212,7 +212,7 @@ sp_nodepath_create_helperpaths(Inkscape::NodePath::Path *np) { g_print ("\n"); } -static void +void sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { g_print ("sp_nodepath_update_helperpaths()\n"); //std::map >* helper_path_vec; @@ -653,7 +653,8 @@ static void update_object(Inkscape::NodePath::Path *np) helper_curve->unref(); } - sp_nodepath_update_helperpaths(np); + // updating helperpaths of LPEItems is now done in sp_lpe_item_update(); + //sp_nodepath_update_helperpaths(np); // now that nodepath and knotholder can be enabled simultaneously, we must update the knotholder, too // TODO: this should be done from ShapeEditor!! nodepath should be oblivious of knotholder! diff --git a/src/nodepath.h b/src/nodepath.h index f11d309cc..3f110f708 100644 --- a/src/nodepath.h +++ b/src/nodepath.h @@ -320,6 +320,7 @@ void sp_nodepath_show_handles(Inkscape::NodePath::Path *nodepath, bool show); //SPCanvasItem *sp_nodepath_generate_helperpath(SPDesktop *desktop, SPPath *path); SPCanvasItem *sp_nodepath_helperpath_from_path(SPDesktop *desktop, SPPath *path); void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *nodepath, bool show); +void sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np); void sp_nodepath_make_straight_path(Inkscape::NodePath::Path *np); void sp_nodepath_selected_nodes_rotate (Inkscape::NodePath::Path * nodepath, gdouble angle, int which, bool screen); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 2eecd8e45..4089e8a24 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -32,6 +32,8 @@ #include "message-stack.h" #include "inkscape.h" #include "desktop.h" +#include "node-context.h" +#include "shape-editor.h" #include @@ -242,6 +244,23 @@ sp_lpe_item_update(SPObject *object, SPCtx *ctx, guint flags) if (((SPObjectClass *) parent_class)->update) { ((SPObjectClass *) parent_class)->update(object, ctx, flags); } + + g_print ("sp_lpe_item_update()\n"); + + // update the helperpaths of all LPEs applied to the item + // TODO: is there a more canonical place for this, since we don't have instant access to the item's nodepath? + // FIXME: this is called multiple (at least 3) times; how can we avoid this? + + // FIXME: ditch inkscape_active_event_context() + SPEventContext *ec = inkscape_active_event_context(); + if (!SP_IS_NODE_CONTEXT(ec)) return; + SPNodeContext *nc = SP_NODE_CONTEXT(ec); + ShapeEditor *sh = nc->shape_editor; + g_assert(sh); + if (!sh->has_nodepath()) return; + + Inkscape::NodePath::Path *np = sh->get_nodepath(); + sp_nodepath_update_helperpaths(np); } /** @@ -250,6 +269,7 @@ sp_lpe_item_update(SPObject *object, SPCtx *ctx, guint flags) static void sp_lpe_item_modified (SPObject *object, unsigned int flags) { + g_print ("sp_lpe_item_modified()\n"); if (SP_IS_GROUP(object) && (flags & SP_OBJECT_MODIFIED_FLAG) && (flags & SP_OBJECT_USER_MODIFIED_FLAG_B)) { sp_lpe_item_update_patheffect(SP_LPE_ITEM(object), true, true);