summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-04 20:38:05 +0000
committerJabiertxof <jtx@jtx>2017-01-04 20:38:05 +0000
commit72a83bc13438724d098533b7d54da814cc7ef4ff (patch)
treef6fceff4ea45dab0ea27fbdf0f1b0b597bc1ba67 /src
parentFixing broken things (diff)
downloadinkscape-72a83bc13438724d098533b7d54da814cc7ef4ff.tar.gz
inkscape-72a83bc13438724d098533b7d54da814cc7ef4ff.zip
Fixing some bugs
(bzr r15295.1.50)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.h7
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp54
-rw-r--r--src/live_effects/lpe-mirror_symmetry.h2
-rw-r--r--src/sp-lpe-item.cpp2
4 files changed, 34 insertions, 31 deletions
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index bc56c2390..9a2d4c67d 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -19,7 +19,7 @@
class SPDocument;
class SPDesktop;
class SPItem;
-class LivePathEffectObject;
+class LivePathEffectObject;
class SPLPEItem;
class KnotHolder;
class KnotHolderEntity;
@@ -132,7 +132,8 @@ public:
bool erase_extra_objects; // set this to false allow retain extra generated objects, see measure line LPE
bool upd_params;
BoolParam is_visible;
-
+ SPCurve * sp_curve;
+ Geom::PathVector pathvector_before_effect;
protected:
Effect(LivePathEffectObject *lpeobject);
@@ -172,8 +173,6 @@ protected:
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
- SPCurve * sp_curve;
- Geom::PathVector pathvector_before_effect;
private:
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 576c7df5e..07a0d8b0c 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -89,7 +89,7 @@ LPEMirrorSymmetry::~LPEMirrorSymmetry()
void
LPEMirrorSymmetry::doAfterEffect (SPLPEItem const* lpeitem)
{
- if (split_elements) {
+ if (split_elements && !discard_orig_path) {
// if (discard_orig_path) {
// discard_orig_path.param_setValue(false);
// discard_orig_path.write_to_SVG();
@@ -191,7 +191,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem)
}
void
-LPEMirrorSymmetry::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, const char * attributes)
+LPEMirrorSymmetry::cloneD(SPObject *origin, SPObject *dest, bool live, bool root)
{
SPDocument * document = SP_ACTIVE_DOCUMENT;
Inkscape::XML::Document *xml_doc = document->getReprDoc();
@@ -201,37 +201,35 @@ LPEMirrorSymmetry::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, c
for (std::vector<SPObject * >::iterator obj_it = childs.begin();
obj_it != childs.end(); ++obj_it) {
SPObject *dest_child = dest->nthChild(index);
- cloneAttrbutes(*obj_it, dest_child, live, attributes);
+ cloneD(*obj_it, dest_child, live, false);
index++;
}
}
- gchar ** attarray = g_strsplit(attributes, ",", 0);
- gchar ** iter = attarray;
- while (*iter != NULL) {
- const char* att = (*iter);
- SPShape * shape = SP_SHAPE(origin);
- SPPath * path = SP_PATH(dest);
- if (!path && !SP_IS_GROUP(dest)) {
- Inkscape::XML::Node *dest_node = sp_selected_item_to_curved_repr(SP_ITEM(dest), 0);
- dest->updateRepr(xml_doc, dest_node, SP_OBJECT_WRITE_ALL);
- }
+ SPShape * shape = SP_SHAPE(origin);
+ SPPath * path = SP_PATH(dest);
+ if (!path && !SP_IS_GROUP(dest)) {
+ Inkscape::XML::Node *dest_node = sp_selected_item_to_curved_repr(SP_ITEM(dest), 0);
+ dest->updateRepr(xml_doc, dest_node, SP_OBJECT_WRITE_ALL);
path = SP_PATH(dest);
- if (path && shape) {
- if ( live && att == "d") {
- SPCurve *c = NULL;
+ }
+ if (path && shape) {
+ if ( live) {
+ SPCurve *c = NULL;
+ if (root) {
+ c = new SPCurve();
+ c->set_pathvector(pathvector_before_effect);
+ } else {
c = shape->getCurve();
- if (c) {
- path->setCurve(c, TRUE);
- dest->getRepr()->setAttribute(att,sp_svg_write_path(c->get_pathvector()));
- c->unref();
- } else {
- dest->getRepr()->setAttribute(att,NULL);
- }
+ }
+ if (c) {
+ path->setCurve(c, TRUE);
+ c->unref();
} else {
- dest->getRepr()->setAttribute(att,origin->getRepr()->attribute(att));
+ dest->getRepr()->setAttribute("d", NULL);
}
+ } else {
+ dest->getRepr()->setAttribute("d", origin->getRepr()->attribute("d"));
}
- iter++;
}
}
@@ -288,7 +286,7 @@ LPEMirrorSymmetry::toMirror(Geom::Affine transform)
elemref = container->appendChildRepr(phantom);
Inkscape::GC::release(phantom);
}
- cloneAttrbutes(SP_OBJECT(sp_lpe_item), elemref, true, "d");
+ cloneD(SP_OBJECT(sp_lpe_item), elemref, true, true);
elemref->getRepr()->setAttribute("transform" , sp_svg_transform_write(transform));
if (elemref->parent != container) {
Inkscape::XML::Node *copy = phantom->duplicate(xml_doc);
@@ -553,6 +551,10 @@ LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in)
mirror.setInitial(portion.finalPoint());
portion.append(mirror);
portion = portion.reversed();
+ } else {
+ if (!tmp_path.empty()) {
+ tmp_path.appendNew<Geom::LineSegment>( portion.initialPoint() );
+ }
}
if (!original.closed()) {
if (!split_elements) {
diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h
index 0680e5be8..c39cf3e04 100644
--- a/src/live_effects/lpe-mirror_symmetry.h
+++ b/src/live_effects/lpe-mirror_symmetry.h
@@ -51,7 +51,7 @@ public:
void processObjects(LpeAction lpe_action);
void toMirror(Geom::Affine transform);
// void cloneAttrbutes(Inkscape::XML::Node * origin, Inkscape::XML::Node * dest, const char * first_attribute, ...);
- void cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, const char * attributes);
+ void cloneD(SPObject *origin, SPObject *dest, bool live, bool root);
protected:
virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec);
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 98428512f..7ad428383 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -260,6 +260,8 @@ bool SPLPEItem::performPathEffect(SPCurve *curve, bool is_clip_or_mask) {
return false;
}
if (!SP_IS_GROUP(this)) {
+ lpe->pathvector_before_effect = curve->get_pathvector();
+ lpe->sp_curve->set_pathvector(lpe->pathvector_before_effect);
lpe->doAfterEffect(this);
}
}