]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiERT.cpp
Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
[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 #include <QCloseEvent>
22
23
24 namespace lyx {
25 namespace frontend {
26
27 GuiERT::GuiERT(GuiView & lv)
28         : GuiDialog(lv, "ert"), status_(InsetERT::Collapsed)
29 {
30         setupUi(this);
31         setViewTitle(_("TeX Code Settings"));
32
33         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
34         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
35         connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
36         connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
37
38         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
39         bc().setOK(okPB);
40         bc().setCancel(closePB);
41 }
42
43
44 void GuiERT::closeEvent(QCloseEvent * e)
45 {
46         slotClose();
47         e->accept();
48 }
49
50
51 void GuiERT::change_adaptor()
52 {
53         changed();
54 }
55
56
57 void GuiERT::applyView()
58 {
59         if (openRB->isChecked())
60                 status_ = Inset::Open;
61         else
62                 status_ = Inset::Collapsed;
63 }
64
65
66 void GuiERT::updateContents()
67 {
68         switch (status_) {
69                 case InsetERT::Open: openRB->setChecked(true); break;
70                 case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
71         }
72 }
73
74
75 bool GuiERT::initialiseParams(std::string const & data)
76 {
77         InsetERTMailer::string2params(data, status_);
78         return true;
79 }
80
81
82 void GuiERT::clearParams()
83 {
84         status_ = InsetERT::Collapsed;
85 }
86
87
88 void GuiERT::dispatchParams()
89 {
90         dispatch(FuncRequest(getLfun(), InsetERTMailer::params2string(status_)));
91 }
92
93
94 Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
95
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #include "GuiERT_moc.cpp"