diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2018-11-09 11:50:35 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2018-11-09 11:50:35 +0000 |
| commit | 2c34d8222d06d8922de07edcd5b85b1bf47cd38e (patch) | |
| tree | f64f8f5d9a0b9326f4c519e227e1bb24008c025f /src/helper | |
| parent | Fix compiling bug (diff) | |
| download | inkscape-2c34d8222d06d8922de07edcd5b85b1bf47cd38e.tar.gz inkscape-2c34d8222d06d8922de07edcd5b85b1bf47cd38e.zip | |
Move icon-loader and provide a temporary fallback to render pixbuf
Diffstat (limited to 'src/helper')
| -rw-r--r-- | src/helper/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/helper/action.cpp | 2 | ||||
| -rw-r--r-- | src/helper/icon-loader.cpp | 114 | ||||
| -rw-r--r-- | src/helper/icon-loader.h | 28 |
4 files changed, 1 insertions, 145 deletions
diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index f1a2e7105..992fd9763 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -18,7 +18,6 @@ set(helper_SRC geom-pathvectorsatellites.cpp geom-satellite.cpp gettext.cpp - icon-loader.cpp pixbuf-ops.cpp png-write.cpp stock-items.cpp @@ -40,7 +39,6 @@ set(helper_SRC geom-satellite.h geom.h gettext.h - icon-loader.h mathfns.h pixbuf-ops.h png-write.h diff --git a/src/helper/action.cpp b/src/helper/action.cpp index 7df15c9c1..81853e086 100644 --- a/src/helper/action.cpp +++ b/src/helper/action.cpp @@ -11,7 +11,7 @@ */ #include "helper/action.h" -#include "helper/icon-loader.h" +#include "ui/icon-loader.h" #include <gtkmm/toolbutton.h> diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp deleted file mode 100644 index c9bce778d..000000000 --- a/src/helper/icon-loader.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Icon Loader - * - * Icon Loader management code - * - * Authors: - * Jabiertxo Arraiza <jabier.arraiza@marker.es> - * - * Released under GNU GPL v2+, read the file 'COPYING' for more information. - */ - -#include "icon-loader.h" -#include "inkscape.h" -#include "io/resource.h" -#include "preferences.h" -#include "svg/svg-color.h" -#include "widgets/toolbox.h" -#include <gtkmm/iconinfo.h> -#include <gtkmm/icontheme.h> -#include <gtkmm/toolitem.h> - -void sp_load_theme() -{ - } - -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) -{ - - using namespace Inkscape::IO::Resource; - static auto icon_theme = Gtk::IconTheme::get_default(); - static bool icon_theme_set; - if (!icon_theme_set) { - icon_theme_set = true; - icon_theme->prepend_search_path(get_path_ustring(SYSTEM, ICONS)); - icon_theme->prepend_search_path(get_path_ustring(USER, ICONS)); - } - return icon_theme->load_icon(icon_name, size, Gtk::ICON_LOOKUP_FORCE_SIZE); -} - -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::IconSize icon_size) -{ - int width, height; - Gtk::IconSize::lookup(icon_size, width, height); - return sp_get_icon_pixbuf(icon_name, width); -} - -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size) -{ - int width, height; - Gtk::IconSize::lookup(Gtk::IconSize(icon_size), width, height); - return sp_get_icon_pixbuf(icon_name, width); -} - -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size) -{ - gint width, height; - gtk_icon_size_lookup(icon_size, &width, &height); - return sp_get_icon_pixbuf(icon_name, width); -} - -Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gchar const *prefs_size) -{ - // 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); -} - - -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size) -{ - - Gtk::Image *icon = new Gtk::Image(); - icon->set_from_icon_name(icon_name, Gtk::IconSize(icon_size)); - return icon; -} - -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::IconSize icon_size) -{ - - Gtk::Image *icon = new Gtk::Image(); - icon->set_from_icon_name(icon_name, icon_size); - return icon; -} - -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) -{ - - Gtk::IconSize icon_size = Inkscape::UI::ToolboxFactory::prefToSize_mm(prefs_size); - Gtk::Image *icon = new Gtk::Image(); - icon->set_from_icon_name(icon_name, icon_size); - return icon; -} - - -GtkWidget *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size) -{ - - return gtk_image_new_from_icon_name(icon_name.c_str(), icon_size); -} - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/helper/icon-loader.h b/src/helper/icon-loader.h deleted file mode 100644 index dd4b3a4ce..000000000 --- a/src/helper/icon-loader.h +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/** @file - * Icon Loader - *//* - * Authors: - * see git history - * Jabiertxo Arraiza <jabier.arraiza@marker.es> - * - * Copyright (C) 2018 Authors - * Released under GNU GPL v2+, read the file 'COPYING' for more information. - */ -#ifndef SEEN_INK_ICON_LOADER_H -#define SEEN_INK_ICON_LOADER_H - -#include <gdkmm/pixbuf.h> -#include <gtkmm/box.h> -#include <gtkmm/image.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, Gtk::IconSize 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, Gtk::BuiltinIconSize icon_size); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::IconSize icon_size); -Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_sice); -GtkWidget *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size); -#endif // SEEN_INK_STOCK_ITEMS_H |
