]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
prefs/tabular MVC work
[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 #ifdef __GNUG__
16 #pragma implementation
17 #endif
18
19 #include "ControlBibtex.h"
20 #include "buffer.h"
21 #include "BufferView.h"
22 #include "lyxrc.h"
23 #include "helper_funcs.h"
24 #include "tex_helpers.h"
25 #include "gettext.h"
26 #include "support/lstrings.h"
27
28
29 using std::pair;
30
31
32 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
33         : ControlCommand(lv, d)
34 {}
35
36
37
38 void ControlBibtex::applyParamsToInset()
39 {
40         if (params().getContents() != inset()->params().getContents())
41                 bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
42                                                     params().getContents());
43
44         inset()->setParams(params());
45         bufferview()->updateInset(inset(), true);
46
47         // We need to do a redraw because the maximum
48         // InsetBibKey width could have changed
49 #warning are you sure you need this repaint() ?
50         bufferview()->repaint();
51         bufferview()->fitCursor();
52 }
53
54
55 void ControlBibtex::applyParamsNoInset()
56 {}
57
58
59 string const ControlBibtex::Browse(string const & in_name,
60                                    string const & title,
61                                    string const & pattern)
62 {
63         pair<string, string> dir1(_("Documents|#o#O"),
64                                   string(lyxrc.document_path));
65         return browseRelFile(&lv_, in_name, buffer()->filePath(),
66                              title, pattern, dir1);
67 }
68
69
70 string const ControlBibtex::getBibStyles() const
71 {
72         string list = getTexFileList("bstFiles.lst", false);
73         // test, if we have a valid list, otherwise run rescan
74         if (list.empty()) {
75                 rescanBibStyles();
76                 list = getTexFileList("bstFiles.lst", false);
77         }
78         return list;
79 }
80
81
82 void ControlBibtex::rescanBibStyles() const
83 {
84         rescanTexStyles();
85 }