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.
|
|
|
|
|
*
|
|
|
|
|
* \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"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
#include "ControlNote.h"
|
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
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
GuiNoteDialog::GuiNoteDialog(LyXView & lv)
|
|
|
|
|
: GuiDialog(lv, "note")
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
setController(new ControlNote(*this));
|
|
|
|
|
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-09-11 18:33:42 +00:00
|
|
|
|
ControlNote & GuiNoteDialog::controller()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
2007-09-10 22:32:59 +00:00
|
|
|
|
return static_cast<ControlNote &>(GuiDialog::controller());
|
2007-04-25 10:57:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
void GuiNoteDialog::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-09-05 20:33:29 +00:00
|
|
|
|
void GuiNoteDialog::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-09-11 18:33:42 +00:00
|
|
|
|
void GuiNoteDialog::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
QRadioButton * rb = 0;
|
|
|
|
|
|
|
|
|
|
switch (controller().params().type) {
|
|
|
|
|
case InsetNoteParams::Note:
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rb = noteRB;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Comment:
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rb = commentRB;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Greyedout:
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rb = greyedoutRB;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
break;
|
2006-08-16 08:57:00 +00:00
|
|
|
|
case InsetNoteParams::Framed:
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rb = framedRB;
|
2006-08-16 08:57:00 +00:00
|
|
|
|
break;
|
|
|
|
|
case InsetNoteParams::Shaded:
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rb = shadedRB;
|
2006-08-16 08:57:00 +00:00
|
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rb->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
void GuiNoteDialog::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
InsetNoteParams::Type type;
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
if (greyedoutRB->isChecked())
|
2006-03-05 17:24:44 +00:00
|
|
|
|
type = InsetNoteParams::Greyedout;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (commentRB->isChecked())
|
2006-03-05 17:24:44 +00:00
|
|
|
|
type = InsetNoteParams::Comment;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (framedRB->isChecked())
|
2006-08-16 08:57:00 +00:00
|
|
|
|
type = InsetNoteParams::Framed;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
else if (shadedRB->isChecked())
|
2006-08-16 08:57:00 +00:00
|
|
|
|
type = InsetNoteParams::Shaded;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
|
|
|
|
type = InsetNoteParams::Note;
|
|
|
|
|
|
|
|
|
|
controller().params().type = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiNote_moc.cpp"
|