#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 "ControlVSpace.h"
-#include "frontend_helpers.h"
+#include "insets/InsetVSpace.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include <QCheckBox>
-#include <QCloseEvent>
#include <QLineEdit>
#include <QPushButton>
#include <QValidator>
-using std::string;
-
+using namespace std;
namespace lyx {
namespace frontend {
-GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
- : GuiDialog(lv, "vspace")
+GuiVSpace::GuiVSpace(GuiView & lv)
+ : GuiDialog(lv, "vspace", qt_("Vertical Space Settings"))
{
setupUi(this);
- setViewTitle(_("Vertical Space Settings"));
- setController(new ControlVSpace(*this));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
- connect(spacingCO, SIGNAL(highlighted(const QString &)),
+ connect(spacingCO, SIGNAL(highlighted(QString)),
this, SLOT(change_adaptor()));
- connect(valueLE, SIGNAL(textChanged(const QString &)),
+ connect(valueLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(spacingCO, SIGNAL(activated(int)),
this, SLOT(enableCustom(int)));
}
-ControlVSpace & GuiVSpaceDialog::controller()
-{
- return static_cast<ControlVSpace &>(GuiDialog::controller());
-}
-
-
-void GuiVSpaceDialog::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 GuiVSpace::updateContents()
+{
+ setWidgetsFromVSpace(params_, spacingCO, valueLE, unitCO, keepCB);
}
-void GuiVSpaceDialog::updateContents()
+bool GuiVSpace::initialiseParams(string const & data)
{
- setWidgetsFromVSpace(controller().params(),
- spacingCO, valueLE, unitCO, keepCB);
+ InsetVSpace::string2params(data, params_);
+ setButtonsValid(true);
+ return true;
}
+
+void GuiVSpace::clearParams()
+{
+ params_ = VSpace();
+}
+
+
+void GuiVSpace::dispatchParams()
+{
+ dispatch(FuncRequest(getLfun(), InsetVSpace::params2string(params_)));
+}
+
+
+Dialog * createGuiVSpace(GuiView & lv) { return new GuiVSpace(lv); }
+
+
} // namespace frontend
} // namespace lyx