]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiERT.cpp
less functions
[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 John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiERT.h"
14 #include "ControlERT.h"
15 #include "gettext.h"
16
17 #include <QRadioButton>
18 #include <QPushButton>
19 #include <QCloseEvent>
20
21
22 namespace lyx {
23 namespace frontend {
24
25 GuiERTDialog::GuiERTDialog(LyXView & lv)
26         : GuiDialog(lv, "ert")
27 {
28         setupUi(this);
29         setViewTitle(_("TeX Code Settings"));
30         setController(new ControlERT(*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 ControlERT & GuiERTDialog::controller() const
44 {
45         return static_cast<ControlERT &>(GuiDialog::controller());
46 }
47
48
49 void GuiERTDialog::closeEvent(QCloseEvent * e)
50 {
51         slotClose();
52         e->accept();
53 }
54
55
56 void GuiERTDialog::change_adaptor()
57 {
58         changed();
59 }
60
61
62 void GuiERTDialog::applyView()
63 {
64         if (openRB->isChecked())
65                 controller().setStatus(Inset::Open);
66         else
67                 controller().setStatus(Inset::Collapsed);
68 }
69
70
71 void GuiERTDialog::update_contents()
72 {
73         switch (controller().status()) {
74                 case InsetERT::Open: openRB->setChecked(true); break;
75                 case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
76         }
77 }
78
79 } // namespace frontend
80 } // namespace lyx
81
82 #include "GuiERT_moc.cpp"