]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlFloat.C
2e8891a3c9adc74f7c4d47c9b703d2d4d0f88ad9
[lyx.git] / src / frontends / controllers / ControlFloat.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  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlFloat.h"
19 #include "ViewBase.h"
20 #include "ButtonControllerBase.h"
21 #include "Dialogs.h"
22 #include "buffer.h"
23 #include "BufferView.h"
24
25 #include "insets/insetfloat.h"
26 #include "frontends/LyXView.h"
27
28 #include <boost/bind.hpp>
29
30 using std::vector;
31
32
33 ControlFloat::ControlFloat(LyXView & lv, Dialogs & d)
34         : ControlInset<InsetFloat, FloatParams>(lv, d)
35 {
36         d_.showFloat = boost::bind(&ControlFloat::showInset, this, _1);
37
38         // We could have an extra method updateInset that calls
39         // view().update() rather than view().show(), but I don't see why
40         // it is really needed.
41         //d_.updateFloat.connect(slot(this, &ControlFloat::showInset));
42 }
43
44
45 void ControlFloat::applyParamsToInset()
46 {
47         inset()->placement(params().placement);
48 }
49
50
51 void ControlFloat::applyParamsNoInset()
52 {}
53
54
55 FloatParams const ControlFloat::getParams(InsetFloat const & inset)
56 {
57         return FloatParams(inset);
58 }
59
60
61 FloatParams::FloatParams()
62         : placement("htbp"),
63           allow_here_definitely(true)
64 {}
65
66
67 FloatParams::FloatParams(InsetFloat const & inset)
68         : placement(inset.placement()),
69           allow_here_definitely(!inset.wide())
70 {}