From dc9b16b7472f89abef38b04d486b8345194f62e1 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 25 Dec 2006 05:52:29 +0000 Subject: [PATCH] Changed suggestions menu to reflect Firefox's Originally committed to SVN as r608. --- core/subs_edit_ctrl.cpp | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/core/subs_edit_ctrl.cpp b/core/subs_edit_ctrl.cpp index bdd3f3878..a5d4e5c55 100644 --- a/core/subs_edit_ctrl.cpp +++ b/core/subs_edit_ctrl.cpp @@ -426,6 +426,36 @@ void SubsTextEditCtrl::ShowPopupMenu(int activePos) { // Position if (activePos == -1) activePos = GetCurrentPos(); + // Spell check + int style = GetStyleAt(activePos); + if (style & 32 && spellchecker) { + // Get word + currentWord = GetWordAtPosition(activePos); + currentWordPos = activePos; + sugs.Clear(); + + // Set font + wxFont font; + font.SetWeight(wxFONTWEIGHT_BOLD); + + // Word is really a typo + if (!spellchecker->CheckWord(currentWord)) { + // Get suggestions + sugs = spellchecker->GetSuggestions(currentWord); + + // Build menu + int nSugs = sugs.Count(); + for (int i=0;iSetFont(font); + + // No suggestions + if (!nSugs) menu.Append(EDIT_MENU_SUGGESTION,_("No correction suggestions"))->Enable(false); + + // Append "add word" + menu.Append(EDIT_MENU_ADD_TO_DICT,wxString::Format(_("Add \"%s\" to dictionary"),currentWord.c_str())); + menu.AppendSeparator(); + } + } + // Standard actions menu.Append(EDIT_MENU_UNDO,_("&Undo"))->Enable(CanUndo()); menu.AppendSeparator(); @@ -440,36 +470,6 @@ void SubsTextEditCtrl::ShowPopupMenu(int activePos) { menu.Append(EDIT_MENU_SPLIT_PRESERVE,_("Split at cursor (preserve times)")); menu.Append(EDIT_MENU_SPLIT_ESTIMATE,_("Split at cursor (estimate times)")); - // Spell check - int style = GetStyleAt(activePos); - if (style & 32 && spellchecker) { - // Get word - currentWord = GetWordAtPosition(activePos); - currentWordPos = activePos; - sugs.Clear(); - - // Word is really a typo - if (!spellchecker->CheckWord(currentWord)) { - // Append "add word" - menu.AppendSeparator(); - menu.Append(EDIT_MENU_ADD_TO_DICT,wxString::Format(_("Add \"%s\" to dictionary"),currentWord.c_str())); - - // Get suggestions - sugs = spellchecker->GetSuggestions(currentWord); - - // Build menu - int nSugs = sugs.Count(); - if (nSugs > 0) { - wxMenu *suggestions = new wxMenu(); - for (int i=0;iAppend(EDIT_MENU_SUGGESTIONS+i,sugs[i]); - menu.AppendSubMenu(suggestions,_("Corrections")); - } - - // No suggestions - else menu.Append(EDIT_MENU_SUGGESTION,_("No correction suggestions"))->Enable(false); - } - } - // Pop the menu PopupMenu(&menu); }