]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibtex.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / insetbibtex.C
index 895b7a032b7ce96d5c1a33f41cabfe4a5bf878dc..68dbbf29aa8cc26c4240b28b6038162b88b5780c 100644 (file)
@@ -16,6 +16,7 @@
 #include "debug.h"
 #include "funcrequest.h"
 #include "gettext.h"
+#include "latexrunparams.h"
 
 #include "support/filetools.h"
 #include "support/path.h"
@@ -48,24 +49,32 @@ InsetBibtex::~InsetBibtex()
 
 dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
 {
-       if (cmd.action != LFUN_INSET_MODIFY)
-               return UNDISPATCHED;
+       switch (cmd.action) {
 
-       InsetCommandParams p;
-       InsetCommandMailer::string2params(cmd.argument, p);
-       if (p.getCmdName().empty())
-               return UNDISPATCHED;
+       case LFUN_INSET_EDIT:
+               InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
+               return DISPATCHED;
 
-       if (view() && p.getContents() != params().getContents()) {
-               view()->ChangeCitationsIfUnique(params().getContents(),
-                                               p.getContents());
+       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;
        }
 
-       setParams(p);
-       if (view())
-               view()->updateInset(this, true);
+       default:
+               return InsetCommand::localDispatch(cmd);
+       }
 
-       return DISPATCHED;
 }
 
 string const InsetBibtex::getScreenLabel(Buffer const *) const
@@ -75,7 +84,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}
@@ -95,7 +104,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());
        }
@@ -135,7 +144,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;
@@ -212,19 +221,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());