Fix two loading-related bugs reported by Kayvan

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7213 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-06-27 07:11:31 +00:00
parent b301ad5ead
commit 43c6809ab4
7 changed files with 34 additions and 37 deletions

View File

@ -182,10 +182,11 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
int const ret = Alert::prompt(_("Create new document?"),
text, 0, 1, _("&Create"), _("Cancel"));
if (ret == 0) {
bufferlist.close(buffer_, false);
buffer(newFile(s, string(), true));
}
if (ret == 0)
b = newFile(s, string(), true);
else
return false;
}
buffer(b);

View File

@ -1,4 +1,9 @@
2003-06-26 Alfredo Brauntein <abraunst@lyx.org>
* lyx_main.C (LyX): get full path of document loaded on the
command line
2003-06-26 André Pönitz <poenitz@gmx.net>
* lyxcursor.[Ch]: move rarely used operator==,!= out of line

View File

@ -1,3 +1,7 @@
2003-06-27 Alfredo Braunstein <abraunst@libero.it>
* lyx_gui.C (start): use BufferView::loadLyXFile
2003-06-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Toolbar_pimpl.C (add): do not add unknown lfuns

View File

@ -145,24 +145,14 @@ void start(string const & batch, vector<string> const & files)
view.show();
view.init();
Buffer * last = 0;
// FIXME: some code below needs moving
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
vector<string>::const_iterator cit = files.begin();
vector<string>::const_iterator end = files.end();
for (; cit != end; ++cit) {
Buffer * b = bufferlist.newBuffer(*cit);
if (loadLyXFile(b, *cit))
last = b;
}
// switch to the last buffer successfully loaded
if (last) {
view.view()->buffer(last);
}
for (; cit != end; ++cit)
view.view()->loadLyXFile(*cit, true);
// handle the batch commands the user asked for
if (!batch.empty()) {

View File

@ -1,3 +1,7 @@
2003-06-27 Alfredo Braunstein <abraunst@libero.it>
* lyx_gui.C (start): use BufferView::loadLyXFile
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
* FormError.[Ch]:

View File

@ -277,24 +277,14 @@ void start(string const & batch, vector<string> const & files)
view.show(xpos, ypos, "LyX");
view.init();
Buffer * last = 0;
// FIXME: some code below needs moving
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
vector<string>::const_iterator cit = files.begin();
vector<string>::const_iterator end = files.end();
for (; cit != end; ++cit) {
Buffer * b = bufferlist.newBuffer(*cit);
if (loadLyXFile(b, *cit))
last = b;
}
// switch to the last buffer successfully loaded
if (last) {
view.view()->buffer(last);
}
for (; cit != end; ++cit)
view.view()->loadLyXFile(*cit, true);
// handle the batch commands the user asked for
if (!batch.empty()) {

View File

@ -143,21 +143,24 @@ LyX::LyX(int & argc, char * argv[])
Buffer * last_loaded = 0;
vector<string>::iterator it = files.begin();
vector<string>::iterator end = files.end();
vector<string>::const_iterator it = files.begin();
vector<string>::const_iterator end = files.end();
for (; it != end; ++it) {
last_loaded = bufferlist.newBuffer(*it, false);
// get absolute path of file and add ".lyx" to
// the filename if necessary
string s = FileSearch(string(), *it, "lyx");
if (s.empty()) {
s = *it;
}
last_loaded = bufferlist.newBuffer(s, false);
last_loaded->parseError.connect(boost::bind(&LyX::printError, this, _1));
loadLyXFile(last_loaded, *it);
loadLyXFile(last_loaded, s);
}
files.clear();
// no buffer loaded, create one
string const tmpfile = "tmpfile";
if (!last_loaded)
last_loaded = newFile(tmpfile, string());
bool success = false;
// try to dispatch to last loaded buffer first