Always add the spellchecker language list to the edit box context menu
There's really no reason not to include it even if the right-click wasn't on a word, and leaving it out can lead to confusing situations when the dictionary file for the user's currently selected language doesn't exist.
This commit is contained in:
parent
01c833d9b3
commit
c1dc875a05
1 changed files with 15 additions and 13 deletions
|
@ -277,7 +277,6 @@ void SubsTextEditCtrl::SetTextTo(wxString const& text) {
|
||||||
Thaw();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SubsTextEditCtrl::Paste() {
|
void SubsTextEditCtrl::Paste() {
|
||||||
wxString data = GetClipboard();
|
wxString data = GetClipboard();
|
||||||
|
|
||||||
|
@ -308,11 +307,17 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
|
||||||
currentWord = line_text.substr(currentWordPos.first, currentWordPos.second);
|
currentWord = line_text.substr(currentWordPos.first, currentWordPos.second);
|
||||||
|
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
if (!currentWord.empty()) {
|
|
||||||
if (spellchecker)
|
if (spellchecker)
|
||||||
AddSpellCheckerEntries(menu);
|
AddSpellCheckerEntries(menu);
|
||||||
|
|
||||||
|
// Append language list
|
||||||
|
menu.Append(-1,_("Spell checker language"), GetLanguagesMenu(
|
||||||
|
EDIT_MENU_DIC_LANGS,
|
||||||
|
lagi_wxString(OPT_GET("Tool/Spell Checker/Language")->GetString()),
|
||||||
|
to_wx(spellchecker->GetLanguageList())));
|
||||||
|
menu.AppendSeparator();
|
||||||
|
|
||||||
AddThesaurusEntries(menu);
|
AddThesaurusEntries(menu);
|
||||||
}
|
|
||||||
|
|
||||||
// Standard actions
|
// Standard actions
|
||||||
menu.Append(EDIT_MENU_CUT,_("Cu&t"))->Enable(GetSelectionStart()-GetSelectionEnd() != 0);
|
menu.Append(EDIT_MENU_CUT,_("Cu&t"))->Enable(GetSelectionStart()-GetSelectionEnd() != 0);
|
||||||
|
@ -332,6 +337,8 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) {
|
void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) {
|
||||||
|
if (currentWord.empty()) return;
|
||||||
|
|
||||||
sugs = spellchecker->GetSuggestions(currentWord);
|
sugs = spellchecker->GetSuggestions(currentWord);
|
||||||
if (spellchecker->CheckWord(currentWord)) {
|
if (spellchecker->CheckWord(currentWord)) {
|
||||||
if (sugs.empty())
|
if (sugs.empty())
|
||||||
|
@ -354,16 +361,11 @@ void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) {
|
||||||
// Append "add word"
|
// Append "add word"
|
||||||
menu.Append(EDIT_MENU_ADD_TO_DICT, wxString::Format(_("Add \"%s\" to dictionary"), to_wx(currentWord)))->Enable(spellchecker->CanAddWord(currentWord));
|
menu.Append(EDIT_MENU_ADD_TO_DICT, wxString::Format(_("Add \"%s\" to dictionary"), to_wx(currentWord)))->Enable(spellchecker->CanAddWord(currentWord));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append language list
|
|
||||||
menu.Append(-1,_("Spell checker language"), GetLanguagesMenu(
|
|
||||||
EDIT_MENU_DIC_LANGS,
|
|
||||||
lagi_wxString(OPT_GET("Tool/Spell Checker/Language")->GetString()),
|
|
||||||
to_wx(spellchecker->GetLanguageList())));
|
|
||||||
menu.AppendSeparator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) {
|
void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) {
|
||||||
|
if (currentWord.empty()) return;
|
||||||
|
|
||||||
if (!thesaurus)
|
if (!thesaurus)
|
||||||
thesaurus.reset(new Thesaurus);
|
thesaurus.reset(new Thesaurus);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue