]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
include sys/time.h
[lyx.git] / src / frontends / controllers / ControlBibtex.C
1 /**
2  * \file ControlBibtex.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Angus Leeming
8  * \author Herbert Voss
9  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #include <config.h>
14
15
16 #include "ControlBibtex.h"
17 #include "buffer.h"
18 #include "BufferView.h"
19 #include "lyxrc.h"
20 #include "helper_funcs.h"
21 #include "tex_helpers.h"
22 #include "gettext.h"
23 #include "support/lstrings.h"
24
25
26 using std::pair;
27
28
29 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
30         : ControlCommand(lv, d)
31 {}
32
33
34
35 void ControlBibtex::applyParamsToInset()
36 {
37         if (params().getContents() != inset()->params().getContents())
38                 bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
39                                                     params().getContents());
40
41         inset()->setParams(params());
42         bufferview()->updateInset(inset(), true);
43
44         // We need to do a redraw because the maximum
45         // InsetBibKey width could have changed
46 #warning are you sure you need this repaint() ?
47         bufferview()->repaint();
48         bufferview()->fitCursor();
49 }
50
51
52 void ControlBibtex::applyParamsNoInset()
53 {}
54
55
56 string const ControlBibtex::Browse(string const & in_name,
57                                    string const & title,
58                                    string const & pattern)
59 {
60         pair<string, string> dir1(_("Documents|#o#O"),
61                                   string(lyxrc.document_path));
62         return browseRelFile(&lv_, in_name, buffer()->filePath(),
63                              title, pattern, false, dir1);
64 }
65
66
67 string const ControlBibtex::getBibStyles() const
68 {
69         string list = getTexFileList("bstFiles.lst", false);
70         // test, if we have a valid list, otherwise run rescan
71         if (list.empty()) {
72                 rescanBibStyles();
73                 list = getTexFileList("bstFiles.lst", false);
74         }
75         return list;
76 }
77
78
79 string const ControlBibtex::getBibFiles() const
80 {
81         string list = getTexFileList("bibFiles.lst", false);
82         // test, if we have a valid list, otherwise run rescan
83         if (list.empty()) {
84                 rescanBibStyles();
85                 list = getTexFileList("bibFiles.lst", false);
86         }
87         return list;
88 }
89
90
91 void ControlBibtex::rescanBibStyles() const
92 {
93         rescanTexStyles();
94 }