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/filetools.h"
26 #include "support/globbing.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);
85 void ControlBibtex::getBibFiles(vector<string> & data) const
89 getTexFileList("bibFiles.lst", data);
90 // test, if we have a valid list, otherwise run rescan
93 getTexFileList("bibFiles.lst", data);
95 vector<string>::iterator it = data.begin();
96 vector<string>::iterator end = data.end();
97 for (; it != end; ++it) {
98 *it = OnlyFilename(*it);
103 void ControlBibtex::rescanBibStyles() const
109 bool ControlBibtex::usingBibtopic() const
111 return kernel().buffer().params().use_bibtopic;
114 } // namespace frontend