lyx_mirror/src/frontends/qt4/GuiPhantom.cpp
Uwe Stöhr 8a0d98e67e - stdmenus.inc: Phantom can contain other things as well, not only text
- LyXAction.cpp: updates and sorting
- GuiPhantom: a dialog to set the different phantom types (stolen from GuiNote)

The Phantom feature should now be complete. Thanks to all who contributed and helped.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28364 a592a061-630c-0410-9148-cb99ea01b6c8
2009-02-05 18:09:36 +00:00

101 lines
2.0 KiB
C++

/**
* \file GuiPhantom.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiPhantom.h"
#include "FuncRequest.h"
#include "support/gettext.h"
#include "insets/InsetPhantom.h"
using namespace std;
namespace lyx {
namespace frontend {
GuiPhantom::GuiPhantom(GuiView & lv)
: GuiDialog(lv, "phantom", qt_("Phantom Settings"))
{
setupUi(this);
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(phantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(hphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(vphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
bc().setOK(okPB);
bc().setCancel(closePB);
}
void GuiPhantom::change_adaptor()
{
changed();
}
void GuiPhantom::updateContents()
{
switch (params_.type) {
case InsetPhantomParams::Phantom:
phantomRB->setChecked(true);
break;
case InsetPhantomParams::HPhantom:
hphantomRB->setChecked(true);
break;
case InsetPhantomParams::VPhantom:
vphantomRB->setChecked(true);
break;
}
}
void GuiPhantom::applyView()
{
if (vphantomRB->isChecked())
params_.type = InsetPhantomParams::VPhantom;
else if (hphantomRB->isChecked())
params_.type = InsetPhantomParams::HPhantom;
else
params_.type = InsetPhantomParams::Phantom;
}
bool GuiPhantom::initialiseParams(string const & data)
{
InsetPhantom::string2params(data, params_);
return true;
}
void GuiPhantom::clearParams()
{
params_ = InsetPhantomParams();
}
void GuiPhantom::dispatchParams()
{
dispatch(FuncRequest(getLfun(), InsetPhantom::params2string(params_)));
}
Dialog * createGuiPhantom(GuiView & lv) { return new GuiPhantom(lv); }
} // namespace frontend
} // namespace lyx
#include "moc_GuiPhantom.cpp"