#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "ControlBibtex.h"
+#include "Kernel.h"
+
#include "buffer.h"
-#include "BufferView.h"
#include "lyxrc.h"
#include "helper_funcs.h"
#include "tex_helpers.h"
#include "gettext.h"
-#include "support/lstrings.h"
+#include "support/filetools.h"
+
+using namespace lyx::support;
using std::pair;
+using std::vector;
-ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
- : ControlCommand(lv, d)
+ControlBibtex::ControlBibtex(Dialog & d)
+ : ControlCommand(d, "bibtex")
{}
-
-void ControlBibtex::applyParamsToInset()
+string const ControlBibtex::Browse(string const & in_name,
+ string const & title,
+ string const & pattern)
{
- if (params().getContents() != inset()->params().getContents())
- bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
- params().getContents());
-
- inset()->setParams(params());
- bufferview()->updateInset(inset(), true);
-
- // We need to do a redraw because the maximum
- // InsetBibKey width could have changed
-#warning are you sure you need this repaint() ?
- bufferview()->repaint();
- bufferview()->fitCursor();
+ pair<string, string> dir1(_("Documents|#o#O"),
+ string(lyxrc.document_path));
+ return browseRelFile(in_name, kernel().buffer()->filePath(),
+ title, pattern, false, dir1);
}
-void ControlBibtex::applyParamsNoInset()
-{}
-
-
-string const ControlBibtex::Browse(string const & in_name,
- string const & title,
- string const & pattern)
+void ControlBibtex::getBibStyles(vector<string> & data) const
{
- pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
- return browseRelFile(&lv_, in_name, buffer()->filePath(),
- title, pattern, dir1);
+ data.clear();
+
+ 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);
+ }
}
-string const ControlBibtex::getBibStyles() const
+void ControlBibtex::getBibFiles(vector<string> & data) const
{
- string list = getTexFileList("bstFiles.lst", false);
+ data.clear();
+
+ getTexFileList("bibFiles.lst", data);
// test, if we have a valid list, otherwise run rescan
- if (list.empty()) {
+ if (data.empty()) {
rescanBibStyles();
- list = getTexFileList("bstFiles.lst", false);
+ getTexFileList("bibFiles.lst", data);
+ }
+ vector<string>::iterator it = data.begin();
+ vector<string>::iterator end = data.end();
+ for (; it != end; ++it) {
+ *it = OnlyFilename(*it);
}
- return list;
}