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 | |
| parent | Fix coding style (diff) | |
| download | inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.tar.gz inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.zip | |
Adding styles default
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.cpp | 32 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 29 | ||||
| -rw-r--r-- | src/ui/icon-loader.cpp | 1 |
4 files changed, 34 insertions, 29 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 826ecd316..b02e60bbe 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -705,6 +705,7 @@ void InkscapePreferences::symbolicCustomColors() if (prefs->getBool("/theme/symbolicIcons", false)) { gchar colornamed[64]; gchar colornamed_inverse[64]; + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); INKSCAPE.set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror); int colorset = 0x2E3436ff; colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset); diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index 657fc8518..79b043520 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -479,37 +479,39 @@ SelectorsDialog::~SelectorsDialog() Inkscape::XML::Node *SelectorsDialog::_getStyleTextNode() { g_debug("SelectorsDialog::_getStyleTextNode"); + Inkscape::XML::Node *styleNode = nullptr; 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 << "SelectorsDialog::_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); } } if (styleNode == nullptr) { // Style element not found, create one styleNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createElement("svg:style"); - textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); + textNode = SP_ACTIVE_DOCUMENT->getReprDoc()->createTextNode(""); root->addChild(styleNode, nullptr); Inkscape::GC::release(styleNode); 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); } } diff --git a/src/ui/icon-loader.cpp b/src/ui/icon-loader.cpp index fff312d31..e4168ceeb 100644 --- a/src/ui/icon-loader.cpp +++ b/src/ui/icon-loader.cpp @@ -73,6 +73,7 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) gchar colornamedsuccess[64]; gchar colornamedwarning[64]; gchar colornamederror[64]; + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); INKSCAPE.set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror); int colorset = 0x2E3436ff; colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset); |
