]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
Herbert's patch, part 1
[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 <algorithm>
17
18 #ifdef __GNUG__
19 #pragma implementation
20 #endif
21
22 #include <config.h>
23 #include "ViewBase.h"
24 #include "ButtonControllerBase.h"
25 #include "ControlBibtex.h"
26 #include "Dialogs.h"
27 #include "LyXView.h"
28 #include "buffer.h"
29 #include "BufferView.h"
30 #include "lyxrc.h"
31 #include "helper_funcs.h"
32 #include "gettext.h"
33
34 using SigC::slot;
35 using std::pair;
36 using std::make_pair;
37
38 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
39         : ControlCommand(lv, d)
40 {
41         d_.showBibtex.connect(slot(this, &ControlBibtex::showInset));
42 }
43
44 void ControlBibtex::applyParamsToInset()
45 {
46         if (params().getContents() != inset()->params().getContents())
47                 lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
48                                                     params().getContents());
49
50         inset()->setParams(params());
51         lv_.view()->updateInset(inset(), true);
52
53         // We need to do a redraw because the maximum
54         // InsetBibKey width could have changed
55         lv_.view()->redraw();
56         lv_.view()->fitCursor();
57 }
58
59
60 void ControlBibtex::applyParamsNoInset()
61 {}
62
63
64 string const ControlBibtex::Browse(string const & in_name, 
65                                    string const & title,
66                                    string const & pattern)
67 {
68         pair<string, string> dir1(N_("Documents"), string(lyxrc.document_path));
69         return browseFile(&lv_, in_name, title, pattern, 
70                           dir1,make_pair(string(), string()));
71 }