]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibtex.C
add warning make controllers compile and remove some alomost unused functions, commen...
[lyx.git] / src / insets / insetbibtex.C
index da263a49698795cd9bf4247ea6e3043f0026e00a..21b54b9112f970d90d0bf863980308d61a2b38c1 100644 (file)
 #include "buffer.h"
 #include "BufferView.h"
 #include "debug.h"
+#include "funcrequest.h"
 #include "gettext.h"
 
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
-
 #include "support/filetools.h"
 #include "support/path.h"
 #include "support/os.h"
@@ -41,6 +39,43 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
 {}
 
 
+InsetBibtex::~InsetBibtex()
+{
+       InsetCommandMailer mailer("bibtex", *this);
+       mailer.hideDialog();
+}
+
+
+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");
@@ -185,18 +220,6 @@ void InsetBibtex::fillWithBibKeys
 }
 
 
-void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state)
-{
-       bv->owner()->getDialogs().showBibtex(this);
-}
-
-
-void InsetBibtex::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
-}
-
-
 bool InsetBibtex::addDatabase(string const & db)
 {
        string contents(getContents());