From 75d662f71d8eeb4b1c83e9bb61c1bd56f9b0e959 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 21 Jul 2018 04:55:31 +0200 Subject: [PATCH 01/26] adding gtk-theme --- ...ymbolic.svg => dialog-layers-symbolic.svg} | 2 +- src/desktop.cpp | 11 + src/desktop.h | 1 + src/helper/CMakeLists.txt | 2 + src/helper/action.cpp | 6 +- src/helper/icon-loader.cpp | 131 ++++ src/helper/icon-loader.h | 25 + src/inkscape.cpp | 39 +- src/inkscape.h | 5 +- src/live_effects/parameter/item.cpp | 9 +- src/live_effects/parameter/originalitem.cpp | 7 +- .../parameter/originalitemarray.cpp | 19 +- .../parameter/originalpatharray.cpp | 14 +- src/live_effects/parameter/path.cpp | 22 +- src/live_effects/parameter/togglebutton.cpp | 23 +- src/preferences-skeleton.h | 3 + src/svg-view-slideshow.cpp | 15 +- src/ui/dialog/align-and-distribute.cpp | 3 +- src/ui/dialog/clonetiler.cpp | 25 +- src/ui/dialog/cssdialog.cpp | 3 +- src/ui/dialog/document-properties.cpp | 6 +- src/ui/dialog/fill-and-stroke.cpp | 4 +- src/ui/dialog/inkscape-preferences.cpp | 191 +++++- src/ui/dialog/inkscape-preferences.h | 15 +- src/ui/dialog/layers.cpp | 12 +- src/ui/dialog/livepatheffect-editor.cpp | 3 +- src/ui/dialog/objects.cpp | 9 +- src/ui/dialog/ocaldialogs.cpp | 12 +- src/ui/dialog/styledialog.cpp | 4 +- src/ui/dialog/symbols.cpp | 40 +- src/ui/dialog/tags.cpp | 16 +- src/ui/dialog/transformation.cpp | 7 +- src/ui/dialog/undo-history.cpp | 11 +- src/ui/dialog/xml-tree.cpp | 29 +- src/ui/interface.cpp | 49 +- src/ui/interface.h | 2 + src/ui/view/edit-widget-interface.h | 3 + src/ui/widget/addtoicon.cpp | 16 +- src/ui/widget/addtoicon.h | 1 - src/ui/widget/alignment-selector.cpp | 4 +- src/ui/widget/anchor-selector.cpp | 7 +- src/ui/widget/clipmaskicon.cpp | 18 +- src/ui/widget/color-notebook.cpp | 10 +- src/ui/widget/dock-item.cpp | 17 +- src/ui/widget/imagetoggler.cpp | 19 +- src/ui/widget/insertordericon.cpp | 16 +- src/ui/widget/labelled.cpp | 5 +- src/ui/widget/layer-selector.cpp | 9 +- src/ui/widget/layertypeicon.cpp | 17 +- src/ui/widget/preferences-widget.cpp | 57 +- src/ui/widget/preferences-widget.h | 10 + src/ui/widget/random.cpp | 5 +- src/verbs.cpp | 634 +++++++++--------- src/widgets/button.cpp | 7 +- src/widgets/desktop-widget.cpp | 42 +- src/widgets/desktop-widget.h | 3 + src/widgets/ege-adjustment-action.cpp | 6 +- src/widgets/gradient-selector.cpp | 3 +- src/widgets/ink-action.cpp | 5 +- src/widgets/ink-radio-action.cpp | 8 +- src/widgets/ink-toggle-action.cpp | 21 +- src/widgets/paint-selector.cpp | 8 +- src/widgets/stroke-marker-selector.cpp | 4 +- src/widgets/stroke-style.cpp | 4 +- 64 files changed, 1100 insertions(+), 634 deletions(-) rename share/icons/hicolor/scalable/actions/{layers-symbolic.svg => dialog-layers-symbolic.svg} (94%) create mode 100644 src/helper/icon-loader.cpp create mode 100644 src/helper/icon-loader.h 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 097edb92e72..ceb0d5e2cfe 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/src/desktop.cpp b/src/desktop.cpp index ad75a441d38..8becdef55c6 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1570,6 +1570,17 @@ 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 01d0b06bfea..a1281a5b826 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 bcd9f7c58a8..7b6b548b9f2 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 6e44487f96e..6d14037f08f 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 00000000000..b19b19582b8 --- /dev/null +++ b/src/helper/icon-loader.cpp @@ -0,0 +1,131 @@ +/* + * 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 + +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; +} + +/* + 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 00000000000..5b6af546f16 --- /dev/null +++ b/src/helper/icon-loader.h @@ -0,0 +1,25 @@ +#ifndef SEEN_INK_ICON_LOADER_H +#define SEEN_INK_ICON_LOADER_H + +/* + * Icon Loader + * + * + * Authors: + * Jabiertxo Arraiza + * + * + */ +#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); + +#endif // SEEN_INK_STOCK_ITEMS_H diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 58d60d3b28f..2fb11444e34 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,37 @@ 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 = "*{-gtk-icon-theme:\""; + css_str += prefs->getString("/theme/iconTheme"); + 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 +479,8 @@ 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/theme").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 d383da15d16..ec9fc9b843d 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -198,6 +198,8 @@ public: gint get_pdf_page() { return _pdf_page; } + void add_style_sheet(); + void add_icon_theme(); private: static Inkscape::Application * _S_inst; @@ -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/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp index 8a8b1230737..5da934da62c 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 b415dd52a6b..c42db4ce904 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 23d9f96cd22..22193b2151c 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 cc4408218c8..474f6c1bf56 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 52e1b62a671..af553a02935 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 535e43dcf97..be75555db41 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/preferences-skeleton.h b/src/preferences-skeleton.h index 620793dc5cb..2bff8d634e9 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 3bb80029215..f5f8c41cac6 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 3d9a53951b6..7ad8a5e185d 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 9a4cd92ab09..3cec3802271 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 aa0198f2721..901bcf36cc6 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 0b47f9bac74..39993bc0981 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 dd387c37e77..067749fa062 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 03c3587d918..5bf594c3840 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "cms-system.h" #include "document.h" @@ -51,6 +53,7 @@ #include "style.h" #include "ui/widget/style-swatch.h" +#include "ui/interface.h" #ifdef HAVE_ASPELL # include @@ -337,6 +340,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 +580,41 @@ 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::initPageUI() { Gtk::TreeModel::iterator iter_ui = this->AddPage(_page_ui, _("Interface"), PREFS_PAGE_UI); @@ -654,23 +698,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 +745,131 @@ void InkscapePreferences::initPageUI() _("Selects whether the dockbar switcher will show text labels, icons, or both"), false); } + //Theme + _page_theme.add_group_header( _("Theme changes, require restart")); + { + 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); + +// g_object_bind_property (gtk_settings_get_default (), "gtk-theme-name", +// (gpointer *)&_theme, "active-id", +// (GBindingFlags)(G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE)); + + _theme.init("/theme/theme", labels, values, "Adwaita"); + _page_theme.add_line(false, _("Change theme:"), _theme, "", "", false); + } + + { + using namespace Inkscape::IO::Resource; + auto files = get_filenames(UIS, {".css"}, {"style.css","dark.css","symbolic.css"}); + std::vector labels; + std::vector values; + for(auto &filename: files) { + // 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 = filename.find_last_of("\\/"); + if (std::string::npos != last_slash_idx) + { + filename.erase(0, last_slash_idx + 1); + } + + // Remove extension if present. + const size_t period_idx = filename.rfind('.'); + if (std::string::npos != period_idx) + { + filename.erase(period_idx); + } + labels.push_back(filename); + values.push_back(filename); + } + _icon_theme.init("/theme/iconTheme", labels, values, "hicolor"); + _page_theme.add_line(false, _("Change icon theme:"), _icon_theme, "", "", false); + } + + _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); + } + Glib::ustring const label = _("Now"); + Glib::ustring const tooltip = _("A bit slow process"); + _apply_theme = new UI::Widget::Button(label,tooltip); + _page_theme.add_line( false, _("Apply theme"), *_apply_theme, "", + _("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,13 +2157,11 @@ 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("")); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 3a1105b114f..f705d8e299f 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 _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; + UI::Widget::Button *_apply_theme; + UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; UI::Widget::PrefRadioButton _win_native; @@ -357,9 +369,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; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index fe528d34d7f..bfd0e05e31d 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 dd019cfbad2..ccd71a171fb 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 397f5690e48..2bcde597ffa 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 2c457b6d05b..ffa535b78e0 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 9171dd9cec9..e978667efcf 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 578562a79b9..cc5434318f3 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 ed8c00c611f..d27a320a775 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 9a0e4ddf407..14ddc90440e 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 e9572443523..c480624fd63 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 c7c5424ebcb..647e0beedb2 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 7e64e876bcf..9f5d2d38cd6 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,52 @@ 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/theme").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 +514,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 83788ca1bc9..90d86bea7e0 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 f2e34b534f8..7004fea9512 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 e5119fc609a..4542333b59e 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 60c773e8481..c17ae907a15 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 c6c95f097b2..9256a08bd02 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 52768b7f150..fc7c15f21b2 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,9 +17,8 @@ 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(); diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 509e218a99c..704b5c653c1 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 5b0f12e51a1..2d8dcc31057 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 7cd841d882c..c85abd6de8b 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 1200144f120..76b48fbbe15 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 d402aca37fc..1343786a128 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 2e98400358e..6ee2b752f75 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 b862224043e..c8aefa65665 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 278bd317b1c..356531620b5 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 fee39263231..09656a80060 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,58 @@ 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 +758,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...")); diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 8e1602ff9a4..f75079c7782 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -181,6 +181,16 @@ public: */ void init(Glib::ustring const &prefs_path, Glib::ustring labels[], Glib::ustring values[], int num_items, Glib::ustring default_value); + /** + * 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; diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 237144c7ce8..3bda641d7ae 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 f859f672ba6..0bbfeb1fbe9 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 19443716cec..83094c1566a 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 d0b6af9a05c..41a7c41b40f 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 60b100028a5..d3917a50508 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -163,6 +163,8 @@ struct SPDesktopWidget { _dtw->window = nullptr; } + void storeDesktopPosition() override + { _dtw->storeDesktopPosition(); } void requestCanvasUpdate() override { _dtw->requestCanvasUpdate(); } void requestCanvasUpdateAndWait() override @@ -237,6 +239,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 5b71110b221..927b6aec0fd 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 230282e6d42..10b1ecf04e3 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 5adb69ac67c..ee647840348 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 611e0c6248a..d0bff127188 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 467f0f24c5b..77dc39c3d66 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 3fcd40bdf92..3b93f20f5b9 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 191d215f30d..dfa8614a1dc 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 9f702a3c4c5..3a5abbca43f 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); -- GitLab From d1ede5d14574fe06e49e2fa3054c4ece7aab9b38 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 21 Jul 2018 17:34:37 +0200 Subject: [PATCH 02/26] Working on themes --- src/helper/icon-loader.cpp | 24 ++++++++- src/helper/icon-loader.h | 5 +- src/inkscape.cpp | 2 +- src/io/resource.cpp | 69 +++++++++++++++++++++++++- src/io/resource.h | 13 +++++ src/preferences-skeleton.h | 2 +- src/ui/dialog/inkscape-preferences.cpp | 12 ++--- src/ui/dialog/inkscape-preferences.h | 2 +- src/ui/interface.cpp | 2 +- 9 files changed, 116 insertions(+), 15 deletions(-) diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp index b19b19582b8..3a7d459b3a2 100644 --- a/src/helper/icon-loader.cpp +++ b/src/helper/icon-loader.cpp @@ -21,6 +21,7 @@ #include "widgets/toolbox.h" #include #include +#include Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) { @@ -45,7 +46,10 @@ Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) 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 = + 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)) { @@ -119,6 +123,24 @@ Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) 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++ diff --git a/src/helper/icon-loader.h b/src/helper/icon-loader.h index 5b6af546f16..ef7dbd110eb 100644 --- a/src/helper/icon-loader.h +++ b/src/helper/icon-loader.h @@ -12,6 +12,9 @@ */ #include #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); @@ -21,5 +24,5 @@ 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 2fb11444e34..59f503bf719 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -479,7 +479,7 @@ 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/theme").c_str(), NULL); + 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/io/resource.cpp b/src/io/resource.cpp index f8cf9fce4c7..127b92b7600 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -213,7 +213,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 +224,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 +238,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 +311,40 @@ 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 diff --git a/src/io/resource.h b/src/io/resource.h index dae43ec8fba..f70e55447af 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -79,11 +79,24 @@ 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/preferences-skeleton.h b/src/preferences-skeleton.h index 2bff8d634e9..2a6083e557e 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -73,7 +73,7 @@ static char const preferences_skeleton[] = " inkscape:window-height=\"480\" />\n" " \n" " \n" +" gtkTheme=\"Adwaita\" iconTheme=\"hicolor\" symbolicIcons=\"0\" darkTheme=\"0\" symbolicColor=\"0x000000ff\" >\n" " \n" "\n" " labels; std::vector values; for(auto &filename: files) { @@ -836,6 +832,8 @@ void InkscapePreferences::initPageUI() labels.push_back(filename); values.push_back(filename); } + 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); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index f705d8e299f..d172687fad7 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -240,7 +240,7 @@ protected: UI::Widget::PrefCheckButton _t_node_delete_preserves_shape; UI::Widget::PrefColorPicker _t_node_pathoutline_color; - UI::Widget::PrefCombo _theme; + UI::Widget::PrefCombo _gtk_theme; UI::Widget::PrefCombo _icon_theme; UI::Widget::PrefCheckButton _dark_theme; UI::Widget::PrefCheckButton _symbolic_icons; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 9f5d2d38cd6..89f2c3d8a20 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -269,7 +269,7 @@ 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/theme").c_str(), NULL); + 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(); -- GitLab From 58c87a9e1d686d1826df7bd29ca27794d859b3dd Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 21 Jul 2018 23:56:50 +0200 Subject: [PATCH 03/26] Fixing some icons dont redraw --- src/inkscape.cpp | 4 +--- src/ui/dialog/inkscape-preferences.cpp | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 59f503bf719..13283b03d83 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -395,9 +395,7 @@ Application::add_style_sheet() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // symbolic auto provider = Gtk::CssProvider::create(); - Glib::ustring css_str = "*{-gtk-icon-theme:\""; - css_str += prefs->getString("/theme/iconTheme"); - css_str += "\";}"; + 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)); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index f31b443fbb3..7e6e516ae3d 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -822,16 +822,12 @@ void InkscapePreferences::initPageUI() { filename.erase(0, last_slash_idx + 1); } - - // Remove extension if present. - const size_t period_idx = filename.rfind('.'); - if (std::string::npos != period_idx) - { - filename.erase(period_idx); - } + labels.push_back(filename); values.push_back(filename); } + 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"); -- GitLab From 34d08da015358e09229ebd7f01744432901bdc47 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 22 Jul 2018 00:19:53 +0200 Subject: [PATCH 04/26] Fixing coding style --- src/desktop.cpp | 3 +- src/helper/icon-loader.cpp | 25 ++-- src/helper/icon-loader.h | 8 +- src/inkscape.cpp | 12 +- src/inkscape.h | 2 +- src/io/resource.cpp | 13 +- src/io/resource.h | 14 +- src/live_effects/parameter/togglebutton.cpp | 4 +- src/ui/dialog/inkscape-preferences.cpp | 152 ++++++++++---------- src/ui/dialog/inkscape-preferences.h | 12 +- src/ui/interface.cpp | 19 ++- src/ui/interface.h | 2 +- src/ui/widget/anchor-selector.cpp | 2 +- src/ui/widget/preferences-widget.cpp | 23 ++- src/ui/widget/preferences-widget.h | 10 +- src/widgets/desktop-widget.cpp | 4 +- src/widgets/desktop-widget.h | 53 +++---- 17 files changed, 164 insertions(+), 194 deletions(-) diff --git a/src/desktop.cpp b/src/desktop.cpp index 8becdef55c6..7b72524ccc3 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1573,8 +1573,7 @@ SPDesktop::onResized (double /*x*/, double /*y*/) /** * Redraw callback; queues Gtk redraw; connected by View. */ -void -SPDesktop::storeDesktopPosition() +void SPDesktop::storeDesktopPosition() { if (main) { _widget->storeDesktopPosition(); diff --git a/src/helper/icon-loader.cpp b/src/helper/icon-loader.cpp index 3a7d459b3a2..e514343a3e5 100644 --- a/src/helper/icon-loader.cpp +++ b/src/helper/icon-loader.cpp @@ -45,13 +45,11 @@ Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size) 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); + 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); + 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; @@ -123,20 +121,21 @@ Gtk::Image *sp_get_icon_image(Glib::ustring icon_name, gchar const *prefs_size) return image; } -std::pair, Gdk::RGBA > sp_set_radioaction_icon(Gtk::RadioAction::Group group, Glib::ustring icon_name, Glib::ustring label, Glib::ustring tooltip) +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; + 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)); + sp_svg_write_color(colornamed, sizeof(colornamed), prefs->getInt("/theme/symbolicColor", 0x000000ff)); color.set(colornamed); return std::make_pair(action, color); } diff --git a/src/helper/icon-loader.h b/src/helper/icon-loader.h index ef7dbd110eb..02b74816310 100644 --- a/src/helper/icon-loader.h +++ b/src/helper/icon-loader.h @@ -11,9 +11,8 @@ * */ #include -#include #include -#include +#include #include Glib::RefPtr sp_get_icon_pixbuf(Glib::ustring icon_name, gint size); @@ -24,5 +23,8 @@ 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); +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 13283b03d83..9be03349461 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -410,8 +410,7 @@ Application::add_style_sheet() #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()); + g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str()); } #else catch (...) { @@ -419,8 +418,8 @@ Application::add_style_sheet() #endif Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - //we want a tiny file with 3 or 4 lines, so we can loada witout removing context - //is more undertable than record previously applyed + // 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(); @@ -477,8 +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); + 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 ec9fc9b843d..59532b2f6f6 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -201,7 +201,7 @@ public: void add_style_sheet(); void add_icon_theme(); -private: + private: static Inkscape::Application * _S_inst; Application(const char* argv0, bool use_gui); diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 127b92b7600..65fd01d0e8d 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -318,27 +318,28 @@ void get_filenames_from_path(std::vector &files, Glib::ustring pa * 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) +void get_foldernames_from_path(std::vector &folders, Glib::ustring path, + std::vector exclusions) { - if(!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { + if (!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return; } Glib::Dir dir(path); std::string file = dir.read_name(); - while (!file.empty()){ + 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); + 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) { + if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR) && !reject) { folders.push_back(filename); } file = dir.read_name(); diff --git a/src/io/resource.h b/src/io/resource.h index f70e55447af..d86eda51aae 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -79,23 +79,19 @@ 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(Type type, std::vector exclusions = {}); -std::vector get_foldernames(Domain domain, 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={}); +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={}); +void get_foldernames_from_path(std::vector &files, Glib::ustring path, + std::vector exclusions = {}); char *profile_path(const char *filename); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index be75555db41..c92e1c437ba 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -111,7 +111,7 @@ ToggleButtonParam::param_newWidget() } gtk_widget_show(box_button); GtkWidget *icon_button = nullptr; - if(!value){ + if (!value) { icon_button = GTK_WIDGET(sp_get_icon_image(_icon_inactive, _icon_size)); } else { icon_button = GTK_WIDGET(sp_get_icon_image(_icon_active, _icon_size)); @@ -163,7 +163,7 @@ ToggleButtonParam::refresh_button() Gtk::Image *im = dynamic_cast(children[0]); Gtk::IconSize is(_icon_size); if (!im) return; - if(!value){ + if (!value) { im = sp_get_icon_image(_icon_inactive, is); } else { im = sp_get_icon_image(_icon_active, is); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7e6e516ae3d..de6a6e2628e 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,14 +19,14 @@ #include "inkscape-preferences.h" +#include #include -#include #include +#include +#include #include -#include #include -#include -#include +#include #include "cms-system.h" #include "document.h" @@ -52,8 +52,8 @@ #include "object/color-profile.h" #include "style.h" -#include "ui/widget/style-swatch.h" #include "ui/interface.h" +#include "ui/widget/style-swatch.h" #ifdef HAVE_ASPELL # include @@ -340,7 +340,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const _("Remember the style of the (first) selected object as this tool's style")); } -//static void changeTheme() +// static void changeTheme() //{ // sp_ui_reload(); //} @@ -580,38 +580,34 @@ void InkscapePreferences::initPageTools() #endif // WITH_LPETOOL } -gchar * _inkscape_get_theme_dir (void) +gchar *_inkscape_get_theme_dir(void) { - const gchar *var; + 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); + 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) +static void _inkscape_fill_gtk(const gchar *path, GHashTable *t) { - const gchar *dir_entry; - GDir *dir = g_dir_open (path, 0, NULL); + const gchar *dir_entry; + GDir *dir = g_dir_open(path, 0, NULL); - if (!dir) - return; + 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); + 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)); + 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_free(filename); } - g_dir_close (dir); + g_dir_close(dir); } @@ -745,8 +741,8 @@ void InkscapePreferences::initPageUI() _("Selects whether the dockbar switcher will show text labels, icons, or both"), false); } - //Theme - _page_theme.add_group_header( _("Theme changes, require restart")); + // Theme + _page_theme.add_group_header(_("Theme changes, require restart")); { GHashTable *t; GHashTableIter iter; @@ -754,54 +750,51 @@ void InkscapePreferences::initPageUI() gchar **builtin_themes; GList *list, *l; guint i; - const gchar * const *dirs; + const gchar *const *dirs; - t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + 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)); + 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); + g_strfreev(builtin_themes); - path = _inkscape_get_theme_dir (); - _inkscape_fill_gtk (path, t); - g_free (path); + 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_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); + 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); + 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); + 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) - { + 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); + 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); @@ -809,25 +802,24 @@ void InkscapePreferences::initPageUI() { using namespace Inkscape::IO::Resource; - auto files = get_foldernames(ICONS, {"application"}); + auto files = get_foldernames(ICONS, { "application" }); std::vector labels; std::vector values; - for(auto &filename: files) { + for (auto &filename : files) { // 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 = filename.find_last_of("\\/"); - if (std::string::npos != last_slash_idx) - { + if (std::string::npos != last_slash_idx) { filename.erase(0, last_slash_idx + 1); } labels.push_back(filename); values.push_back(filename); } - std::sort(labels.begin(), labels.end()); - std::sort(values.begin(), values.end()); + 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"); @@ -841,27 +833,27 @@ void InkscapePreferences::initPageUI() _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}; + 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_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_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); + _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); } Glib::ustring const label = _("Now"); Glib::ustring const tooltip = _("A bit slow process"); - _apply_theme = new UI::Widget::Button(label,tooltip); - _page_theme.add_line( false, _("Apply theme"), *_apply_theme, "", - _("Apply theme"), false); + _apply_theme = new UI::Widget::Button(label, tooltip); + _page_theme.add_line(false, _("Apply theme"), *_apply_theme, "", _("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 diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d172687fad7..152ecf6cdf5 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -240,15 +240,15 @@ 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::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; - UI::Widget::Button *_apply_theme; + UI::Widget::PrefCombo _misc_small_toolbar; + UI::Widget::PrefCombo _misc_small_secondary; + UI::Widget::PrefCombo _misc_small_tools; + UI::Widget::Button *_apply_theme; UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 89f2c3d8a20..99fbbc23cf6 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -263,29 +263,28 @@ sp_ui_new_view() sp_namedview_update_layers_from_document(static_cast(dtw->view)); } -void -sp_ui_reload() +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); + 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; + while (i != desktops.end()) { + SPDesktop *dt = *i; if (dt == nullptr) { ++i; continue; } dt->storeDesktopPosition(); - SPDocument *document; + SPDocument *document; SPViewWidget *dtw; document = dt->getDocument(); @@ -300,8 +299,8 @@ sp_ui_reload() 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)); + sp_namedview_window_from_document(static_cast(dtw->view)); + sp_namedview_update_layers_from_document(static_cast(dtw->view)); dt->destroyWidget(); i++; } diff --git a/src/ui/interface.h b/src/ui/interface.h index 90d86bea7e0..fcaa9801a1f 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -45,7 +45,7 @@ void sp_ui_close_view (GtkWidget *widget); void sp_ui_new_view (); -void sp_ui_reload (); +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/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index fc7c15f21b2..0873f9a84a9 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -20,7 +20,7 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b Gtk::Image *buttonIcon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_SMALL_TOOLBAR)); buttonIcon->show(); - button.set_relief(Gtk::RELIEF_NONE); + button.set_relief(Gtk::RELIEF_NONE); button.show(); button.add(*buttonIcon); button.set_can_focus(false); diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 09656a80060..7e9335a8a34 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -634,13 +634,14 @@ 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) +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; + std::cout << "PrefCombo::" + << "Diferent number of values/labels in " << prefs_path << std::endl; return; } _prefs_path = prefs_path; @@ -648,8 +649,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, int row = 0; int value = prefs->getInt(_prefs_path, default_value); - for (int i = 0 ; i < labels_size; ++i) - { + for (int i = 0; i < labels_size; ++i) { this->append(labels[i]); _values.push_back(values[i]); if (value == values[i]) @@ -658,26 +658,25 @@ 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, Glib::ustring default_value) +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; + 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()) - { + if (value.empty()) { value = default_value; } - for (int i = 0 ; i < labels_size; ++i) - { + for (int i = 0; i < labels_size; ++i) { this->append(labels[i]); _ustr_values.push_back(values[i]); if (value == values[i]) diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index f75079c7782..5036a1c5054 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -185,13 +185,13 @@ public: * 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, + int default_value); - void init(Glib::ustring const &prefs_path, - std::vector labels, std::vector values, Glib::ustring default_value); + void init(Glib::ustring const &prefs_path, std::vector labels, std::vector values, + Glib::ustring default_value); -protected: + protected: Glib::ustring _prefs_path; std::vector _values; std::vector _ustr_values; ///< string key values used optionally instead of numeric _values diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 41a7c41b40f..1626655fff4 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1202,8 +1202,8 @@ SPDesktopWidget::shutdown() /** * \store dessktop position */ -void -SPDesktopWidget::storeDesktopPosition() { +void SPDesktopWidget::storeDesktopPosition() +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool maxed = desktop->is_maximized(); bool full = desktop->is_fullscreen(); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index d3917a50508..40d194bb3d5 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -163,41 +163,24 @@ struct SPDesktopWidget { _dtw->window = nullptr; } - 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 + 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); } -- GitLab From ad8a38ec0a83bdebc6968aaa2c6e5d8b4dc7cfb4 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Sun, 22 Jul 2018 19:54:24 +0200 Subject: [PATCH 05/26] Toggle symbolic icons staff depending the theme has it or not --- src/ui/dialog/inkscape-preferences.cpp | 48 +++++++++++++++++++++----- src/ui/dialog/inkscape-preferences.h | 1 + 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index de6a6e2628e..0a040f87d5a 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -610,7 +611,36 @@ static void _inkscape_fill_gtk(const gchar *path, GHashTable *t) 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")) { + //TODO: check this on WIN + path += "/scalable/actions"; + Glib::ustring ret = Glib::build_filename(path, "3dbox_four_handles-symbolic.svg"); + if (Glib::file_test(ret, Glib::FILE_TEST_EXISTS)) { + symbolic = true; + } + } + } + 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); @@ -742,7 +772,8 @@ void InkscapePreferences::initPageUI() } // Theme - _page_theme.add_group_header(_("Theme changes, require restart")); + symbolicThemeCheck(); + _page_theme.add_group_header(_("Theme changes")); { GHashTable *t; GHashTableIter iter; @@ -802,21 +833,21 @@ void InkscapePreferences::initPageUI() { using namespace Inkscape::IO::Resource; - auto files = get_foldernames(ICONS, { "application" }); + auto folders = get_foldernames(ICONS, { "application" }); std::vector labels; std::vector values; - for (auto &filename : files) { + 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 = filename.find_last_of("\\/"); + const size_t last_slash_idx = folder.find_last_of("\\/"); if (std::string::npos != last_slash_idx) { - filename.erase(0, last_slash_idx + 1); + folder.erase(0, last_slash_idx + 1); } - labels.push_back(filename); - values.push_back(filename); + labels.push_back(folder); + values.push_back(folder); } std::sort(labels.begin(), labels.end()); std::sort(values.begin(), values.end()); @@ -824,6 +855,7 @@ void InkscapePreferences::initPageUI() 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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 152ecf6cdf5..e4346463304 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -565,6 +565,7 @@ protected: private: + void symbolicThemeCheck(); InkscapePreferences(); InkscapePreferences(InkscapePreferences const &d); InkscapePreferences operator=(InkscapePreferences const &d); -- GitLab From 2984959869ff341299e12f6b2ada2aba49fef2e4 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Tue, 24 Jul 2018 19:28:19 +0200 Subject: [PATCH 06/26] Add themes inkscape folder abailable by the app --- src/main.cpp | 30 ++++++++++++++++++++++++++ src/ui/dialog/inkscape-preferences.cpp | 7 ++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fb73eb8100b..108e5b0b2dc 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" @@ -646,6 +647,34 @@ static void set_extensions_env() //printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH")); } +static void set_datadir_env() +{ + 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; + } + + 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 +705,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/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 0a040f87d5a..bc940bbe2c3 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -624,8 +624,11 @@ void InkscapePreferences::symbolicThemeCheck() folder.erase(0, last_slash_idx + 1); } if (folder == prefs->getString("/theme/iconTheme")) { - //TODO: check this on WIN - path += "/scalable/actions"; +#ifdef WIN32 + path += g_win32_locale_filename_from_utf8("/scalable/actions"); +#else + path += "/scalable/actions"; +#endif Glib::ustring ret = Glib::build_filename(path, "3dbox_four_handles-symbolic.svg"); if (Glib::file_test(ret, Glib::FILE_TEST_EXISTS)) { symbolic = true; -- GitLab From 47c013e4cbec8817025b3d362057e0d6e4616ead Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Tue, 24 Jul 2018 20:01:31 +0200 Subject: [PATCH 07/26] Remove pointer --- src/ui/dialog/inkscape-preferences.cpp | 8 +++----- src/ui/dialog/inkscape-preferences.h | 3 ++- src/ui/widget/preferences-widget.cpp | 5 +++++ src/ui/widget/preferences-widget.h | 6 ++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index bc940bbe2c3..d106e735543 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -885,11 +885,9 @@ void InkscapePreferences::initPageUI() _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); } - Glib::ustring const label = _("Now"); - Glib::ustring const tooltip = _("A bit slow process"); - _apply_theme = new UI::Widget::Button(label, tooltip); - _page_theme.add_line(false, _("Apply theme"), *_apply_theme, "", _("Apply theme"), false); - _apply_theme->signal_clicked().connect(sigc::ptr_fun(sp_ui_reload)); + _apply_theme.init(_("Now (slow)")); + _page_theme.add_line(false, _("Apply theme"), _apply_theme, "", _("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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index e4346463304..7596849053e 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -248,7 +248,7 @@ protected: UI::Widget::PrefCombo _misc_small_toolbar; UI::Widget::PrefCombo _misc_small_secondary; UI::Widget::PrefCombo _misc_small_tools; - UI::Widget::Button *_apply_theme; + UI::Widget::PrefButton _apply_theme; UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; @@ -353,6 +353,7 @@ 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; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 7e9335a8a34..108d621c7d3 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -176,6 +176,11 @@ void PrefCheckButton::on_toggled() } } +void PrefButton::init(Glib::ustring const &label) +{ + this->set_label(label); +} + void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &string_value, bool default_value, PrefRadioButton* group_member) { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 5036a1c5054..3c3c81020d0 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -58,6 +58,12 @@ protected: void on_toggled() override; }; +class PrefButton : public Gtk::Button +{ +public: + void init(Glib::ustring const &label); +}; + class PrefRadioButton : public Gtk::RadioButton { public: -- GitLab From 67a8312ad1a5b8ef5f60e63ca464013e5a3adeaf Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Tue, 24 Jul 2018 22:00:14 +0200 Subject: [PATCH 08/26] Fix a wrongy commit --- src/ui/dialog/inkscape-preferences.cpp | 3 ++- src/ui/dialog/inkscape-preferences.h | 2 +- src/ui/widget/preferences-widget.cpp | 5 ----- src/ui/widget/preferences-widget.h | 6 ------ 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d106e735543..8107b3c3044 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -885,7 +885,8 @@ void InkscapePreferences::initPageUI() _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.init(_("Now (slow)")); + _apply_theme.set_label(_("Now")); + _apply_theme.set_tooltip_text (_("It apply slow")); _page_theme.add_line(false, _("Apply theme"), _apply_theme, "", _("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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 7596849053e..becd1f5b562 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -248,7 +248,7 @@ protected: UI::Widget::PrefCombo _misc_small_toolbar; UI::Widget::PrefCombo _misc_small_secondary; UI::Widget::PrefCombo _misc_small_tools; - UI::Widget::PrefButton _apply_theme; + Gtk::Button _apply_theme; UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 108d621c7d3..7e9335a8a34 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -176,11 +176,6 @@ void PrefCheckButton::on_toggled() } } -void PrefButton::init(Glib::ustring const &label) -{ - this->set_label(label); -} - void PrefRadioButton::init(Glib::ustring const &label, Glib::ustring const &prefs_path, Glib::ustring const &string_value, bool default_value, PrefRadioButton* group_member) { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 3c3c81020d0..5036a1c5054 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -58,12 +58,6 @@ protected: void on_toggled() override; }; -class PrefButton : public Gtk::Button -{ -public: - void init(Glib::ustring const &label); -}; - class PrefRadioButton : public Gtk::RadioButton { public: -- GitLab From 742d422c6f7c1abb7e788a16f9866d3063487c43 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Tue, 24 Jul 2018 23:38:26 +0200 Subject: [PATCH 09/26] Add buttons to open folders as sugestion of Maren --- src/ui/dialog/inkscape-preferences.cpp | 31 +++++++++++++++++++++----- src/ui/dialog/inkscape-preferences.h | 11 +++++++-- src/ui/widget/preferences-widget.cpp | 22 ++++++++++++++++++ src/ui/widget/preferences-widget.h | 10 +++++++++ 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8107b3c3044..ea5393d37ba 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2184,18 +2184,37 @@ void InkscapePreferences::initPageSystem() _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 location")); + _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 location")); _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")); + _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 iconos")); + _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")); + _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")); + _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")); + _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 keyboard shorcuts")); + _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")); + _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 becd1f5b562..f734543f398 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -359,8 +359,15 @@ protected: 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; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 7e9335a8a34..2b5378416b0 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -880,6 +880,28 @@ 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 &button_text) +{ + relatedEntry = new Gtk::Entry(); + relatedButton = new Gtk::Button(button_text); + relatedEntry->set_text(entry_string); + relatedEntry->set_sensitive(false); + this->pack_start(*relatedEntry); + this->pack_start(*relatedButton); + 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; + if (!g_app_info_launch_default_for_uri (("file://" + relatedEntry->get_text()).c_str(), NULL, &error)) { + g_warning ("Failed to open uri: %s", error->message); + } +} + 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 5036a1c5054..2a2b2c5f80f 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -247,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 &button_text); +protected: + Gtk::Button *relatedButton; + Gtk::Entry *relatedEntry; + void onRelatedButtonClickedCallback(); +}; + class PrefFileButton : public Gtk::FileChooserButton { public: -- GitLab From 8a5db7a20ad5c72b036b6f0c157d492ad3465550 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Tue, 24 Jul 2018 23:43:35 +0200 Subject: [PATCH 10/26] Fix buttons strings --- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ea5393d37ba..befd28d0460 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2188,10 +2188,10 @@ void InkscapePreferences::initPageSystem() _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_config.init((char const *)Inkscape::IO::Resource::profile_path(""), _("Open location")); + _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 location")); + _sys_user_extension_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""),_("Open extensions")); _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")); -- GitLab From 7b016fcac8ba541b663d62f697c0e0a5ec0ded5a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Tue, 24 Jul 2018 23:45:33 +0200 Subject: [PATCH 11/26] Fix buttons strings --- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index befd28d0460..2d7b6c93d20 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2197,7 +2197,7 @@ void InkscapePreferences::initPageSystem() _sys_user_themes_dir.init((char const *)Inkscape::IO::Resource::profile_path("/themes"),_("Open themes")); _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 iconos")); + _sys_user_icons_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::ICONS, ""),_("Open icons")); _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")); @@ -2209,7 +2209,7 @@ void InkscapePreferences::initPageSystem() _sys_user_palettes_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::PALETTES, ""),_("Open palletes")); _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 keyboard shorcuts")); + _sys_user_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""),_("Open keys shorcuts")); _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")); -- GitLab From a83cce26cd86e87131321ba19a7ba32a9763fb28 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 25 Jul 2018 00:04:44 +0200 Subject: [PATCH 12/26] Improve the look of prefs buttons --- src/ui/widget/preferences-widget.cpp | 16 ++++++++++++---- src/ui/widget/preferences-widget.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 2b5378416b0..171a20418e5 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -880,14 +880,22 @@ 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 &button_text) +void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const &tooltip) { relatedEntry = new Gtk::Entry(); - relatedButton = new Gtk::Button(button_text); + 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(_("_Browse...")); + pixlabel->pack_start(*l); + relatedButton->add(*pixlabel); + relatedButton->set_tooltip_text(tooltip); relatedEntry->set_text(entry_string); relatedEntry->set_sensitive(false); - this->pack_start(*relatedEntry); - this->pack_start(*relatedButton); + this->pack_end(*relatedButton, false, false, 4); + this->pack_start(*relatedEntry, true, true, 0); relatedButton->signal_clicked().connect( sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 2a2b2c5f80f..d8d0123d0cf 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -250,7 +250,7 @@ protected: class PrefOpenFolder : public Gtk::HBox { public: - void init(Glib::ustring const &entry_string, Glib::ustring const &button_text); + void init(Glib::ustring const &entry_string, Glib::ustring const &tooltip); protected: Gtk::Button *relatedButton; Gtk::Entry *relatedEntry; -- GitLab From 7703e5c1ca7828217d12a1a4c039655608011422 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 09:07:01 +0200 Subject: [PATCH 13/26] Improve the 3DBOX icon --- .../scalable/actions/draw-cuboid-symbolic.svg | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg b/share/icons/hicolor/scalable/actions/draw-cuboid-symbolic.svg index f346772db7f..bb5cdf4b2fe 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 @@ - - - - - - - - - + + + + + + + -- GitLab From c1f9f070258f20e6d2e22d5f0d15d2e85360e912 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 09:27:48 +0200 Subject: [PATCH 14/26] Improve string for open button in preferences --- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- src/ui/widget/preferences-widget.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 2d7b6c93d20..6ada3384e01 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -629,8 +629,8 @@ void InkscapePreferences::symbolicThemeCheck() #else path += "/scalable/actions"; #endif - Glib::ustring ret = Glib::build_filename(path, "3dbox_four_handles-symbolic.svg"); - if (Glib::file_test(ret, Glib::FILE_TEST_EXISTS)) { + std::vector symbolic = get_filenames(path, {"-symbolic.svg"}, {}); + if (symbolic.size() > 0) { symbolic = true; } } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 171a20418e5..bdd7c0de9bd 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -888,7 +888,7 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const 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(_("_Browse...")); + l->set_markup_with_mnemonic(_("_Open")); pixlabel->pack_start(*l); relatedButton->add(*pixlabel); relatedButton->set_tooltip_text(tooltip); -- GitLab From 2a4ad3ead24e1428e3a714338ee13004e0ab1404 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 09:28:11 +0200 Subject: [PATCH 15/26] Improve string for open button in preferences II --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index bdd7c0de9bd..d8a548be273 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -888,7 +888,7 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const 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")); + l->set_markup_with_mnemonic(_("Open")); pixlabel->pack_start(*l); relatedButton->add(*pixlabel); relatedButton->set_tooltip_text(tooltip); -- GitLab From e3e7876a1d40ae84c5f513aeb6fea85baf644fa8 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 09:30:51 +0200 Subject: [PATCH 16/26] Improve tooltip for open button in preferences --- src/ui/dialog/inkscape-preferences.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 6ada3384e01..9bdc98b47d9 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2191,28 +2191,28 @@ void InkscapePreferences::initPageSystem() _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")); + _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")); + _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")); + _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")); + _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")); + _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")); + _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")); + _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")); + _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()); -- GitLab From 384a3997b3def9d8382602d97b71649d902e6c38 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 11:03:47 +0200 Subject: [PATCH 17/26] Add some Marting sugestions about main.cpp in MR --- src/main.cpp | 57 ++---------------------- src/path-prefix.cpp | 61 ++++++++++++++++++++++++++ src/path-prefix.h | 3 +- src/ui/dialog/inkscape-preferences.cpp | 7 +-- 4 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 108e5b0b2dc..14dcb0fe815 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -612,64 +612,15 @@ 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() { - 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; - } - + 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")); diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp index 87b756eb45b..75dff6a3368 100644 --- a/src/path-prefix.cpp +++ b/src/path-prefix.cpp @@ -25,6 +25,7 @@ #include #include "path-prefix.h" +#include "io/resource.h" /** @@ -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 a557ca34085..598a2eff897 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/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9bdc98b47d9..4808179b6a1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -625,13 +625,14 @@ void InkscapePreferences::symbolicThemeCheck() } if (folder == prefs->getString("/theme/iconTheme")) { #ifdef WIN32 - path += g_win32_locale_filename_from_utf8("/scalable/actions"); + path += multiplatform_path(("/scalable/actions"); #else path += "/scalable/actions"; #endif - std::vector symbolic = get_filenames(path, {"-symbolic.svg"}, {}); - if (symbolic.size() > 0) { + std::vector symbolic_icons = get_filenames(path, {"-symbolic.svg"}, {}); + if (symbolic_icons.size() > 0) { symbolic = true; + symbolic_icons.clear(); } } } -- GitLab From dd1a4d0373e906d4d2e8db2fb1d7835302eec5a4 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 11:25:39 +0200 Subject: [PATCH 18/26] Fix a compiling bug --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 4808179b6a1..049d6ca5c2f 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -625,7 +625,7 @@ void InkscapePreferences::symbolicThemeCheck() } if (folder == prefs->getString("/theme/iconTheme")) { #ifdef WIN32 - path += multiplatform_path(("/scalable/actions"); + path += g_win32_locale_filename_from_utf8("/scalable/actions"); #else path += "/scalable/actions"; #endif -- GitLab From 3052c39e53adfe7397987f91f7519d91392ea27f Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 11:46:37 +0200 Subject: [PATCH 19/26] Fix codding style --- src/main.cpp | 2 +- src/path-prefix.cpp | 12 ++--- src/ui/widget/anchor-selector.cpp | 77 +++++++++++++++--------------- src/ui/widget/preferences-widget.h | 8 ++-- 4 files changed, 49 insertions(+), 50 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 14dcb0fe815..b51d2d4559d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -623,7 +623,7 @@ 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")); + // printf("XDG_DATA_HOME = %s\n", g_getenv("XDG_DATA_HOME")); } /** diff --git a/src/path-prefix.cpp b/src/path-prefix.cpp index 75dff6a3368..2ef9c4f7d6a 100644 --- a/src/path-prefix.cpp +++ b/src/path-prefix.cpp @@ -23,9 +23,9 @@ #endif -#include -#include "path-prefix.h" #include "io/resource.h" +#include "path-prefix.h" +#include /** @@ -88,10 +88,10 @@ gchar *get_extensions_path() } if (pythonpath) { - new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", - extdir, pythonpath); + new_pythonpath = g_strdup_printf("%s" G_SEARCHPATH_SEPARATOR_S "%s", extdir, pythonpath); g_free(extdir); - } else { + } + else { new_pythonpath = extdir; } @@ -102,7 +102,7 @@ gchar *get_datadir_path() { using namespace Inkscape::IO::Resource; gchar *datadir; - + #ifdef WIN32 datadir = g_win32_locale_filename_from_utf8(profile_path("")); #else diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index 0873f9a84a9..ededc84e3f4 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -21,38 +21,38 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b buttonIcon->show(); button.set_relief(Gtk::RELIEF_NONE); - button.show(); - button.add(*buttonIcon); - button.set_can_focus(false); + 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]); + 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); + _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)); + 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(); + _container.attach(_buttons[i], i % 3, i / 3, 1, 1); + } + _selection = 4; + _buttons[4].set_active(); - this->add(_container); + this->add(_container); } AnchorSelector::~AnchorSelector() @@ -62,27 +62,26 @@ 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/preferences-widget.h b/src/ui/widget/preferences-widget.h index d8d0123d0cf..80cbf46b65e 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -247,11 +247,11 @@ protected: bool on_mnemonic_activate( bool group_cycling ) override; }; -class PrefOpenFolder : public Gtk::HBox -{ -public: +class PrefOpenFolder : public Gtk::HBox { + public: void init(Glib::ustring const &entry_string, Glib::ustring const &tooltip); -protected: + + protected: Gtk::Button *relatedButton; Gtk::Entry *relatedEntry; void onRelatedButtonClickedCallback(); -- GitLab From 7fb3c67bb66ed1bc2647c4695cf441f9683fd064 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 13:12:18 +0200 Subject: [PATCH 20/26] Working on open folders on WIN --- src/io/resource.cpp | 7 +++++-- src/ui/widget/preferences-widget.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 65fd01d0e8d..9f584f58c05 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -105,7 +105,8 @@ gchar *_get_path(Domain domain, Type type, char const *filename) path = profile_path(name); } 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); @@ -422,7 +425,7 @@ 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/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d8a548be273..431b0d0eab8 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -904,8 +904,14 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const void PrefOpenFolder::onRelatedButtonClickedCallback() { g_mkdir_with_parents (relatedEntry->get_text().c_str(), 0700); +#ifdef WIN32 + Uri uri = new System::Uri(relatedEntry->get_text()); + Glib::ustring uri_open = (uri.AbsoluteUri).c_str() +#else + Glib::ustring uri_open = ("file://" + relatedEntry->get_text()).c_str(); +#endif GError *error = NULL; - if (!g_app_info_launch_default_for_uri (("file://" + relatedEntry->get_text()).c_str(), NULL, &error)) { + if (!g_app_info_launch_default_for_uri (uri_open.c_str(), NULL, &error)) { g_warning ("Failed to open uri: %s", error->message); } } -- GitLab From 71da50844cd9aba61152c202a011665fd0bc0f30 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 14:08:00 +0200 Subject: [PATCH 21/26] Fix a win compiling bug and coding style --- src/io/resource.cpp | 7 ++-- src/ui/dialog/inkscape-preferences.cpp | 55 +++++++++++++++----------- src/ui/dialog/inkscape-preferences.h | 30 +++++++------- src/ui/widget/anchor-selector.cpp | 32 +++++++-------- src/ui/widget/preferences-widget.cpp | 21 +++++----- 5 files changed, 76 insertions(+), 69 deletions(-) diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 9f584f58c05..83772dd5d22 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -105,8 +105,8 @@ gchar *_get_path(Domain domain, Type type, char const *filename) path = profile_path(name); } break; } - - + + if (filename && path) { gchar *temp=g_build_filename(path, filename, NULL); g_free(path); @@ -425,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", "ui", "symbols", "themes", "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/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 049d6ca5c2f..414369f5bca 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -20,10 +20,10 @@ #include "inkscape-preferences.h" #include +#include #include #include #include -#include #include #include #include @@ -625,11 +625,11 @@ void InkscapePreferences::symbolicThemeCheck() } if (folder == prefs->getString("/theme/iconTheme")) { #ifdef WIN32 - path += g_win32_locale_filename_from_utf8("/scalable/actions"); + path += g_win32_locale_filename_from_utf8("/scalable/actions"); #else - path += "/scalable/actions"; + path += "/scalable/actions"; #endif - std::vector symbolic_icons = get_filenames(path, {"-symbolic.svg"}, {}); + std::vector symbolic_icons = get_filenames(path, { "-symbolic.svg" }, {}); if (symbolic_icons.size() > 0) { symbolic = true; symbolic_icons.clear(); @@ -640,7 +640,8 @@ void InkscapePreferences::symbolicThemeCheck() _symbolic_icons.set_active(false); _symbolic_icons.hide(); _symbolic_color.hide(); - } else { + } + else { _symbolic_icons.show(); _symbolic_color.show(); } @@ -859,7 +860,7 @@ void InkscapePreferences::initPageUI() 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)); + _icon_theme.signal_changed().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicThemeCheck)); } _dark_theme.init(_("Use dark theme"), "/theme/darkTheme", true); @@ -887,7 +888,7 @@ void InkscapePreferences::initPageUI() _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); } _apply_theme.set_label(_("Now")); - _apply_theme.set_tooltip_text (_("It apply slow")); + _apply_theme.set_tooltip_text(_("It apply slow")); _page_theme.add_line(false, _("Apply theme"), _apply_theme, "", _("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); @@ -2192,28 +2193,38 @@ void InkscapePreferences::initPageSystem() _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")); + _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")); + _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")); + + _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_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_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""),_("Open keys shorcuts folder")); + _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")); + + _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()); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index f734543f398..f36b3d944f5 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -353,21 +353,21 @@ protected: UI::Widget::PrefCheckButton _misc_namedicon_delay; // System page - // UI::Widget::Button *_apply_theme; + // 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; - 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; + 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; @@ -573,11 +573,11 @@ protected: private: - void symbolicThemeCheck(); - 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/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index ededc84e3f4..a92dbd68ee1 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -30,22 +30,21 @@ 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_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)); + 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); } @@ -62,12 +61,10 @@ AnchorSelector::~AnchorSelector() void AnchorSelector::btn_activated(int index) { - if(_selection == index && _buttons[index].get_active() == false) - { + if (_selection == index && _buttons[index].get_active() == false) { _buttons[index].set_active(true); } - else if(_selection != index && _buttons[index].get_active()) - { + else if (_selection != index && _buttons[index].get_active()) { int old_selection = _selection; _selection = index; _buttons[old_selection].set_active(false); @@ -78,9 +75,8 @@ void AnchorSelector::btn_activated(int index) 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()); + if (index >= 0 && index < 9) { + _buttons[index].set_active(!_buttons[index].get_active()); } } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 431b0d0eab8..5a48a2b0dff 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -884,35 +884,34 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const { relatedEntry = new Gtk::Entry(); relatedButton = new Gtk::Button(); - Gtk::HBox* pixlabel = new Gtk::HBox(false, 3); + 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->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)); - + relatedButton->signal_clicked().connect(sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); } void PrefOpenFolder::onRelatedButtonClickedCallback() { - g_mkdir_with_parents (relatedEntry->get_text().c_str(), 0700); + g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); #ifdef WIN32 - Uri uri = new System::Uri(relatedEntry->get_text()); - Glib::ustring uri_open = (uri.AbsoluteUri).c_str() + System::Uri uri = new System::Uri(relatedEntry->get_text()); + Glib::ustring uri_open = (uri.AbsoluteUri) + .c_str() #else Glib::ustring uri_open = ("file://" + relatedEntry->get_text()).c_str(); #endif - GError *error = NULL; - if (!g_app_info_launch_default_for_uri (uri_open.c_str(), NULL, &error)) { - g_warning ("Failed to open uri: %s", error->message); + GError *error = NULL; + if (!g_app_info_launch_default_for_uri(uri_open.c_str(), NULL, &error)) { + g_warning("Failed to open uri: %s", error->message); } } -- GitLab From e7a9946f278ab83fc7c5f541dc736f65060e4f55 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 14:43:33 +0200 Subject: [PATCH 22/26] Fixing a win compiling bug and coding style --- src/ui/widget/preferences-widget.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 5a48a2b0dff..01701456ed3 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -902,15 +902,8 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const void PrefOpenFolder::onRelatedButtonClickedCallback() { g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); -#ifdef WIN32 - System::Uri uri = new System::Uri(relatedEntry->get_text()); - Glib::ustring uri_open = (uri.AbsoluteUri) - .c_str() -#else - Glib::ustring uri_open = ("file://" + relatedEntry->get_text()).c_str(); -#endif - GError *error = NULL; - if (!g_app_info_launch_default_for_uri(uri_open.c_str(), NULL, &error)) { + GError *error = NULL; + if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text()), NULL, &error)) { g_warning("Failed to open uri: %s", error->message); } } -- GitLab From 19594097b9feb312b17b0fc62911881c6616535f Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 15:44:20 +0200 Subject: [PATCH 23/26] Fixing a win compiling bug and coding style --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 01701456ed3..c7aed51bcd3 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -903,7 +903,7 @@ void PrefOpenFolder::onRelatedButtonClickedCallback() { g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); GError *error = NULL; - if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text()), NULL, &error)) { + if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text()->c_str()), NULL, &error)) { g_warning("Failed to open uri: %s", error->message); } } -- GitLab From 9460afe0070bb60c5cbdf7882205d95190f8f83d Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 16:01:58 +0200 Subject: [PATCH 24/26] Fixing a win compiling bug and fix a string pointed by vlada --- src/ui/dialog/inkscape-preferences.cpp | 6 +++--- src/ui/widget/preferences-widget.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 414369f5bca..d6cc3931448 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -867,7 +867,7 @@ void InkscapePreferences::initPageUI() _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); + _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"), @@ -887,9 +887,9 @@ void InkscapePreferences::initPageUI() _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(_("Now")); + _apply_theme.set_label(_("Apply theme")); _apply_theme.set_tooltip_text(_("It apply slow")); - _page_theme.add_line(false, _("Apply theme"), _apply_theme, "", _("Apply theme"), false); + _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 diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index c7aed51bcd3..c4c177e7659 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -903,7 +903,7 @@ void PrefOpenFolder::onRelatedButtonClickedCallback() { g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); GError *error = NULL; - if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text()->c_str()), NULL, &error)) { + 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); } } -- GitLab From 3bfafac688b2f3330eba0c81a1e24d93fa0e2ab8 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 16:38:12 +0200 Subject: [PATCH 25/26] Fixing coding style --- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/widget/preferences-widget.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d6cc3931448..38e217397f9 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -867,7 +867,7 @@ void InkscapePreferences::initPageUI() _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); + _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"), diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index c4c177e7659..135382b1408 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -903,7 +903,8 @@ void PrefOpenFolder::onRelatedButtonClickedCallback() { g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); GError *error = NULL; - if (!g_app_info_launch_default_for_uri(g_filename_to_uri(relatedEntry->get_text().c_str(), NULL, &error), NULL, &error)) { + 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); } } -- GitLab From 19486fdb506cf415413088aa47c7585aee2f6ec3 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 25 Jul 2018 17:17:30 +0200 Subject: [PATCH 26/26] Fixing a win bug open folders --- src/ui/widget/preferences-widget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 135382b1408..584c4fb6dc6 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -903,10 +903,14 @@ 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) -- GitLab