diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2019-05-23 08:06:12 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2019-06-06 12:57:27 +0000 |
| commit | cb8c36249e983866378e7915e6605ef92d247923 (patch) | |
| tree | 53ec0a0745250375aaeb4b5a52f821380ccb614a /src/object/sp-lpe-item.cpp | |
| parent | CI: Avoid failure due to sorting issue (diff) | |
| download | inkscape-cb8c36249e983866378e7915e6605ef92d247923.tar.gz inkscape-cb8c36249e983866378e7915e6605ef92d247923.zip | |
Refactoring: call setAttribute() directly.
Call this->setAttribute(...) directly instead of
this->getRepr()->setAttribute(...). This avoids clutter and mental indirection.
See
http://wiki.inkscape.org/wiki/index.php?title=Refactoring_projects&oldid=112116
and https://en.wikipedia.org/wiki/Law_of_Demeter .
---
I hereby disclaim any implicit or explicit ownership of my changes in this
changeset, and put them under a multiple licence consisting of your choice of
one of more of:
- The CC0 / Public Domain - https://creativecommons.org/choose/zero/ .
- The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License
- The default licence of your project
- The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version
2.1 or higher
- The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or
higher
- Any licence in the 2018-Aug-27 popular licenses list of
https://opensource.org/licenses
- The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later
- The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later
- The https://en.wikipedia.org/wiki/ISC_license
- The https://opensource.org/licenses/BSD-2-Clause
Crediting me will be nice, but not mandatory, and you can change the licence
of the project without needing my permission.
Diffstat (limited to 'src/object/sp-lpe-item.cpp')
| -rwxr-xr-x | src/object/sp-lpe-item.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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)); } /** |
