* 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 "Qt2BC.h"
+#include "support/gettext.h"
+#include "FuncRequest.h"
#include <QRadioButton>
#include <QPushButton>
-#include <QCloseEvent>
+using namespace std;
namespace lyx {
namespace frontend {
-/////////////////////////////////////////////////////////////////////
-//
-// GuiERTDialog
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiERTDialog::GuiERTDialog(GuiERT * form)
- : form_(form)
+GuiERT::GuiERT(GuiView & lv)
+ : GuiDialog(lv, "ert", qt_("TeX Code Settings")), status_(InsetERT::Collapsed)
{
setupUi(this);
- connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+
+ 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);
}
-void GuiERTDialog::closeEvent(QCloseEvent * e)
+void GuiERT::change_adaptor()
{
- form_->slotWMHide();
- e->accept();
+ changed();
}
-void GuiERTDialog::change_adaptor()
+void GuiERT::applyView()
{
- form_->changed();
+ if (openRB->isChecked())
+ status_ = Inset::Open;
+ else
+ status_ = Inset::Collapsed;
}
-/////////////////////////////////////////////////////////////////////
-//
-// GuiERT
-//
-/////////////////////////////////////////////////////////////////////
-
-GuiERT::GuiERT(Dialog & parent)
- : GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
+void GuiERT::updateContents()
{
+ switch (status_) {
+ case InsetERT::Open: openRB->setChecked(true); break;
+ case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
+ }
}
-void GuiERT::build_dialog()
+bool GuiERT::initialiseParams(string const & data)
{
- dialog_.reset(new GuiERTDialog(this));
-
- bcview().setOK(dialog_->okPB);
- bcview().setCancel(dialog_->closePB);
+ InsetERTMailer::string2params(data, status_);
+ return true;
}
-void GuiERT::apply()
+void GuiERT::clearParams()
{
- if (dialog_->openRB->isChecked())
- controller().setStatus(Inset::Open);
- else
- controller().setStatus(Inset::Collapsed);
+ status_ = InsetERT::Collapsed;
}
-void GuiERT::update_contents()
+void GuiERT::dispatchParams()
{
- QRadioButton * rb = 0;
+ dispatch(FuncRequest(getLfun(), InsetERTMailer::params2string(status_)));
+}
- switch (controller().status()) {
- case InsetERT::Open: rb = dialog_->openRB; break;
- case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
- }
- rb->setChecked(true);
-}
+Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
+
} // namespace frontend
} // namespace lyx