using std::endl;
using std::string;
using std::vector;
-using std::mem_fun_ref;
#ifndef CXX_GLOBAL_CSTD
using std::exit;
if (first_start)
files.push_back(i18nLibFileSearch("examples", "splash.lyx"));
- // if a file is specified, I assume that user wants to edit *that* file
- if (files.empty() && lyxrc.load_session) {
- vector<string> const & lastopened = session_->lastOpenedFiles();
- files.insert(files.end(), lastopened.begin(), lastopened.end() );
- }
- // clear this list to save a few bytes of RAM
- session_->clearLastOpenedFiles();
-
// Execute batch commands if available
if (!batch_command.empty()) {
last_loaded = b;
} else {
Buffer * buf = bufferlist.newBuffer(s, false);
- if (loadLyXFile(buf, s))
+ if (loadLyXFile(buf, s)) {
last_loaded = buf;
+ ErrorList const & el = buf->errorList("Parse");
+ if (!el.empty())
+ for_each(el.begin(), el.end(),
+ boost::bind(&LyX::printError, this, _1));
+ }
else
bufferlist.release(buf);
-
- ErrorList const & el = buf->getErrorList();
- if (!el.empty()) {
- // There should be a way to use the following but I (abdel) don't know
- // how to make it compile on MSVC2005.
- //for_each(el.begin(), el.end(), mem_fun_ref(&LyX::printError));
- for (ErrorList::const_iterator it = el.begin();
- it != el.end(); ++it) {
- printError(*it);
- }
- }
}
}
width = 0;
height = 0;
}
+ // create the main window
+ LyXView * view = lyx_gui::create_view(width, height, posx, posy, maximize);
+
+ // load files
+ for_each(files.begin(), files.end(),
+ bind(&LyXView::loadLyXFile, view, _1, true));
+
+ // if a file is specified, I assume that user wants to edit *that* file
+ if (files.empty() && lyxrc.load_session) {
+ vector<string> const & lastopened = session_->lastOpenedFiles();
+ // do not add to the lastfile list since these files are restored from
+ // last seesion, and should be already there (regular files), or should
+ // not be added at all (help files).
+ for_each(lastopened.begin(), lastopened.end(),
+ bind(&LyXView::loadLyXFile, view, _1, false));
+ }
+ // clear this list to save a few bytes of RAM
+ session_->clearLastOpenedFiles();
- return lyx_gui::start(batch_command, files, width, height, posx, posy, maximize);
-
+ return lyx_gui::start(view, batch_command);
} else {
// Something went wrong above
quitLyX(false);
if (!lyxrc.path_prefix.empty())
prependEnvPath("PATH", lyxrc.path_prefix);
- // Check that user LyX directory is ok. We don't do that if
- // running in batch mode.
- if (lyx_gui::use_gui) {
- if (queryUserLyXDir(package().explicit_user_support()))
- reconfigureUserLyXDir();
- } else {
+ // Check that user LyX directory is ok.
+ if (queryUserLyXDir(package().explicit_user_support()))
+ reconfigureUserLyXDir();
+
+ // no need for a splash when there is no GUI
+ if (!lyx_gui::use_gui) {
first_start = false;
}
int parse_version(string const &, string const &)
{
lyxerr << "LyX " << lyx_version
- << " of " << lyx_release_date << endl;
+ << " (" << lyx_release_date << ")" << endl;
lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl;
lyxerr << lyx_version_info << endl;