]> git.lyx.org Git - features.git/commitdiff
next one
authorAndré Pönitz <poenitz@gmx.net>
Fri, 5 Oct 2007 22:27:04 +0000 (22:27 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 5 Oct 2007 22:27:04 +0000 (22:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20764 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ControlVSpace.cpp [deleted file]
src/frontends/controllers/ControlVSpace.h [deleted file]
src/frontends/controllers/Makefile.am
src/frontends/qt4/Dialogs.cpp
src/frontends/qt4/GuiVSpace.cpp
src/frontends/qt4/GuiVSpace.h

diff --git a/src/frontends/controllers/ControlVSpace.cpp b/src/frontends/controllers/ControlVSpace.cpp
deleted file mode 100644 (file)
index 627c793..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * \file ControlVSpace.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Edwin Leuven
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "ControlVSpace.h"
-
-#include "FuncRequest.h"
-#include "insets/InsetVSpace.h"
-
-
-using std::istringstream;
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-ControlVSpace::ControlVSpace(Dialog & parent)
-       : Controller(parent)
-{}
-
-
-bool ControlVSpace::initialiseParams(string const & data)
-{
-       InsetVSpaceMailer::string2params(data, params_);
-       dialog().setButtonsValid(true);
-
-       return true;
-}
-
-
-void ControlVSpace::clearParams()
-{
-       params_ = VSpace();
-}
-
-
-void ControlVSpace::dispatchParams()
-{
-       string const str = InsetVSpaceMailer::params2string(params_);
-       dispatch(FuncRequest(getLfun(), str));
-}
-
-
-VSpace & ControlVSpace::params()
-{
-       return params_;
-}
-
-
-VSpace const & ControlVSpace::params() const
-{
-       return params_;
-}
-
-} // namespace frontend
-} // namespace lyx
diff --git a/src/frontends/controllers/ControlVSpace.h b/src/frontends/controllers/ControlVSpace.h
deleted file mode 100644 (file)
index 104a3ad..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ControlVSpace.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Edwin Leuven
- * \author André Pönitz
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef CONTROLVSPACE_H
-#define CONTROLVSPACE_H
-
-#include "Dialog.h"
-#include "VSpace.h"
-
-namespace lyx {
-namespace frontend {
-
-class ControlVSpace : public Controller {
-public:
-       ///
-       ControlVSpace(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; }
-       ///
-       VSpace & params();
-       ///
-       VSpace const & params() const;
-       ///
-       bool inInset() const;
-
-private:
-       ///
-       VSpace params_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // CONTROLPARAGRAPH_H
index 0bc1308c0ad65a3a131cc4f6b6df37be212b547b..2850f25bf88f3d722fd6aa15072faf7dea0698c2 100644 (file)
@@ -38,7 +38,6 @@ SOURCEFILES = \
        ControlTexinfo.cpp \
        ControlThesaurus.cpp \
        ControlToc.cpp \
-       ControlVSpace.cpp \
        frontend_helpers.cpp 
 
 HEADERFILES = \
@@ -72,7 +71,6 @@ HEADERFILES = \
        ControlTexinfo.h \
        ControlThesaurus.h \
        ControlToc.h \
-       ControlVSpace.h \
        frontend_helpers.h
 
 if MONOLITHIC_CONTROLLERS
index 46d0a3679d6cee424392785c7617dd8526d51979..280d0e075425636bae347b48138c8287d28917e0 100644 (file)
@@ -50,7 +50,6 @@
 #include "GuiViewSource.h"
 #include "TocWidget.h"
 #include "GuiURL.h"
-#include "GuiVSpace.h"
 
 #ifdef HAVE_LIBAIKSAURUS
 #include "ControlThesaurus.h"
@@ -253,7 +252,7 @@ Dialog * Dialogs::build(string const & name)
        } else if (name == "url") {
                dialog = new GuiURLDialog(lyxview_);
        } else if (name == "vspace") {
-               dialog = new GuiVSpaceDialog(lyxview_);
+               dialog = createGuiVSpace(lyxview_);
        } else if (name == "wrap") {
                dialog = createGuiWrap(lyxview_);
        } else if (name == "listings") {
index c1a5dd113ce903d575152e707e88dcde600ae8a3..e6c2dc171b37c0a6804a93e836bd1600cfb4d05c 100644 (file)
 
 #include "GuiVSpace.h"
 
-#include "ControlVSpace.h"
 #include "LengthCombo.h"
 #include "qt_helpers.h"
 #include "Validator.h"
 
 #include "LyXRC.h" // to set the default length values
 #include "Spacing.h"
-#include "VSpace.h"
+#include "FuncRequest.h"
+#include "insets/InsetVSpace.h"
 
 #include "support/lstrings.h"
 
@@ -40,12 +40,12 @@ using std::string;
 namespace lyx {
 namespace frontend {
 
-GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
-       : GuiDialog(lv, "vspace")
+GuiVSpace::GuiVSpace(LyXView & lv)
+       : GuiDialog(lv, "vspace"), Controller(this)
 {
        setupUi(this);
        setViewTitle(_("Vertical Space Settings"));
-       setController(new ControlVSpace(*this));
+       setController(this, false);
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
@@ -84,26 +84,20 @@ GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
 }
 
 
-ControlVSpace & GuiVSpaceDialog::controller()
-{
-       return static_cast<ControlVSpace &>(GuiDialog::controller());
-}
-
-
-void GuiVSpaceDialog::closeEvent(QCloseEvent * e)
+void GuiVSpace::closeEvent(QCloseEvent * e)
 {
        slotClose();
        e->accept();
 }
 
 
-void GuiVSpaceDialog::change_adaptor()
+void GuiVSpace::change_adaptor()
 {
        changed();
 }
 
 
-void GuiVSpaceDialog::enableCustom(int selection)
+void GuiVSpace::enableCustom(int selection)
 {
        bool const enable = selection == 5;
        valueLE->setEnabled(enable);
@@ -164,26 +158,49 @@ static VSpace setVSpaceFromWidgets(int spacing,
 }
 
 
-void GuiVSpaceDialog::applyView()
+void GuiVSpace::applyView()
 {
        // If a vspace choice is "Length" but there's no text in
        // the input field, do not insert a vspace at all.
        if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty())
                return;
 
-       VSpace const space = setVSpaceFromWidgets(spacingCO->currentIndex(),
+       params_ = setVSpaceFromWidgets(spacingCO->currentIndex(),
                        valueLE, unitCO, keepCB->isChecked()); 
 
-       controller().params() = space;
 }
 
 
-void GuiVSpaceDialog::updateContents()
+void GuiVSpace::updateContents()
+{
+       setWidgetsFromVSpace(params_, spacingCO, valueLE, unitCO, keepCB);
+}
+
+
+bool GuiVSpace::initialiseParams(string const & data)
+{
+       InsetVSpaceMailer::string2params(data, params_);
+       dialog().setButtonsValid(true);
+
+       return true;
+}
+
+
+void GuiVSpace::clearParams()
+{
+       params_ = VSpace();
+}
+
+
+void GuiVSpace::dispatchParams()
 {
-       setWidgetsFromVSpace(controller().params(),
-               spacingCO, valueLE, unitCO, keepCB);
+       dispatch(FuncRequest(getLfun(), InsetVSpaceMailer::params2string(params_)));
 }
 
+
+Dialog * createGuiVSpace(LyXView & lv) { return new GuiVSpace(lv); }
+
+
 } // namespace frontend
 } // namespace lyx
 
index fff6041a72239040d9d0c0a2e821948a73e6d5d6..b138c176965fb9a2f44aef934c0803a5d902e2c1 100644 (file)
@@ -7,6 +7,7 @@
  * \author André Pönitz
  * \author Angus Leeming
  * \author Jürgen Spitzmüller
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS.
  */
 #define GUIVSPACE_H
 
 #include "GuiDialog.h"
-#include "ControlVSpace.h"
 #include "ui_VSpaceUi.h"
+#include "VSpace.h"
 
 namespace lyx {
 namespace frontend {
 
-class GuiVSpaceDialog : public GuiDialog, public Ui::VSpaceUi
+class GuiVSpace : public GuiDialog, public Ui::VSpaceUi, public Controller
 {
        Q_OBJECT
 
 public:
-       GuiVSpaceDialog(LyXView & lv);
+       GuiVSpace(LyXView & lv);
 
 private Q_SLOTS:
+       ///
        void change_adaptor();
+       ///
        void closeEvent(QCloseEvent *);
+       ///
        void enableCustom(int);
 
 private:
        /// parent controller
-       ControlVSpace & controller();
+       Controller & controller() { return *this; }
        /// Apply from dialog
        void applyView();
        /// Update the dialog
        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; }
+       ///
+       bool inInset() const;
+
+       ///
+       VSpace params_;
 };
 
 } // namespace frontend