2 * \file ControlBibtex.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
15 #include "ControlBibtex.h"
18 #include "bufferparams.h"
21 #include "helper_funcs.h"
22 #include "tex_helpers.h"
25 #include "support/filefilterlist.h"
26 #include "support/filetools.h"
35 using support::FileFilterList;
36 using support::OnlyFilename;
41 ControlBibtex::ControlBibtex(Dialog & d)
42 : ControlCommand(d, "bibtex")
46 string const ControlBibtex::browseBib(string const & in_name) const
48 pair<string, string> dir1(_("Documents|#o#O"),
49 string(lyxrc.document_path));
50 FileFilterList const filter(_("BibTeX Databases (*.bib)"));
51 return browseRelFile(in_name, kernel().bufferFilepath(),
52 _("Select a BibTeX database to add"),
57 string const ControlBibtex::browseBst(string const & in_name) const
59 pair<string, string> dir1(_("Documents|#o#O"),
60 string(lyxrc.document_path));
61 FileFilterList const filter(_("BibTeX Styles (*.bst)"));
62 return browseRelFile(in_name, kernel().bufferFilepath(),
63 _("Select a BibTeX style"), filter, false, dir1);
67 void ControlBibtex::getBibStyles(vector<string> & data) const
71 getTexFileList("bstFiles.lst", data);
72 // test, if we have a valid list, otherwise run rescan
75 getTexFileList("bstFiles.lst", data);
77 vector<string>::iterator it = data.begin();
78 vector<string>::iterator end = data.end();
79 for (; it != end; ++it) {
80 *it = OnlyFilename(*it);
82 // sort on filename only (no path)
83 std::sort(data.begin(), data.end());
87 void ControlBibtex::getBibFiles(vector<string> & data) const
91 getTexFileList("bibFiles.lst", data);
92 // test, if we have a valid list, otherwise run rescan
95 getTexFileList("bibFiles.lst", data);
97 vector<string>::iterator it = data.begin();
98 vector<string>::iterator end = data.end();
99 for (; it != end; ++it) {
100 *it = OnlyFilename(*it);
102 // sort on filename only (no path)
103 std::sort(data.begin(), data.end());
107 void ControlBibtex::rescanBibStyles() const
113 bool ControlBibtex::usingBibtopic() const
115 return kernel().buffer().params().use_bibtopic;
118 } // namespace frontend