summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dea5c49)
raw | patch | inline | side by side (parent: dea5c49)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 18 Jun 2008 22:30:22 +0000 (22:30 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 18 Jun 2008 22:30:22 +0000 (22:30 +0000) |
src/shape-editor.cpp | patch | blob | history | |
src/sp-lpe-item.cpp | patch | blob | history | |
src/sp-lpe-item.h | patch | blob | history |
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index d5712525aea92a5e52d9d155b97e2d59f70b84fb..4b71184e4c5843007107af130e1d7b3888a5d569 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
// or the LPE is invisible or it doesn't provide a knotholder itself
this->nodepath = sp_nodepath_new(desktop, item,
(prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
- } else if (lpe && lpe->isVisible() && lpe->showOrigPath()) {
+ } else if (lpe && lpe->isVisible()) {
sp_lpe_item_add_temporary_canvasitems(lpeitem, desktop);
}
}
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 4c2ca3857f6bc28b920a68799ebc85c9f3728328..2ba1c86c216b6c453c9590e94fa65568bfb2815d 100644 (file)
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
lpeitem->current_path_effect = NULL;
new (&lpeitem->lpe_modified_connection) sigc::connection();
+
+ lpeitem->adding_helperpaths = false;
+ lpeitem->removing_helperpaths = false;
}
static void
top = lpeitem;
}
+ // TODO: ditch inkscape_active_desktop()
+ SPDesktop *desktop = inkscape_active_desktop();
+ if (desktop) {
+ sp_lpe_item_remove_temporary_canvasitems(lpeitem, desktop);
+ sp_lpe_item_add_temporary_canvasitems(lpeitem, desktop);
+ }
+
if (SP_LPE_ITEM_CLASS (G_OBJECT_GET_CLASS (top))->update_patheffect) {
SP_LPE_ITEM_CLASS (G_OBJECT_GET_CLASS (top))->update_patheffect (top, write);
}
void
sp_lpe_item_add_temporary_canvasitems(SPLPEItem *lpeitem, SPDesktop *desktop)
{
+ if (lpeitem->adding_helperpaths) {
+ return;
+ }
+ lpeitem->adding_helperpaths = true;
+ // FIXME: for some reason it seems that we must create the variable lpe AFTER checking
+ // for adding_helperpaths == true; otherwise we get a crash on startup. why??
Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(lpeitem);
if (lpe) {
+ // TODO: can we just update the tempitem's SPCurve instead of recreating it each time?
lpe->addHelperPaths(lpeitem, desktop);
}
+ lpeitem->adding_helperpaths = false;
}
void
sp_lpe_item_remove_temporary_canvasitems(SPLPEItem *lpeitem, SPDesktop *desktop)
{
+ g_return_if_fail(lpeitem);
+ g_return_if_fail(desktop);
+
+ if (lpeitem->removing_helperpaths) {
+ return;
+ }
+ lpeitem->removing_helperpaths = true;
+
// destroy all temporary canvasitems created by LPEs
std::vector<Inkscape::Display::TemporaryItem*>::iterator i;
for (i = lpeitem->lpe_helperpaths.begin(); i != lpeitem->lpe_helperpaths.end(); ++i) {
desktop->remove_temporary_canvasitem(*i);
}
+
+ lpeitem->removing_helperpaths = false;
}
/*
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index 7691ce9803525898d5e177cfa5ae6eefb3acfdae..54642f27b17a657c7f321bb2437d2b20c8f77bd8 100644 (file)
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
Inkscape::LivePathEffect::LPEObjectReference* current_path_effect;
std::vector<Inkscape::Display::TemporaryItem*> lpe_helperpaths;
+ bool adding_helperpaths;
+ bool removing_helperpaths;
+
sigc::connection lpe_modified_connection;
};