]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiERT.cpp
header cleanup
[lyx.git] / src / frontends / qt4 / GuiERT.cpp
1 /**
2  * \file GuiERT.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Vigna
7  * \author Angus Leeming
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "GuiERT.h"
16 #include "support/gettext.h"
17 #include "FuncRequest.h"
18
19 #include <QRadioButton>
20 #include <QPushButton>
21
22 using namespace std;
23
24 namespace lyx {
25 namespace frontend {
26
27 GuiERT::GuiERT(GuiView & lv)
28         : GuiDialog(lv, "ert", qt_("TeX Code Settings")), status_(InsetERT::Collapsed)
29 {
30         setupUi(this);
31
32         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
33         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
34         connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
35         connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
36
37         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
38         bc().setOK(okPB);
39         bc().setCancel(closePB);
40 }
41
42
43 void GuiERT::change_adaptor()
44 {
45         changed();
46 }
47
48
49 void GuiERT::applyView()
50 {
51         if (openRB->isChecked())
52                 status_ = Inset::Open;
53         else
54                 status_ = Inset::Collapsed;
55 }
56
57
58 void GuiERT::updateContents()
59 {
60         switch (status_) {
61                 case InsetERT::Open: openRB->setChecked(true); break;
62                 case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
63         }
64 }
65
66
67 bool GuiERT::initialiseParams(string const & data)
68 {
69         InsetERTMailer::string2params(data, status_);
70         return true;
71 }
72
73
74 void GuiERT::clearParams()
75 {
76         status_ = InsetERT::Collapsed;
77 }
78
79
80 void GuiERT::dispatchParams()
81 {
82         dispatch(FuncRequest(getLfun(), InsetERTMailer::params2string(status_)));
83 }
84
85
86 Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
87
88
89 } // namespace frontend
90 } // namespace lyx
91
92 #include "GuiERT_moc.cpp"