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