]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiFloat.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiFloat.cpp
index a29df99728b17808fd3383548ff4084252684ff5..773a7f0ba88dacb917789f8c568614f59adf8b4d 100644 (file)
 #include <config.h>
 
 #include "GuiFloat.h"
-#include "GuiFloatDialog.h"
-#include "Qt2BC.h"
-#include "FloatPlacement.h"
 
-#include "controllers/ControlFloat.h"
+#include "FloatPlacement.h"
+#include "FuncRequest.h"
 
 #include "insets/InsetFloat.h"
 
 #include <QPushButton>
 
+using namespace std;
+
 namespace lyx {
 namespace frontend {
 
-typedef QController<ControlFloat, GuiView<GuiFloatDialog> > float_base_class;
+GuiFloat::GuiFloat(GuiView & lv)
+       : GuiDialog(lv, "float", qt_("Float Settings"))
+{
+       setupUi(this);
+       
+       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);
+}
 
 
-GuiFloat::GuiFloat(Dialog & parent)
-       : float_base_class(parent, _("Float Settings"))
+void GuiFloat::change_adaptor()
 {
+       changed();
 }
 
 
-void GuiFloat::build_dialog()
+void GuiFloat::updateContents()
 {
-       dialog_.reset(new GuiFloatDialog(this));
+       floatFP->set(params_);
+}
 
-       bcview().setCancel(dialog_->closePB);
-       bcview().setApply(dialog_->applyPB);
-       bcview().setOK(dialog_->okPB);
-       bcview().setRestore(dialog_->restorePB);
 
-       bcview().addReadOnly(dialog_->floatFP);
+void GuiFloat::applyView()
+{
+       params_.placement = floatFP->get(params_.wide, params_.sideways);
 }
 
 
-void GuiFloat::update_contents()
+bool GuiFloat::initialiseParams(string const & data)
 {
-       dialog_->floatFP->set(controller().params());
+       InsetFloat::string2params(data, params_);
+       return true;
 }
 
 
-void GuiFloat::apply()
+void GuiFloat::clearParams()
 {
-       InsetFloatParams & params = controller().params();
+       params_ = InsetFloatParams();
+}
 
-       params.placement = dialog_->floatFP->get(params.wide, params.sideways);
+
+void GuiFloat::dispatchParams()
+{
+       dispatch(FuncRequest(getLfun(), InsetFloat::params2string(params_)));
 }
 
+
+Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
+
+
 } // namespace frontend
 } // namespace lyx
+
+#include "moc_GuiFloat.cpp"