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
This commit is contained in:
Richard Heck 2008-10-28 15:38:28 +00:00
parent f771d9a994
commit f7acec3bdc
2 changed files with 8 additions and 1 deletions

View File

@ -96,6 +96,7 @@ GuiRef::GuiRef(GuiView & lv)
bc().addReadOnly(bufferCO); bc().addReadOnly(bufferCO);
restored_buffer_ = -1; restored_buffer_ = -1;
active_buffer_ = -1;
} }
@ -230,14 +231,18 @@ void GuiRef::updateContents()
bufferCO->addItem(toqstr(makeDisplayPath(it->absFilename()))); bufferCO->addItem(toqstr(makeDisplayPath(it->absFilename())));
} }
int thebuffer = theBufferList().bufferNum(buffer().fileName());
// restore the buffer combo setting for new insets // restore the buffer combo setting for new insets
if (params_["reference"].empty() && restored_buffer_ != -1 if (params_["reference"].empty() && restored_buffer_ != -1
&& restored_buffer_ < bufferCO->count()) && restored_buffer_ < bufferCO->count() && thebuffer == active_buffer_)
bufferCO->setCurrentIndex(restored_buffer_); bufferCO->setCurrentIndex(restored_buffer_);
else { else {
int num = theBufferList().bufferNum(buffer().fileName()); int num = theBufferList().bufferNum(buffer().fileName());
bufferCO->setCurrentIndex(num); bufferCO->setCurrentIndex(num);
if (thebuffer != active_buffer_)
restored_buffer_ = num;
} }
active_buffer_ = thebuffer;
updateRefs(); updateRefs();
bc().setValid(false); bc().setValid(false);

View File

@ -94,6 +94,8 @@ private:
QString last_reference_; QString last_reference_;
/// store the buffer settings /// store the buffer settings
int restored_buffer_; int restored_buffer_;
/// store the last active buffer
int active_buffer_;
/// the references /// the references
std::vector<docstring> refs_; std::vector<docstring> refs_;
}; };