From 3cf838c4d17bc9aae62a464025881465db1fb119 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 19 Jun 2007 17:04:09 +0000 Subject: [PATCH] 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 --- src/frontends/LyXView.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/frontends/LyXView.cpp b/src/frontends/LyXView.cpp index cdbcc66e16..dbf474462d 100644 --- a/src/frontends/LyXView.cpp +++ b/src/frontends/LyXView.cpp @@ -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(); } } -- 2.39.2