-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2001 The LyX Team.
+/**
+ * \file ControlBibtex.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ======================================================
+ * \author John Levon
+ * \author Angus Leeming
+ * \author Herbert Voss
*
- * \file ControlBibtex.C
- * \author John Levon, moz@compsoc.man.ac.uk
- * \author Angus Leeming <a.leeming@ic.ac.uk>
- * \author Herbert Voss <voss@lyx.org>
+ * Full author contact details are available in file CREDITS
*/
-#include <algorithm>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include <config.h>
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
+
#include "ControlBibtex.h"
-#include "Dialogs.h"
-#include "LyXView.h"
+#include "Kernel.h"
+
#include "buffer.h"
-#include "BufferView.h"
#include "lyxrc.h"
#include "helper_funcs.h"
+#include "tex_helpers.h"
#include "gettext.h"
-using SigC::slot;
+#include "support/filetools.h"
+
+using namespace lyx::support;
+
using std::pair;
-using std::make_pair;
+using std::vector;
+
+
+ControlBibtex::ControlBibtex(Dialog & d)
+ : ControlCommand(d, "bibtex")
+{}
-ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
- : ControlCommand(lv, d)
+
+string const ControlBibtex::Browse(string const & in_name,
+ string const & title,
+ string const & pattern)
{
- d_.showBibtex.connect(slot(this, &ControlBibtex::showInset));
+ pair<string, string> dir1(_("Documents|#o#O"),
+ string(lyxrc.document_path));
+ return browseRelFile(in_name, kernel().buffer()->filePath(),
+ title, pattern, false, dir1);
}
-void ControlBibtex::applyParamsToInset()
-{
- if (params().getContents() != inset()->params().getContents())
- lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
- params().getContents());
- inset()->setParams(params());
- lv_.view()->updateInset(inset(), true);
+void ControlBibtex::getBibStyles(vector<string> & data) const
+{
+ data.clear();
- // We need to do a redraw because the maximum
- // InsetBibKey width could have changed
- lv_.view()->redraw();
- lv_.view()->fitCursor();
+ getTexFileList("bstFiles.lst", data);
+ // test, if we have a valid list, otherwise run rescan
+ if (data.empty()) {
+ rescanBibStyles();
+ getTexFileList("bstFiles.lst", data);
+ }
+ vector<string>::iterator it = data.begin();
+ vector<string>::iterator end = data.end();
+ for (; it != end; ++it) {
+ *it = OnlyFilename(*it);
+ }
}
-void ControlBibtex::applyParamsNoInset()
-{}
+void ControlBibtex::getBibFiles(vector<string> & data) const
+{
+ data.clear();
+ getTexFileList("bibFiles.lst", data);
+ // test, if we have a valid list, otherwise run rescan
+ if (data.empty()) {
+ rescanBibStyles();
+ getTexFileList("bibFiles.lst", data);
+ }
+ vector<string>::iterator it = data.begin();
+ vector<string>::iterator end = data.end();
+ for (; it != end; ++it) {
+ *it = OnlyFilename(*it);
+ }
+}
-string const ControlBibtex::Browse(string const & in_name,
- string const & title,
- string const & pattern)
+
+void ControlBibtex::rescanBibStyles() const
{
- pair<string, string> dir1(N_("Documents|#o#O"), string(lyxrc.document_path));
- return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
- title, pattern, dir1);
+ rescanTexStyles();
}