]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiFloat.cpp
GuiFloat.cpp: fix the regression that float placement dialog has no title
[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 std::string;
24
25
26 namespace lyx {
27 namespace frontend {
28
29 GuiFloat::GuiFloat(LyXView & lv)
30         : GuiDialog(lv, "float")
31 {
32         setupUi(this);
33         setViewTitle(_("Float Settings"));
34
35         connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
36         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
37         connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
38         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
39
40         // enable span columns checkbox
41         floatFP->useWide();
42         // enable sideways checkbox
43         floatFP->useSideways();
44
45         connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
46
47         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
48
49         bc().setCancel(closePB);
50         bc().setApply(applyPB);
51         bc().setOK(okPB);
52         bc().setRestore(restorePB);
53
54         bc().addReadOnly(floatFP);
55 }
56
57
58 void GuiFloat::change_adaptor()
59 {
60         changed();
61 }
62
63
64 void GuiFloat::closeEvent(QCloseEvent * e)
65 {
66         slotClose();
67         e->accept();
68 }
69
70
71 void GuiFloat::updateContents()
72 {
73         floatFP->set(params_);
74 }
75
76
77 void GuiFloat::applyView()
78 {
79         params_.placement = floatFP->get(params_.wide, params_.sideways);
80 }
81
82
83 bool GuiFloat::initialiseParams(string const & data)
84 {
85         InsetFloatMailer::string2params(data, params_);
86         return true;
87 }
88
89
90 void GuiFloat::clearParams()
91 {
92         params_ = InsetFloatParams();
93 }
94
95
96 void GuiFloat::dispatchParams()
97 {
98         dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
99 }
100
101
102 Dialog * createGuiFloat(LyXView & lv) { return new GuiFloat(lv); }
103
104
105 } // namespace frontend
106 } // namespace lyx
107
108 #include "GuiFloat_moc.cpp"