2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file QERT.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.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "QERT.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
|
|
|
|
#include "controllers/ControlERT.h"
|
|
|
|
|
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-04-24 13:47:33 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// QERTDialog
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
QERTDialog::QERTDialog(QERT * form)
|
|
|
|
: form_(form)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
|
|
|
connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QERTDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QERTDialog::change_adaptor()
|
|
|
|
{
|
|
|
|
form_->changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// QERT
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef QController<ControlERT, QView<QERTDialog> > ERTBase;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
QERT::QERT(Dialog & parent)
|
2007-04-24 13:47:33 +00:00
|
|
|
: ERTBase(parent, _("TeX Code Settings"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QERT::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_.reset(new QERTDialog(this));
|
|
|
|
|
|
|
|
bcview().setOK(dialog_->okPB);
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QERT::apply()
|
|
|
|
{
|
|
|
|
if (dialog_->openRB->isChecked())
|
2007-08-16 16:36:50 +00:00
|
|
|
controller().setStatus(Inset::Open);
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2007-08-16 16:36:50 +00:00
|
|
|
controller().setStatus(Inset::Collapsed);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QERT::update_contents()
|
|
|
|
{
|
|
|
|
QRadioButton * rb = 0;
|
|
|
|
|
|
|
|
switch (controller().status()) {
|
|
|
|
case InsetERT::Open: rb = dialog_->openRB; break;
|
|
|
|
case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rb->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 13:47:33 +00:00
|
|
|
|
|
|
|
#include "QERT_moc.cpp"
|