]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiFloat.cpp
'using namespace std' instead of 'using std::xxx'
[lyx.git] / src / frontends / qt4 / GuiFloat.cpp
1 /**
2  * \file GuiFloat.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiFloat.h"
14
15 #include "FloatPlacement.h"
16 #include "FuncRequest.h"
17
18 #include "insets/InsetFloat.h"
19
20 #include <QCloseEvent>
21 #include <QPushButton>
22
23 using namespace std;
24
25 namespace lyx {
26 namespace frontend {
27
28 GuiFloat::GuiFloat(GuiView & lv)
29         : GuiDialog(lv, "float")
30 {
31         setupUi(this);
32         setViewTitle(_("Float Settings"));
33
34         connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
35         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
36         connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
37         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38
39         // enable span columns checkbox
40         floatFP->useWide();
41         // enable sideways checkbox
42         floatFP->useSideways();
43
44         connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
45
46         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
47
48         bc().setCancel(closePB);
49         bc().setApply(applyPB);
50         bc().setOK(okPB);
51         bc().setRestore(restorePB);
52
53         bc().addReadOnly(floatFP);
54 }
55
56
57 void GuiFloat::change_adaptor()
58 {
59         changed();
60 }
61
62
63 void GuiFloat::closeEvent(QCloseEvent * e)
64 {
65         slotClose();
66         e->accept();
67 }
68
69
70 void GuiFloat::updateContents()
71 {
72         floatFP->set(params_);
73 }
74
75
76 void GuiFloat::applyView()
77 {
78         params_.placement = floatFP->get(params_.wide, params_.sideways);
79 }
80
81
82 bool GuiFloat::initialiseParams(string const & data)
83 {
84         InsetFloatMailer::string2params(data, params_);
85         return true;
86 }
87
88
89 void GuiFloat::clearParams()
90 {
91         params_ = InsetFloatParams();
92 }
93
94
95 void GuiFloat::dispatchParams()
96 {
97         dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
98 }
99
100
101 Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
102
103
104 } // namespace frontend
105 } // namespace lyx
106
107 #include "GuiFloat_moc.cpp"