From: Richard Heck Date: Tue, 28 Oct 2008 15:38:28 +0000 (+0000) Subject: From Vincent: X-Git-Tag: 1.6.10~2803 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f7acec3bdce5fd999d72fe4553a928c3d5c273cb;p=features.git From Vincent: > Hi all, > > > > A. > > 1. create a new document (doc1), > > 2. insert a label, > > 3. insert a cross-ref > > 4. create a new document (doc2) > > 5. insert a cross-ref (in doc2) > > then the labels in the cross-ref dialog are those from doc1. > > This is solved by the attached patch. We should not restore the last used buffer if the active buffer has changed. Especially not when you cannot choose the buffer which is now still the case. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27165 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index 24bae1550f..1c5210dae6 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -96,6 +96,7 @@ GuiRef::GuiRef(GuiView & lv) bc().addReadOnly(bufferCO); restored_buffer_ = -1; + active_buffer_ = -1; } @@ -230,14 +231,18 @@ void GuiRef::updateContents() bufferCO->addItem(toqstr(makeDisplayPath(it->absFilename()))); } + int thebuffer = theBufferList().bufferNum(buffer().fileName()); // restore the buffer combo setting for new insets if (params_["reference"].empty() && restored_buffer_ != -1 - && restored_buffer_ < bufferCO->count()) + && restored_buffer_ < bufferCO->count() && thebuffer == active_buffer_) bufferCO->setCurrentIndex(restored_buffer_); else { int num = theBufferList().bufferNum(buffer().fileName()); bufferCO->setCurrentIndex(num); + if (thebuffer != active_buffer_) + restored_buffer_ = num; } + active_buffer_ = thebuffer; updateRefs(); bc().setValid(false); diff --git a/src/frontends/qt4/GuiRef.h b/src/frontends/qt4/GuiRef.h index 5ff45c8635..a7f389e66e 100644 --- a/src/frontends/qt4/GuiRef.h +++ b/src/frontends/qt4/GuiRef.h @@ -94,6 +94,8 @@ private: QString last_reference_; /// store the buffer settings int restored_buffer_; + /// store the last active buffer + int active_buffer_; /// the references std::vector refs_; };