]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
Switch from SigC signals to boost::signals
[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 "ViewBase.h"
23 #include "ButtonControllerBase.h"
24 #include "ControlBibtex.h"
25 #include "Dialogs.h"
26 #include "buffer.h"
27 #include "BufferView.h"
28 #include "lyxrc.h"
29 #include "helper_funcs.h"
30 #include "gettext.h"
31
32 #include "frontends/LyXView.h"
33
34 #include <boost/bind.hpp>
35
36 #include <algorithm>
37
38 using std::pair;
39 using std::make_pair;
40
41 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
42         : ControlCommand(lv, d)
43 {
44         d_.showBibtex = boost::bind(&ControlBibtex::showInset, this, _1);
45 }
46
47 void ControlBibtex::applyParamsToInset()
48 {
49         if (params().getContents() != inset()->params().getContents())
50                 lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
51                                                     params().getContents());
52
53         inset()->setParams(params());
54         lv_.view()->updateInset(inset(), true);
55
56         // We need to do a redraw because the maximum
57         // InsetBibKey width could have changed
58         lv_.view()->redraw();
59         lv_.view()->fitCursor();
60 }
61
62
63 void ControlBibtex::applyParamsNoInset()
64 {}
65
66
67 string const ControlBibtex::Browse(string const & in_name,
68                                    string const & title,
69                                    string const & pattern)
70 {
71         pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
72         return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
73                              title, pattern, dir1);
74 }