#include "LyX.h"
-#include "ASpell_local.h"
+#include "AspellChecker.h"
#include "Buffer.h"
#include "BufferList.h"
#include "CmdDef.h"
#include "ErrorList.h"
#include "Format.h"
#include "FuncStatus.h"
+#include "HunspellChecker.h"
#include "KeyMap.h"
#include "Language.h"
#include "LayoutFile.h"
} // namespace anon
-
/// The main application class private implementation.
struct LyX::Impl
{
- Impl()
+ Impl() : spell_checker_(0), aspell_checker_(0), hunspell_checker_(0)
{
// Set the default User Interface language as soon as possible.
// The language used will be derived from the environment
// variables.
messages_["GUI"] = Messages();
-
-#if defined(USE_ASPELL)
- spell_checker_ = new ASpell();
-#else
- spell_checker_ = 0;
-#endif
}
~Impl()
{
- delete spell_checker_;
+ delete aspell_checker_;
+ delete hunspell_checker_;
}
/// our function handler
graphics::Previews preview_;
///
SpellChecker * spell_checker_;
+ ///
+ SpellChecker * aspell_checker_;
+ ///
+ SpellChecker * hunspell_checker_;
};
///
if (!LyXSetStyle())
return false;
//...and the modules
- moduleList.read();
+ theModuleList.read();
// read keymap and ui files in batch mode as well
// because InsetInfo needs to know these to produce
// load user bind file user.bind
pimpl_->toplevel_keymap_.read("user", 0, KeyMap::MissingOK);
- pimpl_->lyxfunc_.initKeySequences(&pimpl_->toplevel_keymap_);
-
if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print();
}
lyxerr << to_utf8(bformat(_("Setting debug level to %1$s"), from_utf8(arg))) << endl;
- lyxerr.level(Debug::value(arg));
+ lyxerr.setLevel(Debug::value(arg));
Debug::showLevel(lyxerr, lyxerr.level());
return 1;
}
SpellChecker * theSpellChecker()
{
+ if (!singleton_->pimpl_->spell_checker_)
+ setSpellChecker();
return singleton_->pimpl_->spell_checker_;
}
+
+void setSpellChecker()
+{
+#if defined(USE_ASPELL)
+ if (lyxrc.spellchecker == "aspell") {
+ if (!singleton_->pimpl_->aspell_checker_)
+ singleton_->pimpl_->aspell_checker_ = new AspellChecker();
+ singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->aspell_checker_;
+ return;
+ }
+#endif
+#if defined(USE_HUNSPELL)
+ if (lyxrc.spellchecker == "hunspell") {
+ if (!singleton_->pimpl_->hunspell_checker_)
+ singleton_->pimpl_->hunspell_checker_ = new HunspellChecker();
+ singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->hunspell_checker_;
+ return;
+ }
+#endif
+ singleton_->pimpl_->spell_checker_ = 0;
+}
+
} // namespace lyx