2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiFloat.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiFloat.h"
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-08-25 13:40:01 +00:00
|
|
|
#include "FloatPlacement.h"
|
2007-10-05 22:08:56 +00:00
|
|
|
#include "FuncRequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetFloat.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <QCloseEvent>
|
2006-08-25 13:40:01 +00:00
|
|
|
#include <QPushButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiFloat::GuiFloat(GuiView & lv)
|
2007-10-09 19:34:27 +00:00
|
|
|
: GuiDialog(lv, "float")
|
2007-08-31 22:16:11 +00:00
|
|
|
{
|
2007-11-08 23:05:48 +00:00
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
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()));
|
2007-08-31 22:16:11 +00:00
|
|
|
|
|
|
|
// enable span columns checkbox
|
|
|
|
floatFP->useWide();
|
|
|
|
// enable sideways checkbox
|
|
|
|
floatFP->useSideways();
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
|
2007-08-31 22:16:11 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
2007-08-31 22:16:11 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setCancel(closePB);
|
|
|
|
bc().setApply(applyPB);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setRestore(restorePB);
|
|
|
|
|
|
|
|
bc().addReadOnly(floatFP);
|
2007-08-31 22:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
void GuiFloat::change_adaptor()
|
2007-08-31 22:16:11 +00:00
|
|
|
{
|
2007-10-05 22:08:56 +00:00
|
|
|
changed();
|
2007-08-31 22:16:11 +00:00
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
void GuiFloat::closeEvent(QCloseEvent * e)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-05 22:08:56 +00:00
|
|
|
slotClose();
|
|
|
|
e->accept();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
void GuiFloat::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-05 22:08:56 +00:00
|
|
|
floatFP->set(params_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiFloat::applyView()
|
|
|
|
{
|
|
|
|
params_.placement = floatFP->get(params_.wide, params_.sideways);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
bool GuiFloat::initialiseParams(string const & data)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-05 22:08:56 +00:00
|
|
|
InsetFloatMailer::string2params(data, params_);
|
|
|
|
return true;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
void GuiFloat::clearParams()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-05 22:08:56 +00:00
|
|
|
params_ = InsetFloatParams();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2007-10-05 22:08:56 +00:00
|
|
|
|
|
|
|
void GuiFloat::dispatchParams()
|
|
|
|
{
|
|
|
|
dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
|
2007-10-05 22:08:56 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-08-31 22:16:11 +00:00
|
|
|
|
|
|
|
#include "GuiFloat_moc.cpp"
|