diff options
33 files changed, 105 insertions, 105 deletions
diff --git a/src/document.cpp b/src/document.cpp index 03b285710..a6098b30a 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1884,7 +1884,7 @@ void SPDocument::_importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, } } if ( !duplicate ) { - src->getRepr()->setAttribute("id", id.c_str() ); + src->setAttribute("id", id); } } } diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index cde2d45e7..d7b5ccd63 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -380,7 +380,7 @@ SPGradient *sp_gradient_reset_to_userspace(SPGradient *gr, SPItem *item) gr->gradientTransform = squeeze; { gchar *c=sp_svg_transform_write(gr->gradientTransform); - gr->getRepr()->setAttribute("gradientTransform", c); + gr->setAttribute("gradientTransform", c); g_free(c); } } else if (SP_IS_LINEARGRADIENT(gr)) { @@ -509,7 +509,7 @@ SPGradient *sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar gr->gradientTransform = skew; { gchar *c=sp_svg_transform_write(gr->gradientTransform); - gr->getRepr()->setAttribute("gradientTransform", c); + gr->setAttribute("gradientTransform", c); g_free(c); } @@ -588,7 +588,7 @@ void sp_gradient_transform_multiply(SPGradient *gradient, Geom::Affine postmul, gradient->gradientTransform_set = TRUE; gchar *c=sp_svg_transform_write(gradient->gradientTransform); - gradient->getRepr()->setAttribute("gradientTransform", c); + gradient->setAttribute("gradientTransform", c); g_free(c); } @@ -685,7 +685,7 @@ SPStop *sp_vector_add_stop(SPGradient *vector, SPStop* prev_stop, SPStop* next_s sp_svg_write_color (c, sizeof(c), cnew); gdouble opacity = (gdouble) SP_RGBA32_A_F (cnew); os << "stop-color:" << c << ";stop-opacity:" << opacity <<";"; - newstop->getRepr()->setAttribute("style", os.str().c_str()); + newstop->setAttribute("style", os.str()); Inkscape::GC::release(new_stop_repr); return newstop; @@ -1230,7 +1230,7 @@ void sp_item_gradient_set_coords(SPItem *item, GrPointType point_type, guint poi gradient->gradientTransform_set = TRUE; if (write_repr) { gchar *s=sp_svg_transform_write(gradient->gradientTransform); - gradient->getRepr()->setAttribute("gradientTransform", s); + gradient->setAttribute("gradientTransform", s); g_free(s); } else { gradient->requestModified(SP_OBJECT_MODIFIED_FLAG); diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 16b90c23f..6ee6d832f 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -251,7 +251,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) g_free(name); if (object) { - object->getRepr()->setAttribute("inkscape:isstock", "true"); + object->setAttribute("inkscape:isstock", "true"); } return object; diff --git a/src/id-clash.cpp b/src/id-clash.cpp index 75154391b..95c43166c 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -227,7 +227,7 @@ change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc, } // Change to the new ID - elem->getRepr()->setAttribute("id", new_id); + elem->setAttribute("id", new_id); // Make a note of this change, if we need to fix up refs to it if (refmap.find(old_id) != refmap.end()) id_changes->push_back(id_changeitem_type(elem, old_id)); @@ -259,7 +259,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes) switch (it->type) { case REF_HREF: { gchar *new_uri = g_strdup_printf("#%s", obj->getId()); - it->elem->getRepr()->setAttribute(it->attr, new_uri); + it->elem->setAttribute(it->attr, new_uri); g_free(new_uri); break; } @@ -269,7 +269,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes) } case REF_URL: { gchar *url = g_strdup_printf("url(#%s)", obj->getId()); - it->elem->getRepr()->setAttribute(it->attr, url); + it->elem->setAttribute(it->attr, url); g_free(url); break; } @@ -280,7 +280,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes) g_free(url); Glib::ustring style_string; sp_repr_css_write_string(style, style_string); - it->elem->getRepr()->setAttribute("style", style_string); + it->elem->setAttribute("style", style_string); break; } } @@ -327,7 +327,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj) switch (it->type) { case REF_HREF: { gchar *new_uri = g_strdup_printf("#%s", to_obj->getId()); - it->elem->getRepr()->setAttribute(it->attr, new_uri); + it->elem->setAttribute(it->attr, new_uri); g_free(new_uri); break; } @@ -337,7 +337,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj) } case REF_URL: { gchar *url = g_strdup_printf("url(#%s)", to_obj->getId()); - it->elem->getRepr()->setAttribute(it->attr, url); + it->elem->setAttribute(it->attr, url); g_free(url); break; } @@ -348,7 +348,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj) g_free(url); Glib::ustring style_string; sp_repr_css_write_string(style, style_string); - it->elem->getRepr()->setAttribute("style", style_string); + it->elem->setAttribute("style", style_string); break; } } @@ -394,7 +394,7 @@ void rename_id(SPObject *elem, Glib::ustring const &new_name) } g_free (id); // Change to the new ID - elem->getRepr()->setAttribute("id", new_name2); + elem->setAttribute("id", new_name2); // Make a note of this change, if we need to fix up refs to it id_changelist_type id_changes; if (refmap.find(old_id) != refmap.end()) { diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index a3f8dbc30..19e69b97d 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -171,7 +171,7 @@ void LPEBSpline::changeWeight(double weight_ammount) SPCurve *curve = path->getCurveForEdit(); doBSplineFromWidget(curve, weight_ammount/100.0); gchar *str = sp_svg_write_path(curve->get_pathvector()); - path->getRepr()->setAttribute("inkscape:original-d", str); + path->setAttribute("inkscape:original-d", str); g_free(str); } } diff --git a/src/object/filters/blend.cpp b/src/object/filters/blend.cpp index 9c0aa166c..eae652579 100644 --- a/src/object/filters/blend.cpp +++ b/src/object/filters/blend.cpp @@ -178,7 +178,7 @@ void SPFeBlend::update(SPCtx *ctx, guint flags) { this->in2 = this->name_previous_out(); // TODO: XML Tree being used directly here while it shouldn't be. - this->getRepr()->setAttribute("in2", parent->name_for_image(this->in2)); + this->setAttribute("in2", parent->name_for_image(this->in2)); } SPFilterPrimitive::update(ctx, flags); diff --git a/src/object/filters/composite.cpp b/src/object/filters/composite.cpp index 181aeb27e..6a01c4789 100644 --- a/src/object/filters/composite.cpp +++ b/src/object/filters/composite.cpp @@ -205,7 +205,7 @@ void SPFeComposite::update(SPCtx *ctx, guint flags) { this->in2 = this->name_previous_out(); //XML Tree being used directly here while it shouldn't be. - this->getRepr()->setAttribute("in2", parent->name_for_image(this->in2)); + this->setAttribute("in2", parent->name_for_image(this->in2)); } SPFilterPrimitive::update(ctx, flags); diff --git a/src/object/filters/displacementmap.cpp b/src/object/filters/displacementmap.cpp index 99556571e..80b9638f1 100644 --- a/src/object/filters/displacementmap.cpp +++ b/src/object/filters/displacementmap.cpp @@ -162,7 +162,7 @@ void SPFeDisplacementMap::update(SPCtx *ctx, guint flags) { this->in2 = this->name_previous_out(); //XML Tree being used directly here while it shouldn't be. - this->getRepr()->setAttribute("in2", parent->name_for_image(this->in2)); + this->setAttribute("in2", parent->name_for_image(this->in2)); } SPFilterPrimitive::update(ctx, flags); diff --git a/src/object/filters/sp-filter-primitive.cpp b/src/object/filters/sp-filter-primitive.cpp index 25d993b7c..8ed14ff3c 100644 --- a/src/object/filters/sp-filter-primitive.cpp +++ b/src/object/filters/sp-filter-primitive.cpp @@ -233,7 +233,7 @@ int SPFilterPrimitive::name_previous_out() { int slot = parent->set_image_name(name.c_str()); i_prim->image_out = slot; //XML Tree is being directly used while it shouldn't be. - i_prim->getRepr()->setAttribute("result", name.c_str()); + i_prim->setAttribute("result", name); return slot; } else { return i_prim->image_out; diff --git a/src/object/sp-conn-end.cpp b/src/object/sp-conn-end.cpp index dab25bfc0..d121be025 100644 --- a/src/object/sp-conn-end.cpp +++ b/src/object/sp-conn-end.cpp @@ -229,7 +229,7 @@ static void sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned cons { char const * const attrs[] = { "inkscape:connection-start", "inkscape:connection-end"}; - owner->getRepr()->setAttribute(attrs[handle_ix], nullptr); + owner->setAttribute(attrs[handle_ix], nullptr); /* I believe this will trigger sp_conn_end_href_changed. */ } diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp index 4fe73ca4e..853511d42 100644 --- a/src/object/sp-guide.cpp +++ b/src/object/sp-guide.cpp @@ -471,7 +471,7 @@ void SPGuide::set_color(const unsigned r, const unsigned g, const unsigned b, bo std::ostringstream os; os << "rgb(" << r << "," << g << "," << b << ")"; //XML Tree being used directly while it shouldn't be - getRepr()->setAttribute("inkscape:color", os.str().c_str()); + setAttribute("inkscape:color", os.str()); } } @@ -483,7 +483,7 @@ void SPGuide::set_locked(const bool locked, bool const commit) } if (commit) { - getRepr()->setAttribute("inkscape:locked", g_strdup(locked ? "true" : "false")); + setAttribute("inkscape:locked", locked ? "true" : "false"); } } @@ -495,7 +495,7 @@ void SPGuide::set_label(const char* label, bool const commit) if (commit) { //XML Tree being used directly while it shouldn't be - getRepr()->setAttribute("inkscape:label", label); + setAttribute("inkscape:label", label); } } diff --git a/src/object/sp-lpe-item.cpp b/src/object/sp-lpe-item.cpp index ec7b6469e..47ace710b 100755 --- a/src/object/sp-lpe-item.cpp +++ b/src/object/sp-lpe-item.cpp @@ -548,7 +548,7 @@ void SPLPEItem::addPathEffect(std::string value, bool reset) } hreflist.push_back(value); // C++11: should be emplace_back std::move'd (also the reason why passed by value to addPathEffect) - this->getRepr()->setAttribute("inkscape:path-effect", hreflist_svg_string(hreflist)); + this->setAttribute("inkscape:path-effect", hreflist_svg_string(hreflist)); // Make sure that ellipse is stored as <svg:path> if( SP_IS_GENERICELLIPSE(this)) { SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); @@ -603,7 +603,7 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths) effect_->keep_paths = keep_paths; effect_->doOnRemove(this); this->path_effect_list->remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list - this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(*this->path_effect_list)); + this->setAttribute("inkscape:path-effect", patheffectlist_svg_string(*this->path_effect_list)); if (!keep_paths) { // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. if( SP_IS_GENERICELLIPSE(this)) { @@ -640,7 +640,7 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths) } } this->path_effect_list->clear(); - this->getRepr()->setAttribute("inkscape:path-effect", nullptr); + this->setAttribute("inkscape:path-effect", nullptr); if (!keep_paths) { // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. if (SP_IS_GENERICELLIPSE(this)) { @@ -667,7 +667,7 @@ void SPLPEItem::downCurrentPathEffect() } } - this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); + this->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); sp_lpe_item_cleanup_original_path_recursive(this, false); } @@ -686,7 +686,7 @@ void SPLPEItem::upCurrentPathEffect() std::iter_swap(cur_it, up_it); } - this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); + this->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); sp_lpe_item_cleanup_original_path_recursive(this, false); } @@ -820,7 +820,7 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setAttribute("inkscape:original-d", nullptr); shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! @@ -846,7 +846,7 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setAttribute("inkscape:original-d", nullptr); shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! @@ -872,7 +872,7 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse) } else if (shape) { shape->setCurveInsync( shape->getCurveForEdit()); if (!hasPathEffectOnClipOrMaskRecursive(shape)) { - shape->getRepr()->setAttribute("inkscape:original-d", nullptr); + shape->setAttribute("inkscape:original-d", nullptr); shape->setCurveBeforeLPE(nullptr); } else { // make sure there is an original-d for paths!!! @@ -1143,7 +1143,7 @@ void SPLPEItem::replacePathEffects( std::vector<LivePathEffectObject const *> co } } - this->getRepr()->setAttribute("inkscape:path-effect", hreflist_svg_string(hreflist)); + this->setAttribute("inkscape:path-effect", hreflist_svg_string(hreflist)); } /** diff --git a/src/object/sp-marker.cpp b/src/object/sp-marker.cpp index 22d06a247..8084dd5f8 100644 --- a/src/object/sp-marker.cpp +++ b/src/object/sp-marker.cpp @@ -482,13 +482,13 @@ SPObject *sp_marker_fork_if_necessary(SPObject *marker) SPDocument *doc = marker->document; Inkscape::XML::Document *xml_doc = doc->getReprDoc(); // Turn off garbage-collectable or it might be collected before we can use it - marker->getRepr()->setAttribute("inkscape:collect", nullptr); + marker->setAttribute("inkscape:collect", nullptr); Inkscape::XML::Node *mark_repr = marker->getRepr()->duplicate(xml_doc); doc->getDefs()->getRepr()->addChild(mark_repr, nullptr); if (!mark_repr->attribute("inkscape:stockid")) { mark_repr->setAttribute("inkscape:stockid", mark_repr->attribute("id")); } - marker->getRepr()->setAttribute("inkscape:collect", "always"); + marker->setAttribute("inkscape:collect", "always"); SPObject *marker_new = static_cast<SPObject *>(doc->getObjectByRepr(mark_repr)); Inkscape::GC::release(mark_repr); diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp index 714518f08..5936963c7 100644 --- a/src/object/sp-object.cpp +++ b/src/object/sp-object.cpp @@ -906,7 +906,7 @@ void SPObject::set(SPAttributeEnum key, gchar const* value) { sp_object_ref(conflict, nullptr); // give the conflicting object a new ID gchar *new_conflict_id = sp_object_get_unique_id(conflict, nullptr); - conflict->getRepr()->setAttribute("id", new_conflict_id); + conflict->setAttribute("id", new_conflict_id); g_free(new_conflict_id); sp_object_unref(conflict, nullptr); } else { diff --git a/src/object/sp-offset.cpp b/src/object/sp-offset.cpp index 13de079e0..b5965813e 100644 --- a/src/object/sp-offset.cpp +++ b/src/object/sp-offset.cpp @@ -118,8 +118,8 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { //XML Tree being used directly here (as object->getRepr) //in all the below lines in the block while it shouldn't be. gchar const *oldA = this->getRepr()->attribute("sodipodi:radius"); - this->getRepr()->setAttribute("inkscape:radius",oldA); - this->getRepr()->setAttribute("sodipodi:radius",nullptr); + this->setAttribute("inkscape:radius",oldA); + this->setAttribute("sodipodi:radius",nullptr); this->readAttr( "inkscape:radius" ); } @@ -128,8 +128,8 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { this->readAttr( "inkscape:original" ); } else { gchar const *oldA = this->getRepr()->attribute("sodipodi:original"); - this->getRepr()->setAttribute("inkscape:original",oldA); - this->getRepr()->setAttribute("sodipodi:original",nullptr); + this->setAttribute("inkscape:original",oldA); + this->setAttribute("sodipodi:original",nullptr); this->readAttr( "inkscape:original" ); } @@ -148,11 +148,11 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) { nA[0]='#'; nA[lA+1]=0; - this->getRepr()->setAttribute("xlink:href",nA); + this->setAttribute("xlink:href",nA); free(nA); - this->getRepr()->setAttribute("inkscape:href",nullptr); + this->setAttribute("inkscape:href",nullptr); } this->readAttr( "xlink:href" ); @@ -1188,7 +1188,7 @@ refresh_offset_source(SPOffset* offset) // TODO fix: //XML Tree being used directly here while it shouldn't be. - offset->getRepr()->setAttribute("inkscape:original", res_d); + offset->setAttribute("inkscape:original", res_d); free (res_d); } diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp index 379b1bfdf..9d7ef1fe0 100644 --- a/src/object/sp-path.cpp +++ b/src/object/sp-path.cpp @@ -158,7 +158,7 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) { curve->unref(); // Convert from property to attribute (convert back on write) - getRepr()->setAttribute("d", value); + setAttribute("d", value); SPCSSAttr *css = sp_repr_css_attr( getRepr(), "style"); sp_repr_css_unset_property ( css, "d"); diff --git a/src/object/sp-pattern.cpp b/src/object/sp-pattern.cpp index a7035e98e..c20752bc2 100644 --- a/src/object/sp-pattern.cpp +++ b/src/object/sp-pattern.cpp @@ -372,7 +372,7 @@ void SPPattern::transform_multiply(Geom::Affine postmul, bool set) _pattern_transform_set = true; gchar *c = sp_svg_transform_write(_pattern_transform); - getRepr()->setAttribute("patternTransform", c); + setAttribute("patternTransform", c); g_free(c); } diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index 49052d92c..da9c2cca9 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -102,7 +102,7 @@ void SPText::set(SPAttributeEnum key, const gchar* value) { this->style->line_height.value = this->style->line_height.computed = sp_svg_read_percentage (value, 1.0); } // Remove deprecated attribute - this->getRepr()->setAttribute("sodipodi:linespacing", nullptr); + this->setAttribute("sodipodi:linespacing", nullptr); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG); break; diff --git a/src/object/sp-tspan.cpp b/src/object/sp-tspan.cpp index 7a0db5687..30abb9bb4 100644 --- a/src/object/sp-tspan.cpp +++ b/src/object/sp-tspan.cpp @@ -405,14 +405,14 @@ Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscap this->attributes.writeTo(repr); if (this->side == SP_TEXT_PATH_SIDE_RIGHT) { - this->getRepr()->setAttribute("side", "right"); + this->setAttribute("side", "right"); } if (this->startOffset._set) { if (this->startOffset.unit == SVGLength::PERCENT) { Inkscape::SVGOStringStream os; os << (this->startOffset.computed * 100.0) << "%"; - this->getRepr()->setAttribute("startOffset", os.str().c_str()); + this->setAttribute("startOffset", os.str()); } else { /* FIXME: This logic looks rather undesirable if e.g. startOffset is to be in ems. */ diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 81bc531c1..d4e1809f7 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -617,9 +617,9 @@ ObjectSet::pathReverse() gchar *str = sp_svg_write_path(rcurve->get_pathvector()); if ( path->hasPathEffectRecursive() ) { - path->getRepr()->setAttribute("inkscape:original-d", str); + path->setAttribute("inkscape:original-d", str); } else { - path->getRepr()->setAttribute("d", str); + path->setAttribute("d", str); } g_free(str); @@ -628,7 +628,7 @@ ObjectSet::pathReverse() // reverse nodetypes order (Bug #179866) gchar *nodetypes = g_strdup(path->getRepr()->attribute("sodipodi:nodetypes")); if ( nodetypes ) { - path->getRepr()->setAttribute("sodipodi:nodetypes", g_strreverse(nodetypes)); + path->setAttribute("sodipodi:nodetypes", g_strreverse(nodetypes)); g_free(nodetypes); } } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e40743635..ea9d1eace 100755 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -520,7 +520,7 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) // we have both orig and clone in selection, relink // std::cout << id << " old, its ori: " << orig->getId() << "; will relink:" << new_ids[i] << " to " << new_ids[j] << "\n"; SPObject *new_clone = doc->getObjectById(new_ids[i]); - new_clone->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); + new_clone->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); new_clone->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } @@ -528,7 +528,7 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) gchar *source_href = offset->sourceHref; for (guint j = 0; j < old_ids.size(); j++) { if (source_href && source_href[0]=='#' && !strcmp(source_href+1, old_ids[j])) { - doc->getObjectById(new_ids[i])->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); + doc->getObjectById(new_ids[i])->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); } } } else if (text) { @@ -537,7 +537,7 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) const gchar *source_href = sp_textpath_get_path_item(textpath)->getId(); for (guint j = 0; j < old_ids.size(); j++) { if (!strcmp(source_href, old_ids[j])) { - doc->getObjectById(new_ids[i])->firstChild()->getRepr()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); + doc->getObjectById(new_ids[i])->firstChild()->setAttribute("xlink:href", Glib::ustring("#") + new_ids[j]); } } } else if (path) { @@ -547,10 +547,10 @@ void ObjectSet::duplicate(bool suppressDone, bool duplicateLayer) SPObject *new_clone = doc->getObjectById(new_ids[i]); for (guint j = 0; j < old_ids.size(); j++) { if(old_start == Glib::ustring("#") + old_ids[j]) { - new_clone->getRepr()->setAttribute("inkscape:connection-start", Glib::ustring("#") + new_ids[j]); + new_clone->setAttribute("inkscape:connection-start", Glib::ustring("#") + new_ids[j]); } if(old_end == Glib::ustring("#") + old_ids[j]) { - new_clone->getRepr()->setAttribute("inkscape:connection-end", Glib::ustring("#") + new_ids[j]); + new_clone->setAttribute("inkscape:connection-end", Glib::ustring("#") + new_ids[j]); } } } @@ -2666,7 +2666,7 @@ void ObjectSet::relink() SPItem *item = *i; if (dynamic_cast<SPUse *>(item)) { - item->getRepr()->setAttribute("xlink:href", newref); + item->setAttribute("xlink:href", newref); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); relinked = true; } @@ -4150,7 +4150,7 @@ void ObjectSet::unsetMask(const bool apply_clip_path, const bool skip_undo) { } } - (*i)->getRepr()->setAttribute(attributeName, "none"); + (*i)->setAttribute(attributeName, "none"); SPGroup *group = dynamic_cast<SPGroup *>(*i); if (ungroup_masked && group) { diff --git a/src/style.cpp b/src/style.cpp index 17ad85dc3..2d82791af 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -686,7 +686,7 @@ SPStyle::readIfUnset(SPAttributeEnum id, gchar const *val, SPStyleSrc const &sou //XML Tree being directly used here. if (object) { - object->getRepr()->setAttribute("clip-path", val); + object->setAttribute("clip-path", val); } return; case SP_PROP_MASK: @@ -697,7 +697,7 @@ SPStyle::readIfUnset(SPAttributeEnum id, gchar const *val, SPStyleSrc const &sou //XML Tree being directly used here. if (object) { - object->getRepr()->setAttribute("mask", val); + object->setAttribute("mask", val); } return; case SP_PROP_FILTER: diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 802f10a3f..aacc686da 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -136,7 +136,7 @@ text_put_on_path() // remove transform from text, but recursively scale text's fontsize by the expansion SP_TEXT(text)->_adjustFontsizeRecursive (text, text->transform.descrim()); - text->getRepr()->setAttribute("transform", nullptr); + text->setAttribute("transform", nullptr); // make a list of text children std::vector<Inkscape::XML::Node *> text_reprs; @@ -173,8 +173,8 @@ text_put_on_path() } // x/y are useless with textpath, and confuse Batik 1.5 - text->getRepr()->setAttribute("x", nullptr); - text->getRepr()->setAttribute("y", nullptr); + text->setAttribute("x", nullptr); + text->setAttribute("y", nullptr); DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Put text on path")); @@ -219,9 +219,9 @@ text_remove_from_path() static void text_remove_all_kerns_recursively(SPObject *o) { - o->getRepr()->setAttribute("dx", nullptr); - o->getRepr()->setAttribute("dy", nullptr); - o->getRepr()->setAttribute("rotate", nullptr); + o->setAttribute("dx", nullptr); + o->setAttribute("dy", nullptr); + o->setAttribute("rotate", nullptr); // if x contains a list, leave only the first value gchar const *x = o->getRepr()->attribute("x"); @@ -229,9 +229,9 @@ text_remove_all_kerns_recursively(SPObject *o) gchar **xa_space = g_strsplit(x, " ", 0); gchar **xa_comma = g_strsplit(x, ",", 0); if (xa_space && *xa_space && *(xa_space + 1)) { - o->getRepr()->setAttribute("x", *xa_space); + o->setAttribute("x", *xa_space); } else if (xa_comma && *xa_comma && *(xa_comma + 1)) { - o->getRepr()->setAttribute("x", *xa_comma); + o->setAttribute("x", *xa_comma); } g_strfreev(xa_space); g_strfreev(xa_comma); @@ -338,7 +338,7 @@ text_flow_into_shape() // remove transform from text, but recursively scale text's fontsize by the expansion auto ex = i2i_affine(text, shape->parent).descrim(); SP_TEXT(text)->_adjustFontsizeRecursive(text, ex); - text->getRepr()->setAttribute("transform", nullptr); + text->setAttribute("transform", nullptr); } Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 2ccab0492..92ae94272 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1396,7 +1396,7 @@ static void overwrite_style_with_string(SPObject *item, gchar const *style_strin style.mergeString(item_style_string); } Glib::ustring new_style_string = style.write(); - item->getRepr()->setAttribute("style", new_style_string.empty() ? nullptr : new_style_string.c_str()); + item->setAttribute("style", new_style_string.empty() ? nullptr : new_style_string.c_str()); } // Move to style.h? diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 6259c822c..23f0acb9f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1116,7 +1116,7 @@ private: SPFilterPrimitive* prim = _dialog._primitive_list.get_selected(); if(prim) { - _funcNode->getRepr()->setAttribute( "type", _type.get_as_attribute().c_str() ); + _funcNode->setAttribute( "type", _type.get_as_attribute() ); SPFilter* filter = _dialog._filter_modifier.get_selected_filter(); filter->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -2494,20 +2494,20 @@ static void check_single_connection(SPFilterPrimitive* prim, const int result) { if (prim && (result >= 0)) { if (prim->image_in == result) { - prim->getRepr()->setAttribute("in", nullptr); + prim->setAttribute("in", nullptr); } if (SP_IS_FEBLEND(prim)) { if (SP_FEBLEND(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", nullptr); + prim->setAttribute("in2", nullptr); } } else if (SP_IS_FECOMPOSITE(prim)) { if (SP_FECOMPOSITE(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", nullptr); + prim->setAttribute("in2", nullptr); } } else if (SP_IS_FEDISPLACEMENTMAP(prim)) { if (SP_FEDISPLACEMENTMAP(prim)->in2 == result) { - prim->getRepr()->setAttribute("in2", nullptr); + prim->setAttribute("in2", nullptr); } } } @@ -2990,7 +2990,7 @@ void FilterEffectsDialog::set_filternode_attr(const AttrWidget* input) SPFilter *filter = _filter_modifier.get_selected_filter(); const gchar* name = (const gchar*)sp_attribute_name(input->get_attribute()); if (filter && name && filter->getRepr()){ - filter->getRepr()->setAttribute(name, input->get_as_attribute().c_str()); + filter->setAttribute(name, input->get_as_attribute()); filter->requestModified(SP_OBJECT_MODIFIED_FLAG); } _attr_lock = false; @@ -3012,7 +3012,7 @@ void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, cons if(filter && name && o) { update_settings_sensitivity(); - o->getRepr()->setAttribute(name, val); + o->setAttribute(name, val); filter->requestModified(SP_OBJECT_MODIFIED_FLAG); Glib::ustring undokey = "filtereffects:"; diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 402ccd46d..8c43befd7 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -496,7 +496,7 @@ bool Find::item_id_match (SPItem *item, const gchar *id, bool exact, bool casema gchar * replace_text = g_strdup(entry_replace.getEntry()->get_text().c_str()); Glib::ustring new_item_style = find_replace(item_id, id, replace_text , exact, casematch, true); if (new_item_style != item_id) { - item->getRepr()->setAttribute("id", new_item_style.data()); + item->setAttribute("id", new_item_style.data()); } g_free(replace_text); } @@ -521,7 +521,7 @@ bool Find::item_style_match (SPItem *item, const gchar *text, bool exact, bool c gchar * replace_text = g_strdup(entry_replace.getEntry()->get_text().c_str()); Glib::ustring new_item_style = find_replace(item_style, text, replace_text , exact, casematch, true); if (new_item_style != item_style) { - item->getRepr()->setAttribute("style", new_item_style.data()); + item->setAttribute("style", new_item_style.data()); } g_free(replace_text); } @@ -575,7 +575,7 @@ bool Find::item_attrvalue_match(SPItem *item, const gchar *text, bool exact, boo gchar * replace_text = g_strdup(entry_replace.getEntry()->get_text().c_str()); Glib::ustring new_item_style = find_replace(attr_value, text, replace_text , exact, casematch, true); if (new_item_style != attr_value) { - item->getRepr()->setAttribute(key, new_item_style.data()); + item->setAttribute(key, new_item_style.data()); } } @@ -634,7 +634,7 @@ bool Find::item_font_match(SPItem *item, const gchar *text, bool exact, bool cas new_item_style.append(vStyleToken).append(";"); } new_item_style.erase(new_item_style.size()-1); - item->getRepr()->setAttribute("style", new_item_style.data()); + item->setAttribute("style", new_item_style.data()); } return ret; diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 8767a109f..8eea0895f 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -468,8 +468,8 @@ LivePathEffectEditor::onAdd() SPItem *new_item = sel->singleItem(); // Check that the cloning was successful. We don't want to change the ID of the original referenced path! if (new_item && (new_item != orig)) { - new_item->getRepr()->setAttribute("id", id); - new_item->getRepr()->setAttribute("transform", transform); + new_item->setAttribute("id", id); + new_item->setAttribute("transform", transform); } g_free(id); g_free(transform); diff --git a/src/ui/dialog/selectordialog.cpp b/src/ui/dialog/selectordialog.cpp index fefd23e51..e99f35df2 100644 --- a/src/ui/dialog/selectordialog.cpp +++ b/src/ui/dialog/selectordialog.cpp @@ -750,7 +750,7 @@ void SelectorDialog::_removeFromSelector(Gtk::TreeModel::Row row) classAttr.erase(i, 1); } _store->erase(row); - objVec[0]->getRepr()->setAttribute("class", classAttr); + objVec[0]->setAttribute("class", classAttr); parent[_mColumns._colExpand] = true; } else { // Do nothing for element selectors. @@ -823,7 +823,7 @@ void SelectorDialog::_insertClass(const std::vector<SPObject *>& objVec, const G if (!obj->getRepr()->attribute("class")) { // 'class' attribute does not exist, create it. - obj->getRepr()->setAttribute("class", className); + obj->setAttribute("class", className); } else { // 'class' attribute exists, append. Glib::ustring classAttr = obj->getRepr()->attribute("class"); @@ -838,7 +838,7 @@ void SelectorDialog::_insertClass(const std::vector<SPObject *>& objVec, const G } } if (add) { - obj->getRepr()->setAttribute("class", classAttr + " " + className ); + obj->setAttribute("class", classAttr + " " + className ); } } } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 2d9331818..ad6bc25a4 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -137,7 +137,7 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ const gchar* name = (const gchar*)sp_attribute_name(this->attr); if(name && o) { - o->getRepr()->setAttribute((const gchar*) name, this->entry.get_text().c_str()); + o->setAttribute((const gchar*) name, this->entry.get_text()); o->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); Glib::ustring undokey = "svgfonts:"; @@ -209,7 +209,7 @@ void SvgFontsDialog::AttrSpin::on_attr_changed(){ if(name && o) { std::ostringstream temp; temp << this->spin.get_value(); - o->getRepr()->setAttribute((const gchar*) name, temp.str().c_str() ); + o->setAttribute((const gchar*) name, temp.str() ); o->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); Glib::ustring undokey = "svgfonts:"; @@ -269,7 +269,7 @@ void SvgFontsDialog::on_kerning_value_changed(){ //slider values increase from right to left so that they match the kerning pair preview //XML Tree being directly used here while it shouldn't be. - this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider->get_value()).c_str()); + this->kerning_pair->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider->get_value())); DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); //populate_kerning_pairs_box(); @@ -626,7 +626,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ //XML Tree being directly used here while it shouldn't be. gchar *str = sp_svg_write_path (flip_coordinate_system(pathv)); - glyph->getRepr()->setAttribute("d", str); + glyph->setAttribute("d", str); g_free(str); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); @@ -664,7 +664,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ //XML Tree being directly used here while it shouldn't be. gchar *str = sp_svg_write_path (flip_coordinate_system(pathv)); - obj.getRepr()->setAttribute("d", str); + obj.setAttribute("d", str); g_free(str); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } @@ -684,7 +684,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ for (auto& obj: get_selected_spfont()->children) { if (SP_IS_MISSING_GLYPH(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj.getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); + obj.setAttribute("d", "M0,0h1000v1024h-1000z"); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); } } @@ -698,7 +698,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; //XML Tree being directly used here while it shouldn't be. - glyph->getRepr()->setAttribute("glyph-name", str.c_str()); + glyph->setAttribute("glyph-name", str); SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); @@ -712,7 +712,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; //XML Tree being directly used here while it shouldn't be. - glyph->getRepr()->setAttribute("unicode", str.c_str()); + glyph->setAttribute("unicode", str); SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); @@ -730,7 +730,7 @@ void SvgFontsDialog::glyph_advance_edit(const Glib::ustring&, const Glib::ustrin double value; // Check if input valid if ((is >> value)) { - glyph->getRepr()->setAttribute("horiz-adv-x", str.c_str()); + glyph->setAttribute("horiz-adv-x", str); SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph advance")); @@ -966,7 +966,7 @@ void set_font_family(SPFont* font, char* str){ for (auto& obj: font->children) { if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj.getRepr()->setAttribute("font-family", str); + obj.setAttribute("font-family", str); } } @@ -986,7 +986,7 @@ void SvgFontsDialog::add_font(){ for (auto& obj: font->children) { if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj.getRepr()->setAttribute("font-family", os2.str().c_str()); + obj.setAttribute("font-family", os2.str()); } } diff --git a/src/ui/toolbar/rect-toolbar.cpp b/src/ui/toolbar/rect-toolbar.cpp index 44a53c8fc..bfcc14e47 100644 --- a/src/ui/toolbar/rect-toolbar.cpp +++ b/src/ui/toolbar/rect-toolbar.cpp @@ -232,7 +232,7 @@ RectToolbar::value_changed(Glib::RefPtr<Gtk::Adjustment>& adj, if (adj->get_value() != 0) { (SP_RECT(*i)->*setter)(Quantity::convert(adj->get_value(), unit, "px")); } else { - (*i)->getRepr()->setAttribute(value_name, nullptr); + (*i)->setAttribute(value_name, nullptr); } modmade = true; } diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 42e3520a0..1cb757bfd 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -616,9 +616,9 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P } else { SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item); if (lpeitem && lpeitem->hasPathEffectRecursive()) { - item->getRepr()->setAttribute("inkscape:original-d", str); + item->setAttribute("inkscape:original-d", str); } else { - item->getRepr()->setAttribute("d", str); + item->setAttribute("d", str); } } g_free(str); diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index c0e260e5e..cb4eb7a87 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -734,7 +734,7 @@ static void sp_grd_ed_add_stop(GtkWidget */*widget*/, GtkWidget *vb) sp_svg_write_color(c, sizeof(c), cnew); gdouble opacity = static_cast<gdouble>(SP_RGBA32_A_F(cnew)); os << "stop-color:" << c << ";stop-opacity:" << opacity <<";"; - newstop->getRepr()->setAttribute("style", os.str().c_str()); + newstop->setAttribute("style", os.str().c_str()); sp_repr_set_css_double( newstop->getRepr(), "offset", (double)newstop->offset); sp_gradient_vector_widget_load_gradient(vb, gradient); @@ -1097,7 +1097,7 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien if (gradient->getRepr()->attribute("inkscape:collect")) { SPDocument *document = gradient->document; DocumentUndo::ScopedInsensitive _no_undo(document); - gradient->getRepr()->setAttribute("inkscape:collect", nullptr); + gradient->setAttribute("inkscape:collect", nullptr); } } else { // no gradient, disable everything gtk_widget_set_sensitive(widget, FALSE); @@ -1279,9 +1279,9 @@ static void sp_gradient_vector_color_changed(Inkscape::UI::SelectedColor *select sp_repr_set_css_double(stop->getRepr(), "offset", stop->offset); Inkscape::CSSOStringStream os; os << "stop-color:" << color.toString() << ";stop-opacity:" << static_cast<gdouble>(alpha) <<";"; - stop->getRepr()->setAttribute("style", os.str().c_str()); + stop->setAttribute("style", os.str()); // g_snprintf(c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, static_cast<gdouble>(alpha)); - //stop->getRepr()->setAttribute("style", c); + //stop->setAttribute("style", c); DocumentUndo::done(ngr->document, SP_VERB_CONTEXT_GRADIENT, _("Change gradient stop color")); diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index ba1b8035d..aeead1c08 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -98,7 +98,7 @@ void SwatchSelector::_changedCb() gchar c[64]; sp_svg_write_color(c, sizeof(c), rgb); os << "stop-color:" << c << ";stop-opacity:" << static_cast<gdouble>(alpha) <<";"; - stop->getRepr()->setAttribute("style", os.str().c_str()); + stop->setAttribute("style", os.str()); DocumentUndo::done(ngr->document, SP_VERB_CONTEXT_GRADIENT, _("Change swatch color")); |
