#include "GuiFloat.h"
#include "FloatPlacement.h"
-#include "FuncRequest.h"
-#include "insets/InsetFloat.h"
+#include "FuncRequest.h"
-#include <QCloseEvent>
#include <QPushButton>
-using std::string;
-
+using namespace std;
namespace lyx {
namespace frontend {
-GuiFloat::GuiFloat(LyXView & lv)
- : GuiDialog(lv, "float")
+GuiFloat::GuiFloat(GuiView & lv)
+ : InsetDialog(lv, FLOAT_CODE, LFUN_FLOAT_INSERT, "float", "Float Settings")
{
setupUi(this);
- setViewTitle(_("Float Settings"));
-
- connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
- connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
- connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
- connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-
+
// enable span columns checkbox
floatFP->useWide();
// enable sideways checkbox
floatFP->useSideways();
- connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
-
- bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
-
- bc().setCancel(closePB);
- bc().setApply(applyPB);
- bc().setOK(okPB);
- bc().setRestore(restorePB);
-
- bc().addReadOnly(floatFP);
-}
-
-
-void GuiFloat::change_adaptor()
-{
- changed();
-}
-
-
-void GuiFloat::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
-void GuiFloat::updateContents()
-{
- floatFP->set(params_);
+ connect(floatFP, SIGNAL(changed()), this, SLOT(applyView()));
}
-void GuiFloat::applyView()
+void GuiFloat::enableView(bool enable)
{
- params_.placement = floatFP->get(params_.wide, params_.sideways);
+ floatFP->setEnabled(enable);
}
-bool GuiFloat::initialiseParams(string const & data)
+void GuiFloat::paramsToDialog(Inset const * inset)
{
- InsetFloatMailer::string2params(data, params_);
- return true;
+ floatFP->paramsToDialog(inset);
}
-void GuiFloat::clearParams()
+docstring GuiFloat::dialogToParams() const
{
- params_ = InsetFloatParams();
+ return floatFP->dialogToParams();
}
-
-void GuiFloat::dispatchParams()
-{
- dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
-}
-
-
-Dialog * createGuiFloat(LyXView & lv) { return new GuiFloat(lv); }
-
+Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
} // namespace frontend
} // namespace lyx
-#include "GuiFloat_moc.cpp"
+#include "moc_GuiFloat.cpp"