]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
Applied Angus patch to compile on DEC C++ and to avoid name clashes
[lyx.git] / src / lyx_main.C
index 60f322ea01d5474294b104edc4076f18a06be1e9..6d7a1d4780b3acedd8ad9953146222e967d95395 100644 (file)
@@ -64,7 +64,7 @@ LyXServer * lyxserver = 0;
 bool finished = false; // flag, that we are quitting the program
 
 // convenient to have it here.
-kb_keymap * toplevel_keymap;
+boost::scoped_ptr<kb_keymap> toplevel_keymap;
 
 
 LyX::LyX(int * argc, char * argv[])
@@ -78,8 +78,8 @@ LyX::LyX(int * argc, char * argv[])
        bool gui = easyParse(argc, argv);
 
        // Global bindings (this must be done as early as possible.) (Lgb)
-       toplevel_keymap = new kb_keymap;
-       defaultKeyBindings(toplevel_keymap);
+       toplevel_keymap.reset(new kb_keymap);
+       defaultKeyBindings(toplevel_keymap.get());
        
        // Make the GUI object, and let it take care of the
        // command line arguments that concerns it.
@@ -318,10 +318,10 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
 
        // Warn the user if we couldn't find "chkconfig.ltx"
        if (system_lyxdir == "./") {
-               lyxerr <<_("LyX Warning! Couldn't determine system directory.")
-                      <<_("Try the '-sysdir' command line parameter or")
+               lyxerr <<_("LyX Warning! Couldn't determine system directory. ")
+                      <<_("Try the '-sysdir' command line parameter or ")
                       <<_("set the environment variable LYX_DIR_11x to the "
-                          "LyX system directory")
+                          "LyX system directory ")
                       << _("containing the file `chkconfig.ltx'.") << endl;
                if (!path_shown)
                        lyxerr << _("Using built-in default ") 
@@ -351,10 +351,10 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        bool explicit_userdir = true;
        if (user_lyxdir.empty()) {
 
-       // LYX_USERDIR_11x environment variable
+               // LYX_USERDIR_11x environment variable
                user_lyxdir = GetEnvPath("LYX_USERDIR_11x");
 
-       // default behaviour
+               // default behaviour
                if (user_lyxdir.empty())
                        user_lyxdir = AddPath(GetEnvPath("HOME"),
                                                        string(".") + PACKAGE);
@@ -364,8 +364,12 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        lyxerr[Debug::INIT] << "User LyX directory: '" 
                            <<  user_lyxdir << '\'' << endl;
 
-       // Check that user LyX directory is ok.
-       queryUserLyXDir(explicit_userdir);
+       // Check that user LyX directory is ok. We don't do that if
+       // running in batch mode.
+       if (gui)
+               queryUserLyXDir(explicit_userdir);
+       else
+               first_start = false;
 
        //
        // Shine up lyxrc defaults
@@ -409,10 +413,6 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        if (!ReadRcFile("preferences"))
            ReadRcFile("lyxrc");
 
-       /// Init Converter
-       converters.Update(formats);
-       converters.BuildGraph();
-
        // Read encodings
        ReadEncodingsFile("encodings");
        // Read languages
@@ -424,8 +424,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
 
        // Ensure that we have really read a bind file, so that LyX is
        // usable.
-       if (!lyxrc.hasBindFile)
-               lyxrc.ReadBindFile();
+       lyxrc.readBindFileIfNeeded();
 
        // Read menus
        ReadUIFile(lyxrc.ui_file);
@@ -433,7 +432,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        // Bind the X dead keys to the corresponding LyX functions if
        // necessary. 
        if (lyxrc.override_x_deadkeys)
-               deadKeyBindings(toplevel_keymap);
+               deadKeyBindings(toplevel_keymap.get());
 
        if (lyxerr.debugging(Debug::LYXRC)) {
                lyxrc.print();
@@ -468,6 +467,7 @@ void LyX::defaultKeyBindings(kb_keymap  * kbmap)
        kbmap->bind("Down", LFUN_DOWN);
        
        kbmap->bind("Tab", LFUN_TAB);
+       kbmap->bind("ISO_Left_Tab", LFUN_TAB); // jbl 2001-23-02
        
        kbmap->bind("Home", LFUN_HOME);
        kbmap->bind("End", LFUN_END);
@@ -506,6 +506,7 @@ void LyX::defaultKeyBindings(kb_keymap  * kbmap)
        
         kbmap->bind("C-Tab", LFUN_TABINSERT);  // ale970515
        kbmap->bind("S-Tab", LFUN_SHIFT_TAB);  // jug20000522
+       kbmap->bind("S-ISO_Left_Tab", LFUN_SHIFT_TAB); // jbl 2001-23-02
 }
 
 
@@ -689,8 +690,9 @@ void LyX::ReadEncodingsFile(string const & name)
 }
 
 
+namespace {
+
 // Set debugging level and report result to user
-static
 void setDebuggingLevel(string const & dbgLevel)
 {
        lyxerr << _("Setting debug level to ") <<  dbgLevel << endl;
@@ -700,7 +702,6 @@ void setDebuggingLevel(string const & dbgLevel)
 
 
 // Give command line help
-static
 void commandLineHelp()
 {
        lyxerr << "LyX " LYX_VERSION << " of " LYX_RELEASE << endl;
@@ -724,6 +725,8 @@ void commandLineHelp()
                  "Check the LyX man page for more details.") << endl;
 }
 
+} // namespace anon
+
 
 bool LyX::easyParse(int * argc, char * argv[])
 {