/**
* \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>
using std::system;
#endif
-extern void LoadLyXFile(string const &);
extern void QuitLyX();
extern LyXServer * lyxserver;
// #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
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"));
// 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);
}
}