- pair<bool, string> result = Alert::askForText(_("Enter label:"), getContents());
- 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);
-#if 0
- bv->text->redoParagraph(bv);
- if (flag) {
- bv->redraw();
- bv->fitCursor();
- } else
- bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-#else
- bv->updateInset(this, !flag);
-#endif
+ InsetCommandMailer mailer("label", *this);
+ mailer.showDialog(bv);
+}
+
+
+dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
+{
+ 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());