From c20891fabc8c3ee2251e0545878e06545b6f0cdd Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 1 Oct 2017 23:57:52 +0200 Subject: First batch --- src/inkscape.cpp | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 8dfff3c63..c56002753 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -579,8 +579,8 @@ Application::crash_handler (int /*signum*/) gint count = 0; gchar *curdir = g_get_current_dir(); // This one needs to be freed explicitly gchar *inkscapedir = g_path_get_dirname(INKSCAPE._argv0); // Needs to be freed - GSList *savednames = NULL; - GSList *failednames = NULL; + std::vector savednames; + std::vector failednames; for (std::map::iterator iter = INKSCAPE._document_set.begin(), e = INKSCAPE._document_set.end(); iter != e; ++iter) { @@ -641,10 +641,10 @@ Application::crash_handler (int /*signum*/) // Save if (file) { sp_repr_save_stream (repr->document(), file, SP_SVG_NS_URI); - savednames = g_slist_prepend (savednames, g_strdup (c)); + savednames.push_back(g_strdup (c)); fclose (file); } else { - failednames = g_slist_prepend (failednames, (doc->getName()) ? g_strdup(doc->getName()) : g_strdup (_("Untitled document"))); + failednames.push_back((doc->getName()) ? g_strdup(doc->getName()) : g_strdup (_("Untitled document"))); } count++; } @@ -652,18 +652,16 @@ Application::crash_handler (int /*signum*/) g_free(curdir); g_free(inkscapedir); - savednames = g_slist_reverse (savednames); - failednames = g_slist_reverse (failednames); - if (savednames) { + if (!savednames.empty()) { fprintf (stderr, "\nEmergency save document locations:\n"); - for (GSList *l = savednames; l != NULL; l = l->next) { - fprintf (stderr, " %s\n", (gchar *) l->data); + for (auto i:savednames) { + fprintf (stderr, " %s\n", i); } } - if (failednames) { + if (!failednames.empty()) { fprintf (stderr, "\nFailed to do emergency save for documents:\n"); - for (GSList *l = failednames; l != NULL; l = l->next) { - fprintf (stderr, " %s\n", (gchar *) l->data); + for (auto i:failednames) { + fprintf (stderr, " %s\n", i); } } @@ -681,11 +679,11 @@ Application::crash_handler (int /*signum*/) char const *fstr = _("Automatic backup of the following documents failed:\n"); gint nllen = strlen ("\n"); gint len = strlen (istr) + strlen (sstr) + strlen (fstr); - for (GSList *l = savednames; l != NULL; l = l->next) { - len = len + SP_INDENT + strlen ((gchar *) l->data) + nllen; + for (auto i:savednames) { + len = len + SP_INDENT + strlen (i) + nllen; } - for (GSList *l = failednames; l != NULL; l = l->next) { - len = len + SP_INDENT + strlen ((gchar *) l->data) + nllen; + for (auto i:failednames) { + len = len + SP_INDENT + strlen (i) + nllen; } len += 1; gchar *b = g_new (gchar, len); @@ -693,29 +691,29 @@ Application::crash_handler (int /*signum*/) len = strlen (istr); memcpy (b + pos, istr, len); pos += len; - if (savednames) { + if (!savednames.empty()) { len = strlen (sstr); memcpy (b + pos, sstr, len); pos += len; - for (GSList *l = savednames; l != NULL; l = l->next) { + for (auto i:savednames) { memset (b + pos, ' ', SP_INDENT); pos += SP_INDENT; - len = strlen ((gchar *) l->data); - memcpy (b + pos, l->data, len); + len = strlen(i); + memcpy (b + pos, i, len); pos += len; memcpy (b + pos, "\n", nllen); pos += nllen; } } - if (failednames) { + if (!failednames.empty()) { len = strlen (fstr); memcpy (b + pos, fstr, len); pos += len; - for (GSList *l = failednames; l != NULL; l = l->next) { + for (auto i:failednames) { memset (b + pos, ' ', SP_INDENT); pos += SP_INDENT; - len = strlen ((gchar *) l->data); - memcpy (b + pos, l->data, len); + len = strlen(i); + memcpy (b + pos, i, len); pos += len; memcpy (b + pos, "\n", nllen); pos += nllen; -- cgit v1.2.3 From a4a165df79514f34736282e699180cb8ae81c949 Mon Sep 17 00:00:00 2001 From: Andrey Mozzhuhin Date: Sun, 1 Oct 2017 18:13:05 +0300 Subject: Fix bug #1226962 - Keyboard shortcuts (hotkeys) not functional in some cases in non-latin keyboard layouts The key group with zero index can be a non-Latin layout. Try to determine Latin layout group index at runtime by checking available keymap entries for Latin 'a' keyval. --- src/inkscape.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c56002753..c6c43272c 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -487,9 +487,10 @@ Application::Application(const char* argv, bool use_gui) : Inkscape::UI::Dialog::DebugDialog::getInstance()->captureLogMessages(); } - /* Check for global remapping of Alt key */ if (use_gui) { + Inkscape::UI::Tools::init_latin_keys_group(); + /* Check for global remapping of Alt key */ mapalt(guint(prefs->getInt("/options/mapalt/value", 0))); trackalt(guint(prefs->getInt("/options/trackalt/value", 0))); } -- cgit v1.2.3 From 75444920325ba8a134eb16c4844f7fa15f34dd55 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 20 Oct 2017 22:59:35 +0200 Subject: Add preference to load additional fonts from 'fonts' directories - 'use_fontsdir_system' for /share/inkscape/fonts - 'use_fontsdir_user' for /inkscape/fonts in user config (both activated by default) --- src/inkscape.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c6c43272c..0c3763c2b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -47,6 +47,7 @@ #include "inkscape.h" #include "io/sys.h" #include "io/resource.h" +#include "libnrtype/FontFactory.h" #include "message-stack.h" #include "path-prefix.h" #include "resource-manager.h" @@ -429,6 +430,7 @@ Application::Application(const char* argv, bool use_gui) : _trackalt(FALSE), _use_gui(use_gui) { + using namespace Inkscape::IO::Resource; /* fixme: load application defaults */ segv_handler = signal (SIGSEGV, Application::crash_handler); @@ -499,6 +501,17 @@ Application::Application(const char* argv, bool use_gui) : Inkscape::Extension::init(); autosave_init(); + + /* Initialize font factory */ + font_factory *factory = font_factory::Default(); + if (prefs->getBool("/options/font/use_fontsdir_system", true)) { + char const *fontsdir = get_path(SYSTEM, FONTS); + factory->AddFontsDir(fontsdir); + } + if (prefs->getBool("/options/font/use_fontsdir_user", true)) { + char const *fontsdir = get_path(USER, FONTS); + factory->AddFontsDir(fontsdir); + } } Application::~Application() -- cgit v1.2.3 From 2dc0f89864fded681d8ece1d077d6ff5c77bbe97 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 21 Oct 2017 18:25:18 +0200 Subject: Add preference to load additional fonts from custom directories 'custom_fontdirs' is a list of paths to search for fonts --- src/inkscape.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 0c3763c2b..e7e93929b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -512,6 +513,11 @@ Application::Application(const char* argv, bool use_gui) : char const *fontsdir = get_path(USER, FONTS); factory->AddFontsDir(fontsdir); } + Glib::ustring fontdirs_pref = prefs->getString("/options/font/custom_fontdirs"); + std::vector fontdirs = Glib::Regex::split_simple("\\|", fontdirs_pref); + for (auto &fontdir : fontdirs) { + factory->AddFontsDir(fontdir.c_str()); + } } Application::~Application() -- cgit v1.2.3