mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 22:41:09 +00:00
Simplify code a bit: If we only accept CITE_CODE, there is no need
to pass it.
This commit is contained in:
parent
6e25ae3272
commit
6c983d6cd1
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user