summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-07-29 14:55:17 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-07-29 14:55:17 +0000
commitb452b5fb5b86ae23cc25c2204895c24f013be18a (patch)
tree4282ce478010a7ca22502bb83cc7592fb14c1daf /src
parentslightly increase legibility (diff)
downloadinkscape-b452b5fb5b86ae23cc25c2204895c24f013be18a.tar.gz
inkscape-b452b5fb5b86ae23cc25c2204895c24f013be18a.zip
Update helperpaths live also when any of the item's LPEs is modified
(bzr r6456)
Diffstat (limited to 'src')
-rw-r--r--src/nodepath.cpp5
-rw-r--r--src/nodepath.h1
-rw-r--r--src/sp-lpe-item.cpp20
3 files changed, 24 insertions, 2 deletions
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<Inkscape::LivePathEffect::Effect *, std::vector<SPCanvasItem *> >* 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 <algorithm>
@@ -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);