lyx_mirror/src/frontends/qt4/GuiERT.cpp
Abdelrazak Younes 6bb94129d8 Factorize out the way window titles are handled.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22784 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-05 12:43:19 +00:00

101 lines
1.8 KiB
C++

/**
* \file GuiERT.cpp
* 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 "support/gettext.h"
#include "FuncRequest.h"
#include <QRadioButton>
#include <QPushButton>
#include <QCloseEvent>
using namespace std;
namespace lyx {
namespace frontend {
GuiERT::GuiERT(GuiView & lv)
: GuiDialog(lv, "ert", qt_("TeX Code Settings")), status_(InsetERT::Collapsed)
{
setupUi(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);
}
void GuiERT::closeEvent(QCloseEvent * e)
{
slotClose();
e->accept();
}
void GuiERT::change_adaptor()
{
changed();
}
void GuiERT::applyView()
{
if (openRB->isChecked())
status_ = Inset::Open;
else
status_ = Inset::Collapsed;
}
void GuiERT::updateContents()
{
switch (status_) {
case InsetERT::Open: openRB->setChecked(true); break;
case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
}
}
bool GuiERT::initialiseParams(string const & data)
{
InsetERTMailer::string2params(data, status_);
return true;
}
void GuiERT::clearParams()
{
status_ = InsetERT::Collapsed;
}
void GuiERT::dispatchParams()
{
dispatch(FuncRequest(getLfun(), InsetERTMailer::params2string(status_)));
}
Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
} // namespace frontend
} // namespace lyx
#include "GuiERT_moc.cpp"