InsetLabel::InsetLabel(Buffer * buf, InsetCommandParams const & p)
- : InsetCommand(buf, p, "label")
-{
- screen_label_ = p["name"];
-}
+ : InsetCommand(buf, p)
+{}
void InsetLabel::initView()
for (; it != end; ++it) {
buffer().undo().recordUndo(it->second);
if (it->first->lyxCode() == MATH_REF_CODE) {
- InsetMathHull * mi =
- static_cast<InsetMathHull *>(it->first);
+ InsetMathHull * mi = it->first->asInsetMath()->asHullInset();
mi->asRefInset()->changeTarget(label);
} else {
- InsetCommand * ref =
- static_cast<InsetCommand *>(it->first);
+ InsetCommand * ref = it->first->asInsetCommand();
ref->setParam("reference", label);
}
}
}
buffer().undo().endUndoGroup();
-
- // We need an update of the Buffer reference cache. This is achieved by
- // updateBuffer().
- buffer().updateBuffer();
- screen_label_ = label;
}
DocIterator const ref_pit(it->second);
if (it->first->lyxCode() == MATH_REF_CODE)
toc.push_back(TocItem(ref_pit, 1,
- static_cast<InsetMathHull *>(it->first)->asRefInset()
+ it->first->asInsetMath()->asHullInset()->asRefInset()
->screenLabel()));
else
toc.push_back(TocItem(ref_pit, 1,
FuncStatus & status) const
{
bool enabled;
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_LABEL_INSERT_AS_REF:
case LFUN_LABEL_COPY_AS_REF:
enabled = true;
void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY: {
InsetCommandParams p(LABEL_CODE);
// FIXME UNICODE
- InsetCommand::string2params("label", to_utf8(cmd.argument()), p);
+ InsetCommand::string2params(to_utf8(cmd.argument()), p);
if (p.getCmdName().empty()) {
- cur.noUpdate();
+ cur.noScreenUpdate();
break;
}
if (p["name"] != params()["name"])
updateCommand(p["name"]);
+ cur.forceBufferUpdate();
break;
}
case LFUN_LABEL_INSERT_AS_REF: {
InsetCommandParams p(REF_CODE, "ref");
p["reference"] = getParam("name");
- string const data = InsetCommand::params2string("ref", p);
+ string const data = InsetCommand::params2string(p);
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
break;
}