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