diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-11-06 22:38:59 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-11-06 22:38:59 +0000 |
| commit | fe2ff1decd47e6ba50e71b3a4b50fdc6f6f6326a (patch) | |
| tree | 09e46febf010d01b3cb44896d3f71517f50b6659 | |
| parent | Remove delete that is causing crash. (diff) | |
| download | inkscape-fe2ff1decd47e6ba50e71b3a4b50fdc6f6f6326a.tar.gz inkscape-fe2ff1decd47e6ba50e71b3a4b50fdc6f6f6326a.zip | |
Fix icon loader to allow inverse color in symbolic icons. Also added searching.svg for loading symbols
| -rw-r--r-- | share/icons/hicolor/scalable/actions/searching.svg | 2 | ||||
| -rw-r--r-- | share/icons/hicolor/symbolic/actions/searching-symbolic.svg | 21 | ||||
| -rw-r--r-- | src/helper/icon-loader.cpp | 48 | ||||
| -rw-r--r-- | src/helper/icon-loader.h | 19 | ||||
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 12 |
5 files changed, 66 insertions, 36 deletions
diff --git a/share/icons/hicolor/scalable/actions/searching.svg b/share/icons/hicolor/scalable/actions/searching.svg index 0bc5b57bc..c2e2e08b3 100644 --- a/share/icons/hicolor/scalable/actions/searching.svg +++ b/share/icons/hicolor/scalable/actions/searching.svg @@ -63,7 +63,7 @@ <path d="m 6.914463,1.41365 c -3.005658,0 -5.451776,2.43867 -5.451776,5.43532 0,2.99666 2.446078,5.43538 5.451776,5.43538 1.310212,0 2.513927,-0.46362 3.45522,-1.23458 l 3.547304,3.53658 0.620326,-0.61845 -3.536404,-3.52572 c 0.849092,-0.95867 1.365268,-2.21699 1.365268,-3.59321 0,-2.99665 -2.44605,-5.43532 -5.451714,-5.43532 z m 0,0.87467 c 2.531574,0 4.574468,2.03669 4.574468,4.56065 0,2.52399 -2.042905,4.56073 -4.574468,4.56073 -2.531597,0 -4.574466,-2.03674 -4.574466,-4.56073 0,-2.52396 2.042869,-4.56071 4.574466,-4.56071 z" id="path10677" - style="color:#000000;fill:#e7e7e7;stroke:none;" + style="color:#000000;fill:#333333;stroke:none;" /> <rect height="16" diff --git a/share/icons/hicolor/symbolic/actions/searching-symbolic.svg b/share/icons/hicolor/symbolic/actions/searching-symbolic.svg new file mode 100644 index 000000000..8fb9a9499 --- /dev/null +++ b/share/icons/hicolor/symbolic/actions/searching-symbolic.svg @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Created with Inkscape (http://www.inkscape.org/) and export_objects.py --> +<svg xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg1" width="16" height="16" viewBox="0 0 16 16" sodipodi:docname="selection-top-symbolic.svg"><sodipodi:namedview objecttolerance="10" gridtolerance="10" guidetolerance="10" id="namedview" showgrid="true" inkscape:zoom="0.6002936" inkscape:cx="732.67439" inkscape:cy="-567.94603" inkscape:window-width="1920" inkscape:window-height="1016" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" inkscape:current-layer="layer1"> + <inkscape:grid type="xygrid" id="grid"/> + </sodipodi:namedview> + <g + id="searching"> + <path + d="m 6.914463,1.41365 c -3.005658,0 -5.451776,2.43867 -5.451776,5.43532 0,2.99666 2.446078,5.43538 5.451776,5.43538 1.310212,0 2.513927,-0.46362 3.45522,-1.23458 l 3.547304,3.53658 0.620326,-0.61845 -3.536404,-3.52572 c 0.849092,-0.95867 1.365268,-2.21699 1.365268,-3.59321 0,-2.99665 -2.44605,-5.43532 -5.451714,-5.43532 z m 0,0.87467 c 2.531574,0 4.574468,2.03669 4.574468,4.56065 0,2.52399 -2.042905,4.56073 -4.574468,4.56073 -2.531597,0 -4.574466,-2.03674 -4.574466,-4.56073 0,-2.52396 2.042869,-4.56071 4.574466,-4.56071 z" + id="path10677" + style="opacity:1" + /> + <rect + height="16" + id="rect9056-0" + style="opacity:0;fill:none" + width="16" + x="0" + y="0" /> + </g> +</svg> diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp index 5e33cd920..25c6eb32b 100644 --- a/src/helper/icon-loader.cpp +++ b/src/helper/icon-loader.cpp @@ -19,7 +19,7 @@ #include <gtkmm/icontheme.h> #include <gtkmm/toolitem.h> -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size, bool negative) { using namespace Inkscape::IO::Resource; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -34,7 +34,12 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) try { if (prefs->getBool("/theme/symbolicIcons", false)) { gchar colornamed[64]; - sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); + int colorset = prefs->getInt("/theme/symbolicColor", 0x000000ff); + // Use in case the special widgets have inverse theme background and symbolic + if (negative) { + colorset = colorset ^ 0xffffff00; + } + sp_svg_write_color(colornamed, sizeof(colornamed), colorset); Gdk::RGBA color; color.set(colornamed); Gtk::IconInfo iconinfo = @@ -58,61 +63,63 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) return _icon_pixbuf; } -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size) +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size, bool negative) { int width, height; Gtk::IconSize::lookup(Gtk::IconSize(icon_size), width, height); - return sp_get_icon_pixbuf(icon_name, width); + return sp_get_icon_pixbuf(icon_name, width, negative); } -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size) +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size, bool negative) { gint width, height; gtk_icon_size_lookup(icon_size, &width, &height); - return sp_get_icon_pixbuf(icon_name, width); + return sp_get_icon_pixbuf(icon_name, width, negative); } -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gchar const *prefs_size) +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gchar const *prefs_size, bool negative) { // Load icon based in preference size defined allowed values are: //"/toolbox/tools/small" Toolbox icon size //"/toolbox/small" Control bar icon size //"/toolbox/secondary" Secondary toolbar icon size GtkIconSize icon_size = Inkscape::UI::ToolboxFactory::prefToSize(prefs_size); - return sp_get_icon_pixbuf(icon_name, icon_size); + return sp_get_icon_pixbuf(icon_name, icon_size, negative); } -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gint size) +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gint size, bool negative) { - auto icon = sp_get_icon_pixbuf(icon_name, size); + auto icon = sp_get_icon_pixbuf(icon_name, size, negative); Gtk::Image *image = new Gtk::Image(icon); return image; } -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size) +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size, bool negative) { - auto icon = sp_get_icon_pixbuf(icon_name, icon_size); + auto icon = sp_get_icon_pixbuf(icon_name, icon_size, negative); Gtk::Image *image = new Gtk::Image(icon); return image; } -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size) +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size, bool negative) { - auto icon = sp_get_icon_pixbuf(icon_name, icon_size); + auto icon = sp_get_icon_pixbuf(icon_name, icon_size, negative); Gtk::Image *image = new Gtk::Image(icon); return image; } -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size, bool negative) { - auto icon = sp_get_icon_pixbuf(icon_name, prefs_size); + auto icon = sp_get_icon_pixbuf(icon_name, prefs_size, negative); Gtk::Image *image = new Gtk::Image(icon); return image; } std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, Glib::ustring icon_name, - Glib::ustring label, Glib::ustring tooltip) + Glib::ustring label, + Glib::ustring tooltip, + bool negative) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/theme/symbolicIcons", false)) { @@ -124,7 +131,12 @@ std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA> sp_set_radioaction_icon(Gtk Gtk::ToolItem *item = action->create_tool_item(); Gdk::RGBA color; gchar colornamed[64]; - sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); + int colorset = prefs->getInt("/theme/symbolicColor", 0x000000ff); + // Use in case the special widgets have inverse theme background and symbolic + if (negative) { + colorset = colorset ^ 0xffffff00; + } + sp_svg_write_color(colornamed, sizeof(colornamed), colorset); color.set(colornamed); return std::make_pair(action, color); } diff --git a/src/helper/icon-loader.h b/src/helper/icon-loader.h index 02b748163..38a41fcfb 100644 --- a/src/helper/icon-loader.h +++ b/src/helper/icon-loader.h @@ -15,16 +15,17 @@ #include <gtkmm/image.h> #include <gtkmm/radioaction.h> -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size); -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size); -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size); -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gchar const *prefs_sice); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gint size); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_sice); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_sice); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_sice); +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size, bool negative = false); +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size, bool negative = false); +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size, bool negative = false); +Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gchar const *prefs_sice, bool negative = false); +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gint size, bool negative = false); +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size, bool negative = false); +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size, bool negative = false); +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_sice, bool negative = false); std::pair<Glib::RefPtr<Gtk::RadioAction>, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, Glib::ustring icon_name, Glib::ustring label, - Glib::ustring tooltip); + Glib::ustring tooltip, + bool negative = false); #endif // SEEN_INK_STOCK_ITEMS_H diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 0b70ee4bb..ce1e4863b 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -221,11 +221,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : overlay_opacity->set_halign(Gtk::ALIGN_START ); overlay_opacity->set_valign(Gtk::ALIGN_START ); //No results - iconsize = Gtk::IconSize().from_name(Glib::ustring("ICON_SIZE_DIALOG_EXTRA")); - if (!iconsize) { - iconsize = Gtk::IconSize().register_new(Glib::ustring("ICON_SIZE_DIALOG_EXTRA"), 110, 110); - } - overlay_icon = new Gtk::Image(); + overlay_icon = sp_get_icon_image("searching", 110, true); overlay_icon->set_halign(Gtk::ALIGN_CENTER ); overlay_icon->set_valign(Gtk::ALIGN_START ); overlay_icon->set_margin_top(45); @@ -466,11 +462,11 @@ void SymbolsDialog::rebuild() { void SymbolsDialog::showOverlay() { #if GTKMM_CHECK_VERSION(3,14,0) Glib::ustring current = Glib::Markup::escape_text(symbol_set->get_active_text()); - overlay_icon = sp_get_icon_image("none", iconsize); if (current == ALLDOCS && !l.size()) { + overlay_icon->hide(); if (!all_docs_processed ) { - overlay_icon = sp_get_icon_image("searching", iconsize); + overlay_icon->show(); overlay_title->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"large\">") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("</span>")); overlay_desc->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"small\">") + @@ -479,7 +475,7 @@ void SymbolsDialog::showOverlay() { overlay_title->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"large\">") + Glib::ustring(_("No results found")) + Glib::ustring("</span>")); overlay_desc->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"small\">") + Glib::ustring(_("Try a different search term.")) + Glib::ustring("</span>")); } else { - overlay_icon = sp_get_icon_image("searching", iconsize); + overlay_icon->show(); overlay_title->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"large\">") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("</span>")); overlay_desc->set_markup(Glib::ustring("<span foreground=\"#333333\" size=\"small\">") + |
