git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20761 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-10-05 21:06:08 +00:00
parent 169d3fa39e
commit 1a5acd927f
6 changed files with 90 additions and 154 deletions

View File

@ -1,48 +0,0 @@
/**
* \file ControlERT.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
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ControlERT.h"
#include "FuncRequest.h"
using std::string;
namespace lyx {
namespace frontend {
ControlERT::ControlERT(Dialog & parent)
: Controller(parent), status_(InsetERT::Collapsed)
{}
bool ControlERT::initialiseParams(string const & data)
{
InsetERTMailer::string2params(data, status_);
return true;
}
void ControlERT::clearParams()
{
status_ = InsetERT::Collapsed;
}
void ControlERT::dispatchParams()
{
string const lfun = InsetERTMailer::params2string(status_);
dispatch(FuncRequest(getLfun(), lfun));
}
} // namespace frontend
} // namespace lyx

View File

@ -1,47 +0,0 @@
// -*- C++ -*-
/**
* \file ControlERT.h
* 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
*
* Full author contact details are available in file CREDITS.
*/
#ifndef CONTROLERT_H
#define CONTROLERT_H
#include "Dialog.h"
#include "insets/InsetERT.h" // InsetERT::ERTStatus
namespace lyx {
namespace frontend {
class ControlERT : public Controller {
public:
///
ControlERT(Dialog &);
///
InsetCollapsable::CollapseStatus status() const { return status_; }
///
void setStatus(InsetCollapsable::CollapseStatus status) { status_ = status; }
///
virtual bool initialiseParams(std::string const & data);
/// clean-up on hide.
virtual void clearParams();
/// clean-up on hide.
virtual void dispatchParams();
///
virtual bool isBufferDependent() const { return true; }
private:
///
InsetCollapsable::CollapseStatus status_;
};
} // namespace frontend
} // namespace lyx
#endif

View File

@ -20,7 +20,6 @@ SOURCEFILES = \
ControlDocument.cpp \
ControlEmbeddedFiles.cpp \
ControlErrorList.cpp \
ControlERT.cpp \
ControlExternal.cpp \
ControlFloat.cpp \
ControlGraphics.cpp \
@ -56,7 +55,6 @@ HEADERFILES = \
ControlCommandBuffer.h \
ControlDocument.h \
ControlErrorList.h \
ControlERT.h \
ControlEmbeddedFiles.h \
ControlExternal.h \
ControlFloat.h \

View File

