]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Update the GuiLabel view when the document is read-only. Also disable the text field.
[lyx.git] / src / LyX.cpp
index 10cf61a0bb9049b5d0ee2140e09d066f96a2e500..7b5c07636f00556e3b9fa21e5d44ecc3a9424b2c 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "LyX.h"
 
-#include "ASpell_local.h"
+#include "AspellChecker.h"
 #include "Buffer.h"
 #include "BufferList.h"
 #include "CmdDef.h"
@@ -29,6 +29,7 @@
 #include "ErrorList.h"
 #include "Format.h"
 #include "FuncStatus.h"
+#include "HunspellChecker.h"
 #include "KeyMap.h"
 #include "Language.h"
 #include "LayoutFile.h"
@@ -118,27 +119,21 @@ void reconfigureUserLyXDir()
 
 } // 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
@@ -184,6 +179,10 @@ struct LyX::Impl
        graphics::Previews preview_;
        ///
        SpellChecker * spell_checker_;
+       ///
+       SpellChecker * aspell_checker_;
+       ///
+       SpellChecker * hunspell_checker_;
 };
 
 ///
@@ -751,7 +750,7 @@ bool LyX::init()
        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
@@ -764,9 +763,7 @@ bool LyX::init()
        pimpl_->toplevel_keymap_.read("site");
        pimpl_->toplevel_keymap_.read(lyxrc.bind_file);
        // load user bind file user.bind
-       pimpl_->toplevel_keymap_.read("user");
-
-       pimpl_->lyxfunc_.initKeySequences(&pimpl_->toplevel_keymap_);
+       pimpl_->toplevel_keymap_.read("user", 0, KeyMap::MissingOK);
 
        if (lyxerr.debugging(Debug::LYXRC))
                lyxrc.print();
@@ -960,7 +957,7 @@ int parse_dbg(string const & arg, string const &, string &)
        }
        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;
 }
@@ -1275,7 +1272,31 @@ CmdDef & theTopLevelCmdDef()
 
 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