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 
17 #include "GuiApplication.h"
18 #include "GuiView.h"
19 
20 #include "insets/InsetERT.h"
21 
22 #include "support/gettext.h"
23 
24 #include <QRadioButton>
25 #include <QPushButton>
26 
27 using namespace std;
28 
29 namespace lyx {
30 namespace frontend {
31 
GuiERT(QWidget * parent)32 GuiERT::GuiERT(QWidget * parent) : InsetParamsWidget(parent)
33 {
34 	setupUi(this);
35 
36 	connect(collapsedRB, SIGNAL(clicked()), this, SIGNAL(changed()));
37 	connect(openRB, SIGNAL(clicked()), this, SIGNAL(changed()));
38 }
39 
40 
dialogToParams() const41 docstring GuiERT::dialogToParams() const
42 {
43 	InsetCollapsible::CollapseStatus const status = openRB->isChecked()
44 		? InsetCollapsible::Open : InsetCollapsible::Collapsed;
45 	return from_ascii(InsetERT::params2string(status));
46 }
47 
48 
paramsToDialog(Inset const * inset)49 void GuiERT::paramsToDialog(Inset const * inset)
50 {
51 	InsetERT const * ert = static_cast<InsetERT const *>(inset);
52 	// FIXME: This dialog has absolutely no value...
53 	BufferView const * bv = guiApp->currentView()->currentBufferView();
54 	InsetCollapsible::CollapseStatus status = ert->status(*bv);
55 	switch (status) {
56 		case InsetCollapsible::Open: openRB->setChecked(true); break;
57 		case InsetCollapsible::Collapsed: collapsedRB->setChecked(true); break;
58 	}
59 }
60 
61 
checkWidgets(bool readonly) const62 bool GuiERT::checkWidgets(bool readonly) const
63 {
64 	ertBG->setEnabled(!readonly);
65 	return InsetParamsWidget::checkWidgets();
66 }
67 
68 
69 } // namespace frontend
70 } // namespace lyx
71 
72 #include "moc_GuiERT.cpp"
73