]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibtex.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insetbibtex.C
index 0cbb94b61ba2e46085a4c4ae69b71a32ab026772..f016af125cdb1bb223bf769cbf47506afba7c7f0 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"
@@ -27,6 +27,8 @@
 #include <fstream>
 #include <cstdlib>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::ifstream;
 using std::getline;
@@ -35,15 +37,20 @@ 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();
+}
+
+
+std::auto_ptr<InsetBase> InsetBibtex::clone() const
+{
+       return std::auto_ptr<InsetBase>(new InsetBibtex(*this));
 }
 
 
@@ -60,14 +67,7 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
                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;
        }
 
@@ -84,8 +84,7 @@ string const InsetBibtex::getScreenLabel(Buffer const *) const
 
 
 int InsetBibtex::latex(Buffer const * buffer, ostream & os,
-                      LatexRunParams const & runparams,
-                      bool/*fs*/) const
+                      LatexRunParams const & runparams) const
 {
        // changing the sequence of the commands
        // 1. \bibliographystyle{style}
@@ -160,7 +159,6 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
 
 vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
 {
-       // Doesn't appear to be used (Angus, 31 July 2001)
        Path p(buffer.filePath());
 
        vector<string> vec;
@@ -185,10 +183,10 @@ vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
 
 
 // This method returns a comma separated list of Bibtex entries
-void InsetBibtex::fillWithBibKeys
-       (Buffer const * buffer, vector<pair<string, string> > & keys) const
+void InsetBibtex::fillWithBibKeys(Buffer const * buffer,
+                                 std::vector<std::pair<string, string> > & keys) const
 {
-       lyx::Assert(buffer);
+       Assert(buffer);
        vector<string> const files = getFiles(*buffer);
        for (vector<string>::const_iterator it = files.begin();
             it != files.end(); ++ it) {