]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
Move #includes out of header files.
[lyx.git] / src / lyx_main.C
index f12367b635a9517618eebed035035155a94a32f7..250b74681c64664a7516b72c19a70765333b8a5b 100644 (file)
@@ -1,9 +1,15 @@
 /**
  * \file lyx_main.C
- * Copyright 1995-2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
+ * \author Alfredo Braunstein
  * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author John Levon
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "lyx_main.h"
 
-#include "support/filetools.h"
-#include "support/lyxlib.h"
-#include "support/FileInfo.h"
-#include "support/path.h"
-#include "support/path_defines.h"
-#include "debug.h"
-#include "gettext.h"
-#include "lyxlex.h"
-
-#include "graphics/GraphicsTypes.h"
-
-#include "bufferlist.h"
 #include "buffer.h"
 #include "buffer_funcs.h"
-#include "lyxserver.h"
+#include "bufferlist.h"
+#include "converter.h"
+#include "debug.h"
+#include "encoding.h"
+#include "format.h"
+#include "gettext.h"
 #include "kbmap.h"
-#include "lyxfunc.h"
-#include "ToolbarBackend.h"
-#include "MenuBackend.h"
 #include "language.h"
 #include "lastfiles.h"
-#include "encoding.h"
-#include "converter.h"
-#include "format.h"
+#include "lyxfunc.h"
+#include "lyxlex.h"
 #include "lyxtextclasslist.h"
+#include "lyxserver.h"
+#include "MenuBackend.h"
+#include "ToolbarBackend.h"
 
 #include "frontends/Alert.h"
 #include "frontends/lyx_gui.h"
 
+#include "graphics/GraphicsTypes.h"
+
+#include "support/FileInfo.h"
+#include "support/filetools.h"
+#include "support/lyxlib.h"
+#include "support/os.h"
+#include "support/path.h"
+#include "support/path_defines.h"
+
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
 #include <boost/signals/signal1.hpp>
@@ -59,7 +66,6 @@ using std::signal;
 using std::system;
 #endif
 
-extern void LoadLyXFile(string const &);
 extern void QuitLyX();
 
 extern LyXServer * lyxserver;
@@ -97,9 +103,8 @@ LyX::LyX(int & argc, char * argv[])
        // #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
        lyx::graphics::setDisplayTranslator();
 
-       if (want_gui) {
+       if (want_gui)
                lyx_gui::parse_init(argc, argv);
-       }
 
        // check for any spurious extra arguments
        // other than documents
@@ -116,15 +121,13 @@ LyX::LyX(int & argc, char * argv[])
        init(want_gui);
        lyxerr[Debug::INIT] << "Initializing LyX::init...done" << endl;
 
-       if (want_gui) {
+       if (want_gui) 
                lyx_gui::parse_lyxrc();
-       }
 
        vector<string> files;
 
-       for (int argi = argc - 1; argi >= 1; --argi) {
+       for (int argi = argc - 1; argi >= 1; --argi) 
                files.push_back(argv[argi]);
-       }
 
        if (first_start)
                files.push_back(i18nLibFileSearch("examples", "splash.lyx"));
@@ -145,14 +148,14 @@ LyX::LyX(int & argc, char * argv[])
                        // the filename if necessary
                        string s = FileSearch(string(), *it, "lyx");
                        if (s.empty()) {
-                               last_loaded = newFile(*it, "");
+                               last_loaded = newFile(*it, string(), true);
                        } else {
-                               last_loaded = bufferlist.newBuffer(s, false);
-                               last_loaded->error.connect(boost::bind(&LyX::printError, this, _1));
-                               if (!loadLyXFile(last_loaded, s)) {
-                                       bufferlist.release(last_loaded);
-                                       last_loaded = newFile(*it, string());
-                               }
+                               Buffer * buf = bufferlist.newBuffer(s, false);
+                               buf->error.connect(boost::bind(&LyX::printError, this, _1));
+                               if (loadLyXFile(buf, s)) 
+                                       last_loaded = buf;
+                               else
+                                       bufferlist.release(buf);
                        }
                }