// 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) {}
- Messages::init();
+ 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
// we need to parse for "-dbg" and "-help"
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_);
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
return EXIT_FAILURE;
// Remaining arguments are assumed to be files to load.
- for (int argi = argc - 1; argi >= 1; --argi)
+ for (int argi = 1; argi < argc; ++argi)
pimpl_->files_to_load_.push_back(os::utf8_argv(argi));
if (first_start) {
continue;
Buffer * buf = pimpl_->buffer_list_.newBuffer(fname.absFileName(), false);
- if (buf->loadLyXFile(fname)) {
+ if (buf->loadLyXFile(fname) == Buffer::ReadSuccess) {
ErrorList const & el = buf->errorList("Parse");
if (!el.empty())
for_each(el.begin(), el.end(),
break;
}
}
-
+
// create the first main window
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW, geometryArg));
(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);
// 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);
// 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;
}
firstrun = false;
}
- FileName absfile =
+ FileName absfile =
FileName(addName(package().user_support().absFileName(), file));
return !absfile.exists()
|| configure_script.lastModified() > absfile.lastModified();
}
-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;
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