X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetlabel.C;h=66963db35005b0d03398cbd7e78de312fdfb6f78;hb=6ce86e2bfe0a403e0e811b66fdddb2d56cfe0f83;hp=459699b8958f666e1c8f7ff0ec66c5a32ddab274;hpb=05a4c4d79fff606a98da8acdc6a135b9b984f547;p=lyx.git diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 459699b895..66963db350 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -45,45 +45,41 @@ vector const InsetLabel::getLabelList() const } -void InsetLabel::edit(BufferView *, int, int, mouse_button::state) +void InsetLabel::edit(BufferView * bv, int, int, mouse_button::state) { InsetCommandMailer mailer("label", *this); - mailer.showDialog(); + mailer.showDialog(bv); } dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY) - return UNDISPATCHED; - - InsetCommandParams p; - InsetCommandMailer::string2params(cmd.argument, p); - if (p.getCmdName().empty()) - return UNDISPATCHED; - - bool clean = true; - if (view() && p.getContents() != params().getContents()) { - clean = view()->ChangeCitationsIfUnique(params().getContents(), - p.getContents()); + Inset::RESULT result = UNDISPATCHED; + + switch (cmd.action) { + case LFUN_INSET_MODIFY: { + InsetCommandParams p; + InsetCommandMailer::string2params(cmd.argument, p); + if (p.getCmdName().empty()) + return UNDISPATCHED; + + bool clean = true; + if (view() && p.getContents() != params().getContents()) { + clean = view()->ChangeRefsIfUnique(params().getContents(), + p.getContents()); + } + + setParams(p); + cmd.view()->updateInset(this); + result = DISPATCHED; } + break; - setParams(p); - if (view()) - view()->updateInset(this, !clean); - - return DISPATCHED; -// if (result.first) { -// string new_contents = trim(result.second); -// if (!new_contents.empty() && -// getContents() != new_contents) { -// bv->buffer()->markDirty(); -// bool flag = bv->ChangeRefsIfUnique(getContents(), -// new_contents); -// setContents(new_contents); -// bv->updateInset(this, !flag); -// } -// } + default: + result = InsetCommand::localDispatch(cmd); + } + + return result; } @@ -100,6 +96,7 @@ int InsetLabel::latex(Buffer const *, ostream & os, return 0; } + int InsetLabel::ascii(Buffer const *, ostream & os, int) const { os << '<' << getContents() << '>';