]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcite.C
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[lyx.git] / src / insets / insetcite.C
index 9df8737b020c5697e407d27c532d3f7767da7013..e1f51e61d36b2d0dce95f9a286c3b12eda506f1f 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>
 
@@ -230,11 +221,23 @@ string const getBasicLabel(string const & keyList, string const & after)
 } // anon namespace
 
 
-InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
+InsetCitation::InsetCitation(InsetCommandParams const & p)
        : InsetCommand(p)
 {}
 
 
+// InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
+//     : InsetCommand(p, false)
+// {}
+
+
+InsetCitation::~InsetCitation()
+{
+       InsetCommandMailer mailer("citation", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetCitation::generateLabel(Buffer const * buffer) const
 {
        string const before = string();
@@ -320,19 +323,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 InsetCommand::localDispatch(cmd);
+       }
+       return DISPATCHED;
 }
 
 
@@ -355,7 +359,7 @@ int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const
 // citations and then changes his mind, turning natbib support off. The output
 // should revert to \cite[]{}
 int InsetCitation::latex(Buffer const * buffer, ostream & os,
-                       bool /*fragile*/, bool/*fs*/) const
+                        LatexRunParams const &) const
 {
        os << "\\";
        if (buffer->params.use_natbib)