summaryrefslogtreecommitdiffstats
path: root/src/sp-lpe-item.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-18 22:30:22 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-18 22:30:22 +0000
commit9f73c6a042a7da94457ef3adcc142b626fbbc905 (patch)
tree7e41b52903ea44aef046c9d6ad6b385aac44b6fb /src/sp-lpe-item.cpp
parentMake knotholder members protected (diff)
downloadinkscape-9f73c6a042a7da94457ef3adcc142b626fbbc905.tar.gz
inkscape-9f73c6a042a7da94457ef3adcc142b626fbbc905.zip
Update LPE helper paths "live" on changes
(bzr r5995)
Diffstat (limited to 'src/sp-lpe-item.cpp')
-rw-r--r--src/sp-lpe-item.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 4c2ca3857..2ba1c86c2 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -118,6 +118,9 @@ sp_lpe_item_init(SPLPEItem *lpeitem)
lpeitem->current_path_effect = NULL;
new (&lpeitem->lpe_modified_connection) sigc::connection();
+
+ lpeitem->adding_helperpaths = false;
+ lpeitem->removing_helperpaths = false;
}
static void
@@ -345,6 +348,13 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write)
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);
}
@@ -711,20 +721,38 @@ bool sp_lpe_item_path_effects_enabled(SPLPEItem *lpeitem)
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;
}
/*