]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiERT.cpp
GuiTabular, InsetTabular: fix http://bugzilla.lyx.org/show_bug.cgi?id=5752
[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 "FuncRequest.h"
17
18 #include "support/gettext.h"
19
20 #include <QRadioButton>
21 #include <QPushButton>
22
23 using namespace std;
24
25 namespace lyx {
26 namespace frontend {
27
28 GuiERT::GuiERT(GuiView & lv)
29         : GuiDialog(lv, "ert", qt_("TeX Code Settings")), status_(InsetERT::Collapsed)
30 {
31         setupUi(this);
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::change_adaptor()
45 {
46         changed();
47 }
48
49
50 void GuiERT::applyView()
51 {
52         if (openRB->isChecked())
53                 status_ = Inset::Open;
54         else
55                 status_ = Inset::Collapsed;
56 }
57
58
59 void GuiERT::updateContents()
60 {
61         switch (status_) {
62                 case InsetERT::Open: openRB->setChecked(true); break;
63                 case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
64         }
65 }
66
67
68 bool GuiERT::initialiseParams(string const & data)
69 {
70         status_ = InsetERT::string2params(data);
71         return true;
72 }
73
74
75 void GuiERT::clearParams()
76 {
77         status_ = InsetERT::Collapsed;
78 }
79
80
81 void GuiERT::dispatchParams()
82 {
83         dispatch(FuncRequest(getLfun(), InsetERT::params2string(status_)));
84 }
85
86
87 Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
88
89
90 } // namespace frontend
91 } // namespace lyx
92
93 #include "moc_GuiERT.cpp"