X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetbibtex.C;h=21b54b9112f970d90d0bf863980308d61a2b38c1;hb=62be565337f08855dbbbeea9d90db2ce497d4c10;hp=95c97a52503169fb370fb91f4b679729b1dd9b68;hpb=cda53633ff3a06b87889f37e9fb5b905dec4c80d;p=lyx.git diff --git a/src/insets/insetbibtex.C b/src/insets/insetbibtex.C index 95c97a5250..21b54b9112 100644 --- a/src/insets/insetbibtex.C +++ b/src/insets/insetbibtex.C @@ -12,7 +12,9 @@ #include "insetbibtex.h" #include "buffer.h" +#include "BufferView.h" #include "debug.h" +#include "funcrequest.h" #include "gettext.h" #include "support/filetools.h" @@ -44,6 +46,36 @@ InsetBibtex::~InsetBibtex() } +dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd) +{ + switch (cmd.action) { + + case LFUN_INSET_EDIT: + InsetCommandMailer("bibtex", *this).showDialog(cmd.view()); + return DISPATCHED; + + case LFUN_INSET_MODIFY: { + InsetCommandParams p; + InsetCommandMailer::string2params(cmd.argument, p); + if (p.getCmdName().empty()) + return DISPATCHED; + + if (view() && p.getContents() != params().getContents()) { + view()->ChangeCitationsIfUnique(params().getContents(), + p.getContents()); + } + + setParams(p); + cmd.view()->updateInset(this); + return DISPATCHED; + } + + default: + return InsetCommand::localDispatch(cmd); + } + +} + string const InsetBibtex::getScreenLabel(Buffer const *) const { return _("BibTeX Generated References"); @@ -188,19 +220,6 @@ void InsetBibtex::fillWithBibKeys } -void InsetBibtex::edit(BufferView *, int, int, mouse_button::state) -{ - InsetCommandMailer mailer("bibtex", *this); - mailer.showDialog(); -} - - -void InsetBibtex::edit(BufferView * bv, bool) -{ - edit(bv, 0, 0, mouse_button::none); -} - - bool InsetBibtex::addDatabase(string const & db) { string contents(getContents());