From c8d67ea0ff56cd55a0fcccd605be02c11ccfff32 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 11 Jan 2012 19:19:21 +0000 Subject: [PATCH] Fix disabling the spellchecker Originally committed to SVN as r6274. --- aegisub/src/spellchecker_hunspell.cpp | 5 ++++- aegisub/src/subs_edit_ctrl.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/aegisub/src/spellchecker_hunspell.cpp b/aegisub/src/spellchecker_hunspell.cpp index 6fffd7378..88ba834c8 100644 --- a/aegisub/src/spellchecker_hunspell.cpp +++ b/aegisub/src/spellchecker_hunspell.cpp @@ -194,7 +194,10 @@ wxArrayString HunspellSpellChecker::GetLanguageList() { } void HunspellSpellChecker::SetLanguage(wxString language) { - if (language.empty()) return; + if (language.empty()) { + hunspell.reset(); + return; + } wxString userDicRoot = StandardPaths::DecodePath(lagi_wxString(OPT_GET("Path/Dictionary")->GetString())); wxString dataDicRoot = StandardPaths::DecodePath("?data/dictionaries"); diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index 969b08328..ba76844a5 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -883,12 +883,13 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) { void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) { wxArrayString langs = spellchecker->GetLanguageList(); - // Set dictionary int index = event.GetId() - EDIT_MENU_DIC_LANGS - 1; - if (index >= 0) { - spellchecker->SetLanguage(langs[index]); - OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(langs[index])); - } + wxString lang; + if (index >= 0) + lang = langs[index]; + + spellchecker->SetLanguage(lang); + OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(lang)); UpdateStyle(); } @@ -896,7 +897,6 @@ void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) { void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) { wxArrayString langs = thesaurus->GetLanguageList(); - // Set language int index = event.GetId() - EDIT_MENU_THES_LANGS - 1; wxString lang; if (index >= 0) lang = langs[index];