]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiPhantom.cpp
Few string fixes from Dan.
[lyx.git] / src / frontends / qt / GuiPhantom.cpp
1 /**
2  * \file GuiPhantom.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Uwe Stöhr
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiPhantom.h"
14 #include "FuncRequest.h"
15 #include "support/gettext.h"
16
17 using namespace std;
18
19 namespace lyx {
20 namespace frontend {
21
22 GuiPhantom::GuiPhantom(GuiView & lv)
23         : GuiDialog(lv, "phantom", qt_("Phantom Settings"))
24 {
25         setupUi(this);
26
27         connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
28                 this, SLOT(slotButtonBox(QAbstractButton *)));
29
30         connect(phantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
31         connect(hphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
32         connect(vphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
33
34         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
35         bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
36         bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
37 }
38
39
40 void GuiPhantom::change_adaptor()
41 {
42         changed();
43 }
44
45
46 void GuiPhantom::updateContents()
47 {
48         switch (params_.type) {
49         case InsetPhantomParams::Phantom:
50                 phantomRB->setChecked(true);
51                 break;
52         case InsetPhantomParams::HPhantom:
53                 hphantomRB->setChecked(true);
54                 break;
55         case InsetPhantomParams::VPhantom:
56                 vphantomRB->setChecked(true);
57                 break;
58         }
59 }
60
61
62 void GuiPhantom::applyView()
63 {
64         if (vphantomRB->isChecked())
65                 params_.type = InsetPhantomParams::VPhantom;
66         else if (hphantomRB->isChecked())
67                 params_.type = InsetPhantomParams::HPhantom;
68         else
69                 params_.type = InsetPhantomParams::Phantom;
70 }
71
72
73 bool GuiPhantom::initialiseParams(string const & sdata)
74 {
75         InsetPhantom::string2params(sdata, params_);
76         return true;
77 }
78
79
80 void GuiPhantom::clearParams()
81 {
82         params_ = InsetPhantomParams();
83 }
84
85
86 void GuiPhantom::dispatchParams()
87 {
88         dispatch(FuncRequest(getLfun(), InsetPhantom::params2string(params_)));
89 }
90
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #include "moc_GuiPhantom.cpp"