]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Make the fake sequence for braces highly unlikely (addressing #6478).
[lyx.git] / src / LyX.cpp
index b7a409fedb4bad911fde2e801ffcddb488906c12..510bef47e4c2fc250ae55dddf61b007e3b89cd04 100644 (file)
@@ -25,6 +25,7 @@
 #include "ConverterCache.h"
 #include "Converter.h"
 #include "CutAndPaste.h"
+#include "EnchantChecker.h"
 #include "Encoding.h"
 #include "ErrorList.h"
 #include "Format.h"
@@ -71,9 +72,6 @@
 #include <stdlib.h>
 #include <string>
 #include <vector>
-#if defined(_WIN32) || defined(__CYGWIN__)
-#include <windows.h>
-#endif
 
 using namespace std;
 using namespace lyx::support;
@@ -125,7 +123,7 @@ void reconfigureUserLyXDir()
 /// The main application class private implementation.
 struct LyX::Impl
 {
-       Impl() : spell_checker_(0), aspell_checker_(0), hunspell_checker_(0)
+       Impl() : spell_checker_(0), aspell_checker_(0), enchant_checker_(0), hunspell_checker_(0)
        {
                // Set the default User Interface language as soon as possible.
                // The language used will be derived from the environment
@@ -136,6 +134,7 @@ struct LyX::Impl
        ~Impl()
        {
                delete aspell_checker_;
+               delete enchant_checker_;
                delete hunspell_checker_;
        }
 
@@ -185,6 +184,8 @@ struct LyX::Impl
        ///
        SpellChecker * aspell_checker_;
        ///
+       SpellChecker * enchant_checker_;
+       ///
        SpellChecker * hunspell_checker_;
 };
 
@@ -653,18 +654,6 @@ static void error_handler(int err_sig)
        exit(0);
 }
 
-
-#if defined(_WIN32) || defined(__CYGWIN__)
-BOOL terminate_handler(DWORD event)
-{
-       if (event == CTRL_CLOSE_EVENT
-           || event == CTRL_LOGOFF_EVENT
-           || event == CTRL_SHUTDOWN_EVENT)
-               raise(SIGTERM);
-       return FALSE;
-}
-#endif
-
 }
 
 
@@ -686,10 +675,6 @@ bool LyX::init()
        signal(SIGINT, error_handler);
        signal(SIGTERM, error_handler);
        // SIGPIPE can be safely ignored.
-#if defined(_WIN32) || defined(__CYGWIN__)
-       // On Windows we have also to catch logging off or closing the console.
-       SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, TRUE);
-#endif
 
        lyxrc.tempdir_path = package().temp_dir().absFilename();
        lyxrc.document_path = package().document_dir().absFilename();
@@ -769,7 +754,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
@@ -784,8 +769,6 @@ bool LyX::init()
        // 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();
 
@@ -978,7 +961,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;
 }
@@ -1175,6 +1158,13 @@ void dispatch(FuncRequest const & action)
 }
 
 
+void dispatch(FuncRequest const & action, DispatchResult & dr)
+{
+       LASSERT(singleton_, /**/);
+       singleton_->pimpl_->lyxfunc_.dispatch(action, dr);
+}
+
+
 BufferList & theBufferList()
 {
        LASSERT(singleton_, /**/);
@@ -1309,6 +1299,14 @@ void setSpellChecker()
                return;
        }
 #endif
+#if defined(USE_ENCHANT)
+       if (lyxrc.spellchecker == "enchant") {
+               if (!singleton_->pimpl_->enchant_checker_)
+                       singleton_->pimpl_->enchant_checker_ = new EnchantChecker();
+               singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->enchant_checker_;
+               return;
+       }
+#endif
 #if defined(USE_HUNSPELL)
        if (lyxrc.spellchecker == "hunspell") {
                if (!singleton_->pimpl_->hunspell_checker_)