diff --git a/share/icons/hicolor/scalable/actions/layers-symbolic.svg b/share/icons/hicolor/scalable/actions/dialog-layers-symbolic.svg similarity index 94% rename from share/icons/hicolor/scalable/actions/layers-symbolic.svg rename to share/icons/hicolor/scalable/actions/dialog-layers-symbolic.svg index 097edb92e723c468b5e1a9eae159c884d8a9d8d0..ceb0d5e2cfe0eafd65d66f8b13a620df34aa3087 100644 --- a/share/icons/hicolor/scalable/actions/layers-symbolic.svg +++ b/share/icons/hicolor/scalable/actions/dialog-layers-symbolic.svg @@ -3,7 +3,7 @@ - + diff --git a/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg b/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg index f346772db7f79720bcb37a199c0ccd6f02a80fe5..bb5cdf4b2fe30c04a2f11ae3c811480a84392d0b 100644 --- a/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg +++ b/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg @@ -3,12 +3,25 @@ - - - - - - - - - + + + + + + + diff --git a/src/desktop.cpp b/src/desktop.cpp index ad75a441d389965e2a50d3ecad5d6b049abedc19..7b72524ccc3be851bfa9cc67f26c557dedfbf3a8 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1570,6 +1570,16 @@ SPDesktop::onResized (double /*x*/, double /*y*/) // Nothing called here } +/** + * Redraw callback; queues Gtk redraw; connected by View. + */ +void SPDesktop::storeDesktopPosition() +{ + if (main) { + _widget->storeDesktopPosition(); + } +} + /** * Redraw callback; queues Gtk redraw; connected by View. */ diff --git a/src/desktop.h b/src/desktop.h index 01d0b06bfeaa416f725c7b6a79f04f3734bd6ffe..a1281a5b826c03d9221e59cfe2638a9cf4c5d8d1 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -384,6 +384,7 @@ public: bool isToolboxButtonActive (gchar const *id); void updateNow(); void updateCanvasNow(); + void storeDesktopPosition(); void enableInteraction(); void disableInteraction(); diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index bcd9f7c58a89aafd7a58224e0fc29380c2d76330..7b6b548b9f276abedcc0422eb043bc941c1db950 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -17,6 +17,7 @@ set(helper_SRC geom-pathvectorsatellites.cpp geom-satellite.cpp gettext.cpp + icon-loader.cpp pixbuf-ops.cpp png-write.cpp stock-items.cpp @@ -38,6 +39,7 @@ 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 6e44487f96e682468516d33226bcddf8c57a7ac8..6d14037f08f170d4ea7d579a2257b0c5ce8c1ee9 100644 --- a/src/helper/action.cpp +++ b/src/helper/action.cpp @@ -10,6 +10,7 @@ */ #include "helper/action.h" +#include "helper/icon-loader.h" #include @@ -236,8 +237,9 @@ SPAction::create_toolbutton_for_verb(unsigned int verb_code, auto icon_name = verb->get_image(); // Create a button with the required display properties - auto button = Gtk::manage(new Gtk::ToolButton(verb->get_name())); - button->set_icon_name(icon_name); + auto button = Gtk::manage(new Gtk::ToolButton(verb->get_tip())); + auto icon_widget = sp_get_icon_image(icon_name, "/toolbox/small"); + button->set_icon_widget(*icon_widget); button->set_tooltip_text(verb->get_tip()); // Hook up signal handler diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e514343a3e5833d5e0093564c4719fce8e52ddbb --- /dev/null +++ b/src/helper/icon-loader.cpp @@ -0,0 +1,152 @@ +/* + * Icon Loader + * + * Icon Loader management code + * + * Authors: + * Jabiertxo Arraiza + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "icon-loader.h" +#include "inkscape.h" +#include "io/resource.h" +#include "preferences.h" +#include "svg/svg-color.h" +#include "widgets/toolbox.h" +#include +#include +#include + +Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) +{ + using namespace Inkscape::IO::Resource; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getString("/theme/iconTheme") == "") { + prefs->setString("/theme/iconTheme", "hicolor"); + } + auto iconTheme = Gtk::IconTheme::create(); + iconTheme->set_custom_theme(prefs->getString("/theme/iconTheme")); + iconTheme->append_search_path(get_path_ustring(SYSTEM, ICONS)); + iconTheme->append_search_path(get_path_ustring(USER, ICONS)); +#ifdef INKSCAPE_THEMEDIR + iconTheme->append_search_path(get_path_ustring(SYSTEM, THEMES)); + iconTheme->append_search_path(get_path_ustring(USER, THEMES)); +#endif + Glib::RefPtr _icon_pixbuf; + try { + if (prefs->getBool("/theme/symbolicIcons", false)) { + gchar colornamed[64]; + if (icon_name == "gtk-preferences") { + icon_name = "preferences-system"; + } + sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); + Gdk::RGBA color; + color.set(colornamed); + Gtk::IconInfo iconinfo = + iconTheme->lookup_icon(icon_name + Glib::ustring("-symbolic"), size, Gtk::ICON_LOOKUP_FORCE_SIZE); + if (bool(iconinfo)) { + // TODO: view if we need parametrice other colors + bool was_symbolic = false; + _icon_pixbuf = iconinfo.load_symbolic(color, color, color, color, was_symbolic); + } + else { + _icon_pixbuf = iconTheme->load_icon(icon_name, size, Gtk::ICON_LOOKUP_FORCE_SIZE); + } + } + else { + _icon_pixbuf = iconTheme->load_icon(icon_name, size, Gtk::ICON_LOOKUP_FORCE_SIZE); + } + } + catch (const Gtk::IconThemeError &e) { + std::cout << "Icon Loader: " << e.what() << std::endl; + } + return _icon_pixbuf; +} + +Glib::RefPtr 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 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 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, gint size) +{ + auto icon = sp_get_icon_pixbuf(icon_name, size); + Gtk::Image *image = new Gtk::Image(icon); + return image; +} + +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size) +{ + auto icon = sp_get_icon_pixbuf(icon_name, icon_size); + Gtk::Image *image = new Gtk::Image(icon); + return image; +} + +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, GtkIconSize icon_size) +{ + auto icon = sp_get_icon_pixbuf(icon_name, icon_size); + Gtk::Image *image = new Gtk::Image(icon); + return image; +} + +Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) +{ + auto icon = sp_get_icon_pixbuf(icon_name, prefs_size); + Gtk::Image *image = new Gtk::Image(icon); + return image; +} + +std::pair, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, + Glib::ustring icon_name, + Glib::ustring label, Glib::ustring tooltip) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/theme/symbolicIcons", false)) { + icon_name = icon_name + Glib::ustring("-symbolic"); + } + + Glib::RefPtr action = + Gtk::RadioAction::create_with_icon_name(group, "Anonymous", icon_name.c_str(), label.c_str(), tooltip.c_str()); + 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)); + color.set(colornamed); + return std::make_pair(action, color); +} + +/* + 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 new file mode 100644 index 0000000000000000000000000000000000000000..02b748163103ea8f435a659d91320ad786e244c9 --- /dev/null +++ b/src/helper/icon-loader.h @@ -0,0 +1,30 @@ +#ifndef SEEN_INK_ICON_LOADER_H +#define SEEN_INK_ICON_LOADER_H + +/* + * Icon Loader + * + * + * Authors: + * Jabiertxo Arraiza + * + * + */ +#include +#include +#include +#include + +Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size); +Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, Gtk::BuiltinIconSize icon_size); +Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, GtkIconSize icon_size); +Glib::RefPtr 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); +std::pair, Gdk::RGBA> sp_set_radioaction_icon(Gtk::RadioAction::Group group, + Glib::ustring icon_name, + Glib::ustring label, + Glib::ustring tooltip); +#endif // SEEN_INK_STOCK_ITEMS_H diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 58d60d3b28f42a054c5e55de62b1a2cdb108eb11..9be03349461821f0aa1d0f99d5177535b5c178ac 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -46,14 +46,15 @@ #include "extension/system.h" #include "helper/action-context.h" #include "inkscape.h" -#include "io/sys.h" #include "io/resource.h" +#include "io/sys.h" #include "libnrtype/FontFactory.h" #include "message-stack.h" #include "path-prefix.h" #include "resource-manager.h" -#include "ui/tools/tool-base.h" +#include "svg/svg-color.h" #include "ui/dialog/debug.h" +#include "ui/tools/tool-base.h" /* Backbones of configuration xml data */ #include "menus-skeleton.h" @@ -391,9 +392,34 @@ Application::add_style_sheet() using namespace Inkscape::IO::Resource; // Add style sheet (GTK3) auto const screen = Gdk::Screen::get_default(); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + // symbolic + auto provider = Gtk::CssProvider::create(); + Glib::ustring css_str = ""; + if (prefs->getBool("/theme/symbolicIcons", false)) { + gchar colornamed[64]; + sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); + css_str += "*{-gtk-icon-style: symbolic;}toolbutton image{ color: "; + css_str += colornamed; + css_str += ";}"; + } + // From 3.16, throws an error which we must catch. + try { + provider->load_from_data(css_str); + } +#if GTK_CHECK_VERSION(3, 16, 0) + // Gtk::CssProviderError not defined until 3.16. + catch (const Gtk::CssProviderError &ex) { + g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str()); + } +#else + catch (...) { + } +#endif + Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - // Calling get_filename always returns a real filename OR - // if no file exists, then it will have warned already and returns empty. + // we want a tiny file with 3 or 4 lines, so we can loada witout removing context + // is more undertable than record previously applyed Glib::ustring style = get_filename(UIS, "style.css"); if (!style.empty()) { auto provider = Gtk::CssProvider::create(); @@ -450,6 +476,9 @@ Application::Application(const char* argv, bool use_gui) : /* Load the preferences and menus */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + g_object_set(gtk_settings_get_default(), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); + g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", + prefs->getBool("/theme/darkTheme", false), NULL); InkErrorHandler* handler = new InkErrorHandler(use_gui); prefs->setErrorHandler(handler); { diff --git a/src/inkscape.h b/src/inkscape.h index d383da15d164c2c456aa5cd27617fc96f6a6913c..59532b2f6f68aa2d87ac3b1fbf1991f8d13b2188 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -198,8 +198,10 @@ public: gint get_pdf_page() { return _pdf_page; } + void add_style_sheet(); + void add_icon_theme(); -private: + private: static Inkscape::Application * _S_inst; Application(const char* argv0, bool use_gui); @@ -209,9 +211,6 @@ private: Application& operator=(Application const&); // no assign Application* operator&() const; // no pointer access - void add_icon_theme(); - void add_style_sheet(); - Inkscape::XML::Document * _menus; std::map _document_set; std::map _selection_models; diff --git a/src/io/resource.cpp b/src/io/resource.cpp index f8cf9fce4c7cb2b87c3d580aa2eef235732aaef7..83772dd5d2230fcc560f94ed9ee041ac4db2dc02 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -106,6 +106,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) } break; } + if (filename && path) { gchar *temp=g_build_filename(path, filename, NULL); g_free(path); @@ -115,6 +116,8 @@ gchar *_get_path(Domain domain, Type type, char const *filename) return path; } + + Util::ptr_shared get_path(Domain domain, Type type, char const *filename) { char *path = _get_path(domain, type, filename); @@ -213,7 +216,6 @@ Glib::ustring get_filename(Glib::ustring path, Glib::ustring filename) * * domain - Optional domain (overload), will check return domains if not. * type - The type of files, e.g. TEMPLATES - * path - Instead of Domain and Type, specify the path to get the files from. * extensions - A list of extensions to return, e.g. xml, svg * exclusions - A list of names to exclude e.g. default.xml */ @@ -225,6 +227,7 @@ std::vector get_filenames(Type type, std::vector ex get_filenames_from_path(ret, get_path_ustring(CREATE, type), extensions, exclusions); return ret; } + std::vector get_filenames(Domain domain, Type type, std::vector extensions, std::vector exclusions) { std::vector ret; @@ -238,10 +241,41 @@ std::vector get_filenames(Glib::ustring path, std::vector get_foldernames(Type type, std::vector exclusions) +{ + std::vector ret; + get_foldernames_from_path(ret, get_path_ustring(USER, type), exclusions); + get_foldernames_from_path(ret, get_path_ustring(SYSTEM, type), exclusions); + get_foldernames_from_path(ret, get_path_ustring(CREATE, type), exclusions); + return ret; +} + +std::vector get_foldernames(Domain domain, Type type, std::vector exclusions) +{ + std::vector ret; + get_foldernames_from_path(ret, get_path_ustring(domain, type), exclusions); + return ret; +} +std::vector get_foldernames(Glib::ustring path, std::vector exclusions) +{ + std::vector ret; + get_foldernames_from_path(ret, path, exclusions); + return ret; +} + + /* * Get all the files from a specific path and any sub-dirs, populating &files vector * - * &files - Output list to populate, will be opoulated with full paths + * &files - Output list to populate, will be poulated with full paths * path - The directory to parse, will add nothing if directory doesn't exist * extensions - Only add files with these extensions, they must be duplicated * exclusions - Exclude files that exactly match these names. @@ -280,6 +314,41 @@ void get_filenames_from_path(std::vector &files, Glib::ustring pa } } +/* + * Get all the files from a specific path and any sub-dirs, populating &files vector + * + * &folders - Output list to populate, will be poulated with full paths + * path - The directory to parse, will add nothing if directory doesn't exist + * exclusions - Exclude files that exactly match these names. + */ +void get_foldernames_from_path(std::vector &folders, Glib::ustring path, + std::vector exclusions) +{ + if (!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { + return; + } + + Glib::Dir dir(path); + std::string file = dir.read_name(); + while (!file.empty()) { + // If not extensions are specified, don't reject ANY files. + bool reject = false; + + // Reject any file which matches the exclusions. + for (auto &exc : exclusions) { + reject |= Glib::str_has_prefix(file, exc); + } + + // Reject any filename which isn't a regular file + Glib::ustring filename = Glib::build_filename(path, file); + + if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR) && !reject) { + folders.push_back(filename); + } + file = dir.read_name(); + } +} + /** * Get, or guess, or decide the location where the preferences.xml @@ -356,7 +425,8 @@ char *profile_path(const char *filename) int problem = errno; g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem); } else { - gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", nullptr}; + gchar const *userDirs[] = { "keys", "templates", "icons", "extensions", "ui", + "symbols", "themes", "palettes", nullptr }; for (gchar const** name = userDirs; *name; ++name) { gchar *dir = g_build_filename(prefdir, *name, NULL); g_mkdir_with_parents(dir, mode); diff --git a/src/io/resource.h b/src/io/resource.h index dae43ec8fbaff67dbd7c685e61c1bf82baf64a2c..d86eda51aaea96c45ec6c5ea0d3d2afa65be067e 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -79,11 +79,20 @@ std::vector get_filenames(Glib::ustring path, std::vector extensions={}, std::vector exclusions={}); +std::vector get_foldernames(Type type, std::vector exclusions = {}); + +std::vector get_foldernames(Domain domain, Type type, std::vector exclusions = {}); + +std::vector get_foldernames(Glib::ustring path, std::vector exclusions = {}); + void get_filenames_from_path(std::vector &files, Glib::ustring path, std::vector extensions={}, std::vector exclusions={}); +void get_foldernames_from_path(std::vector &files, Glib::ustring path, + std::vector exclusions = {}); + char *profile_path(const char *filename); char *homedir_path(const char *filename); diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp index 8a8b12307370bfb3b9d9b5e922b0c1878dddffbd..5da934da62cb1a89420a3a8bfbd768d40b9295cf 100644 --- a/src/live_effects/parameter/item.cpp +++ b/src/live_effects/parameter/item.cpp @@ -18,12 +18,12 @@ #include "live_effects/effect.h" #include "svg/svg.h" -#include "selection-chemistry.h" -#include "xml/repr.h" #include "desktop.h" +#include "helper/icon-loader.h" #include "inkscape.h" #include "message-stack.h" - +#include "selection-chemistry.h" +#include "xml/repr.h" // clipboard support #include "ui/clipboard.h" // required for linking to other paths @@ -118,8 +118,7 @@ Gtk::Widget * ItemParam::param_newWidget() { Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); - Gtk::Image* pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("edit-clone", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("edit-clone", Gtk::ICON_SIZE_BUTTON)); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast(_widget)->pack_start(*pLabel, true, true); diff --git a/src/live_effects/parameter/originalitem.cpp b/src/live_effects/parameter/originalitem.cpp index b415dd52a6b0899be3463ad89320222507bea121..c42db4ce904e13c538099e600326e78e118d4562 100644 --- a/src/live_effects/parameter/originalitem.cpp +++ b/src/live_effects/parameter/originalitem.cpp @@ -24,6 +24,7 @@ #include "object/uri.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" namespace Inkscape { @@ -52,8 +53,7 @@ OriginalItemParam::param_newWidget() } { // Paste item to link button - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("edit-paste", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("edit-paste", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -65,8 +65,7 @@ OriginalItemParam::param_newWidget() } { // Select original button - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("edit-select-original", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("edit-select-original", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/live_effects/parameter/originalitemarray.cpp b/src/live_effects/parameter/originalitemarray.cpp index 23d9f96cd2227af50145b908fbeaf6bb7c9bea5d..22193b2151c6666867d242127139e7a55e14b8d3 100644 --- a/src/live_effects/parameter/originalitemarray.cpp +++ b/src/live_effects/parameter/originalitemarray.cpp @@ -18,11 +18,12 @@ #include +#include "helper/icon-loader.h" #include "inkscape.h" -#include "ui/clipboard.h" -#include "svg/svg.h" -#include "svg/stringstream.h" #include "originalitem.h" +#include "svg/stringstream.h" +#include "svg/svg.h" +#include "ui/clipboard.h" #include "object/uri.h" @@ -137,8 +138,7 @@ Gtk::Widget* OriginalItemArrayParam::param_newWidget() { // Paste item to link button - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("edit-clone", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("edit-clone", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -150,8 +150,7 @@ Gtk::Widget* OriginalItemArrayParam::param_newWidget() } { // Remove linked item - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("gtk-remove", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-remove", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -163,8 +162,7 @@ Gtk::Widget* OriginalItemArrayParam::param_newWidget() } { // Move Down - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( "gtk-go-down", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-go-down", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -176,8 +174,7 @@ Gtk::Widget* OriginalItemArrayParam::param_newWidget() } { // Move Down - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( "gtk-go-up", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-go-up", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp index cc4408218c8cdaf17a2da55184b4f1d8dc9a5c4c..474f6c1bf563797138cca14b453157842d2cfaeb 100644 --- a/src/live_effects/parameter/originalpatharray.cpp +++ b/src/live_effects/parameter/originalpatharray.cpp @@ -32,6 +32,8 @@ #include <2geom/coord.h> #include <2geom/point.h> +#include "helper/icon-loader.h" + #include "object/sp-shape.h" #include "object/sp-text.h" #include "object/uri.h" @@ -177,8 +179,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() { // Paste path to link button - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("edit-clone", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("edit-clone", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -190,8 +191,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Remove linked path - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name("gtk-remove", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-remove", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -203,8 +203,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Move Down - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( "gtk-go-down", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-go-down", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -216,8 +215,7 @@ Gtk::Widget* OriginalPathArrayParam::param_newWidget() } { // Move Down - Gtk::Image *pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( "gtk-go-up", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("gtk-go-up", Gtk::ICON_SIZE_BUTTON)); Gtk::Button *pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 52e1b62a6712189ea4ad165916c992295a3a3974..af553a0293582e524554cb497834196793ff0a6e 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -22,15 +22,15 @@ #include <2geom/pathvector.h> #include <2geom/d2.h> -#include "selection-chemistry.h" -#include "xml/repr.h" #include "desktop.h" +#include "document-undo.h" +#include "document.h" +#include "helper/icon-loader.h" #include "inkscape.h" #include "message-stack.h" +#include "selection-chemistry.h" #include "verbs.h" -#include "document.h" -#include "document-undo.h" - +#include "xml/repr.h" // needed for on-canvas editing: #include "ui/tools-switch.h" #include "ui/shape-editor.h" @@ -201,8 +201,7 @@ PathParam::param_newWidget() Gtk::Image * pIcon = nullptr; Gtk::Button * pButton = nullptr; if (_edit_button) { - pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( INKSCAPE_ICON("tool-node-editor"), Gtk::ICON_SIZE_BUTTON); + pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("tool-node-editor"), Gtk::ICON_SIZE_BUTTON)); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -214,8 +213,7 @@ PathParam::param_newWidget() } if (_copy_button) { - pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( INKSCAPE_ICON("edit-copy"), Gtk::ICON_SIZE_BUTTON); + pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-copy"), Gtk::ICON_SIZE_BUTTON)); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -227,8 +225,7 @@ PathParam::param_newWidget() } if (_paste_button) { - pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( INKSCAPE_ICON("edit-paste"), Gtk::ICON_SIZE_BUTTON); + pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-paste"), Gtk::ICON_SIZE_BUTTON)); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); @@ -239,8 +236,7 @@ PathParam::param_newWidget() pButton->set_tooltip_text(_("Paste path")); } if (_link_button) { - pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( INKSCAPE_ICON("edit-clone"), Gtk::ICON_SIZE_BUTTON); + pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-clone"), Gtk::ICON_SIZE_BUTTON)); pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 535e43dcf9735c349a54710ef2d40fcd10d57058..c92e1c437baa58535b383514ae53c43408ee88e9 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -10,14 +10,15 @@ #include -#include "live_effects/parameter/togglebutton.h" +#include "helper-fns.h" +#include "helper/icon-loader.h" +#include "inkscape.h" #include "live_effects/effect.h" -#include "svg/svg.h" -#include "svg/stringstream.h" +#include "live_effects/parameter/togglebutton.h" #include "selection.h" -#include "inkscape.h" +#include "svg/stringstream.h" +#include "svg/svg.h" #include "verbs.h" -#include "helper-fns.h" namespace Inkscape { @@ -110,10 +111,10 @@ ToggleButtonParam::param_newWidget() } gtk_widget_show(box_button); GtkWidget *icon_button = nullptr; - if(!value){ - icon_button = gtk_image_new_from_icon_name(_icon_inactive, _icon_size); + if (!value) { + icon_button = GTK_WIDGET(sp_get_icon_image(_icon_inactive, _icon_size)); } else { - icon_button = gtk_image_new_from_icon_name(_icon_active, _icon_size); + icon_button = GTK_WIDGET(sp_get_icon_image(_icon_active, _icon_size)); } gtk_widget_show(icon_button); gtk_box_pack_start (GTK_BOX(box_button), icon_button, false, false, 1); @@ -162,10 +163,10 @@ ToggleButtonParam::refresh_button() Gtk::Image *im = dynamic_cast(children[0]); Gtk::IconSize is(_icon_size); if (!im) return; - if(!value){ - im->set_from_icon_name(_icon_inactive, is); + if (!value) { + im = sp_get_icon_image(_icon_inactive, is); } else { - im->set_from_icon_name(_icon_active, is); + im = sp_get_icon_image(_icon_active, is); } } } diff --git a/src/main.cpp b/src/main.cpp index fb73eb8100be36635c756ecb9def4590d8c71172..b51d2d4559dc0c26d5f2f5cfc74c1965c33549a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,6 +80,7 @@ #include "xml/repr.h" +#include "io/resource.h" #include "io/sys.h" #include "debug/logger.h" @@ -611,41 +612,20 @@ static void _win32_set_inkscape_env(gchar const *exe) static void set_extensions_env() { - gchar const *pythonpath = g_getenv("PYTHONPATH"); - gchar *extdir; - gchar *new_pythonpath; - -#ifdef WIN32 - extdir = g_win32_locale_filename_from_utf8(INKSCAPE_EXTENSIONDIR); -#else - extdir = g_strdup(INKSCAPE_EXTENSIONDIR); -#endif - - // On some platforms, INKSCAPE_EXTENSIONDIR is not absolute, - // but relative to the directory that contains the Inkscape executable. - // Since we spawn Python chdir'ed into the script's directory, - // we need to obtain the absolute path here. - if (!g_path_is_absolute(extdir)) { - gchar *curdir = g_get_current_dir(); - gchar *extdir_new = g_build_filename(curdir, extdir, NULL); - g_free(extdir); - g_free(curdir); - extdir = extdir_new; - } - - if (pythonpath) { - new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", - extdir, pythonpath); - g_free(extdir); - } else { - new_pythonpath = extdir; - } - - g_setenv("PYTHONPATH", new_pythonpath, TRUE); - g_free(new_pythonpath); + gchar *pythonpath = get_extensions_path(); + g_setenv("PYTHONPATH", pythonpath, TRUE); + g_free(pythonpath); //printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH")); } +static void set_datadir_env() +{ + gchar *datadir = get_datadir_path(); + g_setenv("XDG_DATA_HOME", datadir, TRUE); + g_free(datadir); + // printf("XDG_DATA_HOME = %s\n", g_getenv("XDG_DATA_HOME")); +} + /** * This is the classic main() entry point of the program, though on some * architectures it might be called by something else. @@ -676,6 +656,7 @@ main(int argc, char **argv) rt.setPathInfo(); } #endif + set_datadir_env(); set_extensions_env(); // Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example) diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp index 87b756eb45b34d3d1a2fc301e72741c41ae25a3e..2ef9c4f7d6ac35a60f5ef4a3b57fc1ca54f6f457 100644 --- a/src/path-prefix.cpp +++ b/src/path-prefix.cpp @@ -23,8 +23,9 @@ #endif -#include +#include "io/resource.h" #include "path-prefix.h" +#include /** @@ -61,7 +62,67 @@ char *append_inkscape_datadir(const char *relative_path) return g_build_filename(inkscape_datadir, relative_path, NULL); } +gchar *get_extensions_path() +{ + using namespace Inkscape::IO::Resource; + gchar const *pythonpath = g_getenv("PYTHONPATH"); + gchar *extdir; + gchar *new_pythonpath; + +#ifdef WIN32 + extdir = g_win32_locale_filename_from_utf8(INKSCAPE_EXTENSIONDIR); +#else + extdir = g_strdup(INKSCAPE_EXTENSIONDIR); +#endif + + // On some platforms, INKSCAPE_EXTENSIONDIR is not absolute, + // but relative to the directory that contains the Inkscape executable. + // Since we spawn Python chdir'ed into the script's directory, + // we need to obtain the absolute path here. + if (!g_path_is_absolute(extdir)) { + gchar *curdir = g_get_current_dir(); + gchar *extdir_new = g_build_filename(curdir, extdir, NULL); + g_free(extdir); + g_free(curdir); + extdir = extdir_new; + } + + if (pythonpath) { + new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", extdir, pythonpath); + g_free(extdir); + } + else { + new_pythonpath = extdir; + } + return new_pythonpath; +} + +gchar *get_datadir_path() +{ + using namespace Inkscape::IO::Resource; + gchar *datadir; + +#ifdef WIN32 + datadir = g_win32_locale_filename_from_utf8(profile_path("")); +#else + datadir = profile_path(""); +#endif + + // On some platforms, INKSCAPE_EXTENSIONDIR is not absolute, + // but relative to the directory that contains the Inkscape executable. + // Since we spawn Python chdir'ed into the script's directory, + // we need to obtain the absolute path here. + if (!g_path_is_absolute(datadir)) { + gchar *curdir = g_get_current_dir(); + gchar *datadir_new = g_build_filename(curdir, datadir, NULL); + g_free(datadir); + g_free(curdir); + datadir = datadir_new; + } + + return datadir; +} /* Local Variables: mode:c++ diff --git a/src/path-prefix.h b/src/path-prefix.h index a557ca340857fe386112bf3f33bdf4fad821c79e..598a2eff897397cca6b1a87887cb8f76bd9dda04 100644 --- a/src/path-prefix.h +++ b/src/path-prefix.h @@ -20,7 +20,8 @@ char *append_inkscape_datadir(const char *relative_path); - +char *get_datadir_path(); +char *get_extensions_path(); #ifdef _WIN32 #undef INKSCAPE_DATADIR #define INKSCAPE_DATADIR append_inkscape_datadir(NULL) diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 620793dc5cb52c9eea7ff1ec8e2f03678002f159..2a6083e557e915ea007938bd6c8221e2d81423e4 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -72,6 +72,9 @@ static char const preferences_skeleton[] = " inkscape:window-width=\"640\"\n" " inkscape:window-height=\"480\" />\n" " \n" +" \n" +" \n" "\n" " \n" diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp index 3bb80029215b65de3b8e4aa6821853c6a0500aa3..f5f8c41cac64baf5116a8cdc16c5a576133cd15d 100644 --- a/src/svg-view-slideshow.cpp +++ b/src/svg-view-slideshow.cpp @@ -38,6 +38,7 @@ #include #include "document.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include "ui/monitor.h" #include "util/units.h" @@ -100,29 +101,27 @@ void SPSlideShow::control_show() _ctrlwin->add(*t); auto btn_go_first = Gtk::manage(new Gtk::Button()); - auto img_go_first = Gtk::manage(new Gtk::Image()); - img_go_first->set_from_icon_name(INKSCAPE_ICON("go-first"), Gtk::ICON_SIZE_BUTTON); + auto img_go_first = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("go-first"), Gtk::ICON_SIZE_BUTTON)); btn_go_first->set_image(*img_go_first); t->add(*btn_go_first); btn_go_first->signal_clicked().connect(sigc::mem_fun(*this, &SPSlideShow::goto_first)); auto btn_go_prev = Gtk::manage(new Gtk::Button()); - auto img_go_prev = Gtk::manage(new Gtk::Image()); - img_go_prev->set_from_icon_name(INKSCAPE_ICON("go-previous"), Gtk::ICON_SIZE_BUTTON); + auto img_go_prev = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("go-previous"), Gtk::ICON_SIZE_BUTTON)); + btn_go_prev->set_image(*img_go_prev); t->add(*btn_go_prev); btn_go_prev->signal_clicked().connect(sigc::mem_fun(*this, &SPSlideShow::show_prev)); auto btn_go_next = Gtk::manage(new Gtk::Button()); - auto img_go_next = Gtk::manage(new Gtk::Image()); - img_go_next->set_from_icon_name(INKSCAPE_ICON("go-next"), Gtk::ICON_SIZE_BUTTON); + auto img_go_next = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("go-next"), Gtk::ICON_SIZE_BUTTON)); + btn_go_next->set_image(*img_go_next); t->add(*btn_go_next); btn_go_next->signal_clicked().connect(sigc::mem_fun(*this, &SPSlideShow::show_next)); auto btn_go_last = Gtk::manage(new Gtk::Button()); - auto img_go_last = Gtk::manage(new Gtk::Image()); - img_go_last->set_from_icon_name(INKSCAPE_ICON("go-last"), Gtk::ICON_SIZE_BUTTON); + auto img_go_last = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("go-last"), Gtk::ICON_SIZE_BUTTON)); btn_go_last->set_image(*img_go_last); t->add(*btn_go_last); btn_go_last->signal_clicked().connect(sigc::mem_fun(*this, &SPSlideShow::goto_last)); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 3d9a53951b684d2ae659d78dc15c0cb3722a403e..7ad8a5e185d95c42da0ced487829620106bfb31f 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -45,6 +45,7 @@ #include "object/sp-root.h" #include "object/sp-text.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/multi-path-manipulator.h" @@ -68,7 +69,7 @@ Action::Action(Glib::ustring id, _parent(parent) { Gtk::Image* pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( _id, Gtk::ICON_SIZE_LARGE_TOOLBAR); + pIcon = sp_get_icon_image(_id, Gtk::ICON_SIZE_LARGE_TOOLBAR); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 9a4cd92ab09bb654f227ed2c5486bf49d9db1034..3cec380227152c7a98cd898a4c8e10ae57ba5838 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -43,6 +43,7 @@ #include "display/drawing-context.h" #include "display/drawing.h" +#include "helper/icon-loader.h" #include "helper/window.h" #include "object/sp-item.h" @@ -2683,28 +2684,28 @@ GtkWidget * CloneTiler::table_x_y_rand(int values) auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - GtkWidget *i = gtk_image_new_from_icon_name (INKSCAPE_ICON("object-rows"), GTK_ICON_SIZE_MENU); - gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); + GtkWidget *i = GTK_WIDGET(sp_get_icon_image(INKSCAPE_ICON("object-rows"), GTK_ICON_SIZE_MENU)->gobj()); + gtk_box_pack_start(GTK_BOX(hb), i, FALSE, FALSE, 2); - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), _("Per row:")); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2); + GtkWidget *l = gtk_label_new(""); + gtk_label_set_markup(GTK_LABEL(l), _("Per row:")); + gtk_box_pack_start(GTK_BOX(hb), l, FALSE, FALSE, 2); - table_attach (table, hb, 0, 1, 2); + table_attach(table, hb, 0, 1, 2); } { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - GtkWidget *i = gtk_image_new_from_icon_name (INKSCAPE_ICON("object-columns"), GTK_ICON_SIZE_MENU); - gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); + GtkWidget *i = GTK_WIDGET(sp_get_icon_image(INKSCAPE_ICON("object-columns"), GTK_ICON_SIZE_MENU)->gobj()); + gtk_box_pack_start(GTK_BOX(hb), i, FALSE, FALSE, 2); - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), _("Per column:")); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2); + GtkWidget *l = gtk_label_new(""); + gtk_label_set_markup(GTK_LABEL(l), _("Per column:")); + gtk_box_pack_start(GTK_BOX(hb), l, FALSE, FALSE, 2); - table_attach (table, hb, 0, 1, 3); + table_attach(table, hb, 0, 1, 3); } { diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index aa0198f2721d25392023df6c9f9cfba3c264a08d..901bcf36cc614123f03b32c0dbbb03f0d692e9df 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -16,6 +16,7 @@ #include "verbs.h" #include "selection.h" +#include "helper/icon-loader.h" #include "ui/widget/addtoicon.h" #include "xml/attribute-record.h" @@ -123,7 +124,7 @@ void CssDialog::setDesktop(SPDesktop* desktop) void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0b47f9bac74460ee2e91664a742976d0b0a1936e..39993bc0981e299e4227c6eb916c813fbb053fde 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -34,6 +34,7 @@ #include "object/sp-script.h" #include "style.h" +#include "helper/icon-loader.h" #include "ui/dialog/filedialog.h" #include "ui/icon-names.h" #include "ui/shape-editor.h" @@ -75,7 +76,7 @@ static Inkscape::XML::NodeEventVector const _repr_events = { static void docprops_style_button(Gtk::Button& btn, char const* iconName) { - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show( child ); btn.add(*Gtk::manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); @@ -1511,8 +1512,7 @@ DocumentProperties::_createPageTabLabel(const Glib::ustring& label, const char * Gtk::HBox *_tab_label_box = Gtk::manage(new Gtk::HBox(false, 0)); _tab_label_box->set_spacing(4); - auto img = Gtk::manage(new Gtk::Image()); - img->set_from_icon_name(label_image, Gtk::ICON_SIZE_MENU); + auto img = Gtk::manage(sp_get_icon_image(label_image, Gtk::ICON_SIZE_MENU)); _tab_label_box->pack_start(*img); Gtk::Label *_tab_label = Gtk::manage(new Gtk::Label(label, true)); diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index dd387c37e77b0cce45838bfd56e0ee293e044dd5..067749fa0629e532f4657fe365118f2905241217 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -26,6 +26,7 @@ #include "svg/css-ostringstream.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include "ui/view/view-widget.h" #include "ui/widget/notebook-page.h" @@ -177,8 +178,7 @@ FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label { Gtk::HBox *_tab_label_box = Gtk::manage(new Gtk::HBox(false, 4)); - auto img = Gtk::manage(new Gtk::Image()); - img->set_from_icon_name(label_image, Gtk::ICON_SIZE_MENU); + auto img = Gtk::manage(sp_get_icon_image(label_image, Gtk::ICON_SIZE_MENU)); _tab_label_box->pack_start(*img); Gtk::Label *_tab_label = Gtk::manage(new Gtk::Label(label, true)); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 03c3587d918c8869c8b92f9b74d7dabe0f0821b0..38e217397f91060ad1021762114c4435dd6f95e3 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,12 +19,15 @@ #include "inkscape-preferences.h" +#include +#include #include -#include #include +#include +#include #include -#include #include +#include #include "cms-system.h" #include "document.h" @@ -50,6 +53,7 @@ #include "object/color-profile.h" #include "style.h" +#include "ui/interface.h" #include "ui/widget/style-swatch.h" #ifdef HAVE_ASPELL @@ -337,6 +341,12 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const _("Remember the style of the (first) selected object as this tool's style")); } +// static void changeTheme() +//{ +// sp_ui_reload(); +//} + + void InkscapePreferences::initPageTools() { Gtk::TreeModel::iterator iter_tools = this->AddPage(_page_tools, _("Tools"), PREFS_PAGE_TOOLS); @@ -571,6 +581,71 @@ void InkscapePreferences::initPageTools() #endif // WITH_LPETOOL } +gchar *_inkscape_get_theme_dir(void) +{ + const gchar *var; + + var = g_getenv("GTK_DATA_PREFIX"); + if (var == NULL) + var = g_getenv("GTK_PATH"); + return g_build_filename(var, "share", "themes", NULL); +} + +static void _inkscape_fill_gtk(const gchar *path, GHashTable *t) +{ + const gchar *dir_entry; + GDir *dir = g_dir_open(path, 0, NULL); + + if (!dir) + return; + + while ((dir_entry = g_dir_read_name(dir))) { + gchar *filename = g_build_filename(path, dir_entry, "gtk-3.0", "gtk.css", NULL); + + if (g_file_test(filename, G_FILE_TEST_IS_REGULAR) && !g_hash_table_contains(t, dir_entry)) + g_hash_table_add(t, g_strdup(dir_entry)); + + g_free(filename); + } + + g_dir_close(dir); +} + +void InkscapePreferences::symbolicThemeCheck() +{ + using namespace Inkscape::IO::Resource; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + auto folders = get_foldernames(ICONS, { "application" }); + bool symbolic = false; + for (auto &folder : folders) { + auto path = folder; + const size_t last_slash_idx = folder.find_last_of("\\/"); + if (std::string::npos != last_slash_idx) { + folder.erase(0, last_slash_idx + 1); + } + if (folder == prefs->getString("/theme/iconTheme")) { +#ifdef WIN32 + path += g_win32_locale_filename_from_utf8("/scalable/actions"); +#else + path += "/scalable/actions"; +#endif + std::vector symbolic_icons = get_filenames(path, { "-symbolic.svg" }, {}); + if (symbolic_icons.size() > 0) { + symbolic = true; + symbolic_icons.clear(); + } + } + } + if (!symbolic) { + _symbolic_icons.set_active(false); + _symbolic_icons.hide(); + _symbolic_color.hide(); + } + else { + _symbolic_icons.show(); + _symbolic_color.show(); + } +} void InkscapePreferences::initPageUI() { Gtk::TreeModel::iterator iter_ui = this->AddPage(_page_ui, _("Interface"), PREFS_PAGE_UI); @@ -654,23 +729,7 @@ void InkscapePreferences::initPageUI() _page_ui.add_line( false, _("Language (requires restart):"), _ui_languages, "", _("Set the language for menus and number formats"), false); - { - Glib::ustring sizeLabels[] = {C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), C_("Icon size", "Smaller")}; - int sizeValues[] = {3, 0, 1, 2}; - // "Larger" is 3 to not break existing preference files. Should fix in GTK3 - - _misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_ui.add_line( false, _("Toolbox icon size:"), _misc_small_tools, "", - _("Set the size for the tool icons (requires restart)"), false); - - _misc_small_toolbar.init( "/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_ui.add_line( false, _("Control bar icon size:"), _misc_small_toolbar, "", - _("Set the size for the icons in tools' control bars to use (requires restart)"), false); - - _misc_small_secondary.init( "/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); - _page_ui.add_line( false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", - _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); - } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _ui_colorsliders_top.init( _("Work-around color sliders not drawing"), "/options/workarounds/colorsontop", false); _page_ui.add_line( false, "", _ui_colorsliders_top, "", @@ -717,6 +776,122 @@ void InkscapePreferences::initPageUI() _("Selects whether the dockbar switcher will show text labels, icons, or both"), false); } + // Theme + symbolicThemeCheck(); + _page_theme.add_group_header(_("Theme changes")); + { + GHashTable *t; + GHashTableIter iter; + gchar *theme, *path; + gchar **builtin_themes; + GList *list, *l; + guint i; + const gchar *const *dirs; + + t = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + /* Builtin themes */ + builtin_themes = g_resources_enumerate_children("/org/gtk/libgtk/theme", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); + for (i = 0; builtin_themes[i] != NULL; i++) { + if (g_str_has_suffix(builtin_themes[i], "/")) + g_hash_table_add(t, g_strndup(builtin_themes[i], strlen(builtin_themes[i]) - 1)); + } + g_strfreev(builtin_themes); + + path = _inkscape_get_theme_dir(); + _inkscape_fill_gtk(path, t); + g_free(path); + + path = g_build_filename(g_get_user_data_dir(), "themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); + + path = g_build_filename(g_get_home_dir(), ".themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); + + dirs = g_get_system_data_dirs(); + for (i = 0; dirs[i]; i++) { + path = g_build_filename(dirs[i], "themes", NULL); + _inkscape_fill_gtk(path, t); + g_free(path); + } + + list = NULL; + g_hash_table_iter_init(&iter, t); + while (g_hash_table_iter_next(&iter, (gpointer *)&theme, NULL)) + list = g_list_insert_sorted(list, theme, (GCompareFunc)strcmp); + + std::vector labels; + std::vector values; + for (l = list; l; l = l->next) { + theme = (gchar *)l->data; + labels.push_back(Glib::ustring(theme)); + values.push_back(Glib::ustring(theme)); + } + + g_list_free(list); + g_hash_table_destroy(t); + + _gtk_theme.init("/theme/gtkTheme", labels, values, "Adwaita"); + _page_theme.add_line(false, _("Change Gtk theme:"), _gtk_theme, "", "", false); + } + + { + using namespace Inkscape::IO::Resource; + auto folders = get_foldernames(ICONS, { "application" }); + std::vector labels; + std::vector values; + for (auto &folder : folders) { + // from https://stackoverflow.com/questions/8520560/get-a-file-name-from-a-path#8520871 + // Maybe we can link boost path utilities + // Remove directory if present. + // Do this before extension removal incase directory has a period character. + const size_t last_slash_idx = folder.find_last_of("\\/"); + if (std::string::npos != last_slash_idx) { + folder.erase(0, last_slash_idx + 1); + } + + labels.push_back(folder); + values.push_back(folder); + } + std::sort(labels.begin(), labels.end()); + std::sort(values.begin(), values.end()); + labels.erase(unique(labels.begin(), labels.end()), labels.end()); + values.erase(unique(values.begin(), values.end()), values.end()); + _icon_theme.init("/theme/iconTheme", labels, values, "hicolor"); + _page_theme.add_line(false, _("Change icon theme:"), _icon_theme, "", "", false); + _icon_theme.signal_changed().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicThemeCheck)); + } + + _dark_theme.init(_("Use dark theme"), "/theme/darkTheme", true); + _page_theme.add_line(true, "", _dark_theme, "", _("Use dark theme"), true); + _symbolic_icons.init(_("Use symbolic icons"), "/theme/symbolicIcons", true); + _page_theme.add_line(true, "", _symbolic_icons, "", "", true), + _symbolic_color.init(_("Color for symbolic icons:"), "/theme/symbolicColor", 0x000000ff); + _page_theme.add_line(false, _("Color for symbolic icons:"), _symbolic_color, "", "", true); + { + Glib::ustring sizeLabels[] = { C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"), + C_("Icon size", "Smaller") }; + int sizeValues[] = { 3, 0, 1, 2 }; + // "Larger" is 3 to not break existing preference files. Should fix in GTK3 + + _misc_small_tools.init("/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0); + _page_theme.add_line(false, _("Toolbox icon size:"), _misc_small_tools, "", + _("Set the size for the tool icons (requires restart)"), false); + + _misc_small_toolbar.init("/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0); + _page_theme.add_line(false, _("Control bar icon size:"), _misc_small_toolbar, "", + _("Set the size for the icons in tools' control bars to use (requires restart)"), false); + + _misc_small_secondary.init("/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1); + _page_theme.add_line(false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", + _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); + } + _apply_theme.set_label(_("Apply theme")); + _apply_theme.set_tooltip_text(_("It apply slow")); + _page_theme.add_line(false, "", _apply_theme, "", "", false); + _apply_theme.signal_clicked().connect(sigc::ptr_fun(sp_ui_reload)); + this->AddPage(_page_theme, _("Theme"), iter_ui, PREFS_PAGE_UI_THEME); // Windows _win_save_geom.init ( _("Save and restore window geometry for each document"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_FILE, true, nullptr); _win_save_geom_prefs.init ( _("Remember and use last window's geometry"), "/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_LAST, false, &_win_save_geom); @@ -2004,27 +2179,54 @@ void InkscapePreferences::initPageSystem() _misc_latency_skew.init("/debug/latency/skew", 0.5, 2.0, 0.01, 0.10, 1.0, false, false); _page_system.add_line( false, _("Latency _skew:"), _misc_latency_skew, _("(requires restart)"), _("Factor by which the event clock is skewed from the actual time (0.9766 on some systems)"), false); - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _misc_namedicon_delay.init( _("Pre-render named icons"), "/options/iconrender/named_nodelay", false); _page_system.add_line( false, "", _misc_namedicon_delay, "", _("When on, named icons will be rendered before displaying the ui. This is for working around bugs in GTK+ named icon notification"), true); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - _page_system.add_group_header( _("System info")); - _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path("")); - _sys_user_config.set_editable(false); - _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); - _sys_user_prefs.set_text(prefs->getPrefsFilename()); _sys_user_prefs.set_editable(false); _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true); - _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, "")); - _sys_user_extension_dir.set_editable(false); + _sys_user_config.init((char const *)Inkscape::IO::Resource::profile_path(""), _("Open inkscape folder")); + _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); + + _sys_user_extension_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""), + _("Open extensions folder")); _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true); + _sys_user_themes_dir.init((char const *)Inkscape::IO::Resource::profile_path("/themes"), _("Open themes folder")); + _page_system.add_line(true, _("User themes: "), _sys_user_themes_dir, "", _("Location of the users themes"), true); + + _sys_user_icons_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::ICONS, ""), + _("Open icons folder")); + _page_system.add_line(true, _("User icons: "), _sys_user_icons_dir, "", _("Location of the users icons"), true); + + _sys_user_templates_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::TEMPLATES, ""), + _("Open templates folder")); + _page_system.add_line(true, _("User templates: "), _sys_user_templates_dir, "", + _("Location of the users templates"), true); + + _sys_user_symbols_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::SYMBOLS, ""), + _("Open symbols folder")); + _page_system.add_line(true, _("User symbols: "), _sys_user_symbols_dir, "", _("Location of the users symbols"), + true); + + _sys_user_palettes_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::PALETTES, ""), + _("Open palletes folder")); + _page_system.add_line(true, _("User palettes: "), _sys_user_palettes_dir, "", _("Location of the users palettes"), + true); + + _sys_user_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""), + _("Open keys shorcuts folder")); + _page_system.add_line(true, _("User keys: "), _sys_user_keys_dir, "", _("Location of the users keys"), true); + + _sys_user_ui_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::UIS, ""), + _("Open UI folder")); + _page_system.add_line(true, _("User UI: "), _sys_user_ui_dir, "", _("Location of the users UI"), true); + _sys_user_cache.set_text(g_get_user_cache_dir()); _sys_user_cache.set_editable(false); _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 3a1105b114f5a1c5dc3436fcd3ce3a219d1146fc..f36b3d944f555c338f7bbff4cb218234a249cc0a 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -70,6 +70,7 @@ enum { PREFS_PAGE_TOOLS_CONNECTOR, PREFS_PAGE_TOOLS_LPETOOL, PREFS_PAGE_UI, + PREFS_PAGE_UI_THEME, PREFS_PAGE_UI_WINDOWS, PREFS_PAGE_UI_GRIDS, PREFS_PAGE_UI_KEYBOARD_SHORTCUTS, @@ -160,6 +161,7 @@ protected: UI::Widget::DialogPage _page_eraser; UI::Widget::DialogPage _page_ui; + UI::Widget::DialogPage _page_theme; UI::Widget::DialogPage _page_windows; UI::Widget::DialogPage _page_grids; @@ -238,6 +240,16 @@ protected: UI::Widget::PrefCheckButton _t_node_delete_preserves_shape; UI::Widget::PrefColorPicker _t_node_pathoutline_color; + UI::Widget::PrefCombo _gtk_theme; + UI::Widget::PrefCombo _icon_theme; + UI::Widget::PrefCheckButton _dark_theme; + UI::Widget::PrefCheckButton _symbolic_icons; + UI::Widget::PrefColorPicker _symbolic_color; + UI::Widget::PrefCombo _misc_small_toolbar; + UI::Widget::PrefCombo _misc_small_secondary; + UI::Widget::PrefCombo _misc_small_tools; + Gtk::Button _apply_theme; + UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; UI::Widget::PrefRadioButton _win_native; @@ -341,13 +353,21 @@ protected: UI::Widget::PrefCheckButton _misc_namedicon_delay; // System page + // UI::Widget::Button *_apply_theme; UI::Widget::PrefSpinButton _misc_latency_skew; UI::Widget::PrefSpinButton _misc_simpl; Gtk::Entry _sys_user_prefs; Gtk::Entry _sys_tmp_files; Gtk::Entry _sys_extension_dir; - Gtk::Entry _sys_user_extension_dir; - Gtk::Entry _sys_user_config; + UI::Widget::PrefOpenFolder _sys_user_config; + UI::Widget::PrefOpenFolder _sys_user_extension_dir; + UI::Widget::PrefOpenFolder _sys_user_themes_dir; + UI::Widget::PrefOpenFolder _sys_user_ui_dir; + UI::Widget::PrefOpenFolder _sys_user_icons_dir; + UI::Widget::PrefOpenFolder _sys_user_keys_dir; + UI::Widget::PrefOpenFolder _sys_user_palettes_dir; + UI::Widget::PrefOpenFolder _sys_user_templates_dir; + UI::Widget::PrefOpenFolder _sys_user_symbols_dir; Gtk::Entry _sys_user_cache; Gtk::Entry _sys_data; Gtk::TextView _sys_icon; @@ -357,9 +377,6 @@ protected: // UI page UI::Widget::PrefCombo _ui_languages; - UI::Widget::PrefCombo _misc_small_toolbar; - UI::Widget::PrefCombo _misc_small_secondary; - UI::Widget::PrefCombo _misc_small_tools; UI::Widget::PrefCheckButton _ui_colorsliders_top; UI::Widget::PrefSpinButton _misc_recent; UI::Widget::PrefCheckButton _ui_partialdynamic; @@ -556,10 +573,11 @@ protected: private: - InkscapePreferences(); - InkscapePreferences(InkscapePreferences const &d); - InkscapePreferences operator=(InkscapePreferences const &d); - bool _init; + void symbolicThemeCheck(); + InkscapePreferences(); + InkscapePreferences(InkscapePreferences const &d); + InkscapePreferences operator=(InkscapePreferences const &d); + bool _init; }; } // namespace Dialog diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index fe528d34d7fd9b61f1bc13f547b981e89b02a61d..bfd0e05e31da22781d5beeb32a598b6bf47cbb69 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -30,11 +30,13 @@ #include "verbs.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "object/sp-root.h" #include "svg/css-ostringstream.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include "ui/tools/tool-base.h" #include "ui/widget/imagetoggler.h" @@ -85,7 +87,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i bool set = false; if ( iconName ) { - GtkWidget *child = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_SMALL_TOOLBAR ); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); @@ -97,7 +99,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !set && action && action->image ) { - GtkWidget *child = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_SMALL_TOOLBAR ); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(action->image, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); set = true; @@ -121,8 +123,7 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code const char* label = nullptr; if ( iconName ) { - iconWidget = Gtk::manage(new Gtk::Image()); - iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); + iconWidget = Gtk::manage(sp_get_icon_image(iconName, Gtk::ICON_SIZE_MENU)); } if ( desktop ) { @@ -130,8 +131,7 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = Gtk::manage(new Gtk::Image()); - iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); + iconWidget = Gtk::manage(sp_get_icon_image(action->image, Gtk::ICON_SIZE_MENU)); } if ( action ) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index dd019cfbad284d0bbb1994718e49c5a75a0f77de..ccd71a171fb5b9cca4d5a2ef02b2c0a8f1d0401f 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -30,6 +30,7 @@ #include "verbs.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "live_effects/effect.h" #include "live_effects/lpeobject-reference.h" @@ -73,7 +74,7 @@ void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flag static void lpe_style_button(Gtk::Button& btn, char const* iconName) { - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show( child ); btn.add(*Gtk::manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 397f5690e4855e3489ffcc5fcd3c87abc89d2a86..2bcde597ffae23df73382630f379ba4402c3ff52 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -33,6 +33,7 @@ #include "verbs.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "object/filters/blend.h" #include "object/filters/gaussian-blur.h" @@ -230,7 +231,7 @@ public: */ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_SMALL_TOOLBAR ); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); @@ -252,8 +253,7 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod const char* label = nullptr; if ( iconName ) { - iconWidget = Gtk::manage(new Gtk::Image()); - iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); + iconWidget = Gtk::manage(sp_get_icon_image(iconName, Gtk::ICON_SIZE_MENU)); } if ( desktop ) { @@ -261,8 +261,7 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = Gtk::manage(new Gtk::Image()); - iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); + iconWidget = Gtk::manage(sp_get_icon_image(action->image, Gtk::ICON_SIZE_MENU)); } if ( action ) { diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 2c457b6d05b6586fdb628b4de06dec3a6ff46c87..ffa535b78e00cfc406e59aa2f802efef7a723b8e 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -18,12 +18,13 @@ #include "ocaldialogs.h" -#include "path-prefix.h" #include "filedialogimpl-gtkmm.h" -#include "ui/interface.h" +#include "helper/icon-loader.h" #include "inkgc/gc-core.h" #include "io/sys.h" +#include "path-prefix.h" #include "preferences.h" +#include "ui/interface.h" #include #include @@ -462,8 +463,7 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr& cr) StatusWidget::StatusWidget() : Gtk::HBox(false, 6) { - image = new Gtk::Image(); - image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU); + image = sp_get_icon_image("dialog-error", Gtk::ICON_SIZE_MENU); spinner = new Gtk::Spinner(); label = new Gtk::Label(); @@ -488,7 +488,7 @@ void StatusWidget::set_info(Glib::ustring text) spinner->hide(); image->show(); label->show(); - image->set_from_icon_name("dialog-information", Gtk::ICON_SIZE_MENU); + image = sp_get_icon_image("dialog-information", Gtk::ICON_SIZE_MENU); label->set_text(text); } @@ -497,7 +497,7 @@ void StatusWidget::set_error(Glib::ustring text) spinner->hide(); image->show(); label->show(); - image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU); + image = sp_get_icon_image("dialog-error", Gtk::ICON_SIZE_MENU); label->set_text(text); } diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 9171dd9cec94ee49ae684df147cb5142a80474e7..e978667efcf75b0cf6196af04f15fa2efb24da5f 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -18,7 +18,7 @@ #include "inkscape.h" #include "document-undo.h" - +#include "helper/icon-loader.h" #include "ui/widget/addtoicon.h" #include "xml/attribute-record.h" @@ -1518,7 +1518,7 @@ bool StyleDialog::_delProperty(GdkEventButton *event) void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 578562a79b9720fdad7c6c285cf26c4a94d4594f..cc5434318f3cffd3ac139f37b07352c6bd1dc06c 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -28,6 +28,7 @@ #include "io/resource.h" #include "display/cairo-utils.h" +#include "helper/icon-loader.h" #include "ui/cache/svg_preview_cache.h" #include "ui/clipboard.h" #include "ui/icon-names.h" @@ -272,8 +273,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : scroller->set_hexpand(); table->attach(*Gtk::manage(tools),0,row,2,1); - auto add_symbol_image = Gtk::manage(new Gtk::Image()); - add_symbol_image->set_from_icon_name("symbol-add", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto add_symbol_image = Gtk::manage(sp_get_icon_image("symbol-add", Gtk::ICON_SIZE_SMALL_TOOLBAR)); add_symbol = Gtk::manage(new Gtk::Button()); add_symbol->add(*add_symbol_image); @@ -283,8 +283,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : add_symbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::insertSymbol)); tools->pack_start(* add_symbol, Gtk::PACK_SHRINK); - auto remove_symbolImage = Gtk::manage(new Gtk::Image()); - remove_symbolImage->set_from_icon_name("symbol-remove", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto remove_symbolImage = Gtk::manage(sp_get_icon_image("symbol-remove", Gtk::ICON_SIZE_SMALL_TOOLBAR)); remove_symbol = Gtk::manage(new Gtk::Button()); remove_symbol->add(*remove_symbolImage); @@ -300,8 +299,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : // Pack size (controls display area) pack_size = 2; // Default 32px - auto packMoreImage = Gtk::manage(new Gtk::Image()); - packMoreImage->set_from_icon_name("pack-more", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto packMoreImage = Gtk::manage(sp_get_icon_image("pack-more", Gtk::ICON_SIZE_SMALL_TOOLBAR)); more = Gtk::manage(new Gtk::Button()); more->add(*packMoreImage); @@ -311,8 +309,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : more->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packmore)); tools->pack_start(* more, Gtk::PACK_SHRINK); - auto packLessImage = Gtk::manage(new Gtk::Image()); - packLessImage->set_from_icon_name("pack-less", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto packLessImage = Gtk::manage(sp_get_icon_image("pack-less", Gtk::ICON_SIZE_SMALL_TOOLBAR)); fewer = Gtk::manage(new Gtk::Button()); fewer->add(*packLessImage); @@ -323,8 +320,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : tools->pack_start(* fewer, Gtk::PACK_SHRINK); // Toggle scale to fit on/off - auto fit_symbolImage = Gtk::manage(new Gtk::Image()); - fit_symbolImage->set_from_icon_name("symbol-fit", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto fit_symbolImage = Gtk::manage(sp_get_icon_image("symbol-fit", Gtk::ICON_SIZE_SMALL_TOOLBAR)); fit_symbol = Gtk::manage(new Gtk::ToggleButton()); fit_symbol->add(*fit_symbolImage); @@ -337,8 +333,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : // Render size (scales symbols within display area) scale_factor = 0; // Default 1:1 * pack_size/pack_size default - auto zoom_outImage = Gtk::manage(new Gtk::Image()); - zoom_outImage->set_from_icon_name("symbol-smaller", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto zoom_outImage = Gtk::manage(sp_get_icon_image("symbol-smaller", Gtk::ICON_SIZE_SMALL_TOOLBAR)); zoom_out = Gtk::manage(new Gtk::Button()); zoom_out->add(*zoom_outImage); @@ -349,8 +344,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : zoom_out->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout)); tools->pack_start(* zoom_out, Gtk::PACK_SHRINK); - auto zoom_inImage = Gtk::manage(new Gtk::Image()); - zoom_inImage->set_from_icon_name("symbol-bigger", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto zoom_inImage = Gtk::manage(sp_get_icon_image("symbol-bigger", Gtk::ICON_SIZE_SMALL_TOOLBAR)); zoom_in = Gtk::manage(new Gtk::Button()); zoom_in->add(*zoom_inImage); @@ -471,20 +465,24 @@ 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->set_from_icon_name("none", iconsize); + overlay_icon = sp_get_icon_image("none", iconsize); if (current == ALLDOCS && !l.size()) { if (!all_docs_processed ) { - overlay_icon->set_from_icon_name("searching", iconsize); - overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("")); - overlay_desc->set_markup(Glib::ustring("") + Glib::ustring(_("First search can be slow.")) + Glib::ustring("")); + overlay_icon = sp_get_icon_image("searching", iconsize); + overlay_title->set_markup(Glib::ustring("") + + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("")); + overlay_desc->set_markup(Glib::ustring("") + + Glib::ustring(_("First search can be slow.")) + Glib::ustring("")); } else if (!icons_found && !search_str.empty()) { overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("No results found")) + Glib::ustring("")); overlay_desc->set_markup(Glib::ustring("") + Glib::ustring(_("Try a different search term.")) + Glib::ustring("")); } else { - overlay_icon->set_from_icon_name("searching", iconsize); - overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("")); - overlay_desc->set_markup(Glib::ustring("") + Glib::ustring("")); + overlay_icon = sp_get_icon_image("searching", iconsize); + overlay_title->set_markup(Glib::ustring("") + + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("")); + overlay_desc->set_markup(Glib::ustring("") + + Glib::ustring("")); } } else if (!number_symbols && (current != CURRENTDOC || !search_str.empty())) { overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("No results found")) + Glib::ustring("")); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index ed8c00c611f151594f002673818b0a6aa54e4edb..d27a320a775124963304eafc45a0e953f6a53d8a 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -18,21 +18,23 @@ #include #include -#include "desktop.h" #include "desktop-style.h" -#include "document.h" +#include "desktop.h" #include "document-undo.h" +#include "document.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" +#include "helper/icon-loader.h" #include "svg/css-ostringstream.h" -#include "ui/widget/layertypeicon.h" +#include "ui/tools/tool-base.h" //"event-context.h" #include "ui/widget/addtoicon.h" +#include "ui/widget/layertypeicon.h" #include "verbs.h" #include "xml/node-observer.h" -#include "ui/tools/tool-base.h" //"event-context.h" //#include "dialogs/dialog-events.h" #include "ui/widget/color-notebook.h" #include "filter-chemistry.h" @@ -125,7 +127,7 @@ public: void TagsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); @@ -139,7 +141,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, const char* label = nullptr; if ( iconName ) { - iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU ); + iconWidget = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_MENU)->gobj()); } if ( desktop ) { @@ -147,7 +149,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, if ( verb ) { SPAction *action = verb->get_action(desktop); if ( !iconWidget && action && action->image ) { - iconWidget = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_MENU ); + iconWidget = GTK_WIDGET(sp_get_icon_image(action->image, GTK_ICON_SIZE_MENU)->gobj()); } if ( action ) { diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 9a0e4ddf4076d03ab2801a70b4bb5d945e2eeab2..14ddc90440e468229ba825854d1dce5e0347a1c9 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -29,6 +29,7 @@ #include "transformation.h" #include "verbs.h" +#include "helper/icon-loader.h" #include "object/sp-item-transform.h" #include "object/sp-namedview.h" @@ -280,16 +281,14 @@ void Transformation::layoutPageRotate() _scalar_rotate.setDigits(3); _scalar_rotate.setIncrements(0.1, 1.0); - auto object_rotate_left_icon = Gtk::manage(new Gtk::Image()); - object_rotate_left_icon->set_from_icon_name("object-rotate-left", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto object_rotate_left_icon = Gtk::manage(sp_get_icon_image("object-rotate-left", Gtk::ICON_SIZE_SMALL_TOOLBAR)); _counterclockwise_rotate.add(*object_rotate_left_icon); _counterclockwise_rotate.set_mode(false); _counterclockwise_rotate.set_relief(Gtk::RELIEF_NONE); _counterclockwise_rotate.set_tooltip_text(_("Rotate in a counterclockwise direction")); - auto object_rotate_right_icon = Gtk::manage(new Gtk::Image()); - object_rotate_right_icon->set_from_icon_name("object-rotate-right", Gtk::ICON_SIZE_SMALL_TOOLBAR); + auto object_rotate_right_icon = Gtk::manage(sp_get_icon_image("object-rotate-right", Gtk::ICON_SIZE_SMALL_TOOLBAR)); _clockwise_rotate.add(*object_rotate_right_icon); _clockwise_rotate.set_mode(false); diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index e95724435236f01a4106821848cc41f83921a629..c480624fd6314e8bbde1a31e78f631d0311fb071 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -17,14 +17,14 @@ #include "undo-history.h" -#include "document.h" #include "document-undo.h" +#include "document.h" +#include "helper/icon-loader.h" #include "inkscape.h" - #include "util/signal-blocker.h" #include "desktop.h" -#include + namespace Inkscape { namespace UI { @@ -45,14 +45,13 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr& cr, Glib::ustring image_name = Inkscape::Verb::get(_property_event_type)->get_image(); Gtk::Image* icon = Gtk::manage(new Gtk::Image()); - icon->set_from_icon_name(image_name, Gtk::ICON_SIZE_MENU); + icon = sp_get_icon_image(image_name, Gtk::ICON_SIZE_MENU); if (icon) { // check icon type (inkscape, gtk, none) if ( GTK_IS_IMAGE(icon->gobj()) ) { - auto icon_theme = Gtk::IconTheme::get_default(); - _property_icon = icon_theme->load_icon(image_name, 16); + _property_icon = sp_get_icon_pixbuf(image_name, 16); } else { delete icon; return; diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c7c5424ebcbbba3ef3165011aa9ff5fb6e3197ac..647e0beedb2ab818562b24c6d7852ff8640b2781 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -35,6 +35,7 @@ #include "object/sp-root.h" #include "object/sp-string.h" +#include "helper/icon-loader.h" #include "ui/dialog-events.h" #include "ui/icon-names.h" #include "ui/interface.h" @@ -113,24 +114,21 @@ XmlTree::XmlTree() : tree_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); - auto xml_element_new_icon = Gtk::manage(new Gtk::Image()); - xml_element_new_icon->set_from_icon_name("xml-element-new", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto xml_element_new_icon = Gtk::manage(sp_get_icon_image("xml-element-new", Gtk::ICON_SIZE_LARGE_TOOLBAR)); xml_element_new_button.set_icon_widget(*xml_element_new_icon); xml_element_new_button.set_tooltip_text(_("New element node")); xml_element_new_button.set_sensitive(false); tree_toolbar.add(xml_element_new_button); - auto xml_text_new_icon = Gtk::manage(new Gtk::Image()); - xml_text_new_icon->set_from_icon_name("xml-text-new", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto xml_text_new_icon = Gtk::manage(sp_get_icon_image("xml-text-new", Gtk::ICON_SIZE_LARGE_TOOLBAR)); xml_text_new_button.set_icon_widget(*xml_text_new_icon); xml_text_new_button.set_tooltip_text(_("New text node")); xml_text_new_button.set_sensitive(false); tree_toolbar.add(xml_text_new_button); - auto xml_node_duplicate_icon = Gtk::manage(new Gtk::Image()); - xml_node_duplicate_icon->set_from_icon_name("xml-node-duplicate", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto xml_node_duplicate_icon = Gtk::manage(sp_get_icon_image("xml-node-duplicate", Gtk::ICON_SIZE_LARGE_TOOLBAR)); xml_node_duplicate_button.set_icon_widget(*xml_node_duplicate_icon); xml_node_duplicate_button.set_tooltip_text(_("Duplicate node")); @@ -139,8 +137,7 @@ XmlTree::XmlTree() : tree_toolbar.add(separator); - auto xml_node_delete_icon = Gtk::manage(new Gtk::Image()); - xml_node_delete_icon->set_from_icon_name("xml-node-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto xml_node_delete_icon = Gtk::manage(sp_get_icon_image("xml-node-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR)); xml_node_delete_button.set_icon_widget(*xml_node_delete_icon); xml_node_delete_button.set_tooltip_text(Q_("nodeAsInXMLdialogTooltip|Delete node")); @@ -149,8 +146,7 @@ XmlTree::XmlTree() : tree_toolbar.add(separator2); - auto format_indent_less_icon = Gtk::manage(new Gtk::Image()); - format_indent_less_icon->set_from_icon_name("format-indent-less", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto format_indent_less_icon = Gtk::manage(sp_get_icon_image("format-indent-less", Gtk::ICON_SIZE_LARGE_TOOLBAR)); unindent_node_button.set_icon_widget(*format_indent_less_icon); unindent_node_button.set_label(_("Unindent node")); @@ -158,8 +154,7 @@ XmlTree::XmlTree() : unindent_node_button.set_sensitive(false); tree_toolbar.add(unindent_node_button); - auto format_indent_more_icon = Gtk::manage(new Gtk::Image()); - format_indent_more_icon->set_from_icon_name("format-indent-more", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto format_indent_more_icon = Gtk::manage(sp_get_icon_image("format-indent-more", Gtk::ICON_SIZE_LARGE_TOOLBAR)); indent_node_button.set_icon_widget(*format_indent_more_icon); indent_node_button.set_label(_("Indent node")); @@ -167,8 +162,7 @@ XmlTree::XmlTree() : indent_node_button.set_sensitive(false); tree_toolbar.add(indent_node_button); - auto go_up_icon = Gtk::manage(new Gtk::Image()); - go_up_icon->set_from_icon_name("go-up", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto go_up_icon = Gtk::manage(sp_get_icon_image("go-up", Gtk::ICON_SIZE_LARGE_TOOLBAR)); raise_node_button.set_icon_widget(*go_up_icon); raise_node_button.set_label(_("Raise node")); @@ -176,8 +170,7 @@ XmlTree::XmlTree() : raise_node_button.set_sensitive(false); tree_toolbar.add(raise_node_button); - auto go_down_icon = Gtk::manage(new Gtk::Image()); - go_down_icon->set_from_icon_name("go-down", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto go_down_icon = Gtk::manage(sp_get_icon_image("go-down", Gtk::ICON_SIZE_LARGE_TOOLBAR)); lower_node_button.set_icon_widget(*go_down_icon); lower_node_button.set_label(_("Lower node")); @@ -204,8 +197,8 @@ XmlTree::XmlTree() : attr_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); - auto xml_attribute_delete_icon = Gtk::manage(new Gtk::Image()); - xml_attribute_delete_icon->set_from_icon_name("xml-attribute-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto xml_attribute_delete_icon = + Gtk::manage(sp_get_icon_image("xml-attribute-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR)); xml_attribute_delete_button.set_icon_widget(*xml_attribute_delete_icon); xml_attribute_delete_button.set_tooltip_text(_("Delete attribute")); xml_attribute_delete_button.set_sensitive(false); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 7e64e876bcfc83e34225c9879aaf13c8d3b37938..99fbbc23cf64bffeeac2554dc948cea780fbd143 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -51,6 +51,7 @@ #include "extension/input.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "helper/window.h" #include "io/sys.h" @@ -262,6 +263,51 @@ sp_ui_new_view() sp_namedview_update_layers_from_document(static_cast(dtw->view)); } +void sp_ui_reload() +{ + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int window_geometry = prefs->getInt("/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_NONE); + g_object_set(gtk_settings_get_default(), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL); + g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", + prefs->getBool("/theme/darkTheme", false), NULL); + prefs->setInt("/options/savewindowgeometry/value", PREFS_WINDOW_GEOMETRY_LAST); + prefs->save(); + std::list desktops; + INKSCAPE.get_all_desktops(desktops); + std::list::iterator i = desktops.begin(); + while (i != desktops.end()) { + SPDesktop *dt = *i; + if (dt == nullptr) { + ++i; + continue; + } + dt->storeDesktopPosition(); + + SPDocument *document; + SPViewWidget *dtw; + + document = dt->getDocument(); + if (!document) { + ++i; + continue; + } + + dtw = sp_desktop_widget_new(sp_document_namedview(document, nullptr)); + if (dtw == nullptr) { + ++i; + continue; + } + sp_create_window(dtw, TRUE); + sp_namedview_window_from_document(static_cast(dtw->view)); + sp_namedview_update_layers_from_document(static_cast(dtw->view)); + dt->destroyWidget(); + i++; + } + INKSCAPE.add_style_sheet(); + prefs->setInt("/options/savewindowgeometry/value", window_geometry); +} + void sp_ui_new_view_preview() { SPDocument *document = SP_ACTIVE_DOCUMENT; @@ -467,7 +513,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *men // If there is an image associated with the action, then we can add it as an // icon for the menu item. If not, give the label a bit more space if(show_icon && action->image) { - icon = gtk_image_new_from_icon_name(action->image, GTK_ICON_SIZE_MENU); + icon = GTK_WIDGET(sp_get_icon_image(action->image, GTK_ICON_SIZE_MENU)->gobj()); } else { icon = gtk_label_new(nullptr); // A fake icon just to act as a placeholder diff --git a/src/ui/interface.h b/src/ui/interface.h index 83788ca1bc9e9a51ea24d4e45e3c02a680a2f639..fcaa9801a1f39941d1268684a7b387b2df8d4031 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -45,6 +45,8 @@ void sp_ui_close_view (GtkWidget *widget); void sp_ui_new_view (); +void sp_ui_reload(); + /** * @todo TODO: not yet working. To be re-enabled (by adding to menu) once it works. */ diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index f2e34b534f8049b9e1e3e9b470581dd052da765d..7004fea95129b905cae78c6917eedfaa0e55a20f 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -83,6 +83,9 @@ struct EditWidgetInterface virtual void destroy() = 0; + /// Store window position to prefs + virtual void storeDesktopPosition() = 0; + /// Queue a redraw request with the canvas virtual void requestCanvasUpdate() = 0; diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index e5119fc609a4985f7cba59111036f2dd055971f0..4542333b59e6f944a74a225976a34e6ad29ef990 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -14,11 +14,10 @@ #include "ui/widget/addtoicon.h" -#include - -#include "widgets/toolbox.h" -#include "ui/icon-names.h" +#include "helper/icon-loader.h" #include "layertypeicon.h" +#include "ui/icon-names.h" +#include "widgets/toolbox.h" namespace Inkscape { namespace UI { @@ -33,9 +32,6 @@ AddToIcon::AddToIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_BUTTON, &width, &height); - phys = width; // Assumes that we have a square icon? // Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); // @@ -103,11 +99,7 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/, void AddToIcon::set_pixbuf() { bool active = property_active().get_value(); - - auto icon_theme = Gtk::IconTheme::get_default(); - - property_pixbuf() = icon_theme->load_icon(active ? "list-add" : "edit-delete", - phys); + property_pixbuf() = sp_get_icon_pixbuf((active ? "list-add" : "edit-delete"), GTK_ICON_SIZE_BUTTON); } diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h index 60c773e84814b41940f60dc95656eaa2756ac5a1..c17ae907a155f02c88dbd5a805b3e8f45c3dd99a 100644 --- a/src/ui/widget/addtoicon.h +++ b/src/ui/widget/addtoicon.h @@ -54,7 +54,6 @@ protected: private: - int phys; ///< Physical size of the icon (px) // Glib::ustring _pixAddName; diff --git a/src/ui/widget/alignment-selector.cpp b/src/ui/widget/alignment-selector.cpp index c6c95f097b25711ccf7b8b917a2c7f2ae2665eb6..9256a08bd02c3a6b2719b2d4934fa793e2db4216 100644 --- a/src/ui/widget/alignment-selector.cpp +++ b/src/ui/widget/alignment-selector.cpp @@ -5,6 +5,7 @@ */ #include "ui/widget/alignment-selector.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include @@ -14,8 +15,7 @@ namespace UI { namespace Widget { void AlignmentSelector::setupButton(const Glib::ustring& icon, Gtk::Button& button) { - Gtk::Image* buttonIcon = Gtk::manage(new Gtk::Image()); - buttonIcon->set_from_icon_name(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR); + Gtk::Image *buttonIcon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR)); buttonIcon->show(); button.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index 52768b7f1503a85fe40dd9dd265101237d77cb47..a92dbd68ee14a40c7214f3687f03b5db4b534174 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -6,8 +6,8 @@ * * Released under GNU GPL. Read the file 'COPYING' for more information. */ - #include "ui/widget/anchor-selector.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include @@ -17,43 +17,41 @@ namespace UI { namespace Widget { void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& button) { - Gtk::Image* buttonIcon = Gtk::manage(new Gtk::Image()); - buttonIcon->set_from_icon_name(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR); - buttonIcon->show(); + Gtk::Image *buttonIcon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR)); + buttonIcon->show(); - button.set_relief(Gtk::RELIEF_NONE); - button.show(); - button.add(*buttonIcon); - button.set_can_focus(false); + button.set_relief(Gtk::RELIEF_NONE); + button.show(); + button.add(*buttonIcon); + button.set_can_focus(false); } AnchorSelector::AnchorSelector() : _container() { set_halign(Gtk::ALIGN_CENTER); - setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); - setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); - setupButton(INKSCAPE_ICON("boundingbox_top_right"), _buttons[2]); - setupButton(INKSCAPE_ICON("boundingbox_left"), _buttons[3]); - setupButton(INKSCAPE_ICON("boundingbox_center"), _buttons[4]); - setupButton(INKSCAPE_ICON("boundingbox_right"), _buttons[5]); - setupButton(INKSCAPE_ICON("boundingbox_bottom_left"), _buttons[6]); - setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); - setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); - - _container.set_row_homogeneous(); - _container.set_column_homogeneous(true); - - for(int i = 0; i < 9; ++i) { - _buttons[i].signal_clicked().connect( - sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); - - _container.attach(_buttons[i], i % 3, i / 3, 1, 1); - } - _selection = 4; - _buttons[4].set_active(); - - this->add(_container); + setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); + setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); + setupButton(INKSCAPE_ICON("boundingbox_top_right"), _buttons[2]); + setupButton(INKSCAPE_ICON("boundingbox_left"), _buttons[3]); + setupButton(INKSCAPE_ICON("boundingbox_center"), _buttons[4]); + setupButton(INKSCAPE_ICON("boundingbox_right"), _buttons[5]); + setupButton(INKSCAPE_ICON("boundingbox_bottom_left"), _buttons[6]); + setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); + setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); + + _container.set_row_homogeneous(); + _container.set_column_homogeneous(true); + + for (int i = 0; i < 9; ++i) { + _buttons[i].signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); + + _container.attach(_buttons[i], i % 3, i / 3, 1, 1); + } + _selection = 4; + _buttons[4].set_active(); + + this->add(_container); } AnchorSelector::~AnchorSelector() @@ -63,27 +61,23 @@ AnchorSelector::~AnchorSelector() void AnchorSelector::btn_activated(int index) { - - if(_selection == index && _buttons[index].get_active() == false) - { - _buttons[index].set_active(true); - } - else if(_selection != index && _buttons[index].get_active()) - { - int old_selection = _selection; - _selection = index; - _buttons[old_selection].set_active(false); - _selectionChanged.emit(); - } + if (_selection == index && _buttons[index].get_active() == false) { + _buttons[index].set_active(true); + } + else if (_selection != index && _buttons[index].get_active()) { + int old_selection = _selection; + _selection = index; + _buttons[old_selection].set_active(false); + _selectionChanged.emit(); + } } void AnchorSelector::setAlignment(int horizontal, int vertical) { - int index = 3 * vertical + horizontal; - if(index >= 0 && index < 9) - { - _buttons[index].set_active(!_buttons[index].get_active()); - } + int index = 3 * vertical + horizontal; + if (index >= 0 && index < 9) { + _buttons[index].set_active(!_buttons[index].get_active()); + } } } // namespace Widget diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 509e218a99c6d6a399135f921fa507d77d1e5cee..704b5c653c1d9d05525a1c51584d673e094f2bbf 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -13,11 +13,10 @@ #include "ui/widget/clipmaskicon.h" -#include - -#include "widgets/toolbox.h" -#include "ui/icon-names.h" +#include "helper/icon-loader.h" #include "layertypeicon.h" +#include "ui/icon-names.h" +#include "widgets/toolbox.h" namespace Inkscape { namespace UI { @@ -37,14 +36,9 @@ ClipMaskIcon::ClipMaskIcon() : property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); - phys = width; - - Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - _property_pixbuf_clip = icon_theme->load_icon(_pixClipName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_clip = sp_get_icon_pixbuf(_pixClipName, GTK_ICON_SIZE_MENU); + _property_pixbuf_mask = sp_get_icon_pixbuf(_pixMaskName, GTK_ICON_SIZE_MENU); + _property_pixbuf_both = sp_get_icon_pixbuf(_pixBothName, GTK_ICON_SIZE_MENU); property_pixbuf() = Glib::RefPtr(nullptr); } diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 5b0f12e51a16f8b4f9d801d4a7ec65f48acaceaa..2d8dcc310577d898b2347ef9dc0f97b1952e9779 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -30,6 +30,7 @@ #include "preferences.h" #include "profile-manager.h" +#include "helper/icon-loader.h" #include "object/color-profile.h" #include "svg/svg-icc-color.h" @@ -159,21 +160,22 @@ void ColorNotebook::_initUI() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create color management icons */ _box_colormanaged = gtk_event_box_new(); - GtkWidget *colormanaged = gtk_image_new_from_icon_name("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *colormanaged = + GTK_WIDGET(sp_get_icon_image("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_container_add(GTK_CONTAINER(_box_colormanaged), colormanaged); gtk_widget_set_tooltip_text(_box_colormanaged, _("Color Managed")); gtk_widget_set_sensitive(_box_colormanaged, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_colormanaged, FALSE, FALSE, 2); _box_outofgamut = gtk_event_box_new(); - GtkWidget *outofgamut = gtk_image_new_from_icon_name("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *outofgamut = GTK_WIDGET(sp_get_icon_image("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_container_add(GTK_CONTAINER(_box_outofgamut), outofgamut); gtk_widget_set_tooltip_text(_box_outofgamut, _("Out of gamut!")); gtk_widget_set_sensitive(_box_outofgamut, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_outofgamut, FALSE, FALSE, 2); _box_toomuchink = gtk_event_box_new(); - GtkWidget *toomuchink = gtk_image_new_from_icon_name("too-much-ink-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *toomuchink = GTK_WIDGET(sp_get_icon_image("too-much-ink-icon", GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_container_add(GTK_CONTAINER(_box_toomuchink), toomuchink); gtk_widget_set_tooltip_text(_box_toomuchink, _("Too much ink!")); gtk_widget_set_sensitive(_box_toomuchink, false); @@ -182,7 +184,7 @@ void ColorNotebook::_initUI() /* Color picker */ - GtkWidget *picker = gtk_image_new_from_icon_name("color-picker", GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *picker = GTK_WIDGET(sp_get_icon_image("color-picker", GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); _btn_picker = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(_btn_picker), GTK_RELIEF_NONE); gtk_container_add(GTK_CONTAINER(_btn_picker), picker); diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 7cd841d882c749f6f11b89329293e1215fe6a164..c85abd6de8b28ab7be4e1996cde9b7fe93fea6fd 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -10,11 +10,11 @@ #include "ui/widget/dock.h" #include "desktop.h" +#include "helper/icon-loader.h" #include "inkscape.h" #include "ui/icon-names.h" - -#include #include +#include namespace Inkscape { namespace UI { @@ -31,6 +31,7 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l _grab_focus_on_realize(false), _gdl_dock_item(nullptr) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GdlDockItemBehavior gdl_dock_behavior = (prefs->getBool("/options/dock/cancenterdock", true) ? @@ -39,17 +40,7 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l if (!icon_name.empty()) { - Glib::RefPtr iconTheme = Gtk::IconTheme::get_default(); - - int width = 0; - int height = 0; - Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height); - try { - _icon_pixbuf = iconTheme->load_icon(icon_name, width); - } - catch (const Gtk::IconThemeError& e) { - std::cerr << "DocItem::DocItem(): " << e.what() << std::endl; - } + _icon_pixbuf = sp_get_icon_pixbuf(icon_name, "/toolbox/secondary"); } if ( _icon_pixbuf ) { diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 1200144f120e3d3c1212a8a3d2fe5038ca2efc8f..76b48fbbe1500eaab073e2eed03161bbe3685667 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -11,10 +11,9 @@ #include "ui/widget/imagetoggler.h" -#include - -#include "widgets/toolbox.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" +#include "widgets/toolbox.h" #include @@ -34,18 +33,8 @@ ImageToggler::ImageToggler( char const* on, char const* off) : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); - int phys = width; - - Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - try { - _property_pixbuf_on = icon_theme->load_icon(_pixOnName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_off = icon_theme->load_icon(_pixOffName, phys, (Gtk::IconLookupFlags)0); - } - catch (const Gtk::IconThemeError& e) { - std::cerr << "ImageToggler::ImageToggler(): " << e.what() << std::endl; - } + _property_pixbuf_on = sp_get_icon_pixbuf(_pixOnName, GTK_ICON_SIZE_MENU); + _property_pixbuf_off = sp_get_icon_pixbuf(_pixOffName, GTK_ICON_SIZE_MENU); property_pixbuf() = _property_pixbuf_off.get_value(); } diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index d402aca37fc5d4653494fff8d04635c018b74bb5..1343786a128e7a6ec6b21fb358f367961efa1103 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -8,12 +8,11 @@ */ #include "ui/widget/insertordericon.h" - -#include -#include "widgets/toolbox.h" -#include "ui/icon-names.h" +#include "helper/icon-loader.h" #include "layertypeicon.h" +#include "ui/icon-names.h" +#include "widgets/toolbox.h" namespace Inkscape { namespace UI { @@ -31,13 +30,8 @@ InsertOrderIcon::InsertOrderIcon() : property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); - phys=width; - - Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - _property_pixbuf_top = icon_theme->load_icon(_pixTopName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_bottom = icon_theme->load_icon(_pixBottomName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_top = sp_get_icon_pixbuf(_pixTopName, GTK_ICON_SIZE_MENU); + _property_pixbuf_bottom = sp_get_icon_pixbuf(_pixBottomName, GTK_ICON_SIZE_MENU); property_pixbuf() = Glib::RefPtr(nullptr); } diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 2e98400358e3c29782175d9a015fc8b54c22970e..6ee2b752f75472daf816b3bddad3e4ceca1b81de 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -12,8 +12,8 @@ # include #endif +#include "helper/icon-loader.h" #include "labelled.h" - #include #include @@ -32,8 +32,7 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, { g_assert(g_utf8_validate(icon.c_str(), -1, nullptr)); if (icon != "") { - _icon = Gtk::manage(new Gtk::Image()); - _icon->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); + _icon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR)); pack_start(*_icon, Gtk::PACK_SHRINK); } pack_start(*Gtk::manage(_label), Gtk::PACK_EXPAND_WIDGET, 6); diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index b862224043e10e20a43f0d6384b4b976c296516f..c8aefa656656296be0ea1ce9521f165d0c0a7cbc 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -17,10 +17,11 @@ #include #include +#include "helper/icon-loader.h" #include "ui/dialog/layer-properties.h" -#include #include #include +#include #include "desktop.h" @@ -46,14 +47,12 @@ public: { set_name("AlternateIcons"); if (!a.empty()) { - _a = Gtk::manage(new Gtk::Image()); - _a->set_from_icon_name(a, size); + _a = Gtk::manage(sp_get_icon_image(a, size)); _a->set_no_show_all(true); add(*_a); } if (!b.empty()) { - _b = Gtk::manage(new Gtk::Image()); - _b->set_from_icon_name(b, size); + _b = Gtk::manage(sp_get_icon_image(b, size)); _b->set_no_show_all(true); add(*_b); } diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 278bd317b1c4142745f5f0f63fae560a736af362..356531620b54b17896faf4b1a3edce24d7ea5ac6 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -13,10 +13,9 @@ #include "ui/widget/layertypeicon.h" -#include - -#include "widgets/toolbox.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" +#include "widgets/toolbox.h" namespace Inkscape { namespace UI { @@ -36,14 +35,10 @@ LayerTypeIcon::LayerTypeIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); - int phys = width; - - Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - _property_pixbuf_layer = icon_theme->load_icon(_pixLayerName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_group = icon_theme->load_icon(_pixGroupName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_path = icon_theme->load_icon(_pixPathName, phys, (Gtk::IconLookupFlags)0); + + _property_pixbuf_layer = sp_get_icon_pixbuf(_pixLayerName, GTK_ICON_SIZE_MENU); + _property_pixbuf_group = sp_get_icon_pixbuf(_pixGroupName, GTK_ICON_SIZE_MENU); + _property_pixbuf_path = sp_get_icon_pixbuf(_pixPathName, GTK_ICON_SIZE_MENU); property_pixbuf() = _property_pixbuf_path.get_value(); } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index fee3926323192a78fc225f45097aa8a83b60b8b8..584c4fb6dc68fd21f46f3c1cca1b9e4a5f4b3eec 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -34,6 +34,7 @@ #include "io/sys.h" +#include "helper/icon-loader.h" #include "ui/dialog/filedialog.h" #include "ui/widget/preferences-widget.h" @@ -633,6 +634,57 @@ void PrefCombo::init(Glib::ustring const &prefs_path, this->set_active(row); } +void PrefCombo::init(Glib::ustring const &prefs_path, std::vector labels, std::vector values, + int default_value) +{ + size_t labels_size = labels.size(); + size_t values_size = values.size(); + if (values_size != labels_size) { + std::cout << "PrefCombo::" + << "Diferent number of values/labels in " << prefs_path << std::endl; + return; + } + _prefs_path = prefs_path; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int row = 0; + int value = prefs->getInt(_prefs_path, default_value); + + for (int i = 0; i < labels_size; ++i) { + this->append(labels[i]); + _values.push_back(values[i]); + if (value == values[i]) + row = i; + } + this->set_active(row); +} + +void PrefCombo::init(Glib::ustring const &prefs_path, std::vector labels, + std::vector values, Glib::ustring default_value) +{ + size_t labels_size = labels.size(); + size_t values_size = values.size(); + if (values_size != labels_size) { + std::cout << "PrefCombo::" + << "Diferent number of values/labels in " << prefs_path << std::endl; + return; + } + _prefs_path = prefs_path; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + int row = 0; + Glib::ustring value = prefs->getString(_prefs_path); + if (value.empty()) { + value = default_value; + } + + for (int i = 0; i < labels_size; ++i) { + this->append(labels[i]); + _ustr_values.push_back(values[i]); + if (value == values[i]) + row = i; + } + this->set_active(row); +} + void PrefCombo::on_changed() { if (this->get_visible()) //only take action if user changed value @@ -705,9 +757,7 @@ void PrefEntryFileButtonHBox::init(Glib::ustring const &prefs_path, relatedButton = new Gtk::Button(); Gtk::HBox* pixlabel = new Gtk::HBox(false, 3); - Gtk::Image *im = new Gtk::Image(); - im->set_from_icon_name("applications-graphics", - Gtk::ICON_SIZE_BUTTON); + Gtk::Image *im = sp_get_icon_image("applications-graphics", Gtk::ICON_SIZE_BUTTON); pixlabel->pack_start(*im); Gtk::Label *l = new Gtk::Label(); l->set_markup_with_mnemonic(_("_Browse...")); @@ -830,6 +880,39 @@ bool PrefEntryFileButtonHBox::on_mnemonic_activate ( bool group_cycling ) return relatedEntry->mnemonic_activate ( group_cycling ); } +void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const &tooltip) +{ + relatedEntry = new Gtk::Entry(); + relatedButton = new Gtk::Button(); + Gtk::HBox *pixlabel = new Gtk::HBox(false, 3); + Gtk::Image *im = sp_get_icon_image("document-open", Gtk::ICON_SIZE_BUTTON); + pixlabel->pack_start(*im); + Gtk::Label *l = new Gtk::Label(); + l->set_markup_with_mnemonic(_("Open")); + pixlabel->pack_start(*l); + relatedButton->add(*pixlabel); + relatedButton->set_tooltip_text(tooltip); + relatedEntry->set_text(entry_string); + relatedEntry->set_sensitive(false); + this->pack_end(*relatedButton, false, false, 4); + this->pack_start(*relatedEntry, true, true, 0); + relatedButton->signal_clicked().connect(sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); +} + +void PrefOpenFolder::onRelatedButtonClickedCallback() +{ + g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); + GError *error = NULL; +#ifdef WIN32 + ShellExecute(NULL, "open", relatedEntry->get_text().c_str(), NULL, NULL, SW_SHOWDEFAULT); +#else + if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text().c_str(), NULL, &error), NULL, + &error)) { + g_warning("Failed to open uri: %s", error->message); + } +#endif +} + void PrefFileButton::init(Glib::ustring const &prefs_path) { _prefs_path = prefs_path; diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 8e1602ff9a48a9e3dd0be15d7064f7bb10d41b7b..80cbf46b65e190c5af0465f25c11197f128aeb22 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -181,7 +181,17 @@ public: */ void init(Glib::ustring const &prefs_path, Glib::ustring labels[], Glib::ustring values[], int num_items, Glib::ustring default_value); -protected: + /** + * Initialize a combo box. + * with vectors. + */ + void init(Glib::ustring const &prefs_path, std::vector labels, std::vector values, + int default_value); + + void init(Glib::ustring const &prefs_path, std::vector labels, std::vector values, + Glib::ustring default_value); + + protected: Glib::ustring _prefs_path; std::vector _values; std::vector _ustr_values; ///< string key values used optionally instead of numeric _values @@ -237,6 +247,16 @@ protected: bool on_mnemonic_activate( bool group_cycling ) override; }; +class PrefOpenFolder : public Gtk::HBox { + public: + void init(Glib::ustring const &entry_string, Glib::ustring const &tooltip); + + protected: + Gtk::Button *relatedButton; + Gtk::Entry *relatedEntry; + void onRelatedButtonClickedCallback(); +}; + class PrefFileButton : public Gtk::FileChooserButton { public: diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 237144c7ce855c6b98ba946f1ac786545713dba3..3bda641d7aea8206d09feb47811d1bfe695fbb7e 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -14,8 +14,8 @@ #endif +#include "helper/icon-loader.h" #include "random.h" - #include #include @@ -70,8 +70,7 @@ void Random::setStartSeed(long newseed) void Random::addReseedButton() { - Gtk::Image* pIcon = Gtk::manage(new Gtk::Image()); - pIcon->set_from_icon_name( "randomize", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *pIcon = Gtk::manage(sp_get_icon_image("randomize", Gtk::ICON_SIZE_BUTTON)); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/verbs.cpp b/src/verbs.cpp index f859f672ba6ca4cb3050abcb69dc464ab0e20ead..0bbfeb1fbe9f33febc1291c1e1f5704e1e99f563 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2603,48 +2603,50 @@ Verb *Verb::_base_verbs[] = { // File new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("_New"), N_("Create new document from the default template"), INKSCAPE_ICON("document-new")), - new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."), - N_("Open an existing document"), INKSCAPE_ICON("document-open")), + new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."), N_("Open an existing document"), + INKSCAPE_ICON("document-open")), new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"), - N_("Revert to the last saved version of document (changes will be lost)"), INKSCAPE_ICON("document-revert")), - new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"), - INKSCAPE_ICON("document-save")), - new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."), - N_("Save document under a new name"), INKSCAPE_ICON("document-save-as")), + N_("Revert to the last saved version of document (changes will be lost)"), + INKSCAPE_ICON("document-revert")), + new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"), INKSCAPE_ICON("document-save")), + new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."), N_("Save document under a new name"), + INKSCAPE_ICON("document-save-as")), new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."), - N_("Save a copy of the document under a new name"), nullptr ), + N_("Save a copy of the document under a new name"), nullptr), new FileVerb(SP_VERB_FILE_SAVE_TEMPLATE, "FileSaveTemplate", N_("Save template ..."), - N_("Save a copy of the document as template"), nullptr ), + N_("Save a copy of the document as template"), nullptr), new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"), INKSCAPE_ICON("document-print")), // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions) - new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Clean _up document"), N_("Remove unused definitions (such as gradients or clipping paths) from the <defs> of the document"), - INKSCAPE_ICON("document-cleanup") ), + new FileVerb( + SP_VERB_FILE_VACUUM, "FileVacuum", N_("Clean _up document"), + N_("Remove unused definitions (such as gradients or clipping paths) from the <defs> of the document"), + INKSCAPE_ICON("document-cleanup")), new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."), N_("Import a bitmap or SVG image into this document"), INKSCAPE_ICON("document-import")), -// new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."), N_("Export this document or a selection as a bitmap image"), INKSCAPE_ICON("document-export")), + // new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."), N_("Export this document or a + // selection as a bitmap image"), INKSCAPE_ICON("document-export")), new FileVerb(SP_VERB_FILE_IMPORT_FROM_OCAL, "FileImportFromOCAL", N_("Import Clip Art..."), - N_("Import clipart from Open Clip Art Library"), INKSCAPE_ICON("document-import-ocal")), -// new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL), - new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"), - N_("Switch to the next document window"), INKSCAPE_ICON("window-next")), + N_("Import clipart from Open Clip Art Library"), INKSCAPE_ICON("document-import-ocal")), + // new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), + // N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL), + new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"), N_("Switch to the next document window"), + INKSCAPE_ICON("window-next")), new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"), N_("Switch to the previous document window"), INKSCAPE_ICON("window-previous")), - new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"), - N_("Close this document window"), INKSCAPE_ICON("window-close")), + new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"), N_("Close this document window"), + INKSCAPE_ICON("window-close")), new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), INKSCAPE_ICON("application-exit")), new FileVerb(SP_VERB_FILE_TEMPLATES, "FileTemplates", N_("New from _Template..."), - N_("Create new project from template"), INKSCAPE_ICON("dialog-templates")), + N_("Create new project from template"), INKSCAPE_ICON("dialog-templates")), // Edit - new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"), - INKSCAPE_ICON("edit-undo")), - new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"), - N_("Do again the last undone action"), INKSCAPE_ICON("edit-redo")), - new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"), - N_("Cut selection to clipboard"), INKSCAPE_ICON("edit-cut")), - new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"), - N_("Copy selection to clipboard"), INKSCAPE_ICON("edit-copy")), + new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"), INKSCAPE_ICON("edit-undo")), + new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"), N_("Do again the last undone action"), + INKSCAPE_ICON("edit-redo")), + new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"), N_("Cut selection to clipboard"), INKSCAPE_ICON("edit-cut")), + new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"), N_("Copy selection to clipboard"), + INKSCAPE_ICON("edit-copy")), new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"), N_("Paste objects from clipboard to mouse point, or paste text"), INKSCAPE_ICON("edit-paste")), new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"), @@ -2669,16 +2671,18 @@ Verb *Verb::_base_verbs[] = { N_("Remove any path effects from selected objects"), nullptr), new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("_Remove Filters"), N_("Remove any filters from selected objects"), nullptr), - new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), - N_("Delete selection"), INKSCAPE_ICON("edit-delete")), - new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"), - N_("Duplicate selected objects"), INKSCAPE_ICON("edit-duplicate")), + new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), N_("Delete selection"), + INKSCAPE_ICON("edit-delete")), + new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"), N_("Duplicate selected objects"), + INKSCAPE_ICON("edit-duplicate")), new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"), N_("Create a clone (a copy linked to the original) of selected object"), INKSCAPE_ICON("edit-clone")), new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"), - N_("Cut the selected clones' links to the originals, turning them into standalone objects"), INKSCAPE_ICON("edit-clone-unlink")), + N_("Cut the selected clones' links to the originals, turning them into standalone objects"), + INKSCAPE_ICON("edit-clone-unlink")), new EditVerb(SP_VERB_EDIT_UNLINK_CLONE_RECURSIVE, "EditUnlinkCloneRecursive", N_("Unlink Clones _recursively"), - N_("Unlink all clones in the selection, even if they are in groups."), INKSCAPE_ICON("edit-clone-unlink")), + N_("Unlink all clones in the selection, even if they are in groups."), + INKSCAPE_ICON("edit-clone-unlink")), new EditVerb(SP_VERB_EDIT_RELINK_CLONE, "EditRelinkClone", N_("Relink to Copied"), N_("Relink the selected clones to the object currently on the clipboard"), nullptr), new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"), @@ -2693,55 +2697,63 @@ Verb *Verb::_base_verbs[] = { N_("Convert selection to a rectangle with tiled pattern fill"), nullptr), new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"), N_("Extract objects from a tiled pattern fill"), nullptr), - new EditVerb(SP_VERB_EDIT_SYMBOL, "ObjectsToSymbol", N_("Group to Symbol"), - N_("Convert group to a symbol"), nullptr), - new EditVerb(SP_VERB_EDIT_UNSYMBOL, "ObjectsFromSymbol", N_("Symbol to Group"), - N_("Extract group from a symbol"), nullptr), - new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"), - N_("Delete all objects from document"), nullptr), - new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"), - N_("Select all objects or all nodes"), INKSCAPE_ICON("edit-select-all")), + new EditVerb(SP_VERB_EDIT_SYMBOL, "ObjectsToSymbol", N_("Group to Symbol"), N_("Convert group to a symbol"), + nullptr), + new EditVerb(SP_VERB_EDIT_UNSYMBOL, "ObjectsFromSymbol", N_("Symbol to Group"), N_("Extract group from a symbol"), + nullptr), + new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"), N_("Delete all objects from document"), + nullptr), + new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"), N_("Select all objects or all nodes"), + INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"), N_("Select all objects in all visible and unlocked layers"), INKSCAPE_ICON("edit-select-all-layers")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_FILL_STROKE, "EditSelectSameFillStroke", N_("Fill _and Stroke"), - N_("Select all objects with the same fill and stroke as the selected objects"), INKSCAPE_ICON("edit-select-all")), + N_("Select all objects with the same fill and stroke as the selected objects"), + INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_FILL_COLOR, "EditSelectSameFillColor", N_("_Fill Color"), - N_("Select all objects with the same fill as the selected objects"), INKSCAPE_ICON("edit-select-all")), + N_("Select all objects with the same fill as the selected objects"), INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_COLOR, "EditSelectSameStrokeColor", N_("_Stroke Color"), - N_("Select all objects with the same stroke as the selected objects"), INKSCAPE_ICON("edit-select-all")), + N_("Select all objects with the same stroke as the selected objects"), + INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_STYLE, "EditSelectSameStrokeStyle", N_("Stroke St_yle"), - N_("Select all objects with the same stroke style (width, dash, markers) as the selected objects"), INKSCAPE_ICON("edit-select-all")), - new EditVerb(SP_VERB_EDIT_SELECT_SAME_OBJECT_TYPE, "EditSelectSameObjectType", N_("_Object Type"), - N_("Select all objects with the same object type (rect, arc, text, path, bitmap etc) as the selected objects"), INKSCAPE_ICON("edit-select-all")), + N_("Select all objects with the same stroke style (width, dash, markers) as the selected objects"), + INKSCAPE_ICON("edit-select-all")), + new EditVerb( + SP_VERB_EDIT_SELECT_SAME_OBJECT_TYPE, "EditSelectSameObjectType", N_("_Object Type"), + N_("Select all objects with the same object type (rect, arc, text, path, bitmap etc) as the selected objects"), + INKSCAPE_ICON("edit-select-all")), new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"), - N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON("edit-select-invert")), + N_("Invert selection (unselect what is selected and select everything else)"), + INKSCAPE_ICON("edit-select-invert")), new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"), N_("Invert selection in all visible and unlocked layers"), nullptr), - new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"), - N_("Select next object or node"), nullptr), + new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"), N_("Select next object or node"), + nullptr), new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"), N_("Select previous object or node"), nullptr), - new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"), - N_("Deselect any selected objects or nodes"), INKSCAPE_ICON("edit-select-none")), + new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"), N_("Deselect any selected objects or nodes"), + INKSCAPE_ICON("edit-select-none")), new EditVerb(SP_VERB_EDIT_DELETE_ALL_GUIDES, "EditRemoveAllGuides", N_("Delete All Guides"), N_("Delete all the guides in the document"), nullptr), - new EditVerb(SP_VERB_EDIT_GUIDES_TOGGLE_LOCK, "EditGuidesToggleLock", N_("Lock All Guides"), N_("Toggle lock of all guides in the document"), nullptr), + new EditVerb(SP_VERB_EDIT_GUIDES_TOGGLE_LOCK, "EditGuidesToggleLock", N_("Lock All Guides"), + N_("Toggle lock of all guides in the document"), nullptr), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("Create _Guides Around the Page"), N_("Create four guides aligned with the page borders"), nullptr), - new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"), - N_("Show next editable path effect parameter"), INKSCAPE_ICON("path-effect-parameter-next")), + new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", + N_("Next path effect parameter"), N_("Show next editable path effect parameter"), + INKSCAPE_ICON("path-effect-parameter-next")), new EditVerb(SP_VERB_EDIT_SWAP_FILL_STROKE, "EditSwapFillStroke", N_("Swap fill and stroke"), N_("Swap fill and stroke of an object"), nullptr), // Selection - new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"), - N_("Raise selection to top"), INKSCAPE_ICON("selection-top")), + new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"), N_("Raise selection to top"), + INKSCAPE_ICON("selection-top")), new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"), N_("Lower selection to bottom"), INKSCAPE_ICON("selection-bottom")), - new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"), - N_("Raise selection one step"), INKSCAPE_ICON("selection-raise")), - new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"), - N_("Lower selection one step"), INKSCAPE_ICON("selection-lower")), + new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"), N_("Raise selection one step"), + INKSCAPE_ICON("selection-raise")), + new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"), N_("Lower selection one step"), + INKSCAPE_ICON("selection-lower")), new SelectionVerb(SP_VERB_SELECTION_STACK_UP, "SelectionStackUp", N_("_Stack up"), @@ -2750,44 +2762,47 @@ Verb *Verb::_base_verbs[] = { N_("Stack selection one step down"), INKSCAPE_ICON("layer-lower")), - new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"), - N_("Group selected objects"), INKSCAPE_ICON("object-group")), - new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"), - N_("Ungroup selected groups"), INKSCAPE_ICON("object-ungroup")), - new SelectionVerb(SP_VERB_SELECTION_UNGROUP_POP_SELECTION, "SelectionUnGroupPopSelection", N_("_Pop selected objects out of group"), - N_("Pop selected objects out of group"), INKSCAPE_ICON("object-ungroup-pop-selection")), + new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"), N_("Group selected objects"), + INKSCAPE_ICON("object-group")), + new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"), N_("Ungroup selected groups"), + INKSCAPE_ICON("object-ungroup")), + new SelectionVerb(SP_VERB_SELECTION_UNGROUP_POP_SELECTION, "SelectionUnGroupPopSelection", + N_("_Pop selected objects out of group"), N_("Pop selected objects out of group"), + INKSCAPE_ICON("object-ungroup-pop-selection")), - new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"), - N_("Put text on path"), INKSCAPE_ICON("text-put-on-path")), + new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"), N_("Put text on path"), + INKSCAPE_ICON("text-put-on-path")), new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"), N_("Remove text from path"), INKSCAPE_ICON("text-remove-from-path")), new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"), // TRANSLATORS: "glyph": An image used in the visual representation of characters; // roughly speaking, how a character looks. A font is a set of glyphs. - N_("Remove all manual kerns and glyph rotations from a text object"), INKSCAPE_ICON("text-unkern")), + N_("Remove all manual kerns and glyph rotations from a text object"), + INKSCAPE_ICON("text-unkern")), - new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"), - N_("Create union of selected paths"), INKSCAPE_ICON("path-union")), + new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"), N_("Create union of selected paths"), + INKSCAPE_ICON("path-union")), new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"), N_("Create intersection of selected paths"), INKSCAPE_ICON("path-intersection")), new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"), N_("Create difference of selected paths (bottom minus top)"), INKSCAPE_ICON("path-difference")), new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"), - N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), INKSCAPE_ICON("path-exclusion")), - new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"), - N_("Cut the bottom path into pieces"), INKSCAPE_ICON("path-division")), + N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), + INKSCAPE_ICON("path-exclusion")), + new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"), N_("Cut the bottom path into pieces"), + INKSCAPE_ICON("path-division")), // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the // Advanced tutorial for more info new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"), N_("Cut the bottom path's stroke into pieces, removing fill"), INKSCAPE_ICON("path-cut")), - new SelectionVerb(SP_VERB_SELECTION_GROW, "SelectionGrow", N_("_Grow"), - N_("Make selected objects bigger"), INKSCAPE_ICON("selection-grow")), + new SelectionVerb(SP_VERB_SELECTION_GROW, "SelectionGrow", N_("_Grow"), N_("Make selected objects bigger"), + INKSCAPE_ICON("selection-grow")), new SelectionVerb(SP_VERB_SELECTION_GROW_SCREEN, "SelectionGrowScreen", N_("_Grow on screen"), N_("Make selected objects bigger relative to screen"), INKSCAPE_ICON("selection-grow-screen")), new SelectionVerb(SP_VERB_SELECTION_GROW_DOUBLE, "SelectionGrowDouble", N_("_Double size"), N_("Double the size of selected objects"), INKSCAPE_ICON("selection-grow-double")), - new SelectionVerb(SP_VERB_SELECTION_SHRINK, "SelectionShrink", N_("_Shrink"), - N_("Make selected objects smaller"), INKSCAPE_ICON("selection-shrink")), + new SelectionVerb(SP_VERB_SELECTION_SHRINK, "SelectionShrink", N_("_Shrink"), N_("Make selected objects smaller"), + INKSCAPE_ICON("selection-shrink")), new SelectionVerb(SP_VERB_SELECTION_SHRINK_SCREEN, "SelectionShrinkScreen", N_("_Shrink on screen"), N_("Make selected objects smaller relative to screen"), INKSCAPE_ICON("selection-shrink-screen")), new SelectionVerb(SP_VERB_SELECTION_SHRINK_HALVE, "SelectionShrinkHalve", N_("_Halve size"), @@ -2795,29 +2810,24 @@ Verb *Verb::_base_verbs[] = { // TRANSLATORS: "outset": expand a shape by offsetting the object's path, // i.e. by displacing it perpendicular to the path in each point. // See also the Advanced Tutorial for explanation. - new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"), - N_("Outset selected paths"), INKSCAPE_ICON("path-outset")), - new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen", - N_("O_utset Path by 1 px"), + new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"), N_("Outset selected paths"), + INKSCAPE_ICON("path-outset")), + new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen", N_("O_utset Path by 1 px"), N_("Outset selected paths by 1 px"), nullptr), - new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10", - N_("O_utset Path by 10 px"), + new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10", N_("O_utset Path by 10 px"), N_("Outset selected paths by 10 px"), nullptr), // TRANSLATORS: "inset": contract a shape by offsetting the object's path, // i.e. by displacing it perpendicular to the path in each point. // See also the Advanced Tutorial for explanation. - new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"), - N_("Inset selected paths"), INKSCAPE_ICON("path-inset")), - new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen", - N_("I_nset Path by 1 px"), + new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"), N_("Inset selected paths"), + INKSCAPE_ICON("path-inset")), + new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen", N_("I_nset Path by 1 px"), N_("Inset selected paths by 1 px"), nullptr), - new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10", - N_("I_nset Path by 10 px"), + new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10", N_("I_nset Path by 10 px"), N_("Inset selected paths by 10 px"), nullptr), - new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset", - N_("D_ynamic Offset"), N_("Create a dynamic offset object"), INKSCAPE_ICON("path-offset-dynamic")), - new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset", - N_("_Linked Offset"), + new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset", N_("D_ynamic Offset"), + N_("Create a dynamic offset object"), INKSCAPE_ICON("path-offset-dynamic")), + new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset", N_("_Linked Offset"), N_("Create a dynamic offset object linked to the original path"), INKSCAPE_ICON("path-offset-linked")), new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"), @@ -2827,7 +2837,8 @@ Verb *Verb::_base_verbs[] = { new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"), N_("Simplify selected paths (remove extra nodes)"), INKSCAPE_ICON("path-simplify")), new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"), - N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON("path-reverse")), + N_("Reverse the direction of selected paths (useful for flipping markers)"), + INKSCAPE_ICON("path-reverse")), #if HAVE_POTRACE // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) @@ -2836,9 +2847,11 @@ Verb *Verb::_base_verbs[] = { #endif new SelectionVerb(SP_VERB_SELECTION_PIXEL_ART, "SelectionPixelArt", N_("Trace Pixel Art..."), - N_("Create paths using Kopf-Lischinski algorithm to vectorize pixel art"), INKSCAPE_ICON("pixelart-trace")), + N_("Create paths using Kopf-Lischinski algorithm to vectorize pixel art"), + INKSCAPE_ICON("pixelart-trace")), new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("Make a _Bitmap Copy"), - N_("Export selection to a bitmap and insert it into document"), INKSCAPE_ICON("selection-make-bitmap-copy") ), + N_("Export selection to a bitmap and insert it into document"), + INKSCAPE_ICON("selection-make-bitmap-copy")), new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"), N_("Combine several paths into one"), INKSCAPE_ICON("path-combine")), // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the @@ -2848,10 +2861,10 @@ Verb *Verb::_base_verbs[] = { new SelectionVerb(SP_VERB_SELECTION_ARRANGE, "DialogArrange", N_("_Arrange..."), N_("Arrange selected objects in a table or circle"), INKSCAPE_ICON("dialog-rows-and-columns")), // Layer - new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."), - N_("Create a new layer"), INKSCAPE_ICON("layer-new")), - new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."), - N_("Rename the current layer"), INKSCAPE_ICON("layer-rename")), + new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."), N_("Create a new layer"), + INKSCAPE_ICON("layer-new")), + new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."), N_("Rename the current layer"), + INKSCAPE_ICON("layer-rename")), new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"), N_("Switch to the layer above the current"), INKSCAPE_ICON("layer-previous")), new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"), @@ -2860,32 +2873,29 @@ Verb *Verb::_base_verbs[] = { N_("Move selection to the layer above the current"), INKSCAPE_ICON("selection-move-to-layer-above")), new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"), N_("Move selection to the layer below the current"), INKSCAPE_ICON("selection-move-to-layer-below")), - new LayerVerb(SP_VERB_LAYER_MOVE_TO, "LayerMoveTo", N_("Move Selection to Layer..."), - N_("Move selection to layer"), INKSCAPE_ICON("layer-rename")), - new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"), - N_("Raise the current layer to the top"), INKSCAPE_ICON("layer-top")), + new LayerVerb(SP_VERB_LAYER_MOVE_TO, "LayerMoveTo", N_("Move Selection to Layer..."), N_("Move selection to layer"), + INKSCAPE_ICON("layer-rename")), + new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"), N_("Raise the current layer to the top"), + INKSCAPE_ICON("layer-top")), new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"), N_("Lower the current layer to the bottom"), INKSCAPE_ICON("layer-bottom")), - new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"), - N_("Raise the current layer"), INKSCAPE_ICON("layer-raise")), - new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"), - N_("Lower the current layer"), INKSCAPE_ICON("layer-lower")), + new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"), N_("Raise the current layer"), + INKSCAPE_ICON("layer-raise")), + new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"), N_("Lower the current layer"), + INKSCAPE_ICON("layer-lower")), new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("D_uplicate Current Layer"), N_("Duplicate an existing layer"), INKSCAPE_ICON("layer-duplicate")), - new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"), - N_("Delete the current layer"), INKSCAPE_ICON("layer-delete")), - new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"), - N_("Solo the current layer"), nullptr), - new LayerVerb(SP_VERB_LAYER_SHOW_ALL, "LayerShowAll", N_("_Show all layers"), - N_("Show all the layers"), nullptr), - new LayerVerb(SP_VERB_LAYER_HIDE_ALL, "LayerHideAll", N_("_Hide all layers"), - N_("Hide all the layers"), nullptr), - new LayerVerb(SP_VERB_LAYER_LOCK_ALL, "LayerLockAll", N_("_Lock all layers"), - N_("Lock all the layers"), nullptr), + new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"), N_("Delete the current layer"), + INKSCAPE_ICON("layer-delete")), + new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"), N_("Solo the current layer"), + nullptr), + new LayerVerb(SP_VERB_LAYER_SHOW_ALL, "LayerShowAll", N_("_Show all layers"), N_("Show all the layers"), nullptr), + new LayerVerb(SP_VERB_LAYER_HIDE_ALL, "LayerHideAll", N_("_Hide all layers"), N_("Hide all the layers"), nullptr), + new LayerVerb(SP_VERB_LAYER_LOCK_ALL, "LayerLockAll", N_("_Lock all layers"), N_("Lock all the layers"), nullptr), new LayerVerb(SP_VERB_LAYER_LOCK_OTHERS, "LayerLockOthers", N_("Lock/Unlock _other layers"), - N_("Lock all the other layers"), nullptr), - new LayerVerb(SP_VERB_LAYER_UNLOCK_ALL, "LayerUnlockAll", N_("_Unlock all layers"), - N_("Unlock all the layers"), nullptr), + N_("Lock all the other layers"), nullptr), + new LayerVerb(SP_VERB_LAYER_UNLOCK_ALL, "LayerUnlockAll", N_("_Unlock all layers"), N_("Unlock all the layers"), + nullptr), new LayerVerb(SP_VERB_LAYER_TOGGLE_LOCK, "LayerToggleLock", N_("_Lock/Unlock Current Layer"), N_("Toggle lock on current layer"), nullptr), new LayerVerb(SP_VERB_LAYER_TOGGLE_HIDE, "LayerToggleHide", N_("_Show/hide Current Layer"), @@ -2905,75 +2915,74 @@ Verb *Verb::_base_verbs[] = { new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"), N_("Convert selected object to path"), INKSCAPE_ICON("object-to-path")), new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"), - N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "text-flow-into-frame"), + N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), + "text-flow-into-frame"), new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"), N_("Remove text from frame (creates a single-line text object)"), INKSCAPE_ICON("text-unflow")), new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"), - N_("Convert flowed text to regular text object (preserves appearance)"), INKSCAPE_ICON("text-convert-to-regular")), - new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally", - N_("Flip _Horizontal"), N_("Flip selected objects horizontally"), - INKSCAPE_ICON("object-flip-horizontal")), - new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically", - N_("Flip _Vertical"), N_("Flip selected objects vertically"), - INKSCAPE_ICON("object-flip-vertical")), + N_("Convert flowed text to regular text object (preserves appearance)"), + INKSCAPE_ICON("text-convert-to-regular")), + new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally", N_("Flip _Horizontal"), + N_("Flip selected objects horizontally"), INKSCAPE_ICON("object-flip-horizontal")), + new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically", N_("Flip _Vertical"), + N_("Flip selected objects vertically"), INKSCAPE_ICON("object-flip-vertical")), new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"), - N_("Apply mask to selection (using the topmost object as mask)"), nullptr), + N_("Apply mask to selection (using the topmost object as mask)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_INVERSE_MASK, "ObjectSetInverseMask", N_("_Set Inverse (LPE)"), - N_("Apply inverse mask to selection (using the topmost object as mask)"), nullptr), - new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"), - N_("Edit mask"), INKSCAPE_ICON("path-mask-edit")), - new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"), - N_("Remove mask from selection"), nullptr), + N_("Apply inverse mask to selection (using the topmost object as mask)"), nullptr), + new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"), N_("Edit mask"), + INKSCAPE_ICON("path-mask-edit")), + new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"), N_("Remove mask from selection"), + nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"), - N_("Apply clipping path to selection (using the topmost object as clipping path)"), nullptr), + N_("Apply clipping path to selection (using the topmost object as clipping path)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_SET_INVERSE_CLIPPATH, "ObjectSetInverseClipPath", N_("_Set Inverse (LPE)"), - N_("Apply inverse clipping path to selection (using the topmost object as clipping path)"), nullptr), + N_("Apply inverse clipping path to selection (using the topmost object as clipping path)"), nullptr), new ObjectVerb(SP_VERB_OBJECT_CREATE_CLIP_GROUP, "ObjectCreateClipGroup", N_("Create Cl_ip Group"), - N_("Creates a clip group using the selected objects as a base"), nullptr), - new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"), - N_("Edit clipping path"), INKSCAPE_ICON("path-clip-edit")), + N_("Creates a clip group using the selected objects as a base"), nullptr), + new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"), N_("Edit clipping path"), + INKSCAPE_ICON("path-clip-edit")), new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"), - N_("Remove clipping path from selection"), nullptr), + N_("Remove clipping path from selection"), nullptr), // Tag - new TagVerb(SP_VERB_TAG_NEW, "TagNew", N_("_New"), - N_("Create new selection set"), nullptr), + new TagVerb(SP_VERB_TAG_NEW, "TagNew", N_("_New"), N_("Create new selection set"), nullptr), // Tools new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", NC_("ContextVerb", "Select"), N_("Select and transform objects"), INKSCAPE_ICON("tool-pointer")), - new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", NC_("ContextVerb", "Node Edit"), - N_("Edit paths by nodes"), INKSCAPE_ICON("tool-node-editor")), + new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", NC_("ContextVerb", "Node Edit"), N_("Edit paths by nodes"), + INKSCAPE_ICON("tool-node-editor")), new ContextVerb(SP_VERB_CONTEXT_TWEAK, "ToolTweak", NC_("ContextVerb", "Tweak"), N_("Tweak objects by sculpting or painting"), INKSCAPE_ICON("tool-tweak")), new ContextVerb(SP_VERB_CONTEXT_SPRAY, "ToolSpray", NC_("ContextVerb", "Spray"), N_("Spray objects by sculpting or painting"), INKSCAPE_ICON("tool-spray")), new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", NC_("ContextVerb", "Rectangle"), N_("Create rectangles and squares"), INKSCAPE_ICON("draw-rectangle")), - new ContextVerb(SP_VERB_CONTEXT_3DBOX, "Tool3DBox", NC_("ContextVerb", "3D Box"), - N_("Create 3D boxes"), INKSCAPE_ICON("draw-cuboid")), + new ContextVerb(SP_VERB_CONTEXT_3DBOX, "Tool3DBox", NC_("ContextVerb", "3D Box"), N_("Create 3D boxes"), + INKSCAPE_ICON("draw-cuboid")), new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", NC_("ContextVerb", "Ellipse"), N_("Create circles, ellipses, and arcs"), INKSCAPE_ICON("draw-ellipse")), - new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", NC_("ContextVerb", "Star"), - N_("Create stars and polygons"), INKSCAPE_ICON("draw-polygon-star")), - new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", NC_("ContextVerb", "Spiral"), - N_("Create spirals"), INKSCAPE_ICON("draw-spiral")), - new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", NC_("ContextVerb", "Pencil"), - N_("Draw freehand lines"), INKSCAPE_ICON("draw-freehand")), + new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", NC_("ContextVerb", "Star"), N_("Create stars and polygons"), + INKSCAPE_ICON("draw-polygon-star")), + new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", NC_("ContextVerb", "Spiral"), N_("Create spirals"), + INKSCAPE_ICON("draw-spiral")), + new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", NC_("ContextVerb", "Pencil"), N_("Draw freehand lines"), + INKSCAPE_ICON("draw-freehand")), new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", NC_("ContextVerb", "Pen"), N_("Draw Bezier curves and straight lines"), INKSCAPE_ICON("draw-path")), new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligraphic", NC_("ContextVerb", "Calligraphy"), N_("Draw calligraphic or brush strokes"), INKSCAPE_ICON("draw-calligraphic")), - new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", NC_("ContextVerb", "Text"), - N_("Create and edit text objects"), INKSCAPE_ICON("draw-text")), - new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", NC_("ContextVerb", "Gradient"), + new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", NC_("ContextVerb", "Text"), N_("Create and edit text objects"), + INKSCAPE_ICON("draw-text")), + new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", NC_("ContextVerb", "Gradient"), N_("Create and edit gradients"), INKSCAPE_ICON("color-gradient")), - new ContextVerb(SP_VERB_CONTEXT_MESH, "ToolMesh", NC_("ContextVerb", "Mesh"), - N_("Create and edit meshes"), INKSCAPE_ICON("mesh-gradient")), - new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", NC_("ContextVerb", "Zoom"), - N_("Zoom in or out"), INKSCAPE_ICON("zoom")), - new ContextVerb(SP_VERB_CONTEXT_MEASURE, "ToolMeasure", NC_("ContextVerb", "Measure"), - N_("Measurement tool"), INKSCAPE_ICON("tool-measure")), - new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", NC_("ContextVerb", "Dropper"), - N_("Pick colors from image"), INKSCAPE_ICON("color-picker")), + new ContextVerb(SP_VERB_CONTEXT_MESH, "ToolMesh", NC_("ContextVerb", "Mesh"), N_("Create and edit meshes"), + INKSCAPE_ICON("mesh-gradient")), + new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", NC_("ContextVerb", "Zoom"), N_("Zoom in or out"), + INKSCAPE_ICON("zoom")), + new ContextVerb(SP_VERB_CONTEXT_MEASURE, "ToolMeasure", NC_("ContextVerb", "Measure"), N_("Measurement tool"), + INKSCAPE_ICON("tool-measure")), + new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", NC_("ContextVerb", "Dropper"), N_("Pick colors from image"), + INKSCAPE_ICON("color-picker")), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", NC_("ContextVerb", "Connector"), N_("Create diagram connectors"), INKSCAPE_ICON("draw-connector")), @@ -2982,10 +2991,10 @@ Verb *Verb::_base_verbs[] = { N_("Fill bounded areas"), INKSCAPE_ICON("color-fill")), #endif - new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", NC_("ContextVerb", "LPE Edit"), - N_("Edit Path Effect parameters"), nullptr), - new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", NC_("ContextVerb", "Eraser"), - N_("Erase existing paths"), INKSCAPE_ICON("draw-eraser")), + new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", NC_("ContextVerb", "LPE Edit"), N_("Edit Path Effect parameters"), + nullptr), + new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", NC_("ContextVerb", "Eraser"), N_("Erase existing paths"), + INKSCAPE_ICON("draw-eraser")), new ContextVerb(SP_VERB_CONTEXT_LPETOOL, "ToolLPETool", NC_("ContextVerb", "LPE Tool"), N_("Do geometric constructions"), "draw-geometry"), // Tool prefs @@ -3045,58 +3054,67 @@ Verb *Verb::_base_verbs[] = { INKSCAPE_ICON("zoom-next")), new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"), INKSCAPE_ICON("zoom-previous")), - new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"), - INKSCAPE_ICON("zoom-original")), - new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"), - INKSCAPE_ICON("zoom-half-size")), - new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"), - INKSCAPE_ICON("zoom-double-size")), - new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"), - N_("Zoom to fit page in window"), INKSCAPE_ICON("zoom-fit-page")), - new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"), - N_("Zoom to fit page width in window"), INKSCAPE_ICON("zoom-fit-width")), - new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"), - N_("Zoom to fit drawing in window"), INKSCAPE_ICON("zoom-fit-drawing")), - new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"), - N_("Zoom to fit selection in window"), INKSCAPE_ICON("zoom-fit-selection")), - - new ZoomVerb(SP_VERB_ROTATE_CW, "RotateClockwise", N_("Rotate Clockwise"), N_("Rotate canvas clockwise"), nullptr), - new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), N_("Rotate canvas counter-clockwise"), nullptr), - new ZoomVerb(SP_VERB_ROTATE_ZERO, "RotateZero", N_("Reset Rotation"), N_("Reset canvas rotation to zero"), nullptr), - - new ZoomVerb(SP_VERB_FLIP_HORIZONTAL, "FlipHorizontal", N_("Flip Horizontally"), N_("Flip canvas horizontally"), INKSCAPE_ICON("object-flip-horizontal")), - new ZoomVerb(SP_VERB_FLIP_VERTICAL, "FlipVertical", N_("Flip Vertically"), N_("Flip canvas vertically"), INKSCAPE_ICON("object-flip-vertical")), - new ZoomVerb(SP_VERB_FLIP_NONE, "FlipNone", N_("Reset Flip"), N_("Undo any flip"), nullptr), - - -// WHY ARE THE FOLLOWING ZoomVerbs??? + new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"), INKSCAPE_ICON("zoom-original")), + new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"), INKSCAPE_ICON("zoom-half-size")), + new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"), INKSCAPE_ICON("zoom-double-size")), + new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"), N_("Zoom to fit page in window"), + INKSCAPE_ICON("zoom-fit-page")), + new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"), N_("Zoom to fit page width in window"), + INKSCAPE_ICON("zoom-fit-width")), + new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"), N_("Zoom to fit drawing in window"), + INKSCAPE_ICON("zoom-fit-drawing")), + new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"), N_("Zoom to fit selection in window"), + INKSCAPE_ICON("zoom-fit-selection")), + + new ZoomVerb(SP_VERB_ROTATE_CW, "RotateClockwise", N_("Rotate Clockwise"), N_("Rotate canvas clockwise"), nullptr), + new ZoomVerb(SP_VERB_ROTATE_CCW, "RotateCounterClockwise", N_("Rotate Counter-Clockwise"), + N_("Rotate canvas counter-clockwise"), nullptr), + new ZoomVerb(SP_VERB_ROTATE_ZERO, "RotateZero", N_("Reset Rotation"), N_("Reset canvas rotation to zero"), nullptr), + + new ZoomVerb(SP_VERB_FLIP_HORIZONTAL, "FlipHorizontal", N_("Flip Horizontally"), N_("Flip canvas horizontally"), + INKSCAPE_ICON("object-flip-horizontal")), + new ZoomVerb(SP_VERB_FLIP_VERTICAL, "FlipVertical", N_("Flip Vertically"), N_("Flip canvas vertically"), + INKSCAPE_ICON("object-flip-vertical")), + new ZoomVerb(SP_VERB_FLIP_NONE, "FlipNone", N_("Reset Flip"), N_("Undo any flip"), nullptr), + + + // WHY ARE THE FOLLOWING ZoomVerbs??? // View new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("Page _Grid"), N_("Show or hide the page grid"), INKSCAPE_ICON("show-grid")), - new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON("show-guides")), + new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), + N_("Show or hide the canvas scrollbars"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("Page _Grid"), N_("Show or hide the page grid"), + INKSCAPE_ICON("show-grid")), + new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), + N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON("show-guides")), new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Enable snapping"), INKSCAPE_ICON("snap")), - new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), N_("Show or hide the Commands bar (under the menu)"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), N_("Show or hide the snapping controls"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), N_("Show or hide the Tool Controls bar"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), N_("Show or hide the main toolbox (on the left)"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), nullptr), - new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), N_("Show or hide the statusbar (at the bottom of the window)"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), + N_("Show or hide the Commands bar (under the menu)"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), + N_("Show or hide the snapping controls"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), + N_("Show or hide the Tool Controls bar"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), + N_("Show or hide the main toolbox (on the left)"), nullptr), + new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), + nullptr), + new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), + N_("Show or hide the statusbar (at the bottom of the window)"), nullptr), new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"), INKSCAPE_ICON("view-fullscreen")), - new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), N_("Stretch this document window to full screen"), - INKSCAPE_ICON("view-fullscreen")), - new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"), - nullptr), + new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), + N_("Stretch this document window to full screen"), INKSCAPE_ICON("view-fullscreen")), + new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), + N_("Remove excess toolbars to focus on drawing"), nullptr), new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"), INKSCAPE_ICON("window-new")), - new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"), - N_("New View Preview"), nullptr/*"view_new_preview"*/), + new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"), N_("New View Preview"), + nullptr /*"view_new_preview"*/), - new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"), - N_("Switch to normal display mode"), nullptr), + new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"), N_("Switch to normal display mode"), + nullptr), new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"), N_("Switch to normal display without filters"), nullptr), new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"), @@ -3105,38 +3123,43 @@ Verb *Verb::_base_verbs[] = { N_("Toggle between normal and outline display modes"), nullptr), new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_NORMAL, "ViewColorModeNormal", N_("_Normal"), N_("Switch to normal color display mode"), nullptr), - new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_GRAYSCALE, "ViewColorModeGrayscale", N_("_Grayscale"), + new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_GRAYSCALE, "ViewColorModeGrayscale", N_("_Grayscale"), N_("Switch to grayscale display mode"), nullptr), -// new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_PRINT_COLORS_PREVIEW, "ViewColorModePrintColorsPreview", N_("_Print Colors Preview"), -// N_("Switch to print colors preview mode"), NULL), - new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_TOGGLE, "ViewColorModeToggle", N_("_Toggle"), + // new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_PRINT_COLORS_PREVIEW, "ViewColorModePrintColorsPreview", N_("_Print + // Colors Preview"), + // N_("Switch to print colors preview mode"), NULL), + new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_TOGGLE, "ViewColorModeToggle", N_("_Toggle"), N_("Toggle between normal and grayscale color display modes"), nullptr), new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"), N_("Toggle color-managed display for this document window"), INKSCAPE_ICON("color-management")), new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."), - N_("Open a window to preview objects at different icon resolutions"), INKSCAPE_ICON("dialog-icon-preview")), + N_("Open a window to preview objects at different icon resolutions"), + INKSCAPE_ICON("dialog-icon-preview")), // Dialogs - new DialogVerb(SP_VERB_DIALOG_PROTOTYPE, "DialogPrototype", N_("Prototype..."), - N_("Prototype Dialog"), INKSCAPE_ICON("gtk-preferences")), + new DialogVerb(SP_VERB_DIALOG_PROTOTYPE, "DialogPrototype", N_("Prototype..."), N_("Prototype Dialog"), + INKSCAPE_ICON("gtk-preferences")), new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("P_references..."), N_("Edit global Inkscape preferences"), INKSCAPE_ICON("gtk-preferences")), new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."), - N_("Edit properties of this document (to be saved with the document)"), INKSCAPE_ICON("document-properties")), + N_("Edit properties of this document (to be saved with the document)"), + INKSCAPE_ICON("document-properties")), new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), - N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON("document-metadata") ), + N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON("document-metadata")), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), - N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON("dialog-fill-and-stroke")), + N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), + INKSCAPE_ICON("dialog-fill-and-stroke")), // FIXME: Probably better to either use something from the icon naming spec or ship our own "select-font" icon - // Technically what we show are unicode code points and not glyphs. The actual glyphs shown are determined by the shaping engines. + // Technically what we show are unicode code points and not glyphs. The actual glyphs shown are determined by the + // shaping engines. new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("_Unicode Characters..."), N_("Select Unicode characters from a palette"), INKSCAPE_ICON("gtk-select-font")), // FIXME: Probably better to either use something from the icon naming spec or ship our own "select-color" icon // TRANSLATORS: "Swatches" means: color samples new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."), - N_("Select colors from a swatches palette"), INKSCAPE_ICON("gtk-select-color")), + N_("Select colors from a swatches palette"), INKSCAPE_ICON("swatches")), new DialogVerb(SP_VERB_DIALOG_SYMBOLS, "DialogSymbols", N_("S_ymbols..."), N_("Select symbol from a symbols palette"), INKSCAPE_ICON("symbols")), new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."), @@ -3145,74 +3168,75 @@ Verb *Verb::_base_verbs[] = { N_("Align and distribute objects"), INKSCAPE_ICON("dialog-align-and-distribute")), new DialogVerb(SP_VERB_DIALOG_SPRAY_OPTION, "DialogSprayOption", N_("_Spray options..."), N_("Some options for the spray"), INKSCAPE_ICON("dialog-spray-options")), - new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."), - N_("Undo History"), INKSCAPE_ICON("edit-undo-history")), + new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."), N_("Undo History"), + INKSCAPE_ICON("edit-undo-history")), new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."), - N_("View and select font family, font size and other text properties"), INKSCAPE_ICON("dialog-text-and-font")), + N_("View and select font family, font size and other text properties"), + INKSCAPE_ICON("dialog-text-and-font")), new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."), N_("View and edit the XML tree of the document"), INKSCAPE_ICON("dialog-xml-editor")), - new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find/Replace..."), - N_("Find objects in document"), INKSCAPE_ICON("edit-find")), + new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find/Replace..."), N_("Find objects in document"), + INKSCAPE_ICON("edit-find")), new DialogVerb(SP_VERB_DIALOG_FINDREPLACE, "DialogFindReplace", N_("Find and _Replace Text..."), N_("Find and replace text in document"), INKSCAPE_ICON("edit-find-replace")), new DialogVerb(SP_VERB_DIALOG_SPELLCHECK, "DialogSpellcheck", N_("Check Spellin_g..."), N_("Check spelling of text in document"), INKSCAPE_ICON("tools-check-spelling")), - new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."), - N_("View debug messages"), INKSCAPE_ICON("dialog-messages")), + new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."), N_("View debug messages"), + INKSCAPE_ICON("dialog-messages")), new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"), N_("Show or hide all open dialogs"), INKSCAPE_ICON("show-dialogs")), new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."), - N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON("dialog-tile-clones")), + N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), + INKSCAPE_ICON("dialog-tile-clones")), new DialogVerb(SP_VERB_DIALOG_ATTR, "DialogObjectAttributes", N_("_Object attributes..."), N_("Edit the object attributes..."), INKSCAPE_ICON("dialog-object-properties")), new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."), - N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON("dialog-object-properties")), + N_("Edit the ID, locked and visible status, and other object properties"), + INKSCAPE_ICON("dialog-object-properties")), new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."), - N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON("dialog-input-devices")), + N_("Configure extended input devices, such as a graphics tablet"), + INKSCAPE_ICON("dialog-input-devices")), new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."), N_("Query information about extensions"), nullptr), - new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."), - N_("View Layers"), INKSCAPE_ICON("dialog-layers")), - new DialogVerb(SP_VERB_DIALOG_OBJECTS, "DialogObjects", N_("Object_s..."), - N_("View Objects"), INKSCAPE_ICON("dialog-layers")), - new DialogVerb(SP_VERB_DIALOG_TAGS, "DialogTags", N_("Selection se_ts..."), - N_("View Tags"), INKSCAPE_ICON("edit-select-all-layers")), - new DialogVerb(SP_VERB_DIALOG_STYLE, "DialogStyle", N_("Style Dialog..."), - N_("View Style Dialog"), nullptr), - new DialogVerb(SP_VERB_DIALOG_CSS, "DialogCss", N_("Css Dialog..."), - N_("View Css Dialog"), nullptr), + new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."), N_("View Layers"), + INKSCAPE_ICON("dialog-layers")), + new DialogVerb(SP_VERB_DIALOG_OBJECTS, "DialogObjects", N_("Object_s..."), N_("View Objects"), + INKSCAPE_ICON("dialog-layers")), + new DialogVerb(SP_VERB_DIALOG_TAGS, "DialogTags", N_("Selection se_ts..."), N_("View Tags"), + INKSCAPE_ICON("edit-select-all-layers")), + new DialogVerb(SP_VERB_DIALOG_STYLE, "DialogStyle", N_("Style Dialog..."), N_("View Style Dialog"), nullptr), + new DialogVerb(SP_VERB_DIALOG_CSS, "DialogCss", N_("Css Dialog..."), N_("View Css Dialog"), nullptr), new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffects ..."), N_("Manage, edit, and apply path effects"), INKSCAPE_ICON("dialog-path-effects")), new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter _Editor..."), N_("Manage, edit, and apply SVG filters"), INKSCAPE_ICON("dialog-filters")), - new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Font Editor..."), - N_("Edit SVG fonts"), nullptr), + new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Font Editor..."), N_("Edit SVG fonts"), nullptr), new DialogVerb(SP_VERB_DIALOG_PRINT_COLORS_PREVIEW, "DialogPrintColorsPreview", N_("Print Colors..."), N_("Select which color separations to render in Print Colors Preview rendermode"), nullptr), new DialogVerb(SP_VERB_DIALOG_EXPORT, "DialogExport", N_("_Export PNG Image..."), - N_("Export this document or a selection as a PNG image"), INKSCAPE_ICON("document-export")), + N_("Export this document or a selection as a PNG image"), INKSCAPE_ICON("document-export")), // Help new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"), N_("Information on Inkscape extensions"), nullptr), - new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"), - N_("Memory usage information"), INKSCAPE_ICON("dialog-memory")), - new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"), - N_("Inkscape version, authors, license"), INKSCAPE_ICON("inkscape-logo")), - //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"), + new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"), N_("Memory usage information"), + INKSCAPE_ICON("dialog-memory")), + new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"), N_("Inkscape version, authors, license"), + INKSCAPE_ICON("inkscape-logo")), + // new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"), // N_("Distribution terms"), /*"show_license"*/"inkscape_options"), // Tutorials new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"), - N_("Getting started with Inkscape"), nullptr/*"tutorial_basic"*/), + N_("Getting started with Inkscape"), nullptr /*"tutorial_basic"*/), new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"), N_("Using shape tools to create and edit shapes"), nullptr), new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"), - N_("Advanced Inkscape topics"), nullptr/*"tutorial_advanced"*/), + N_("Advanced Inkscape topics"), nullptr /*"tutorial_advanced"*/), #if HAVE_POTRACE // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) - new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"), - N_("Using bitmap tracing"), nullptr/*"tutorial_tracing"*/), + new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"), N_("Using bitmap tracing"), + nullptr /*"tutorial_tracing"*/), #endif new TutorialVerb(SP_VERB_TUTORIAL_TRACING_PIXELART, "TutorialsTracingPixelArt", N_("Inkscape: Tracing Pixel Art"), @@ -3220,11 +3244,11 @@ Verb *Verb::_base_verbs[] = { new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"), N_("Using the Calligraphy pen tool"), nullptr), new TutorialVerb(SP_VERB_TUTORIAL_INTERPOLATE, "TutorialsInterpolate", N_("Inkscape: _Interpolate"), - N_("Using the interpolate extension"), nullptr/*"tutorial_interpolate"*/), + N_("Using the interpolate extension"), nullptr /*"tutorial_interpolate"*/), new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"), - N_("Principles of design in the tutorial form"), nullptr/*"tutorial_design"*/), + N_("Principles of design in the tutorial form"), nullptr /*"tutorial_design"*/), new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"), - N_("Miscellaneous tips and tricks"), nullptr/*"tutorial_tips"*/), + N_("Miscellaneous tips and tricks"), nullptr /*"tutorial_tips"*/), // Effect -- renamed Extension new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Exte_nsion"), @@ -3234,59 +3258,69 @@ Verb *Verb::_base_verbs[] = { // Fit Page new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"), - N_("Fit the page to the current selection"), nullptr), + N_("Fit the page to the current selection"), nullptr), new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"), - N_("Fit the page to the drawing"), nullptr), - new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("_Resize Page to Selection"), - N_("Fit the page to the current selection or the drawing if there is no selection"), nullptr), + N_("Fit the page to the drawing"), nullptr), + new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", + N_("_Resize Page to Selection"), + N_("Fit the page to the current selection or the drawing if there is no selection"), nullptr), // LockAndHide new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"), - N_("Unlock all objects in the current layer"), nullptr), + N_("Unlock all objects in the current layer"), nullptr), new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"), - N_("Unlock all objects in all layers"), nullptr), + N_("Unlock all objects in all layers"), nullptr), new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"), - N_("Unhide all objects in the current layer"), nullptr), + N_("Unhide all objects in the current layer"), nullptr), new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"), - N_("Unhide all objects in all layers"), nullptr), + N_("Unhide all objects in all layers"), nullptr), // Color Management new EditVerb(SP_VERB_EDIT_LINK_COLOR_PROFILE, "LinkColorProfile", N_("Link Color Profile"), N_("Link an ICC color profile"), nullptr), new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"), N_("Remove a linked ICC color profile"), nullptr), // Scripting - new ContextVerb(SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, "AddExternalScript", - N_("Add External Script"), N_("Add an external script"), nullptr), - new ContextVerb(SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, "AddEmbeddedScript", - N_("Add Embedded Script"), N_("Add an embedded script"), nullptr), - new ContextVerb(SP_VERB_EDIT_EMBEDDED_SCRIPT, "EditEmbeddedScript", - N_("Edit Embedded Script"), N_("Edit an embedded script"), nullptr), - new ContextVerb(SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, "RemoveExternalScript", - N_("Remove External Script"), N_("Remove an external script"), nullptr), - new ContextVerb(SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, "RemoveEmbeddedScript", - N_("Remove Embedded Script"), N_("Remove an embedded script"), nullptr), - // Align - new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", N_("Align right edges of objects to the left edge of the anchor"), - N_("Align right edges of objects to the left edge of the anchor"), INKSCAPE_ICON("align-horizontal-right-to-anchor")), - new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT, "AlignHorizontalLeft", N_("Align left edges"), - N_("Align left edges"), INKSCAPE_ICON("align-horizontal-left")), - new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_CENTER, "AlignHorizontalCenter", N_("Center on vertical axis"), - N_("Center on vertical axis"), INKSCAPE_ICON("align-horizontal-center")), - new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT, "AlignHorizontalRight", N_("Align right sides"), - N_("Align right sides"), INKSCAPE_ICON("align-horizontal-right")), - new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, "AlignHorizontalLeftToAnchor", N_("Align left edges of objects to the right edge of the anchor"), - N_("Align left edges of objects to the right edge of the anchor"), INKSCAPE_ICON("align-horizontal-left-to-anchor")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, "AlignVerticalBottomToAnchor", N_("Align bottom edges of objects to the top edge of the anchor"), - N_("Align bottom edges of objects to the top edge of the anchor"), INKSCAPE_ICON("align-vertical-bottom-to-anchor")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP, "AlignVerticalTop", N_("Align top edges"), - N_("Align top edges"), INKSCAPE_ICON("align-vertical-top")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_CENTER, "AlignVerticalCenter", N_("Center on horizontal axis"), - N_("Center on horizontal axis"), INKSCAPE_ICON("align-vertical-center")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM, "AlignVerticalBottom", N_("Align bottom edges"), - N_("Align bottom edges"), INKSCAPE_ICON("align-vertical-bottom")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR, "AlignVerticalTopToAnchor", N_("Align top edges of objects to the bottom edge of the anchor"), - N_("Align top edges of objects to the bottom edge of the anchor"), INKSCAPE_ICON("align-vertical-top-to-anchor")), - new ContextVerb(SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER, "AlignVerticalHorizontalCenter", N_("Center on horizontal and vertical axis"), - N_("Center on horizontal and vertical axis"), INKSCAPE_ICON("align-vertical-center")), + new ContextVerb(SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, "AddExternalScript", N_("Add External Script"), + N_("Add an external script"), nullptr), + new ContextVerb(SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, "AddEmbeddedScript", N_("Add Embedded Script"), + N_("Add an embedded script"), nullptr), + new ContextVerb(SP_VERB_EDIT_EMBEDDED_SCRIPT, "EditEmbeddedScript", N_("Edit Embedded Script"), + N_("Edit an embedded script"), nullptr), + new ContextVerb(SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, "RemoveExternalScript", N_("Remove External Script"), + N_("Remove an external script"), nullptr), + new ContextVerb(SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, "RemoveEmbeddedScript", N_("Remove Embedded Script"), + N_("Remove an embedded script"), nullptr), + // Align + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", + N_("Align right edges of objects to the left edge of the anchor"), + N_("Align right edges of objects to the left edge of the anchor"), + INKSCAPE_ICON("align-horizontal-right-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT, "AlignHorizontalLeft", N_("Align left edges"), + N_("Align left edges"), INKSCAPE_ICON("align-horizontal-left")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_CENTER, "AlignHorizontalCenter", N_("Center on vertical axis"), + N_("Center on vertical axis"), INKSCAPE_ICON("align-horizontal-center")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT, "AlignHorizontalRight", N_("Align right sides"), + N_("Align right sides"), INKSCAPE_ICON("align-horizontal-right")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, "AlignHorizontalLeftToAnchor", + N_("Align left edges of objects to the right edge of the anchor"), + N_("Align left edges of objects to the right edge of the anchor"), + INKSCAPE_ICON("align-horizontal-left-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, "AlignVerticalBottomToAnchor", + N_("Align bottom edges of objects to the top edge of the anchor"), + N_("Align bottom edges of objects to the top edge of the anchor"), + INKSCAPE_ICON("align-vertical-bottom-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP, "AlignVerticalTop", N_("Align top edges"), N_("Align top edges"), + INKSCAPE_ICON("align-vertical-top")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_CENTER, "AlignVerticalCenter", N_("Center on horizontal axis"), + N_("Center on horizontal axis"), INKSCAPE_ICON("align-vertical-center")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM, "AlignVerticalBottom", N_("Align bottom edges"), + N_("Align bottom edges"), INKSCAPE_ICON("align-vertical-bottom")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR, "AlignVerticalTopToAnchor", + N_("Align top edges of objects to the bottom edge of the anchor"), + N_("Align top edges of objects to the bottom edge of the anchor"), + INKSCAPE_ICON("align-vertical-top-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER, "AlignVerticalHorizontalCenter", + N_("Center on horizontal and vertical axis"), N_("Center on horizontal and vertical axis"), + INKSCAPE_ICON("align-vertical-center")), // Footer diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 19443716cec682492e44f9953c1de67636db7e95..83094c1566ab5ceb55aeb604ea47f5024e63c6ec 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -15,9 +15,10 @@ #include "button.h" #include "helper/action-context.h" -#include "ui/interface.h" -#include "shortcuts.h" #include "helper/action.h" +#include "helper/icon-loader.h" +#include "shortcuts.h" +#include "ui/interface.h" static void sp_button_dispose(GObject *object); static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width); @@ -211,7 +212,7 @@ static void sp_button_set_action(SPButton *button, SPAction *action) button->c_set_sensitive = action->signal_set_sensitive.connect( sigc::bind<0>(sigc::ptr_fun(>k_widget_set_sensitive), GTK_WIDGET(button))); if (action->image) { - child = gtk_image_new_from_icon_name(action->image, button->lsize); + child = GTK_WIDGET(sp_get_icon_image(action->image, "/toolbox/tools/small")->gobj()); gtk_widget_show(child); gtk_container_add(GTK_CONTAINER(button), child); } diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index d0b6af9a05c3d5e30afecf787f9935f44496181b..1626655fff43fe3127700c8852a1ed724ab723b1 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1194,28 +1194,34 @@ SPDesktopWidget::shutdown() * Use depends on setting of "options.savewindowgeometry". * But we save the info here regardless of the setting. */ - { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool maxed = desktop->is_maximized(); - bool full = desktop->is_fullscreen(); - prefs->setBool("/desktop/geometry/fullscreen", full); - prefs->setBool("/desktop/geometry/maximized", maxed); - gint w, h, x, y; - desktop->getWindowGeometry(x, y, w, h); - // Don't save geom for maximized windows. It - // just tells you the current maximized size, which is not - // as useful as whatever value it had previously. - if (!maxed && !full) { - prefs->setInt("/desktop/geometry/width", w); - prefs->setInt("/desktop/geometry/height", h); - prefs->setInt("/desktop/geometry/x", x); - prefs->setInt("/desktop/geometry/y", y); - } - } + storeDesktopPosition(); return FALSE; } +/** + * \store dessktop position + */ +void SPDesktopWidget::storeDesktopPosition() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool maxed = desktop->is_maximized(); + bool full = desktop->is_fullscreen(); + prefs->setBool("/desktop/geometry/fullscreen", full); + prefs->setBool("/desktop/geometry/maximized", maxed); + gint w, h, x, y; + desktop->getWindowGeometry(x, y, w, h); + // Don't save geom for maximized windows. It + // just tells you the current maximized size, which is not + // as useful as whatever value it had previously. + if (!maxed && !full) { + prefs->setInt("/desktop/geometry/width", w); + prefs->setInt("/desktop/geometry/height", h); + prefs->setInt("/desktop/geometry/x", x); + prefs->setInt("/desktop/geometry/y", y); + } +} + /** * \pre this->desktop->main != 0 */ diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 60b100028a5dd0f20dff32b58d5b0c16b3e39b9b..40d194bb3d57e0278b53ee480a13db14de1a32f9 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -163,39 +163,24 @@ struct SPDesktopWidget { _dtw->window = nullptr; } - void requestCanvasUpdate() override - { _dtw->requestCanvasUpdate(); } - void requestCanvasUpdateAndWait() override - { _dtw->requestCanvasUpdateAndWait(); } - void enableInteraction() override - { _dtw->enableInteraction(); } - void disableInteraction() override - { _dtw->disableInteraction(); } - void activateDesktop() override - { sp_dtw_desktop_activate (_dtw); } - void deactivateDesktop() override - { sp_dtw_desktop_deactivate (_dtw); } - void updateRulers() override - { sp_desktop_widget_update_rulers (_dtw); } - void updateScrollbars (double scale) override - { sp_desktop_widget_update_scrollbars (_dtw, scale); } - void toggleRulers() override - { sp_desktop_widget_toggle_rulers (_dtw); } - void toggleScrollbars() override - { sp_desktop_widget_toggle_scrollbars (_dtw); } - void toggleColorProfAdjust() override - { sp_desktop_widget_toggle_color_prof_adj(_dtw); } - bool colorProfAdjustEnabled() override - { return sp_desktop_widget_color_prof_adj_enabled(_dtw); } - void updateZoom() override - { sp_desktop_widget_update_zoom (_dtw); } - void letZoomGrabFocus() override - { _dtw->letZoomGrabFocus(); } - void updateRotation() override - { sp_desktop_widget_update_rotation (_dtw); } - void setToolboxFocusTo (const gchar * id) override - { _dtw->setToolboxFocusTo (id); } - void setToolboxAdjustmentValue (const gchar *id, double val) override + void storeDesktopPosition() override { _dtw->storeDesktopPosition(); } + void requestCanvasUpdate() override { _dtw->requestCanvasUpdate(); } + void requestCanvasUpdateAndWait() override { _dtw->requestCanvasUpdateAndWait(); } + void enableInteraction() override { _dtw->enableInteraction(); } + void disableInteraction() override { _dtw->disableInteraction(); } + void activateDesktop() override { sp_dtw_desktop_activate(_dtw); } + void deactivateDesktop() override { sp_dtw_desktop_deactivate(_dtw); } + void updateRulers() override { sp_desktop_widget_update_rulers(_dtw); } + void updateScrollbars(double scale) override { sp_desktop_widget_update_scrollbars(_dtw, scale); } + void toggleRulers() override { sp_desktop_widget_toggle_rulers(_dtw); } + void toggleScrollbars() override { sp_desktop_widget_toggle_scrollbars(_dtw); } + void toggleColorProfAdjust() override { sp_desktop_widget_toggle_color_prof_adj(_dtw); } + bool colorProfAdjustEnabled() override { return sp_desktop_widget_color_prof_adj_enabled(_dtw); } + void updateZoom() override { sp_desktop_widget_update_zoom(_dtw); } + void letZoomGrabFocus() override { _dtw->letZoomGrabFocus(); } + void updateRotation() override { sp_desktop_widget_update_rotation(_dtw); } + void setToolboxFocusTo(const gchar *id) override { _dtw->setToolboxFocusTo(id); } + void setToolboxAdjustmentValue(const gchar *id, double val) override { _dtw->setToolboxAdjustmentValue (id, val); } void setToolboxSelectOneValue (gchar const *id, int val) override { _dtw->setToolboxSelectOneValue (id, val); } @@ -237,6 +222,7 @@ struct SPDesktopWidget { bool isToolboxButtonActive (gchar const *id); void setToolboxPosition(Glib::ustring const& id, GtkPositionType pos); void setCoordinateStatus(Geom::Point p); + void storeDesktopPosition(); void requestCanvasUpdate(); void requestCanvasUpdateAndWait(); void enableInteraction(); diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp index 5b71110b2211f7d26231fca343ef63e8bddd52a9..927b6aec0fd8b383a40a007bce3c471f9141b14f 100644 --- a/src/widgets/ege-adjustment-action.cpp +++ b/src/widgets/ege-adjustment-action.cpp @@ -50,9 +50,10 @@ #include #include -#include "widgets/ege-adjustment-action.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" #include "ui/widget/ink-spinscale.h" +#include "widgets/ege-adjustment-action.h" static void ege_adjustment_action_finalize( GObject* object ); static void ege_adjustment_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); @@ -864,7 +865,8 @@ static GtkWidget* create_tool_item( GtkAction* action ) /* Use an icon if available or use short-label */ if ( act->private_data->iconId && strcmp( act->private_data->iconId, "" ) != 0 ) { - GtkWidget* icon = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize ); + GtkWidget *icon = + GTK_WIDGET(sp_get_icon_image(act->private_data->iconId, act->private_data->iconSize)->gobj()); gtk_box_pack_start( GTK_BOX(hb), icon, FALSE, FALSE, 0 ); } else { GtkWidget* lbl = gtk_label_new( g_value_get_string( &value ) ? g_value_get_string( &value ) : "wwww" ); diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 230282e6d42fe8810464a13644bab0ca430d50b9..10b1ecf04e3c1cd8c95ff8224647e3563b230140 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -35,6 +35,7 @@ #include "style.h" #include "helper/action.h" +#include "helper/icon-loader.h" #include "ui/icon-names.h" @@ -98,7 +99,7 @@ static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass) static void gradsel_style_button(GtkWidget *gtkbtn, char const *iconName) { Gtk::Button *btn = Glib::wrap(GTK_BUTTON(gtkbtn)); - GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); + GtkWidget *child = GTK_WIDGET(sp_get_icon_image(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR)->gobj()); gtk_widget_show(child); btn->add(*manage(Glib::wrap(child))); btn->set_relief(Gtk::RELIEF_NONE); diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp index 5adb69ac67c1b443d344ec52963f0f72ea462c19..ee64784034851157ce6ae614b45742dd9444a1fe 100644 --- a/src/widgets/ink-action.cpp +++ b/src/widgets/ink-action.cpp @@ -1,5 +1,5 @@ #include "ink-action.h" - +#include "helper/icon-loader.h" #include static void ink_action_finalize( GObject* obj ); @@ -161,7 +161,8 @@ static GtkWidget* ink_action_create_tool_item( GtkAction* action ) if ( GTK_IS_TOOL_BUTTON(item) ) { GtkToolButton* button = GTK_TOOL_BUTTON(item); - GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize ); + GtkWidget *child = + GTK_WIDGET(sp_get_icon_image(act->private_data->iconId, act->private_data->iconSize)->gobj()); gtk_tool_button_set_icon_widget( button, child ); } else { // For now trigger a warning but don't do anything else diff --git a/src/widgets/ink-radio-action.cpp b/src/widgets/ink-radio-action.cpp index 611e0c6248a14e24d7a50b3feee120edbfb4874e..d0bff12718813b33d14b5510242a880b5a9e80d0 100644 --- a/src/widgets/ink-radio-action.cpp +++ b/src/widgets/ink-radio-action.cpp @@ -1,4 +1,5 @@ #include "ink-radio-action.h" +#include "helper/icon-loader.h" static void ink_radio_action_finalize( GObject* obj ); static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); @@ -157,9 +158,10 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action ) if ( GTK_IS_TOOL_BUTTON(item) ) { GtkToolButton* button = GTK_TOOL_BUTTON(item); - GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize ); - gtk_widget_set_hexpand(child, FALSE); - gtk_widget_set_vexpand(child, FALSE); + GtkWidget *child = + GTK_WIDGET(sp_get_icon_image(act->private_data->iconId, act->private_data->iconSize)->gobj()); + gtk_widget_set_hexpand(child, FALSE); + gtk_widget_set_vexpand(child, FALSE); gtk_tool_button_set_icon_widget(button, child); } else { // For now trigger a warning but don't do anything else diff --git a/src/widgets/ink-toggle-action.cpp b/src/widgets/ink-toggle-action.cpp index 467f0f24c5bd914ef3ce812b389f1319c07c960f..77dc39c3d66a05ff4eb72f50ac34c741e6a6ce83 100644 --- a/src/widgets/ink-toggle-action.cpp +++ b/src/widgets/ink-toggle-action.cpp @@ -1,4 +1,5 @@ #include "ink-toggle-action.h" +#include "helper/icon-loader.h" static void ink_toggle_action_finalize( GObject* obj ); static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); @@ -163,11 +164,12 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action ) if ( GTK_IS_TOOL_BUTTON(item) ) { GtkToolButton* button = GTK_TOOL_BUTTON(item); if ( act->private_data->iconId ) { - GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize ); + GtkWidget *child = + GTK_WIDGET(sp_get_icon_image(act->private_data->iconId, act->private_data->iconSize)->gobj()); - gtk_widget_set_hexpand(child, FALSE); - gtk_widget_set_vexpand(child, FALSE); - gtk_tool_button_set_icon_widget(button, child); + gtk_widget_set_hexpand(child, FALSE); + gtk_widget_set_vexpand(child, FALSE); + gtk_tool_button_set_icon_widget(button, child); } else { gchar *label = nullptr; g_object_get( G_OBJECT(action), "short_label", &label, NULL ); @@ -195,11 +197,12 @@ static void ink_toggle_action_update_icon( InkToggleAction* action ) if ( GTK_IS_TOOL_BUTTON(proxies->data) ) { GtkToolButton* button = GTK_TOOL_BUTTON(proxies->data); - GtkWidget* child = gtk_image_new_from_icon_name( action->private_data->iconId, action->private_data->iconSize ); - gtk_widget_set_hexpand(child, FALSE); - gtk_widget_set_vexpand(child, FALSE); - gtk_widget_show_all(child); - gtk_tool_button_set_icon_widget(button, child); + GtkWidget *child = GTK_WIDGET( + sp_get_icon_image(action->private_data->iconId, action->private_data->iconSize)->gobj()); + gtk_widget_set_hexpand(child, FALSE); + gtk_widget_set_vexpand(child, FALSE); + gtk_widget_show_all(child); + gtk_tool_button_set_icon_widget(button, child); } } diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 3fcd40bdf9294f1e140ee9d3a54f15f1012165c2..3b93f20f5b9e1a9637262500e2ceada617bbb178 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -34,6 +34,7 @@ #include "paint-selector.h" #include "path-prefix.h" +#include "helper/icon-loader.h" #include "helper/stock-items.h" #include "style.h" @@ -243,7 +244,7 @@ sp_paint_selector_init(SPPaintSelector *psel) // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty gtk_widget_set_tooltip_text(psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)")); g_object_set_data(G_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD)); - w = gtk_image_new_from_icon_name("fill-rule-even-odd", GTK_ICON_SIZE_MENU); + w = GTK_WIDGET(sp_get_icon_image("fill-rule-even-odd", GTK_ICON_SIZE_MENU)->gobj()); gtk_container_add(GTK_CONTAINER(psel->evenodd), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(psel->evenodd), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); @@ -254,7 +255,7 @@ sp_paint_selector_init(SPPaintSelector *psel) // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty gtk_widget_set_tooltip_text(psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)")); g_object_set_data(G_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO)); - w = gtk_image_new_from_icon_name("fill-rule-nonzero", GTK_ICON_SIZE_MENU); + w = GTK_WIDGET(sp_get_icon_image("fill-rule-nonzero", GTK_ICON_SIZE_MENU)->gobj()); gtk_container_add(GTK_CONTAINER(psel->nonzero), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(psel->nonzero), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); @@ -323,8 +324,7 @@ static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(b), FALSE); g_object_set_data(G_OBJECT(b), "mode", GUINT_TO_POINTER(mode)); - w = gtk_image_new_from_icon_name(pixmap, GTK_ICON_SIZE_BUTTON); - gtk_widget_show(w); + w = GTK_WIDGET(sp_get_icon_image(pixmap, GTK_ICON_SIZE_BUTTON)->gobj()); gtk_container_add(GTK_CONTAINER(b), w); gtk_box_pack_start(GTK_BOX(psel->style), b, FALSE, FALSE, 0); diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index 191d215f30d000be4d0ce8bdcc1d5ec19b248274..dfa8614a1dc40e0aeea2c46499610534e5964c78 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -25,6 +25,7 @@ #include "path-prefix.h" #include "stroke-style.h" +#include "helper/icon-loader.h" #include "helper/stock-items.h" #include "io/sys.h" @@ -55,8 +56,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) : set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer)); gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, nullptr, nullptr); - empty_image = new Gtk::Image(); - empty_image->set_from_icon_name("no-marker", Gtk::ICON_SIZE_SMALL_TOOLBAR); + empty_image = sp_get_icon_image("no-marker", Gtk::ICON_SIZE_SMALL_TOOLBAR); sandbox = ink_markers_preview_doc (); desktop = SP_ACTIVE_DESKTOP; diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 9f702a3c4c5c36affd71cff866e0adce8485dc8b..3a5abbca43f0e9be77d2ac3796c9467815717d7e 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -28,6 +28,7 @@ #include "svg/svg-color.h" +#include "helper/icon-loader.h" #include "ui/widget/unit-menu.h" #include "widgets/style-utils.h" @@ -120,8 +121,7 @@ StrokeStyle::StrokeStyleButton::StrokeStyleButton(Gtk::RadioButtonGroup &grp, show(); set_mode(false); - auto px = Gtk::manage(new Gtk::Image()); - px->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR); + auto px = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR)); g_assert(px != nullptr); px->show(); add(*px);