diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-06-18 21:04:05 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-07-08 21:01:34 +0000 |
| commit | 9eb6b6234c39e1b1539ba78a68f01b620dc9c011 (patch) | |
| tree | ac54317141dae6589534ce697726518a632e0b48 /src/ui/dialog/styledialog.cpp | |
| parent | Fix coding style (diff) | |
| download | inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.tar.gz inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.zip | |
Adding styles default
Diffstat (limited to 'src/ui/dialog/styledialog.cpp')
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index e2263f559..34f4276eb 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -266,26 +266,27 @@ Inkscape::XML::Node *StyleDialog::_getStyleTextNode() Inkscape::XML::Node *textNode = nullptr; Inkscape::XML::Node *root = SP_ACTIVE_DOCUMENT->getReprRoot(); + bool first = false; for (unsigned i = 0; i < root->childCount(); ++i) { if (Glib::ustring(root->nthChild(i)->name()) == "svg:style") { - styleNode = root->nthChild(i); - - for (unsigned j = 0; j < styleNode->childCount(); ++j) { - if (styleNode->nthChild(j)->type() == Inkscape::XML::TEXT_NODE) { - textNode = styleNode->nthChild(j); + if (!first) { + for (unsigned j = 0; j < styleNode->childCount(); ++j) { + if (styleNode->nthChild(j)->type() == Inkscape::XML::TEXT_NODE) { + textNode = styleNode->nthChild(j); + } } - } - if (textNode == nullptr) { - // Style element found but does not contain text node! - std::cerr << "StyleDialog::_getStyleTextNode(): No text node!" << std::endl; - textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); - styleNode->appendChild(textNode); - Inkscape::GC::release(textNode); + if (textNode == nullptr) { + // Style element found but does not contain text node! + std::cerr << "StyleDialog::_getStyleTextNode(): No text node!" << std::endl; + textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); + styleNode->appendChild(textNode); + Inkscape::GC::release(textNode); + } + first = true; } - // TODO: handle imports - break; //read only first CSS element + styleNode->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } } |
