Abdel, this is for you. The main purpose of these lfuns is the addition of two items to the continuous spellchecking context menu, namely "Ignore All" and "Add to personal dictionary". These are pretty fundamental for a proper continuous spell checking framework, IMHO.
Jürgen
Index: src/LyXAction.cpp =================================================================== --- src/LyXAction.cpp (Revision 33085) +++ src/LyXAction.cpp (Arbeitskopie) @@ -981,6 +981,28 @@ */ { LFUN_WORD_LOWCASE, "word-lowcase", Noop, Edit }, /*! + * \var lyx::FuncCode lyx::LFUN_SPELLING_ADD + * \li Action: Add the word under the cursor to the respective + * spell checker dictionary. + * \li Syntax: spelling-add [<STRING>] [<LANG>] + * \li Params: <WORD>: word to add + <LANG>: language code (see file languages) + * \li Origin: JSpitzm, 18 Jan 2010 + * \endvar + */ + { LFUN_SPELLING_ADD, "spelling-add", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_SPELLING_IGNORE + * \li Action: Let the spell checker ignore the word under the cursor + * in the current session for the given language. + * \li Syntax: spelling-ignore [<WORD>] [<LANG>] + * \li Params: <WORD>: word to ignore + <LANG>: language code (see file languages) + * \li Origin: JSpitzm, 18 Jan 2010 + * \endvar + */ + { LFUN_SPELLING_IGNORE, "spelling-ignore", ReadOnly, Edit }, +/*! * \var lyx::FuncCode lyx::LFUN_THESAURUS_ENTRY * \li Action: Look up thesaurus entries with respect to the word under the cursor. * \li Syntax: thesaurus-entry [<STRING>] [lang=<LANG>] Index: src/frontends/qt4/Menus.cpp =================================================================== --- src/frontends/qt4/Menus.cpp (Revision 33085) +++ src/frontends/qt4/Menus.cpp (Arbeitskopie) @@ -741,6 +741,16 @@ } if (i >= 10) add(item); + if (i > 0) + add(MenuItem(MenuItem::Separator)); + docstring arg = wl.word() + " " + from_ascii(wl.lang_code()); + if (!wl.lang_variety().empty()) + arg += from_ascii("-") + from_ascii(wl.lang_variety()); + add(MenuItem(MenuItem::Command, qt_("Add to personal dictionary|c"), + FuncRequest(LFUN_SPELLING_ADD, arg))); + add(MenuItem(MenuItem::Command, qt_("Ignore all|I"), + FuncRequest(LFUN_SPELLING_IGNORE, arg))); + } Index: src/Text3.cpp =================================================================== --- src/Text3.cpp (Revision 33085) +++ src/Text3.cpp (Arbeitskopie) @@ -42,9 +42,11 @@ #include "LyXRC.h" #include "Paragraph.h" #include "ParagraphParameters.h" +#include "SpellChecker.h" #include "TextClass.h" #include "TextMetrics.h" #include "VSpace.h" +#include "WordLangTuple.h" #include "frontends/Application.h" #include "frontends/Clipboard.h" @@ -1996,6 +1998,48 @@ break; } + case LFUN_SPELLING_ADD: { + docstring word = from_utf8(cmd.getArg(0)); + string code; + string variety; + if (word.empty()) { + word = cur.selectionAsString(false); + // FIXME + if (word.size() > 100 || word.empty()) { + // Get word or selection + selectWordWhenUnderCursor(cur, WHOLE_WORD); + word = cur.selectionAsString(false); + } + code = cur.getFont().language()->code(); + variety = cur.getFont().language()->variety(); + } else + variety = split(cmd.getArg(1), code, '-'); + WordLangTuple wl(word, code, variety); + theSpellChecker()->insert(wl); + break; + } + + case LFUN_SPELLING_IGNORE: { + docstring word = from_utf8(cmd.getArg(0)); + string code; + string variety; + if (word.empty()) { + word = cur.selectionAsString(false); + // FIXME + if (word.size() > 100 || word.empty()) { + // Get word or selection + selectWordWhenUnderCursor(cur, WHOLE_WORD); + word = cur.selectionAsString(false); + } + code = cur.getFont().language()->code(); + variety = cur.getFont().language()->variety(); + } else + variety = split(cmd.getArg(1), code, '-'); + WordLangTuple wl(word, code, variety); + theSpellChecker()->accept(wl); + break; + } + case LFUN_PARAGRAPH_PARAMS_APPLY: { // Given data, an encoding of the ParagraphParameters // generated in the Paragraph dialog, this function sets @@ -2505,6 +2549,11 @@ case LFUN_BREAK_PARAGRAPH: enable = cur.inset().getLayout().isMultiPar(); break; + + case LFUN_SPELLING_ADD: + case LFUN_SPELLING_IGNORE: + enable = theSpellChecker(); + break; case LFUN_WORD_DELETE_FORWARD: case LFUN_WORD_DELETE_BACKWARD: Index: src/FuncCode.h =================================================================== --- src/FuncCode.h (Revision 33085) +++ src/FuncCode.h (Arbeitskopie) @@ -442,7 +442,9 @@ LFUN_BUFFER_CLOSE_ALL, // vfr 20090806 LFUN_GRAPHICS_RELOAD, // vfr 20090810 LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325 + LFUN_SPELLING_ADD, // spitz 20100118 // 345 + LFUN_SPELLING_IGNORE, // spitz 20100118 LFUN_LASTACTION // end of the table };