From 1a5acd927f86d3cd8740a6cae70287b344f1db29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 5 Oct 2007 21:06:08 +0000 Subject: [PATCH] 37 or so git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20761 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlERT.cpp | 48 ---------------- src/frontends/controllers/ControlERT.h | 47 ---------------- src/frontends/controllers/Makefile.am | 2 - src/frontends/qt4/Dialogs.cpp | 71 ++++++++++++------------ src/frontends/qt4/GuiERT.cpp | 53 ++++++++++++------ src/frontends/qt4/GuiERT.h | 23 ++++++-- 6 files changed, 90 insertions(+), 154 deletions(-) delete mode 100644 src/frontends/controllers/ControlERT.cpp delete mode 100644 src/frontends/controllers/ControlERT.h diff --git a/src/frontends/controllers/ControlERT.cpp b/src/frontends/controllers/ControlERT.cpp deleted file mode 100644 index 4f80a0fc5d..0000000000 --- a/src/frontends/controllers/ControlERT.cpp +++ /dev/null @@ -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 - -#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 diff --git a/src/frontends/controllers/ControlERT.h b/src/frontends/controllers/ControlERT.h deleted file mode 100644 index 7f3d5da7f0..0000000000 --- a/src/frontends/controllers/ControlERT.h +++ /dev/null @@ -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 diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index ad03b9aaad..bbf807ae3d 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -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 \ diff --git a/src/frontends/qt4/Dialogs.cpp b/src/frontends/qt4/Dialogs.cpp index 96c0172854..96f0b92191 100644 --- a/src/frontends/qt4/Dialogs.cpp +++ b/src/frontends/qt4/Dialogs.cpp @@ -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") { diff --git a/src/frontends/qt4/GuiERT.cpp b/src/frontends/qt4/GuiERT.cpp index 5082997d7c..efd6d7e07d 100644 --- a/src/frontends/qt4/GuiERT.cpp +++ b/src/frontends/qt4/GuiERT.cpp @@ -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 #include "GuiERT.h" -#include "ControlERT.h" #include "gettext.h" +#include "FuncRequest.h" #include #include @@ -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(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 diff --git a/src/frontends/qt4/GuiERT.h b/src/frontends/qt4/GuiERT.h index f714f1c29e..20577dac2a 100644 --- a/src/frontends/qt4/GuiERT.h +++ b/src/frontends/qt4/GuiERT.h @@ -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 -- 2.39.5