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 \ ControlDocument.cpp \
ControlEmbeddedFiles.cpp \ ControlEmbeddedFiles.cpp \
ControlErrorList.cpp \ ControlErrorList.cpp \
ControlERT.cpp \
ControlExternal.cpp \ ControlExternal.cpp \
ControlFloat.cpp \ ControlFloat.cpp \
ControlGraphics.cpp \ ControlGraphics.cpp \
@ -56,7 +55,6 @@ HEADERFILES = \
ControlCommandBuffer.h \ ControlCommandBuffer.h \
ControlDocument.h \ ControlDocument.h \
ControlErrorList.h \ ControlErrorList.h \
ControlERT.h \
ControlEmbeddedFiles.h \ ControlEmbeddedFiles.h \
ControlExternal.h \ ControlExternal.h \
ControlFloat.h \ ControlFloat.h \

View File

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

View File

@ -3,6 +3,8 @@
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Jürgen Vigna
* \author Angus Leeming
* \author John Levon * \author John Levon
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
@ -11,8 +13,8 @@
#include <config.h> #include <config.h>
#include "GuiERT.h" #include "GuiERT.h"
#include "ControlERT.h"
#include "gettext.h" #include "gettext.h"
#include "FuncRequest.h"
#include <QRadioButton> #include <QRadioButton>
#include <QPushButton> #include <QPushButton>
@ -22,12 +24,12 @@
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GuiERTDialog::GuiERTDialog(LyXView & lv) GuiERT::GuiERT(LyXView & lv)
: GuiDialog(lv, "ert") : GuiDialog(lv, "ert"), Controller(this), status_(InsetERT::Collapsed)
{ {
setupUi(this); setupUi(this);
setViewTitle(_("TeX Code Settings")); setViewTitle(_("TeX Code Settings"));
setController(new ControlERT(*this)); setController(this, false);
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
@ -40,42 +42,59 @@ GuiERTDialog::GuiERTDialog(LyXView & lv)
} }
ControlERT & GuiERTDialog::controller() void GuiERT::closeEvent(QCloseEvent * e)
{
return static_cast<ControlERT &>(GuiDialog::controller());
}
void GuiERTDialog::closeEvent(QCloseEvent * e)
{ {
slotClose(); slotClose();
e->accept(); e->accept();
} }
void GuiERTDialog::change_adaptor() void GuiERT::change_adaptor()
{ {
changed(); changed();
} }
void GuiERTDialog::applyView() void GuiERT::applyView()
{ {
if (openRB->isChecked()) if (openRB->isChecked())
controller().setStatus(Inset::Open); status_ = Inset::Open;
else 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::Open: openRB->setChecked(true); break;
case InsetERT::Collapsed: collapsedRB->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 frontend
} // namespace lyx } // namespace lyx

View File

@ -13,18 +13,18 @@
#define GUIERT_H #define GUIERT_H
#include "GuiDialog.h" #include "GuiDialog.h"
#include "ControlERT.h"
#include "ui_ERTUi.h" #include "ui_ERTUi.h"
#include "insets/InsetERT.h" // InsetERT::ERTStatus
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GuiERTDialog : public GuiDialog, public Ui::ERTUi class GuiERT : public GuiDialog, public Ui::ERTUi, public Controller
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiERTDialog(LyXView & lv); GuiERT(LyXView & lv);
private Q_SLOTS: private Q_SLOTS:
void change_adaptor(); void change_adaptor();
@ -32,11 +32,26 @@ private Q_SLOTS:
private: private:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);
/// parent controller /// parent controller
ControlERT & controller(); Controller & controller() { return *this; }
/// Apply changes /// Apply changes
void applyView(); void applyView();
/// update /// update
void updateContents(); 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 } // namespace frontend