diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2019-08-21 15:15:48 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2019-08-21 15:15:48 +0000 |
| commit | 606e39f3b7a587989cc5acbbd4ad903f3be8cf8a (patch) | |
| tree | 7c3c4c159c17b7eea24596d60e719605e36c6313 /src/ui/dialog/inkscape-preferences.cpp | |
| parent | Palettes: GNOME HIG (diff) | |
| download | inkscape-606e39f3b7a587989cc5acbbd4ad903f3be8cf8a.tar.gz inkscape-606e39f3b7a587989cc5acbbd4ad903f3be8cf8a.zip | |
Improve spellcheck dialog
- only use one language at a time for spell check
- allow quick language change in spellcheck dialog
- if no languages selected in preferences, list all installed
aspell dictionaries in dialog
- don't make "en" the default, use first available dictionary
- add preferences button
- auto-select first suggestion
- fix #362 crash if no dictionaries available
Diffstat (limited to 'src/ui/dialog/inkscape-preferences.cpp')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9f05cece1..a0ddfe6dc 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -65,7 +65,7 @@ #include <fstream> #if HAVE_ASPELL -# include <aspell.h> +# include "ui/dialog/spellcheck.h" // for get_available_langs # ifdef _WIN32 # include <windows.h> # endif @@ -2498,36 +2498,15 @@ void InkscapePreferences::initPageSpellcheck() std::vector<Glib::ustring> languages; std::vector<Glib::ustring> langValues; - AspellConfig *config = new_aspell_config(); - - /* the returned pointer should _not_ need to be deleted */ - AspellDictInfoList *dlist = get_aspell_dict_info_list(config); - - /* config is no longer needed */ - delete_aspell_config(config); - - AspellDictInfoEnumeration *dels = aspell_dict_info_list_elements(dlist); - languages.emplace_back(C_("Spellchecker language", "None")); langValues.emplace_back(""); - const AspellDictInfo *entry; - int en_index = 0; - int i = 0; - while ( (entry = aspell_dict_info_enumeration_next(dels)) != nullptr) - { - languages.emplace_back(entry->name); - langValues.emplace_back(entry->name); - if (!strcmp (entry->name, "en")) - { - en_index = i; - } - i++; + for (auto const &lang : SpellCheck::get_available_langs()) { + languages.emplace_back(lang); + langValues.emplace_back(lang); } - delete_aspell_dict_info_enumeration(dels); - - _spell_language.init( "/dialogs/spellcheck/lang", &languages[0], &langValues[0], languages.size(), languages[en_index]); + _spell_language.init( "/dialogs/spellcheck/lang", &languages[0], &langValues[0], languages.size(), languages[0]); _page_spellcheck.add_line( false, _("Language:"), _spell_language, "", _("Set the main spell check language"), false); |
