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 | |
| parent | Fix coding style (diff) | |
| download | inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.tar.gz inkscape-9eb6b6234c39e1b1539ba78a68f01b620dc9c011.zip | |
Adding styles default
Diffstat (limited to 'src')
| -rw-r--r-- | src/inkscape.cpp | 3 | ||||
| -rw-r--r-- | src/inkscape.h | 2 | ||||
| -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 |
6 files changed, 37 insertions, 31 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 6871cf467..7593c0666 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -365,7 +365,7 @@ void Application::autosave_init() } } -void Application::set_higlightcolors(gchar *&colornamedsuccess, gchar *&colornamedwarning, *&gchar colornamederror) +void Application::set_higlightcolors(gchar *colornamedsuccess, gchar *colornamedwarning, gchar *colornamederror); { int colorsetsuccess = 0x4AD589ff; int colorsetwarning = 0xF57900ff; @@ -479,6 +479,7 @@ Application::add_gtk_css() if (!prefs->getBool("/theme/symbolicIconsDefaultColor", true)) { gchar colornamed[64]; gchar colornamed_inverse[64]; + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror); int colorset = 0x2E3436ff; colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset); diff --git a/src/inkscape.h b/src/inkscape.h index 583f8a599..3e70c0fc3 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -139,7 +139,7 @@ public: void selection_changed (Inkscape::Selection * selection); void subselection_changed (SPDesktop *desktop); void selection_set (Inkscape::Selection * selection); - void set_higlightcolors(gchar *&colornamedsuccess, gchar *&colornamedwarning, gchar *&colornamederror); + void set_higlightcolors(gchar *colornamedsuccess, gchar *colornamedwarning, gchar *colornamederror); void eventcontext_set (Inkscape::UI::Tools::ToolBase * eventcontext); // Moved document add/remove functions into public inkscape.h as they are used 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); |
