]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
- lyxsweave.R: set missing SVN EOL style and add missing makefile entry
[lyx.git] / src / LyX.cpp
index 42f79297cc0c8cf64da29457574de830baae1f4d..4992de8e73a6bede93ddee20d00f1441041e263c 100644 (file)
@@ -284,8 +284,11 @@ int LyX::exec(int & argc, char * argv[])
        // Minimal setting of locale before parsing command line
        try {
                init_package(os::utf8_argv(0), string(), string(),
-                             top_build_dir_is_one_level_up);
-       } catch (ExceptionMessage const & message) {}
+                       top_build_dir_is_one_level_up);
+       } catch (ExceptionMessage const & message) {
+               LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
+       }
+       // FIXME: This breaks out of source build under Windows.
        locale_init();
 
        // Here we need to parse the command line. At least
@@ -294,8 +297,8 @@ int LyX::exec(int & argc, char * argv[])
 
        try {
                init_package(os::utf8_argv(0),
-                             cl_system_support, cl_user_support,
-                             top_build_dir_is_one_level_up);
+                       cl_system_support, cl_user_support,
+                       top_build_dir_is_one_level_up);
        } catch (ExceptionMessage const & message) {
                if (message.type_ == ErrorException) {
                        Alert::error(message.title_, message.details_);
@@ -362,7 +365,7 @@ int LyX::exec(int & argc, char * argv[])
                prepareExit();
                return exit_status;
        }
+
        // FIXME
        /* Create a CoreApplication class that will provide the main event loop
        * and the socket callback registering. With Qt4, only QtCore
@@ -546,7 +549,7 @@ void LyX::execCommands()
                        break;
                }
        }
-       
+
        // create the first main window
        lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW, geometryArg));
 
@@ -674,7 +677,7 @@ static void error_handler(int err_sig)
                (err_sig != SIGHUP && !getEnv("LYXDEBUG").empty())) {
 #else
        if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty()) {
-#endif 
+#endif
 #ifdef _MSC_VER
                // with abort() it crashes again.
                exit(err_sig);
@@ -805,6 +808,7 @@ bool LyX::init()
        // Set up command definitions
        pimpl_->toplevel_cmddef_.read(lyxrc.def_file);
 
+       // FIXME
        // Set up bindings
        pimpl_->toplevel_keymap_.read("site");
        pimpl_->toplevel_keymap_.read(lyxrc.bind_file);
@@ -846,7 +850,7 @@ bool LyX::init()
        // This must happen after package initialization and after lyxrc is
        // read, therefore it can't be done by a static object.
        ConverterCache::init();
-               
+
        return true;
 }
 
@@ -882,7 +886,7 @@ static bool needsUpdate(string const & file)
                firstrun = false;
        }
 
-       FileName absfile = 
+       FileName absfile =
                FileName(addName(package().user_support().absFileName(), file));
        return !absfile.exists()
                || configure_script.lastModified() > absfile.lastModified();
@@ -1131,14 +1135,14 @@ int parse_geometry(string const & arg1, string const &, string &)
 }
 
 
-int parse_batch(string const &, string const &, string &) 
+int parse_batch(string const &, string const &, string &)
 {
        use_gui = false;
        return 0;
 }
 
 
-int parse_force(string const & arg, string const &, string &) 
+int parse_force(string const & arg, string const &, string &)
 {
        if (arg == "all") {
                force_overwrite = ALL_FILES;
@@ -1351,39 +1355,48 @@ SpellChecker * theSpellChecker()
 
 void setSpellChecker()
 {
-#if defined(USE_MACOSX_PACKAGING)
+       SpellChecker::ChangeNumber speller_change_number =singleton_->pimpl_->spell_checker_ ?
+               singleton_->pimpl_->spell_checker_->changeNumber() : 0;
+
        if (lyxrc.spellchecker == "native") {
+#if defined(USE_MACOSX_PACKAGING)
                if (!singleton_->pimpl_->apple_spell_checker_)
                        singleton_->pimpl_->apple_spell_checker_ = new AppleSpellChecker();
                singleton_->pimpl_->spell_checker_ = singleton_->pimpl_->apple_spell_checker_;
-               return;
-       }
+#else
+               singleton_->pimpl_->spell_checker_ = 0;
 #endif
+       } else if (lyxrc.spellchecker == "aspell") {
 #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;
-       }
+#else
+               singleton_->pimpl_->spell_checker_ = 0;
 #endif
+       } else if (lyxrc.spellchecker == "enchant") {
 #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;
-       }
+#else
+               singleton_->pimpl_->spell_checker_ = 0;
 #endif
+       } else if (lyxrc.spellchecker == "hunspell") {
 #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;
-       }
+#else
+               singleton_->pimpl_->spell_checker_ = 0;
 #endif
-       singleton_->pimpl_->spell_checker_ = 0;
+       } else {
+               singleton_->pimpl_->spell_checker_ = 0;
+       }
+       if (singleton_->pimpl_->spell_checker_) {
+               singleton_->pimpl_->spell_checker_->changeNumber(speller_change_number);
+               singleton_->pimpl_->spell_checker_->advanceChangeNumber();
+       }
 }
 
 } // namespace lyx