summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bcc4310)
raw | patch | inline | side by side (parent: bcc4310)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 13 Aug 2009 20:18:16 +0000 (20:18 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 13 Aug 2009 20:18:16 +0000 (20:18 +0000) |
src/nodepath.cpp | patch | blob | history |
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 74d0758a7e3a6f025f53a26e44d05ad9366c63ec..5b2a738d3dc2c96e4d007a0bb0064b01a5149c8a 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
}
}
+static void
+sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) {
+ for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) {
+ for (std::vector<SPCanvasItem *>::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) {
+ GtkObject *temp = *j;
+ *j = NULL;
+ gtk_object_destroy(temp);
+ }
+ }
+ np->helper_path_vec.clear();
+}
+
+/** updates canvas items from the effect's helper paths */
void
sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) {
//std::map<Inkscape::LivePathEffect::Effect *, std::vector<SPCanvasItem *> > helper_path_vec;
SPLPEItem *lpeitem = SP_LPE_ITEM(np->item);
PathEffectList lpelist = sp_lpe_item_get_effect_list(lpeitem);
+
+ /* The number or type or LPEs may have changed, so we need to clear and recreate our
+ * helper_path_vec to make sure it is in sync */
+ sp_nodepath_destroy_helperpaths(np);
+ sp_nodepath_create_helperpaths(np);
+
for (PathEffectList::iterator i = lpelist.begin(); i != lpelist.end(); ++i) {
Inkscape::LivePathEffect::Effect *lpe = (*i)->lpeobject->get_lpe();
if (lpe) {
- /* update canvas items from the effect's helper paths; note that this code relies on the
- * fact that getHelperPaths() will always return the same number of helperpaths in the same
- * order as during their creation in sp_nodepath_create_helperpaths
- */
std::vector<Geom::PathVector> hpaths = lpe->getHelperPaths(lpeitem);
for (unsigned int j = 0; j < hpaths.size(); ++j) {
SPCurve *curve = new SPCurve(hpaths[j]);
}
}
-static void
-sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) {
- for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) {
- for (std::vector<SPCanvasItem *>::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) {
- GtkObject *temp = *j;
- *j = NULL;
- gtk_object_destroy(temp);
- }
- }
- np->helper_path_vec.clear();
-}
-
-
/**
* \brief Creates new nodepath from item
*