mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Fix to bug 633.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5382 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
816344ab1d
commit
2ed6872ad5
@ -1119,8 +1119,11 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
|
||||
InsetCitation * inset = new InsetCitation(p);
|
||||
if (!insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
else {
|
||||
inset->setLoadingBuffer(bv_->buffer(), false);
|
||||
updateInset(inset, true);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-10-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Bufferview_pimpl.C (dispatch): call InsetCitation::setLoadingBuffer
|
||||
to turn off an optimisation if a new inset is to be inserted.
|
||||
|
||||
2002-10-11 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lytext.h: make some functions public to allow access
|
||||
|
@ -1,3 +1,11 @@
|
||||
2002-10-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetcite.[Ch] (setLoadingBuffer): new method, invoked by
|
||||
BufferView::dispatch that turns off this optimisation when a new inset
|
||||
is inserted.
|
||||
|
||||
* insetcite.C (getNatbibLabel): correct logic of when and when not to
|
||||
reload the BibTeX keys.
|
||||
|
||||
2002-10-11 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -51,17 +51,22 @@ string const getNatbibLabel(Buffer const * buffer,
|
||||
string const & before, string const & after,
|
||||
bool numerical)
|
||||
{
|
||||
// Only reload the bibkeys if we have to...
|
||||
map<Buffer const *, bool>::iterator lit = loading_buffer.find(buffer);
|
||||
if (lit != loading_buffer.end())
|
||||
loading_buffer[buffer] = true;
|
||||
|
||||
typedef std::map<Buffer const *, biblio::InfoMap> CachedMap;
|
||||
static CachedMap cached_keys;
|
||||
|
||||
CachedMap::iterator kit = cached_keys.find(buffer);
|
||||
// Only load the bibkeys once if we're loading up the buffer,
|
||||
// else load them afresh each time.
|
||||
map<Buffer const *, bool>::iterator lit = loading_buffer.find(buffer);
|
||||
if (lit == loading_buffer.end())
|
||||
loading_buffer[buffer] = true;
|
||||
|
||||
if (!loading_buffer[buffer] || kit == cached_keys.end()) {
|
||||
bool loadkeys = !loading_buffer[buffer];
|
||||
if (!loadkeys) {
|
||||
CachedMap::iterator kit = cached_keys.find(buffer);
|
||||
loadkeys = kit == cached_keys.end();
|
||||
}
|
||||
|
||||
if (loadkeys) {
|
||||
// build the keylist
|
||||
typedef vector<std::pair<string, string> > InfoType;
|
||||
InfoType bibkeys = buffer->getBibkeyList();
|
||||
@ -74,7 +79,7 @@ string const getNatbibLabel(Buffer const * buffer,
|
||||
infomap[bit->first] = bit->second;
|
||||
}
|
||||
if (infomap.empty())
|
||||
return string();
|
||||
return string();
|
||||
|
||||
cached_keys[buffer] = infomap;
|
||||
}
|
||||
@ -310,12 +315,18 @@ string const InsetCitation::getScreenLabel(Buffer const * buffer) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::setLoadingBuffer(Buffer const * buffer, bool state) const
|
||||
{
|
||||
// Doesn't matter if there is no bv->buffer() entry in the map.
|
||||
loading_buffer[buffer] = state;
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
{
|
||||
// A call to edit() indicates that we're no longer loading the
|
||||
// buffer but doing some real work.
|
||||
// Doesn't matter if there is no bv->buffer() entry in the map.
|
||||
loading_buffer[bv->buffer()] = false;
|
||||
setLoadingBuffer(bv->buffer(), false);
|
||||
|
||||
bv->owner()->getDialogs().showCitation(this);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user