3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
15 #include "FuncRequest.h"
16 #include "support/gettext.h"
18 #include "insets/InsetNote.h"
20 #include <QCloseEvent>
28 GuiNote::GuiNote(GuiView & lv)
29 : GuiDialog(lv, "note")
32 setViewTitle(_("Note Settings"));
34 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
35 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
37 connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
38 connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
39 connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
40 connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
41 connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
43 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
45 bc().setCancel(closePB);
49 void GuiNote::closeEvent(QCloseEvent * e)
56 void GuiNote::change_adaptor()
62 void GuiNote::updateContents()
64 switch (params_.type) {
65 case InsetNoteParams::Note:
66 noteRB->setChecked(true);
68 case InsetNoteParams::Comment:
69 commentRB->setChecked(true);
71 case InsetNoteParams::Greyedout:
72 greyedoutRB->setChecked(true);
74 case InsetNoteParams::Framed:
75 framedRB->setChecked(true);
77 case InsetNoteParams::Shaded:
78 shadedRB->setChecked(true);
84 void GuiNote::applyView()
86 if (greyedoutRB->isChecked())
87 params_.type = InsetNoteParams::Greyedout;
88 else if (commentRB->isChecked())
89 params_.type = InsetNoteParams::Comment;
90 else if (framedRB->isChecked())
91 params_.type = InsetNoteParams::Framed;
92 else if (shadedRB->isChecked())
93 params_.type = InsetNoteParams::Shaded;
95 params_.type = InsetNoteParams::Note;
99 bool GuiNote::initialiseParams(string const & data)
101 InsetNoteMailer::string2params(data, params_);
106 void GuiNote::clearParams()
108 params_ = InsetNoteParams();
112 void GuiNote::dispatchParams()
114 dispatch(FuncRequest(getLfun(), InsetNoteMailer::params2string(params_)));
118 Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); }
121 } // namespace frontend
124 #include "GuiNote_moc.cpp"