mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
Fix a few quirks and a crash introduced by a bad manual merge of local tree at revision 18828. Sorry.
* LyXView::setBuffer(): update labels and toc only if we change parents. * LyXView::loadLyXFile(): - update labels in _any_ case and before setting the Buffer. - update GUI controls in case we move to a saved position. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18829 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
144e721b65
commit
3cf838c4d1
@ -143,21 +143,19 @@ void LyXView::setBuffer(Buffer * b, bool child_document)
|
||||
|
||||
work_area_->bufferView().setBuffer(b);
|
||||
|
||||
//FIXME This would be a little simpler if setBuffer returned the buffer.
|
||||
//FIXME This would be a little simpler if setBuffer returned the buffer.
|
||||
Buffer * newBuffer = work_area_->bufferView().buffer();
|
||||
if (newBuffer) {
|
||||
if (child_document && newBuffer != oldBuffer) {
|
||||
if (child_document && newBuffer->getMasterBuffer() != oldBuffer) {
|
||||
// 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.
|
||||
newBuffer->setParentName(parentfilename);
|
||||
// updateLabels() will emit Buffer::structureChanged() so better
|
||||
// connect it before.
|
||||
connectBuffer(*newBuffer);
|
||||
// Update the labels and section numbering.
|
||||
// Update the labels and section numbering to the new master Buffer.
|
||||
updateLabels(*newBuffer->getMasterBuffer());
|
||||
} else
|
||||
connectBuffer(*newBuffer);
|
||||
}
|
||||
|
||||
connectBuffer(*newBuffer);
|
||||
|
||||
// Buffer-dependent dialogs should be updated or
|
||||
// hidden. This should go here because some dialogs (eg ToC)
|
||||
@ -209,15 +207,15 @@ bool LyXView::loadLyXFile(FileName const & filename, bool tolastfiles,
|
||||
makeDisplayPath(filename.absFilename())));
|
||||
}
|
||||
|
||||
// Update the labels and section numbering.
|
||||
updateLabels(*newBuffer->getMasterBuffer());
|
||||
|
||||
bool const parse_error = !newBuffer->errorList("Parse").empty();
|
||||
if (parse_error || !auto_open) {
|
||||
setBuffer(newBuffer, child_document);
|
||||
showErrorList("Parse");
|
||||
}
|
||||
|
||||
// Update the labels and section numbering.
|
||||
updateLabels(*newBuffer->getMasterBuffer());
|
||||
|
||||
// scroll to the position when the file was last closed
|
||||
if (!auto_open && lyxrc.use_lastfilepos) {
|
||||
pit_type pit;
|
||||
@ -229,6 +227,11 @@ bool LyXView::loadLyXFile(FileName const & filename, bool tolastfiles,
|
||||
if (work_area_->bufferView().fitCursor())
|
||||
work_area_->bufferView().updateMetrics(false);
|
||||
newBuffer->text().setCurrentFont(work_area_->bufferView().cursor());
|
||||
updateMenubar();
|
||||
updateToolbars();
|
||||
updateLayoutChoice();
|
||||
updateStatusBar();
|
||||
work_area_->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user