From c2f2b1742dec6e368e0842d6d35821e3ba70e021 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 5 Oct 2007 22:08:56 +0000 Subject: [PATCH] next one git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20763 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlFloat.cpp | 47 -------------------- src/frontends/controllers/ControlFloat.h | 46 -------------------- src/frontends/controllers/Makefile.am | 2 - src/frontends/qt4/Dialogs.cpp | 3 +- src/frontends/qt4/GuiFloat.cpp | 50 +++++++++++++++------- src/frontends/qt4/GuiFloat.h | 21 +++++++-- 6 files changed, 52 insertions(+), 117 deletions(-) delete mode 100644 src/frontends/controllers/ControlFloat.cpp delete mode 100644 src/frontends/controllers/ControlFloat.h diff --git a/src/frontends/controllers/ControlFloat.cpp b/src/frontends/controllers/ControlFloat.cpp deleted file mode 100644 index a55527e737..0000000000 --- a/src/frontends/controllers/ControlFloat.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * \file ControlFloat.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "ControlFloat.h" -#include "FuncRequest.h" - - -using std::string; - -namespace lyx { -namespace frontend { - -ControlFloat::ControlFloat(Dialog & parent) - : Controller(parent) -{} - - -bool ControlFloat::initialiseParams(string const & data) -{ - InsetFloatMailer::string2params(data, params_); - return true; -} - - -void ControlFloat::clearParams() -{ - params_ = InsetFloatParams(); -} - - -void ControlFloat::dispatchParams() -{ - string const lfun = InsetFloatMailer::params2string(params()); - dispatch(FuncRequest(getLfun(), lfun)); -} - -} // namespace frontend -} // namespace lyx diff --git a/src/frontends/controllers/ControlFloat.h b/src/frontends/controllers/ControlFloat.h deleted file mode 100644 index 06e6fc4a60..0000000000 --- a/src/frontends/controllers/ControlFloat.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -/** - * \file ControlFloat.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef CONTROLFLOAT_H -#define CONTROLFLOAT_H - -#include "Dialog.h" -#include "insets/InsetFloat.h" - -namespace lyx { -namespace frontend { - -class ControlFloat : public Controller -{ -public: - /// - ControlFloat(Dialog &); - /// - 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; } - /// - InsetFloatParams & params() { return params_; } - /// - InsetFloatParams const & params() const { return params_; } -private: - /// - InsetFloatParams params_; -}; - -} // namespace frontend -} // namespace lyx - -#endif diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index 8d8a0fdc49..0bc1308c0a 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -21,7 +21,6 @@ SOURCEFILES = \ ControlEmbeddedFiles.cpp \ ControlErrorList.cpp \ ControlExternal.cpp \ - ControlFloat.cpp \ ControlGraphics.cpp \ ControlInclude.cpp \ ControlLog.cpp \ @@ -56,7 +55,6 @@ HEADERFILES = \ ControlErrorList.h \ ControlEmbeddedFiles.h \ ControlExternal.h \ - ControlFloat.h \ ControlGraphics.h \ ControlInclude.h \ ControlLog.h \ diff --git a/src/frontends/qt4/Dialogs.cpp b/src/frontends/qt4/Dialogs.cpp index b2988e86ad..46d0a3679d 100644 --- a/src/frontends/qt4/Dialogs.cpp +++ b/src/frontends/qt4/Dialogs.cpp @@ -29,7 +29,6 @@ #include "GuiEmbeddedFiles.h" #include "GuiErrorList.h" #include "GuiExternal.h" -#include "GuiFloat.h" #include "GuiGraphics.h" #include "GuiInclude.h" #include "GuiIndex.h" @@ -191,7 +190,7 @@ Dialog * Dialogs::build(string const & name) } else if (name == "findreplace") { dialog = new GuiSearchDialog(lyxview_); } else if (name == "float") { - dialog = new GuiFloatDialog(lyxview_); + dialog = createGuiFloat(lyxview_); } else if (name == "graphics") { dialog = new GuiGraphicsDialog(lyxview_); } else if (name == "include") { diff --git a/src/frontends/qt4/GuiFloat.cpp b/src/frontends/qt4/GuiFloat.cpp index 87d1ca7a67..6b8abe0107 100644 --- a/src/frontends/qt4/GuiFloat.cpp +++ b/src/frontends/qt4/GuiFloat.cpp @@ -12,22 +12,24 @@ #include "GuiFloat.h" -#include "ControlFloat.h" #include "FloatPlacement.h" +#include "FuncRequest.h" #include "insets/InsetFloat.h" #include #include +using std::string; + namespace lyx { namespace frontend { -GuiFloatDialog::GuiFloatDialog(LyXView & lv) - : GuiDialog(lv, "float") +GuiFloat::GuiFloat(LyXView & lv) + : GuiDialog(lv, "float"), Controller(this) { - setController(new ControlFloat(*this)); + setController(this, false); setViewTitle(_("Float Settings")); setupUi(this); @@ -54,37 +56,53 @@ GuiFloatDialog::GuiFloatDialog(LyXView & lv) } -ControlFloat & GuiFloatDialog::controller() +void GuiFloat::change_adaptor() { - return static_cast(GuiDialog::controller()); + changed(); } -void GuiFloatDialog::change_adaptor() +void GuiFloat::closeEvent(QCloseEvent * e) { - changed(); + slotClose(); + e->accept(); } -void GuiFloatDialog::closeEvent(QCloseEvent * e) +void GuiFloat::updateContents() { - slotClose(); - e->accept(); + floatFP->set(params_); +} + + +void GuiFloat::applyView() +{ + params_.placement = floatFP->get(params_.wide, params_.sideways); } -void GuiFloatDialog::updateContents() +bool GuiFloat::initialiseParams(string const & data) { - floatFP->set(controller().params()); + InsetFloatMailer::string2params(data, params_); + return true; } -void GuiFloatDialog::applyView() +void GuiFloat::clearParams() { - InsetFloatParams & params = controller().params(); - params.placement = floatFP->get(params.wide, params.sideways); + params_ = InsetFloatParams(); } + +void GuiFloat::dispatchParams() +{ + dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_))); +} + + +Dialog * createGuiFloat(LyXView & lv) { return new GuiFloat(lv); } + + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiFloat.h b/src/frontends/qt4/GuiFloat.h index 881245d0ed..28049e5f40 100644 --- a/src/frontends/qt4/GuiFloat.h +++ b/src/frontends/qt4/GuiFloat.h @@ -13,18 +13,19 @@ #define GUIFLOAT_H #include "GuiDialog.h" -#include "ControlFloat.h" #include "ui_FloatUi.h" +#include "insets/InsetFloat.h" + namespace lyx { namespace frontend { -class GuiFloatDialog : public GuiDialog, public Ui::FloatUi +class GuiFloat : public GuiDialog, public Ui::FloatUi, public Controller { Q_OBJECT public: - GuiFloatDialog(LyXView & lv); + GuiFloat(LyXView & lv); private Q_SLOTS: void change_adaptor(); @@ -32,11 +33,23 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); /// parent controller - ControlFloat & controller(); + Controller & controller() { return *this; } /// Apply changes void applyView(); /// update void updateContents(); + /// + bool initialiseParams(std::string const & data); + /// clean-up on hide. + void clearParams(); + /// clean-up on hide. + void dispatchParams(); + /// + bool isBufferDependent() const { return true; } + +private: + /// + InsetFloatParams params_; }; } // namespace frontend -- 2.39.5