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