Simplify code a bit: If we only accept CITE_CODE, there is no need

to pass it.
This commit is contained in:
Richard Heck 2013-04-06 12:34:26 -04:00
parent 6e25ae3272
commit 6c983d6cd1
3 changed files with 9 additions and 16 deletions

View File

@ -3359,12 +3359,9 @@ void Buffer::clearReferenceCache() const
}
void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
InsetCode code)
void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to)
{
//FIXME: This does not work for child documents yet.
LASSERT(code == CITE_CODE, /**/);
reloadBibInfoCache();
// Check if the label 'from' appears more than once
@ -3382,14 +3379,12 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
string const paramName = "key";
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
if (it->lyxCode() == code) {
InsetCommand * inset = it->asInsetCommand();
if (!inset)
continue;
docstring const oldValue = inset->getParam(paramName);
if (oldValue == from)
inset->setParam(paramName, to);
}
if (it->lyxCode() != CITE_CODE)
continue;
InsetCommand * inset = it->asInsetCommand();
docstring const oldValue = inset->getParam(paramName);
if (oldValue == from)
inset->setParam(paramName, to);
}
}

View File

@ -591,8 +591,7 @@ public:
/// Replace the inset contents for insets which InsetCode is equal
/// to the passed \p inset_code.
void changeRefsIfUnique(docstring const & from, docstring const & to,
InsetCode code);
void changeRefsIfUnique(docstring const & from, docstring const & to);
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
/// including preamble

View File

@ -177,8 +177,7 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
setParam("label", p["label"]);
if (p["key"] != old_key) {
updateCommand(p["key"]);
cur.bv().buffer().changeRefsIfUnique(old_key,
params()["key"], CITE_CODE);
cur.bv().buffer().changeRefsIfUnique(old_key, params()["key"]);
cur.forceBufferUpdate();
buffer().invalidateBibinfoCache();
}