2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* \file GuiNote.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.
|
|
|
|
|
*
|
2007-10-05 20:43:26 +00:00
|
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiNote.h"
|
2007-10-05 20:43:26 +00:00
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
#include "gettext.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetNote.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
|
#include <QCloseEvent>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
GuiNote::GuiNote(LyXView & lv)
|
|
|
|
|
: GuiDialog(lv, "note"), Controller(this)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
2007-10-05 20:43:26 +00:00
|
|
|
|
setController(this, false);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
setViewTitle(_("Note Settings"));
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
|
|
|
|
connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
|
connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
|
connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
|
connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
|
connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
|
bc().setOK(okPB);
|
|
|
|
|
bc().setCancel(closePB);
|
2007-04-25 10:57:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
void GuiNote::closeEvent(QCloseEvent * e)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
2007-09-11 17:06:15 +00:00
|
|
|
|
slotClose();
|
2007-09-05 20:33:29 +00:00
|
|
|
|
e->accept();
|
2007-04-25 10:57:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
void GuiNote::change_adaptor()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
void GuiNote::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-10-05 20:43:26 +00:00
|
|
|
|
switch (params_.type) {
|
2006-03-05 17:24:44 +00:00
|
|
|
|
case InsetNoteParams::Note:
|
2007-10-05 20:43:26 +00:00
|
|
|
|
noteRB->setChecked(true);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Comment:
|
2007-10-05 20:43:26 +00:00
|
|
|
|
commentRB->setChecked(true);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Greyedout:
|
2007-10-05 20:43:26 +00:00
|
|
|
|
greyedoutRB->setChecked(true);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
2006-08-16 08:57:00 +00:00
|
|
|
|
case InsetNoteParams::Framed:
|
2007-10-05 20:43:26 +00:00
|
|
|
|
framedRB->setChecked(true);
|
2006-08-16 08:57:00 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Shaded:
|
2007-10-05 20:43:26 +00:00
|
|
|
|
shadedRB->setChecked(true);
|
2006-08-16 08:57:00 +00:00
|
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
void GuiNote::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
if (greyedoutRB->isChecked())
|
2007-10-05 20:43:26 +00:00
|
|
|
|
params_.type = InsetNoteParams::Greyedout;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (commentRB->isChecked())
|
2007-10-05 20:43:26 +00:00
|
|
|
|
params_.type = InsetNoteParams::Comment;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (framedRB->isChecked())
|
2007-10-05 20:43:26 +00:00
|
|
|
|
params_.type = InsetNoteParams::Framed;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (shadedRB->isChecked())
|
2007-10-05 20:43:26 +00:00
|
|
|
|
params_.type = InsetNoteParams::Shaded;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2007-10-05 20:43:26 +00:00
|
|
|
|
params_.type = InsetNoteParams::Note;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
bool GuiNote::initialiseParams(string const & data)
|
|
|
|
|
{
|
|
|
|
|
InsetNoteMailer::string2params(data, params_);
|
|
|
|
|
return true;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
|
|
|
|
|
|
void GuiNote::clearParams()
|
|
|
|
|
{
|
|
|
|
|
params_ = InsetNoteParams();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GuiNote::dispatchParams()
|
|
|
|
|
{
|
|
|
|
|
dispatch(FuncRequest(getLfun(), InsetNoteMailer::params2string(params_)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dialog * createGuiNote(LyXView & lv) { return new GuiNote(lv); }
|
|
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiNote_moc.cpp"
|