diff options
| author | Jabiertxof <jtx@jtx> | 2016-12-06 21:16:46 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2016-12-06 21:16:46 +0000 |
| commit | 03098d9de7fbca944663da45b1a662be8a69c485 (patch) | |
| tree | 39951755689ed508acfae25bde67ce80f269e634 /src | |
| parent | Update to trunk (diff) | |
| download | inkscape-03098d9de7fbca944663da45b1a662be8a69c485.tar.gz inkscape-03098d9de7fbca944663da45b1a662be8a69c485.zip | |
Fix to const char
(bzr r15295.1.9)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.cpp | 32 | ||||
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.h | 4 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index d6989fa41..e44d57a0e 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -109,7 +109,6 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) Geom::Affine m = Geom::identity();//lpeitem->transform; Point point_a(boundingbox_X.max(), boundingbox_Y.min()); Point point_b(boundingbox_X.max(), boundingbox_Y.max()); - gchar * id = g_strdup(((Glib::ustring)"mirror-" + (Glib::ustring)id_origin.param_getSVGValue() + (Glib::ustring)"-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str()); if (mode == MT_Y) { point_a = Geom::Point(boundingbox_X.min(),center_point[Y]); point_b = Geom::Point(boundingbox_X.max(),center_point[Y]); @@ -162,9 +161,6 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) } previous_center = center_point; if (split_elements) { - ms_elements.clear(); - ms_elements.push_back(id); - ms_elements.push_back(id_origin.param_getSVGValue()); ms_container = dynamic_cast<SPObject *>(splpeitem->parent); SPDocument * doc = SP_ACTIVE_DOCUMENT; Inkscape::XML::Node *root = splpeitem->document->getReprRoot(); @@ -186,16 +182,22 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) Geom::Affine m2(cos, -sin, sin, cos, 0.0, 0.0); gap *= m2; Geom::Scale sca(1.0, -1.0); - if (std::strcmp(splpeitem->getId(), id) == 0) { - id = id_origin.param_getSVGValue(); - } + const char * id_original = id_origin.param_getSVGValue(); + const char * id = g_strdup(Glib::ustring("mirror-").append(id_original).append("-").append(this->getRepr()->attribute("id")).c_str()); m = m1.inverse() * m2; m = m * sca; m = m * m2.inverse(); m = m * m1; m = m * gap; m = m * lpeitem->transform; - createMirror(splpeitem, m, id); + if (std::strcmp(splpeitem->getId(), id) == 0) { + createMirror(splpeitem, m, id_original); + } else { + createMirror(splpeitem, m, id); + } + ms_elements.clear(); + ms_elements.push_back(id); + ms_elements.push_back(id_original); } else { ms_elements.clear(); processObjects(LPE_ERASE); @@ -269,11 +271,11 @@ LPEMirrorSymmetry::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, c } void -LPEMirrorSymmetry::createMirror(SPLPEItem *origin, Geom::Affine transform, gchar * id) +LPEMirrorSymmetry::createMirror(SPLPEItem *origin, Geom::Affine transform, const char * id) { if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) { Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); - Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + id).c_str()); + Inkscape::URI SVGElem_uri(Glib::ustring("#").append(id).c_str()); Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc()); SVGElemRef->attach(SVGElem_uri); SPObject *elemref= NULL; @@ -324,17 +326,15 @@ void LPEMirrorSymmetry::processObjects(LpeAction lpe_action) { if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) { - for (std::vector<gchar *>::iterator el_it = ms_elements.begin(); + for (std::vector<const char *>::iterator el_it = ms_elements.begin(); el_it != ms_elements.end(); ++el_it) { - gchar * id = *el_it; - std::cout << id << "idididididididididi\n"; - Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + id).c_str()); + const char * id = *el_it; + Inkscape::URI SVGElem_uri(Glib::ustring("#").append(id).c_str()); Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc()); SVGElemRef->attach(SVGElem_uri); SPObject *elemref = NULL; if (elemref = SVGElemRef->getObject()) { SPLPEItem *lpe_element = dynamic_cast<SPLPEItem *>(elemref); - std::cout << elemref->getId() << "elemref->getId()elemref->getId()elemref->getId()elemref->getId()\n"; switch (lpe_action){ case LPE_TO_OBJECTS: elemref->getRepr()->setAttribute("sodipodi:insensitive", NULL); @@ -392,7 +392,7 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem) end_point.param_update_default(point_b); center_point = point_c; previous_center = center_point; - id_origin.param_setValue((Glib::ustring)lpeitem->getId()); + id_origin.param_setValue(Glib::ustring(lpeitem->getId())); id_origin.write_to_SVG(); } diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h index cdbfe67e2..9ca86872f 100644 --- a/src/live_effects/lpe-mirror_symmetry.h +++ b/src/live_effects/lpe-mirror_symmetry.h @@ -55,7 +55,7 @@ public: void processObjects(LpeAction lpe_action); /* the knotholder entity classes must be declared friends */ friend class MS::KnotHolderEntityCenterMirrorSymmetry; - void createMirror(SPLPEItem *origin, Geom::Affine transform, gchar * id); + void createMirror(SPLPEItem *origin, Geom::Affine transform, const char * id); // void cloneAttrbutes(Inkscape::XML::Node * origin, Inkscape::XML::Node * dest, char const * first_attribute, ...); void cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, char const * first_attribute, ...); void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item); @@ -77,7 +77,7 @@ private: Geom::Point previous_center; Geom::Point center_point; bool actual; - std::vector<gchar *> ms_elements; + std::vector<const char *> ms_elements; SPObject * ms_container; LPEMirrorSymmetry(const LPEMirrorSymmetry&); LPEMirrorSymmetry& operator=(const LPEMirrorSymmetry&); |
