]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
Various fixes to Tabular, InsetTabular and InsetText. Fixed left border for
[lyx.git] / src / lyx_main.C
index 6d7a1d4780b3acedd8ad9953146222e967d95395..259ad5c5b5b983e15c310dbf005317fb18dcb654 100644 (file)
 #include "lyxlex.h"
 #include "encoding.h"
 #include "converter.h"
+#include "language.h"
+#include "support/os.h"
 
 using std::endl;
 
+#ifndef CXX_GLOBAL_CSTD
+using std::signal;
+#endif
+
 extern void LoadLyXFile(string const &);
 extern void QuitLyX();
 
@@ -101,7 +107,7 @@ LyX::LyX(int * argc, char * argv[])
        
        // Initialization of LyX (reads lyxrc and more)
        lyxerr[Debug::INIT] << "Initializing LyX::init..." << endl;
-       init(argc, argv, gui);
+       init(gui);
        lyxerr[Debug::INIT] << "Initializing LyX::init...done" << endl;
 
        lyxGUI->init();
@@ -179,7 +185,7 @@ LyX::~LyX()
 
 extern "C" void error_handler(int err_sig);
 
-void LyX::init(int */*argc*/, char **argv, bool gui)
+void LyX::init(bool gui)
 {
        // Install the signal handlers
        signal(SIGHUP, error_handler);
@@ -193,27 +199,9 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        //
 
        string fullbinpath;
-       string binpath = subst(argv[0], '\\', '/');
-       string binname = OnlyFilename(argv[0]);
-       // Sorry for system specific code. (SMiyata)
-       if (suffixIs(binname, ".exe")) 
-               binname.erase(binname.length()-4, string::npos);
-       
-       binpath = ExpandPath(binpath); // This expands ./ and ~/
-       
-       if (!AbsolutePath(binpath)) {
-               string binsearchpath = GetEnvPath("PATH");
-               // This will make "src/lyx" work always :-)
-               binsearchpath += ";."; 
-               binpath = FileOpenSearch(binsearchpath, argv[0]);
-       }
-
+       string binpath = os::binpath();
+       string binname = os::binname();
        fullbinpath = binpath;
-       binpath = MakeAbsPath(OnlyPath(binpath));
-
-       // In case we are running in place and compiled with shared libraries
-       if (suffixIs(binpath, "/.libs/"))
-               binpath.erase(binpath.length()-6, string::npos);
 
        if (binpath.empty()) {
                lyxerr << _("Warning: could not determine path of binary.")
@@ -416,7 +404,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        // Read encodings
        ReadEncodingsFile("encodings");
        // Read languages
-       ReadLangugesFile("languages");
+       ReadLanguagesFile("languages");
 
        // Load the layouts
        lyxerr[Debug::INIT] << "Reading layouts..." << endl;
@@ -439,7 +427,8 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        }
 
        // Create temp directory        
-       system_tempdir = CreateLyXTmpDir(lyxrc.tempdir_path);
+       os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
+       system_tempdir = os::getTmpDir();
        if (lyxerr.debugging(Debug::INIT)) {
                lyxerr << "LyX tmp dir: `" << system_tempdir << '\'' << endl;
        }
@@ -484,7 +473,7 @@ void LyX::defaultKeyBindings(kb_keymap  * kbmap)
        // e.g. Num Lock set
        kbmap->bind("KP_0", LFUN_SELFINSERT);
        kbmap->bind("KP_Decimal", LFUN_SELFINSERT);
-       kbmap->bind("KP_Enter", LFUN_SELFINSERT);
+       kbmap->bind("KP_Enter", LFUN_BREAKPARAGRAPH);
        kbmap->bind("KP_1", LFUN_SELFINSERT);
        kbmap->bind("KP_2", LFUN_SELFINSERT);
        kbmap->bind("KP_3", LFUN_SELFINSERT);
@@ -653,8 +642,9 @@ void LyX::ReadUIFile(string const & name)
                        break;
 
                default:
-                       lex.printError("LyX::ReadUFile: "
-                                      "Unknown menu tag: `$$Token'");
+                       if(!strip(lex.GetString()).empty())
+                               lex.printError("LyX::ReadUIFile: "
+                                              "Unknown menu tag: `$$Token'");
                        break;
                }
        }
@@ -662,7 +652,7 @@ void LyX::ReadUIFile(string const & name)
 
 
 // Read the languages file `name'
-void LyX::ReadLangugesFile(string const & name)
+void LyX::ReadLanguagesFile(string const & name)
 {
        lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;