diff options
Diffstat (limited to 'src')
| -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 |
3 files changed, 44 insertions, 35 deletions
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\">") + |
