]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
controller-view split of FormLog and FormVCLog.
[lyx.git] / src / frontends / controllers / ControlBibtex.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2001 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \file ControlBibtex.C
12  * \author John Levon, moz@compsoc.man.ac.uk
13  * \author Angus Leeming <a.leeming@ic.ac.uk>
14  */
15
16 #include <algorithm>
17
18 #ifdef __GNUG__
19 #pragma implementation
20 #endif
21
22 #include <config.h>
23 #include "ControlBibtex.h"
24 #include "Dialogs.h"
25 #include "LyXView.h"
26 #include "BufferView.h"
27
28 using SigC::slot;
29
30 ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
31         : ControlCommand(lv, d)
32 {
33         d_.showBibtex.connect(slot(this, &ControlBibtex::showInset));
34 }
35
36 void ControlBibtex::apply()
37 {
38         view().apply();
39
40         if (inset_ && params() != inset_->params()) {
41                 if (params().getContents() != inset_->params().getContents())
42                         lv_.view()->ChangeCitationsIfUnique(
43                                 inset_->params().getContents(),
44                                 params().getContents());
45
46                 inset_->setParams(params());
47                 lv_.view()->updateInset(inset_, true);
48
49                 // We need to do a redraw because the maximum
50                 // InsetBibKey width could have changed
51                 lv_.view()->redraw();
52                 lv_.view()->fitCursor(lv_.view()->getLyXText());
53         }
54 }