]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
* src/LaTeXFeatures.cpp: simplify greektext definition. Patch by G. Milde (bug #6458)
[lyx.git] / src / LyX.cpp
index f835166302a38d1ce683decc83abc0ebdc307dac..7fa09164178b205b80a37e7bd34a0f82d614cf9d 100644 (file)
@@ -502,16 +502,16 @@ void LyX::execCommands()
        // aknowledged.
 
        // if reconfiguration is needed.
-       while (LayoutFileList::get().empty()) {
+       if (LayoutFileList::get().empty()) {
                switch (Alert::prompt(
                        _("No textclass is found"),
-                       _("LyX cannot continue because no textclass is found. "
-                               "You can either reconfigure normally, or reconfigure using "
-                               "default textclasses, or quit LyX."),
+                       _("LyX will have minimal functionality because no textclasses "
+                               "have been found. You can either try to reconfigure LyX normally, "
+                               "try to reconfigure using only the defaults, or continue."),
                        0, 2,
                        _("&Reconfigure"),
-                       _("&Use Default"),
-                       _("&Exit LyX")))
+                       _("&Use Defaults"),
+                       _("&Continue")))
                {
                case 0:
                        // regular reconfigure
@@ -523,8 +523,7 @@ void LyX::execCommands()
                                " --without-latex-config"));
                        break;
                default:
-                       lyx::dispatch(FuncRequest(LFUN_LYX_QUIT));
-                       return;
+                       break;
                }
        }
        
@@ -611,21 +610,23 @@ static void error_handler(int err_sig)
 
        // This shouldn't matter here, however, as we've already invoked
        // emergencyCleanup.
+       docstring msg;
        switch (err_sig) {
 #ifdef SIGHUP
        case SIGHUP:
-               lyxerr << "\nlyx: SIGHUP signal caught\nBye." << endl;
+               msg = _("SIGHUP signal caught!\nBye.");
                break;
 #endif
        case SIGFPE:
-               lyxerr << "\nlyx: SIGFPE signal caught\nBye." << endl;
+               msg = _("SIGFPE signal caught!\nBye.");
                break;
        case SIGSEGV:
-               lyxerr << "\nlyx: SIGSEGV signal caught\n"
-                         "Sorry, you have found a bug in LyX. "
+               msg = _("SIGSEGV signal caught!\n"
+                         "Sorry, you have found a bug in LyX, "
+                         "hope you have not lost any data.\n"
                          "Please read the bug-reporting instructions "
-                         "in Help->Introduction and send us a bug report, "
-                         "if necessary. Thanks !\nBye." << endl;
+                         "in 'Help->Introduction' and send us a bug report, "
+                         "if necessary. Thanks !\nBye.");
                break;
        case SIGINT:
        case SIGTERM:
@@ -633,6 +634,12 @@ static void error_handler(int err_sig)
                break;
        }
 
+       if (!msg.empty()) {
+               lyxerr << "\nlyx: " << msg << endl;
+               // try to make a GUI message
+               Alert::error(_("LyX crashed!"), msg);
+       }
+
        // Deinstall the signal handlers
 #ifdef SIGHUP
        signal(SIGHUP, SIG_DFL);
@@ -644,11 +651,18 @@ static void error_handler(int err_sig)
 
 #ifdef SIGHUP
        if (err_sig == SIGSEGV ||
-           (err_sig != SIGHUP && !getEnv("LYXDEBUG").empty()))
+               (err_sig != SIGHUP && !getEnv("LYXDEBUG").empty())) {
+#else
+       if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty()) {
+#endif 
+#ifdef _MSC_VER
+               // with abort() it crashes again.
+               exit(err_sig);
 #else
-       if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty())
-#endif
                abort();
+#endif
+       }
+
        exit(0);
 }
 
@@ -747,10 +761,9 @@ bool LyX::init()
        // Set the language defined by the user.
        setRcGuiLanguage();
 
-       // Load the layouts
        LYXERR(Debug::INIT, "Reading layouts...");
-       if (!LyXSetStyle())
-               return false;
+       // Load the layouts
+       LayoutFileList::get().read();
        //...and the modules
        theModuleList.read();
 
@@ -987,7 +1000,7 @@ int parse_help(string const &, string const &, string &)
                  "\t-i [--import] fmt file.xxx\n"
                  "                  where fmt is the import format of choice\n"
                  "                  and file.xxx is the file to be imported.\n"
-                 "\t--batch         execute commands and exit\n"
+                 "\t-batch          execute commands without launching GUI and exit.\n"
                  "\t-version        summarize version and build info\n"
                               "Check the LyX man page for more details.")) << endl;
        exit(0);
@@ -1110,7 +1123,7 @@ void LyX::easyParse(int & argc, char * argv[])
        cmdmap["-i"] = parse_import;
        cmdmap["--import"] = parse_import;
        cmdmap["-geometry"] = parse_geometry;
-       cmdmap["--batch"] = parse_batch;
+       cmdmap["-batch"] = parse_batch;
 
        for (int i = 1; i < argc; ++i) {
                map<string, cmd_helper>::const_iterator it
@@ -1133,6 +1146,7 @@ void LyX::easyParse(int & argc, char * argv[])
                // Now, remove used arguments by shifting
                // the following ones remove places down.
                if (remove > 0) {
+                       os::remove_internal_args(i, remove);
                        argc -= remove;
                        for (int j = i; j < argc; ++j)
                                argv[j] = argv[j + remove];
@@ -1237,14 +1251,14 @@ Movers & theSystemMovers()
 }
 
 
-Messages & getMessages(string const & language)
+Messages const & getMessages(string const & language)
 {
        LASSERT(singleton_, /**/);
        return singleton_->messages(language);
 }
 
 
-Messages & getGuiMessages()
+Messages const & getGuiMessages()
 {
        LASSERT(singleton_, /**/);
        return singleton_->pimpl_->messages_["GUI"];