All occurrences of buf->errors("Parse") in GuiApplication an GuiView are positioned after a call to GuiView::loadDocument which already should handle any errors.

GuiView::loadDocument also already calls setBuffer(), so this is not needed everytime too.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35917 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-29 18:57:40 +00:00
parent e82cd410c1
commit e9e577f6a4
2 changed files with 6 additions and 30 deletions

View File

@ -1352,13 +1352,10 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
current_view_->message(bformat(_("Opening help file %1$s..."),
makeDisplayPath(fname.absFileName())));
Buffer * buf = current_view_->loadDocument(fname, false);
if (buf) {
current_view_->setBuffer(buf);
#ifndef DEVEL_VERSION
if (buf)
buf->setReadonly(true);
#endif
buf->errors("Parse");
}
break;
}

View File

@ -1815,6 +1815,7 @@ Buffer * GuiView::loadDocument(FileName const & filename, bool tolastfiles)
return 0;
}
newBuffer->errors("Parse");
setBuffer(newBuffer);
if (tolastfiles)
@ -1895,10 +1896,6 @@ void GuiView::openDocument(string const & fname)
docstring str2;
Buffer * buf = loadDocument(fullname);
if (buf) {
// I don't think this is needed, since it will be done in setBuffer().
// buf->updateBuffer();
setBuffer(buf);
buf->errors("Parse");
str2 = bformat(_("Document %1$s opened."), disp_fn);
if (buf->lyxvc().inUse())
str2 += " " + from_utf8(buf->lyxvc().versionString()) +
@ -1945,10 +1942,6 @@ static bool import(GuiView * lv, FileName const & filename,
Buffer * buf = lv->loadDocument(lyxfile);
if (!buf)
return false;
// I don't think this is needed, since it will be done in setBuffer().
// buf->updateBuffer();
lv->setBuffer(buf);
buf->errors("Parse");
} else {
Buffer * const b = newFile(lyxfile.absFileName(), string(), true);
if (!b)
@ -2804,29 +2797,19 @@ void GuiView::openChildDocument(string const & fname)
FileName const filename = support::makeAbsPath(fname, buffer.filePath());
documentBufferView()->saveBookmark(false);
Buffer * child = 0;
bool parsed = false;
if (theBufferList().exists(filename)) {
child = theBufferList().getBuffer(filename);
setBuffer(child);
} else {
message(bformat(_("Opening child document %1$s..."),
makeDisplayPath(filename.absFileName())));
child = loadDocument(filename, false);
parsed = true;
}
if (!child)
return;
// Set the parent name of the child document.
// This makes insertion of citations and references in the child work,
// when the target is in the parent or another child document.
if (child)
child->setParent(&buffer);
// I don't think this is needed, since it will be called in
// setBuffer().
// child->masterBuffer()->updateBuffer();
setBuffer(child);
if (parsed)
child->errors("Parse");
}
@ -2873,10 +2856,6 @@ bool GuiView::goToFileRow(string const & argument)
buf = loadDocument(s);
if (!buf)
return false;
// I don't think this is needed. loadDocument() calls
// setBuffer(), which calls updateBuffer().
// buf->updateBuffer();
buf->errors("Parse");
} else {
message(bformat(
_("File does not exist: %1$s"),