* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
+ * \author Jürgen Vigna
+ * \author Angus Leeming
* \author John Levon
*
* Full author contact details are available in file CREDITS.
#include <config.h>
#include "GuiERT.h"
-#include "ControlERT.h"
-#include "gettext.h"
+
+#include "GuiApplication.h"
+#include "GuiView.h"
+
+#include "insets/InsetERT.h"
+
+#include "support/gettext.h"
#include <QRadioButton>
#include <QPushButton>
-#include <QCloseEvent>
+using namespace std;
namespace lyx {
namespace frontend {
-GuiERTDialog::GuiERTDialog(LyXView & lv)
- : GuiDialog(lv, "ert")
+GuiERT::GuiERT(QWidget * parent) : InsetParamsWidget(parent)
{
setupUi(this);
- setViewTitle(_("TeX Code Settings"));
- setController(new ControlERT(*this));
-
- connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
- connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
- connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
- bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
- bc().setOK(okPB);
- bc().setCancel(closePB);
+ connect(collapsedRB, SIGNAL(clicked()), this, SIGNAL(changed()));
+ connect(openRB, SIGNAL(clicked()), this, SIGNAL(changed()));
}
-ControlERT & GuiERTDialog::controller()
+docstring GuiERT::dialogToParams() const
{
- return static_cast<ControlERT &>(GuiDialog::controller());
+ InsetCollapsable::CollapseStatus const status = openRB->isChecked()
+ ? InsetCollapsable::Open : InsetCollapsable::Collapsed;
+ return from_ascii(InsetERT::params2string(status));
}
-void GuiERTDialog::closeEvent(QCloseEvent * e)
+void GuiERT::paramsToDialog(Inset const * inset)
{
- slotClose();
- e->accept();
-}
-
-
-void GuiERTDialog::change_adaptor()
-{
- changed();
+ InsetERT const * ert = static_cast<InsetERT const *>(inset);
+ // FIXME: This dialog has absolutely no value...
+ BufferView const * bv = guiApp->currentView()->currentBufferView();
+ InsetCollapsable::CollapseStatus status = ert->status(*bv);
+ switch (status) {
+ case InsetCollapsable::Open: openRB->setChecked(true); break;
+ case InsetCollapsable::Collapsed: collapsedRB->setChecked(true); break;
+ }
}
-void GuiERTDialog::applyView()
+bool GuiERT::checkWidgets(bool readonly) const
{
- if (openRB->isChecked())
- controller().setStatus(Inset::Open);
- else
- controller().setStatus(Inset::Collapsed);
+ ertBG->setEnabled(!readonly);
+ return InsetParamsWidget::checkWidgets();
}
-void GuiERTDialog::updateContents()
-{
- switch (controller().status()) {
- case InsetERT::Open: openRB->setChecked(true); break;
- case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
- }
-}
-
} // namespace frontend
} // namespace lyx
-#include "GuiERT_moc.cpp"
+#include "moc_GuiERT.cpp"