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