2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiERT.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2007-10-05 21:06:08 +00:00
|
|
|
* \author Jürgen Vigna
|
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiERT.h"
|
2007-09-03 05:59:32 +00:00
|
|
|
#include "gettext.h"
|
2007-10-05 21:06:08 +00:00
|
|
|
#include "FuncRequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-24 13:47:33 +00:00
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QCloseEvent>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
GuiERT::GuiERT(LyXView & lv)
|
2007-10-09 19:34:27 +00:00
|
|
|
: GuiDialog(lv, "ert"), status_(InsetERT::Collapsed)
|
2007-04-24 13:47:33 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
setViewTitle(_("TeX Code Settings"));
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-24 13:47:33 +00:00
|
|
|
connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setCancel(closePB);
|
2007-04-24 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
void GuiERT::closeEvent(QCloseEvent * e)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-11 17:06:15 +00:00
|
|
|
slotClose();
|
2007-09-05 20:33:29 +00:00
|
|
|
e->accept();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
void GuiERT::change_adaptor()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
void GuiERT::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
if (openRB->isChecked())
|
2007-10-05 21:06:08 +00:00
|
|
|
status_ = Inset::Open;
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2007-10-05 21:06:08 +00:00
|
|
|
status_ = Inset::Collapsed;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
void GuiERT::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-05 21:06:08 +00:00
|
|
|
switch (status_) {
|
2007-09-05 20:33:29 +00:00
|
|
|
case InsetERT::Open: openRB->setChecked(true); break;
|
|
|
|
case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-05 21:06:08 +00:00
|
|
|
|
|
|
|
bool GuiERT::initialiseParams(std::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(LyXView & lv) { return new GuiERT(lv); }
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 13:47:33 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiERT_moc.cpp"
|