diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2017-02-06 16:50:07 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2017-02-06 16:50:07 +0000 |
| commit | 1232596134bcba8d19f2809ffdc84e3b5c33d3b3 (patch) | |
| tree | 2fcb91d6fe9ef47a85ba3f73be10dc5dc7ee10a4 /src/sp-object.cpp | |
| parent | Merged. (diff) | |
| parent | Remove some unneeded < C++11 fallback code (diff) | |
| download | inkscape-1232596134bcba8d19f2809ffdc84e3b5c33d3b3.tar.gz inkscape-1232596134bcba8d19f2809ffdc84e3b5c33d3b3.zip | |
Merged.
(bzr r15369.1.18)
Diffstat (limited to 'src/sp-object.cpp')
| -rw-r--r-- | src/sp-object.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 75f4657ef..7807703f6 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -775,6 +775,21 @@ void SPObject::appendChild(Inkscape::XML::Node *child) { repr->appendChild(child); } +SPObject* SPObject::nthChild(unsigned index) { + g_assert(this->repr); + if (hasChildren()) { + std::vector<SPObject*> l; + unsigned counter = 0; + for (auto& child: children) { + if (counter == index) { + return &child; + } + counter++; + } + } + return NULL; +} + void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev) { g_assert(this->repr); @@ -1046,7 +1061,9 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML } if (style) { - Glib::ustring s = style->write(SP_STYLE_FLAG_IFSET); + // Write if property set by style attribute in this object + Glib::ustring s = + style->write(SP_STYLE_FLAG_IFSET | SP_STYLE_FLAG_IFSRC, SP_STYLE_SRC_STYLE_PROP); // Check for valid attributes. This may be time consuming. // It is useful, though, for debugging Inkscape code. |
