]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcite.C
fix #832
[lyx.git] / src / insets / insetcite.C
index d7b7206cd317b2f11e072966217f0be3757aaab4..419cf6f21958eb1613de8510f1b2a9d9919cbe7d 100644 (file)
 
 #include <config.h>
 
-
 #include "insetcite.h"
+#include "funcrequest.h"
 #include "buffer.h"
 #include "BufferView.h"
 #include "LaTeXFeatures.h"
-#include "frontends/LyXView.h"
-#include "debug.h"
-#include "gettext.h"
 
 #include "frontends/controllers/biblio.h"
-#include "frontends/Dialogs.h"
 
-#include "support/filetools.h"
-#include "support/lstrings.h"
-#include "support/path.h"
-#include "support/os.h"
 #include "support/lstrings.h"
-#include "support/LAssert.h"
 
 #include <map>
 
@@ -66,7 +57,8 @@ string const getNatbibLabel(Buffer const * buffer,
        if (loadkeys) {
                // build the keylist
                typedef vector<std::pair<string, string> > InfoType;
-               InfoType bibkeys = buffer->getBibkeyList();
+               InfoType bibkeys;
+               buffer->fillWithBibKeys(bibkeys);
 
                InfoType::const_iterator bit  = bibkeys.begin();
                InfoType::const_iterator bend = bibkeys.end();
@@ -234,6 +226,13 @@ InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
 {}
 
 
+InsetCitation::~InsetCitation()
+{
+       InsetCommandMailer mailer("citation", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetCitation::generateLabel(Buffer const * buffer) const
 {
        string const before = string();
@@ -319,19 +318,20 @@ void InsetCitation::setLoadingBuffer(Buffer const * buffer, bool state) const
 }
 
 
-void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state)
+dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd)
 {
-       // A call to edit() indicates that we're no longer loading the
-       // buffer but doing some real work.
-       setLoadingBuffer(bv->buffer(), false);
-
-       bv->owner()->getDialogs().showCitation(this);
-}
-
-
-void InsetCitation::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
+       switch (cmd.action) {
+               case LFUN_INSET_EDIT:
+                       // A call to edit indicates that we're no longer loading the
+                       // buffer but doing some real work.
+                       setLoadingBuffer(cmd.view()->buffer(), false);
+                       InsetCommandMailer("citation", *this).showDialog(cmd.view());
+                       break;
+
+               default:
+                       return UNDISPATCHED;
+       }
+       return DISPATCHED;
 }