diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-06-20 14:31:53 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-07-08 21:04:15 +0000 |
| commit | 50d61f09eb5baf99a1d25060f09e892d72fc4df5 (patch) | |
| tree | 8b47e239b803f12d680565290cbd0936a662345b /src/inkscape.cpp | |
| parent | working wth colors for icons (diff) | |
| download | inkscape-50d61f09eb5baf99a1d25060f09e892d72fc4df5.tar.gz inkscape-50d61f09eb5baf99a1d25060f09e892d72fc4df5.zip | |
Add coloring default to theme
Diffstat (limited to 'src/inkscape.cpp')
| -rw-r--r-- | src/inkscape.cpp | 72 |
1 files changed, 6 insertions, 66 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c4e1f8dbe..418285c4c 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -503,11 +503,11 @@ Glib::ustring Application::get_symbolic_colors() gchar colornamed_inverse[64]; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); - int colorsetbase = 0x2E3436ff; - int colorsetbase_inverse = colorsetbase^ 0xffffff00; - int colorsetsuccess = 0x4AD589ff; - int colorsetwarning = 0xF57900ff; - int colorseterror = 0xcc0000ff; + guint32 colorsetbase = 0x2E3436ff; + guint32 colorsetbase_inverse = colorsetbase^ 0xffffff00; + guint32 colorsetsuccess = 0x4AD589ff; + guint32 colorsetwarning = 0xF57900ff; + guint32 colorseterror = 0xcc0000ff; colorsetbase = prefs->getInt("/theme/" + themeiconname + "/symbolicBaseColor", colorsetbase); sp_svg_write_color(colornamed, sizeof(colornamed), colorsetbase); colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", colorsetsuccess); @@ -538,66 +538,6 @@ Glib::ustring Application::get_symbolic_colors() return css_str; } -void Application::get_higlight_colors(int &colorsetbase, int &colorsetsuccess, int &colorsetwarning, int &colorseterror) -{ - using namespace Inkscape::IO::Resource; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); - if (themeiconname == prefs->getString("/theme/defaultIconTheme")) { - themeiconname = "hicolor"; - } - Glib::ustring higlight = get_filename(ICONS, Glib::ustring(themeiconname + "/highlights.css").c_str(), false, true); - if (!higlight.empty()) { - std::ifstream ifs(higlight); - std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); - Glib::ustring result; - size_t startpos = content.find(".base"); - size_t endpos = content.find("}"); - if (startpos != std::string::npos) { - result = content.substr(startpos, endpos - startpos); - startpos = result.find("fill:"); - endpos = result.find(";"); - result = content.substr(startpos + 5, endpos - (startpos + 5)); - Gdk::RGBA base_color = Gdk::RGBA(result); - SPColor base_color_sp(base_color.get_red(), base_color.get_green(), base_color.get_blue()); - colorsetbase = base_color_sp.toRGBA32(1); - } - startpos = content.find(".success"); - endpos = content.find("}"); - if (startpos != std::string::npos) { - result = content.substr(startpos, endpos - startpos); - startpos = result.find("fill:"); - endpos = result.find(";"); - result = content.substr(startpos + 5, endpos - (startpos + 5)); - Gdk::RGBA success_color = Gdk::RGBA(result); - SPColor success_color_sp(success_color.get_red(), success_color.get_green(), success_color.get_blue()); - colorsetsuccess = success_color_sp.toRGBA32(1); - } - startpos = content.find(".warning"); - endpos = content.find("}"); - if (startpos != std::string::npos) { - result = content.substr(startpos, endpos - startpos); - startpos = result.find("fill:"); - endpos = result.find(";"); - result = content.substr(startpos + 5, endpos - (startpos + 5)); - Gdk::RGBA warning_color = Gdk::RGBA(result); - SPColor warning_color_sp(warning_color.get_red(), warning_color.get_green(), warning_color.get_blue()); - colorsetwarning = warning_color_sp.toRGBA32(1); - } - startpos = content.find(".error"); - endpos = content.find("}"); - if (startpos != std::string::npos) { - result = content.substr(startpos, endpos - startpos); - startpos = result.find("fill:"); - endpos = result.find(";"); - result = content.substr(startpos + 5, endpos - (startpos + 5)); - Gdk::RGBA error_color = Gdk::RGBA(result); - SPColor error_color_sp(error_color.get_red(), error_color.get_green(), error_color.get_blue()); - colorseterror = error_color_sp.toRGBA32(1); - } - } -} - /** * \brief Add our CSS style sheets */ @@ -654,7 +594,7 @@ Application::add_gtk_css() } Glib::ustring css_str = ""; if (prefs->getBool("/theme/symbolicIcons", false)) { - if (!prefs->getBool("/theme/symbolicIconsDefaultColor", true)) { + if (!prefs->getBool("/theme/symbolicDefaultColors", true)) { css_str = get_symbolic_colors(); } } |
