]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibtex.C
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[lyx.git] / src / insets / insetbibtex.C
index 6796f5db485be9ca99c435d65f6c3c51f632b3a2..f0f536f23c0a0fb3a8562e05226ed3c78022c6c3 100644 (file)
@@ -7,8 +7,8 @@
  *
  * Full author contact details are available in file CREDITS
  */
-#include <config.h>
 
+#include <config.h>
 
 #include "insetbibtex.h"
 #include "buffer.h"
@@ -16,6 +16,7 @@
 #include "debug.h"
 #include "funcrequest.h"
 #include "gettext.h"
+#include "latexrunparams.h"
 
 #include "support/filetools.h"
 #include "support/path.h"
@@ -34,28 +35,30 @@ using std::vector;
 using std::pair;
 
 
-InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
+InsetBibtex::InsetBibtex(InsetCommandParams const & p)
        : InsetCommand(p)
 {}
 
 
 InsetBibtex::~InsetBibtex()
 {
-       InsetCommandMailer mailer("bibtex", *this);
-       mailer.hideDialog();
+       InsetCommandMailer("bibtex", *this).hideDialog();
 }
 
 
 dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
 {
-       Inset::RESULT result = UNDISPATCHED;
-
        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())
-                       break;
+                       return DISPATCHED;
 
                if (view() && p.getContents() != params().getContents()) {
                        view()->ChangeCitationsIfUnique(params().getContents(),
@@ -63,15 +66,14 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
                }
 
                setParams(p);
-               cmd.view()->updateInset(this, true);
-               result = DISPATCHED;
+               cmd.view()->updateInset(this);
+               return  DISPATCHED;
        }
-       break;
+
        default:
-               result = InsetCommand::localDispatch(cmd);
+               return InsetCommand::localDispatch(cmd);
        }
 
-       return result;
 }
 
 string const InsetBibtex::getScreenLabel(Buffer const *) const
@@ -81,7 +83,7 @@ string const InsetBibtex::getScreenLabel(Buffer const *) const
 
 
 int InsetBibtex::latex(Buffer const * buffer, ostream & os,
-                      bool /*fragile*/, bool/*fs*/) const
+                      LatexRunParams const & runparams) const
 {
        // changing the sequence of the commands
        // 1. \bibliographystyle{style}
@@ -101,7 +103,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
                }
        }
 
-       if (!buffer->niceFile
+       if (!runparams.nice
            && IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
                style = MakeAbsPath(style, buffer->filePath());
        }
@@ -141,7 +143,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
        // have a comma-separated list of bibliographies
        string db_out;
        while (!adb.empty()) {
-               if (!buffer->niceFile &&
+               if (!runparams.nice &&
                    IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
                         adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
                db_out += adb;
@@ -218,19 +220,6 @@ void InsetBibtex::fillWithBibKeys
 }
 
 
-void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state)
-{
-       InsetCommandMailer mailer("bibtex", *this);
-       mailer.showDialog(bv);
-}
-
-
-void InsetBibtex::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
-}
-
-
 bool InsetBibtex::addDatabase(string const & db)
 {
        string contents(getContents());