+++ /dev/null
-/**
- * \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
+++ /dev/null
-// -*- 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
#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"
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()));
}
-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);
}
-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
* \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