summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2016-12-07 22:19:44 +0000
committerJabiertxof <jtx@jtx>2016-12-07 22:19:44 +0000
commit043cb3136f9118e411aff77e8105b3ac0b05b6b8 (patch)
tree8f7454097b1495fbeab2b2bbdc30be3dc5e03e45 /src
parentfixing extra LPE on copies on release (diff)
downloadinkscape-043cb3136f9118e411aff77e8105b3ac0b05b6b8.tar.gz
inkscape-043cb3136f9118e411aff77e8105b3ac0b05b6b8.zip
Fix the duplicated LPE on erase bug
(bzr r15295.1.16)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-measure-line.cpp15
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp11
-rw-r--r--src/sp-lpe-item.cpp6
3 files changed, 17 insertions, 15 deletions
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index 3d0583f55..ef63888d9 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -686,7 +686,7 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
}
}
-
+//TODO: Migrate the tree next function to effect.cpp/h to avoid duplication
void
LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
{
@@ -696,9 +696,8 @@ LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
void
LPEMeasureLine::doOnRemove (SPLPEItem const* /*lpeitem*/)
{
- std::cout << "111111111111111111111111\n";
+ //unset "erase_extra_objects" hook on sp-lpe-item.cpp
if (!erase_extra_objects) {
- std::cout << "2222222222222222222222222\n";
processObjects(LPE_TO_OBJECTS);
elements.clear();
return;
@@ -713,6 +712,9 @@ LPEMeasureLine::processObjects(LpeAction lpe_action)
for (std::vector<const char *>::iterator el_it = elements.begin();
el_it != elements.end(); ++el_it) {
const char * id = *el_it;
+ if (!id || strlen(id) == 0) {
+ return;
+ }
Inkscape::URI SVGElem_uri(Glib::ustring("#").append(id).c_str());
Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
SVGElemRef->attach(SVGElem_uri);
@@ -722,12 +724,7 @@ LPEMeasureLine::processObjects(LpeAction lpe_action)
Glib::ustring css_str;
switch (lpe_action){
case LPE_TO_OBJECTS:
- std::cout << sp_lpe_item->getId() << "sp_lpe_item->getId()\n";
- std::cout << id << "Id()\n";
- if (std::strcmp(sp_lpe_item->getId(), id) != 0) {
- std::cout << id << "loborro\n";
- elemref->getRepr()->setAttribute("inkscape:path-effect", NULL);
- }
+ elemref->getRepr()->setAttribute("inkscape:path-effect", NULL);
elemref->getRepr()->setAttribute("sodipodi:insensitive", NULL);
break;
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index fd7c7824d..a338f60f4 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -299,7 +299,7 @@ LPEMirrorSymmetry::createMirror(SPLPEItem *origin, Geom::Affine transform, const
}
}
-
+//TODO: Migrate the tree next function to effect.cpp/h to avoid duplication
void
LPEMirrorSymmetry::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
{
@@ -309,9 +309,9 @@ LPEMirrorSymmetry::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
void
LPEMirrorSymmetry::doOnRemove (SPLPEItem const* /*lpeitem*/)
{
+ //unset "erase_extra_objects" hook on sp-lpe-item.cpp
if (!erase_extra_objects) {
processObjects(LPE_TO_OBJECTS);
- std::cout << elements.size() << "elements.size() elements.size() elements.size() elements.size() elements.size() \n";
elements.clear();
return;
}
@@ -325,6 +325,9 @@ LPEMirrorSymmetry::processObjects(LpeAction lpe_action)
for (std::vector<const char *>::iterator el_it = elements.begin();
el_it != elements.end(); ++el_it) {
const char * id = *el_it;
+ if (!id || strlen(id) == 0) {
+ return;
+ }
Inkscape::URI SVGElem_uri(Glib::ustring("#").append(id).c_str());
Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
SVGElemRef->attach(SVGElem_uri);
@@ -334,9 +337,7 @@ LPEMirrorSymmetry::processObjects(LpeAction lpe_action)
Glib::ustring css_str;
switch (lpe_action){
case LPE_TO_OBJECTS:
- if (std::strcmp(sp_lpe_item->getId(), id) != 0) {
- elemref->getRepr()->setAttribute("inkscape:path-effect", NULL);
- }
+ elemref->getRepr()->setAttribute("inkscape:path-effect", NULL);
elemref->getRepr()->setAttribute("sodipodi:insensitive", NULL);
break;
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 872a88289..9cf9dadc1 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -24,6 +24,7 @@
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "live_effects/lpe-measure-line.h"
+#include "live_effects/lpe-mirror_symmetry.h"
#include "sp-path.h"
#include "sp-item-group.h"
@@ -125,7 +126,10 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
{
if (!value) {
LivePathEffectObject *lpeobj = (*it)->lpeobject;
- if (Inkscape::LivePathEffect::LPEMeasureLine * lpe = dynamic_cast<Inkscape::LivePathEffect::LPEMeasureLine *>(lpeobj->get_lpe())) {
+ Inkscape::LivePathEffect::Effect * lpe = lpeobj->get_lpe();
+ if (dynamic_cast<Inkscape::LivePathEffect::LPEMirrorSymmetry *>(lpe) ||
+ dynamic_cast<Inkscape::LivePathEffect::LPEMeasureLine *>(lpe) )
+ {
lpe->doOnRemove(this);
}
}