]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
Fixed cut&paste bugs and added freespacing for ERT Insets.
[lyx.git] / src / lyx_main.C
index 795c4360dbe12e578a4ea823c626461cddeaf839..1dfd3ced2ff7c763374806bf7bd9d935566efa1c 100644 (file)
 #pragma implementation
 #endif
 
-#include "version.h"
-#include <version_info.h>
+#include <version.h>
 #include "lyx_main.h"
 #include "lyx_gui.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
+#include "frontends/GUIRunTime.h"
 #include "lyxrc.h"
 #include "support/path.h"
 #include "support/filetools.h"
@@ -204,10 +204,10 @@ void error_handler(int err_sig)
        case SIGSEGV:
                lyxerr << "\nlyx: SIGSEGV signal caught" << endl;
                lyxerr <<
-                       "Sorry, you have found a bug in LyX."
-                       " If possible, please read 'Known bugs'\n"
-                       "under the Help menu and then send us "
-                       "a full bug report. Thanks!" << endl;
+                       "Sorry, you have found a bug in LyX. "
+                       "Please read the bug-reporting instructions " 
+                       "in Help->Introduction and send us a bug report, "
+                       "if necessary. Thanks !" << endl;
                break;
        case SIGTERM:
                // no comments
@@ -221,7 +221,7 @@ void error_handler(int err_sig)
        signal(SIGSEGV, SIG_DFL);
        signal(SIGTERM, SIG_DFL);
 
-       bufferlist.emergencyWriteAll();
+       LyX::emergencyCleanup();
 
        lyxerr << "Bye." << endl;
        if (err_sig!= SIGHUP && 
@@ -375,7 +375,6 @@ void LyX::init(bool gui)
                system_lyxdir = LYX_DIR;
                path_shown = true;
        }
-
        // Report the system directory if debugging is on
        if (!path_shown)
                lyxerr[Debug::INIT] << "System directory: '"
@@ -435,7 +434,7 @@ void LyX::init(bool gui)
  
         // Calculate screen dpi as average of x-DPI and y-DPI:
        if (lyxrc.use_gui) {
-               lyxrc.dpi = getScreenDPI();
+               lyxrc.dpi = GUIRunTime::getScreenDPI();
                lyxerr[Debug::INIT] << "DPI setting detected to be "
                                                 << lyxrc.dpi + 0.5 << endl;
        } else {
@@ -558,6 +557,19 @@ void LyX::defaultKeyBindings(kb_keymap  * kbmap)
 }
 
 
+void LyX::emergencyCleanup()
+{
+       // what to do about tmpfiles is non-obvious. we would
+       // like to delete any we find, but our lyxdir might
+       // contain documents etc. which might be helpful on
+       // a crash
+       bufferlist.emergencyWriteAll();
+       if (lyxserver)
+               lyxserver->emergencyCleanup();
+}
+
 // LyX can optionally take over the handling of deadkeys
 void LyX::deadKeyBindings(kb_keymap * kbmap)
 {
@@ -601,7 +613,7 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
        // If the user specified explicitely a directory, ask whether
        // to create it (otherwise, always create it)
        if (explicit_userdir &&
-           !AskQuestion(_("You have specified an invalid LyX directory."),
+           !Alert::askQuestion(_("You have specified an invalid LyX directory."),
                         _("It is needed to keep your own configuration."),
                         _("Should I try to set it up for you (recommended)?"))) {
                lyxerr << _("Running without personal LyX directory.") << endl;
@@ -640,7 +652,7 @@ bool LyX::readRcFile(string const & name)
                lyxerr[Debug::INIT] << "Found " << name
                                    << " in " << lyxrc_path << endl;
                if (lyxrc.read(lyxrc_path) < 0) { 
-                       WriteAlert(_("LyX Warning!"), 
+                       Alert::alert(_("LyX Warning!"), 
                                   _("Error while reading ") + lyxrc_path + ".",
                                   _("Using built-in defaults."));
                        return false;
@@ -777,10 +789,11 @@ void commandLineHelp()
 // Give command line version information
 void commandLineVersionInfo()
 {
-       lyxerr << "LyX " LYX_VERSION << " of " LYX_RELEASE << endl;
+       lyxerr << "LyX " << lyx_version
+              << " of " << lyx_release_date << endl;
        lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl;
 
-       lyxerr << version_info << endl;
+       lyxerr << lyx_version_info << endl;
 }
 
 
@@ -898,5 +911,3 @@ bool LyX::easyParse(int * argc, char * argv[])
 
        return gui;
 }
-
-