#include "frontends/alert.h"
-#include "support/lstrings.h"
+#include "support/convert.h"
#include "support/docstream.h"
#include "support/gettext.h"
-#include "support/convert.h"
+#include "support/lstrings.h"
using namespace std;
using namespace lyx::support;
docstring const key_prefix = from_ascii("key-");
-InsetBibitem::InsetBibitem(InsetCommandParams const & p)
+InsetBibitem::InsetBibitem(Buffer const & buf, InsetCommandParams const & p)
: InsetCommand(p, "bibitem")
{
+ Inset::setBuffer(const_cast<Buffer &>(buf));
+ buffer_->invalidateBibinfoCache();
if (getParam("key").empty())
setParam("key", key_prefix + convert<docstring>(++key_counter));
}
+InsetBibitem::~InsetBibitem()
+{
+ if (isBufferValid())
+ buffer_->invalidateBibinfoCache();
+}
+
+
void InsetBibitem::initView()
{
updateCommand(getParam("key"));
}
docstring old_key = params()["key"];
setParam("label", p["label"]);
- updateCommand(p["key"]);
- if (params()["key"] != old_key)
+ if (params()["key"] != old_key) {
+ updateCommand(p["key"]);
cur.bv().buffer().changeRefsIfUnique(old_key,
params()["key"], CITE_CODE);
+ }
+ buffer_->invalidateBibinfoCache();
break;
}
keyvalmap[from_ascii("label")] = getParam("label");
DocIterator doc_it(it);
doc_it.forwardPos();
- keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(false);
+ keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
keys[key] = keyvalmap;
}