*
* Full author contact details are available in file CREDITS
*/
-#include <config.h>
+#include <config.h>
#include "insetbibtex.h"
#include "buffer.h"
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
+#include "latexrunparams.h"
#include "support/filetools.h"
#include "support/path.h"
#include <fstream>
#include <cstdlib>
+using namespace lyx::support;
+
using std::ostream;
using std::ifstream;
using std::getline;
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));
}
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;
}
}
-int InsetBibtex::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
- bool /*fragile*/, bool/*fs*/) const
+int InsetBibtex::latex(Buffer const * buffer, ostream & os,
+ LatexRunParams const & runparams) const
{
// changing the sequence of the commands
// 1. \bibliographystyle{style}
}
}
- if (!buffer->niceFile
+ if (!runparams.nice
&& IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
style = MakeAbsPath(style, buffer->filePath());
}
// 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;
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;
// 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) {