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"
18 #include "insets/InsetNote.h"
20 #include <QCloseEvent>
28 GuiNote::GuiNote(LyXView & lv)
29 : GuiDialog(lv, "note"), Controller(this)
32 setController(this, false);
33 setViewTitle(_("Note Settings"));
35 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
36 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38 connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
39 connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
40 connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
41 connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
42 connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
44 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
46 bc().setCancel(closePB);
50 void GuiNote::closeEvent(QCloseEvent * e)
57 void GuiNote::change_adaptor()
63 void GuiNote::updateContents()
65 switch (params_.type) {
66 case InsetNoteParams::Note:
67 noteRB->setChecked(true);
69 case InsetNoteParams::Comment:
70 commentRB->setChecked(true);
72 case InsetNoteParams::Greyedout:
73 greyedoutRB->setChecked(true);
75 case InsetNoteParams::Framed:
76 framedRB->setChecked(true);
78 case InsetNoteParams::Shaded:
79 shadedRB->setChecked(true);
85 void GuiNote::applyView()
87 if (greyedoutRB->isChecked())
88 params_.type = InsetNoteParams::Greyedout;
89 else if (commentRB->isChecked())
90 params_.type = InsetNoteParams::Comment;
91 else if (framedRB->isChecked())
92 params_.type = InsetNoteParams::Framed;
93 else if (shadedRB->isChecked())
94 params_.type = InsetNoteParams::Shaded;
96 params_.type = InsetNoteParams::Note;
100 bool GuiNote::initialiseParams(string const & data)
102 InsetNoteMailer::string2params(data, params_);
107 void GuiNote::clearParams()
109 params_ = InsetNoteParams();
113 void GuiNote::dispatchParams()
115 dispatch(FuncRequest(getLfun(), InsetNoteMailer::params2string(params_)));
119 Dialog * createGuiNote(LyXView & lv) { return new GuiNote(lv); }
122 } // namespace frontend
125 #include "GuiNote_moc.cpp"