@ -28,7 +28,6 @@
#include "GuiDocument.h"
#include "GuiEmbeddedFiles.h"
#include "GuiErrorList.h"
#include "GuiERT.h"
#include "GuiExternal.h"
#include "GuiFloat.h"
#include "GuiGraphics.h"
@ -108,42 +107,42 @@ private:
} // namespace anon
// will be replaced by a proper factory...
Dialog * createGuiAboutDialog(LyXView & lv);
Dialog * createGuiBibitemDialog(LyXView & lv);
Dialog * createGuiBibtexDialog(LyXView & lv);
Dialog * createGuiBoxDialog(LyXView & lv);
Dialog * createGuiBranchDialog(LyXView & lv);
Dialog * createGuiChangesDialog(LyXView & lv);
Dialog * createGuiCharacterDialog(LyXView & lv);
Dialog * createGuiCitationDialog(LyXView & lv);
Dialog * createGuiDelimiterDialog(LyXView & lv);
Dialog * createGuiDocumentDialog(LyXView & lv);
Dialog * createGuiErrorListDialog(LyXView & lv);
Dialog * createGuiERTDialog(LyXView & lv);
Dialog * createGuiExternalDialog(LyXView & lv);
Dialog * createGuiFloatDialog(LyXView & lv);
Dialog * createGuiGraphicsDialog(LyXView & lv);
Dialog * createGuiIncludeDialog(LyXView & lv);
Dialog * createGuiIndexDialog(LyXView & lv);
Dialog * createGuiLabelDialog(LyXView & lv);
Dialog * createGuiListingsDialog(LyXView & lv);
Dialog * createGuiLogDialog(LyXView & lv);
Dialog * createGuiMathMatrixDialog(LyXView & lv);
Dialog * createGuiNomenclDialog(LyXView & lv);
Dialog * createGuiAbout(LyXView & lv);
Dialog * createGuiBibitem(LyXView & lv);
Dialog * createGuiBibtex(LyXView & lv);
Dialog * createGuiBox(LyXView & lv);
Dialog * createGuiBranch(LyXView & lv);
Dialog * createGuiChanges(LyXView & lv);
Dialog * createGuiCharacter(LyXView & lv);
Dialog * createGuiCitation(LyXView & lv);
Dialog * createGuiDelimiter(LyXView & lv);
Dialog * createGuiDocument(LyXView & lv);
Dialog * createGuiErrorList(LyXView & lv);
Dialog * createGuiERT(LyXView & lv);
Dialog * createGuiExternal(LyXView & lv);
Dialog * createGuiFloat(LyXView & lv);
Dialog * createGuiGraphics(LyXView & lv);
Dialog * createGuiInclude(LyXView & lv);
Dialog * createGuiIndex(LyXView & lv);
Dialog * createGuiLabel(LyXView & lv);
Dialog * createGuiListings(LyXView & lv);
Dialog * createGuiLog(LyXView & lv);
Dialog * createGuiMathMatrix(LyXView & lv);
Dialog * createGuiNomencl(LyXView & lv);
Dialog * createGuiNote(LyXView & lv);
Dialog * createGuiPrefsDialog(LyXView & lv);
Dialog * createGuiPrintDialog(LyXView & lv);
Dialog * createGuiPrefs(LyXView & lv);
Dialog * createGuiPrint(LyXView & lv);
Dialog * createGuiRef(LyXView & lv);
Dialog * createGuiSearchDialog(LyXView & lv);
Dialog * createGuiSendtoDialog(LyXView & lv);
Dialog * createGuiShowFileDialog(LyXView & lv);
Dialog * createGuiSpellcheckerDialog(LyXView & lv);
Dialog * createGuiTabularCreateDialog(LyXView & lv);
Dialog * createGuiTabularDialog(LyXView & lv);
Dialog * createGuiTexinfoDialog(LyXView & lv);
Dialog * createGuiThesaurusDialog(LyXView & lv);
Dialog * createGuiURLDialog(LyXView & lv);
Dialog * createGuiVSpaceDialog(LyXView & lv);
Dialog * createGuiSearch(LyXView & lv);
Dialog * createGuiSendto(LyXView & lv);
Dialog * createGuiShowFile(LyXView & lv);
Dialog * createGuiSpellchecker(LyXView & lv);
Dialog * createGuiTabularCreate(LyXView & lv);
Dialog * createGuiTabular(LyXView & lv);
Dialog * createGuiTexinfo(LyXView & lv);
Dialog * createGuiThesaurus(LyXView & lv);
Dialog * createGuiURL(LyXView & lv);
Dialog * createGuiVSpace(LyXView & lv);
Dialog * createGuiWrap(LyXView & lv);
@ -185,7 +184,7 @@ Dialog * Dialogs::build(string const & name)
} else if (name == "errorlist") {
dialog = new GuiErrorListDialog(lyxview_);
} else if (name == "ert") {
dialog = new GuiERTDialog(lyxview_);
dialog = createGuiERT(lyxview_);
} else if (name == "external") {
dialog = new GuiExternalDialog(lyxview_);
} else if (name == "file") {

View File

@ -3,6 +3,8 @@
* 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.
@ -11,8 +13,8 @@
#include <config.h>
#include "GuiERT.h"
#include "ControlERT.h"
#include "gettext.h"
#include "FuncRequest.h"
#include <QRadioButton>
#include <QPushButton>
@ -22,12 +24,12 @@
namespace lyx {
namespace frontend {
GuiERTDialog::GuiERTDialog(LyXView & lv)
: GuiDialog(lv, "ert")
GuiERT::GuiERT(LyXView & lv)
: GuiDialog(lv, "ert"), Controller(this), status_(InsetERT::Collapsed)
{
setupUi(this);
setViewTitle(_("TeX Code Settings"));
setController(new ControlERT(*this));
setController(this, false);
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
@ -40,42 +42,59 @@ GuiERTDialog::GuiERTDialog(LyXView & lv)
}
ControlERT & GuiERTDialog::controller()
{
return static_cast<ControlERT &>(GuiDialog::controller());
}
void GuiERTDialog::closeEvent(QCloseEvent * e)
void GuiERT::closeEvent(QCloseEvent * e)
{
slotClose();
e->accept();
}
void GuiERTDialog::change_adaptor()
void GuiERT::change_adaptor()
{
changed();
}
void GuiERTDialog::applyView()
void GuiERT::applyView()
{
if (openRB->isChecked())
controller().setStatus(Inset::Open);
status_ = Inset::Open;
else
controller().setStatus(Inset::Collapsed);
status_ = Inset::Collapsed;
}
void GuiERTDialog::updateContents()
void GuiERT::updateContents()
{
switch (controller().status()) {
switch (status_) {
case InsetERT::Open: openRB->setChecked(true); break;
case InsetERT::Collapsed: collapsedRB->setChecked(true); break;
}
}
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); }
} // namespace frontend
} // namespace lyx

View File

@ -13,18 +13,18 @@
#define GUIERT_H
#include "GuiDialog.h"
#include "ControlERT.h"
#include "ui_ERTUi.h"
#include "insets/InsetERT.h" // InsetERT::ERTStatus
namespace lyx {
namespace frontend {
class GuiERTDialog : public GuiDialog, public Ui::ERTUi
class GuiERT : public GuiDialog, public Ui::ERTUi, public Controller
{
Q_OBJECT
public:
GuiERTDialog(LyXView & lv);
GuiERT(LyXView & lv);
private Q_SLOTS:
void change_adaptor();
@ -32,11 +32,26 @@ private Q_SLOTS:
private:
void closeEvent(QCloseEvent * e);
/// parent controller
ControlERT & controller();
Controller & controller() { return *this; }
/// Apply changes
void applyView();
/// update
void updateContents();
///
InsetCollapsable::CollapseStatus status() const { return status_; }
///
void setStatus(InsetCollapsable::CollapseStatus status) { status_ = status; }
///
bool initialiseParams(std::string const & data);
/// clean-up on hide.
void clearParams();
/// clean-up on hide.
void dispatchParams();
///
bool isBufferDependent() const { return true; }
private:
///
InsetCollapsable::CollapseStatus status_;
};
} // namespace frontend