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.
|
|
|
|
*
|
|
|
|
* \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"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "Qt2BC.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
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiERTDialog
|
2007-04-24 13:47:33 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiERTDialog::GuiERTDialog(GuiERT * form)
|
2007-04-24 13:47:33 +00:00
|
|
|
: 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()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiERTDialog::closeEvent(QCloseEvent * e)
|
2007-04-24 13:47:33 +00:00
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiERTDialog::change_adaptor()
|
2007-04-24 13:47:33 +00:00
|
|
|
{
|
|
|
|
form_->changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiERT
|
2007-04-24 13:47:33 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiERT::GuiERT(Dialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
: GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiERT::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
dialog_.reset(new GuiERTDialog(this));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
bcview().setOK(dialog_->okPB);
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiERT::apply()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiERT::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiERT_moc.cpp"
|