Fix disabling the spellchecker

Originally committed to SVN as r6274.
This commit is contained in:
Thomas Goyne 2012-01-11 19:19:21 +00:00
parent db18cea308
commit c8d67ea0ff
2 changed files with 10 additions and 7 deletions

View file

@ -194,7 +194,10 @@ wxArrayString HunspellSpellChecker::GetLanguageList() {
} }
void HunspellSpellChecker::SetLanguage(wxString language) { 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 userDicRoot = StandardPaths::DecodePath(lagi_wxString(OPT_GET("Path/Dictionary")->GetString()));
wxString dataDicRoot = StandardPaths::DecodePath("?data/dictionaries"); wxString dataDicRoot = StandardPaths::DecodePath("?data/dictionaries");

View file

@ -883,12 +883,13 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) {
void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) { void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) {
wxArrayString langs = spellchecker->GetLanguageList(); wxArrayString langs = spellchecker->GetLanguageList();
// Set dictionary
int index = event.GetId() - EDIT_MENU_DIC_LANGS - 1; int index = event.GetId() - EDIT_MENU_DIC_LANGS - 1;
if (index >= 0) { wxString lang;
spellchecker->SetLanguage(langs[index]); if (index >= 0)
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(langs[index])); lang = langs[index];
}
spellchecker->SetLanguage(lang);
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(lang));
UpdateStyle(); UpdateStyle();
} }
@ -896,7 +897,6 @@ void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) {
void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) { void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) {
wxArrayString langs = thesaurus->GetLanguageList(); wxArrayString langs = thesaurus->GetLanguageList();
// Set language
int index = event.GetId() - EDIT_MENU_THES_LANGS - 1; int index = event.GetId() - EDIT_MENU_THES_LANGS - 1;
wxString lang; wxString lang;
if (index >= 0) lang = langs[index]; if (index >= 0) lang = langs[index];