]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiNote.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiNote.cpp
1 /**
2  * \file GuiNote.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  * \author Jürgen Spitzmüller
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "GuiNote.h"
15 #include "FuncRequest.h"
16 #include "support/gettext.h"
17
18 #include "insets/InsetNote.h"
19
20 using namespace std;
21
22 namespace lyx {
23 namespace frontend {
24
25 GuiNote::GuiNote(GuiView & lv)
26         : GuiDialog(lv, "note", qt_("Note Settings"))
27 {
28         setupUi(this);
29
30         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
31         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
32
33         connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
34         connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
35         connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
36
37         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
38         bc().setOK(okPB);
39         bc().setCancel(closePB);
40 }
41
42
43 void GuiNote::change_adaptor()
44 {
45         changed();
46 }
47
48
49 void GuiNote::updateContents()
50 {
51         switch (params_.type) {
52         case InsetNoteParams::Note:
53                 noteRB->setChecked(true);
54                 break;
55         case InsetNoteParams::Comment:
56                 commentRB->setChecked(true);
57                 break;
58         case InsetNoteParams::Greyedout:
59                 greyedoutRB->setChecked(true);
60                 break;
61         }
62 }
63
64
65 void GuiNote::applyView()
66 {
67         if (greyedoutRB->isChecked())
68                 params_.type = InsetNoteParams::Greyedout;
69         else if (commentRB->isChecked())
70                 params_.type = InsetNoteParams::Comment;
71         else
72                 params_.type = InsetNoteParams::Note;
73 }
74
75
76 bool GuiNote::initialiseParams(string const & data)
77 {
78         InsetNote::string2params(data, params_);
79         return true;
80 }
81
82
83 void GuiNote::clearParams()
84 {
85         params_ = InsetNoteParams();
86 }
87
88
89 void GuiNote::dispatchParams()
90 {
91         dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_)));
92 }
93
94
95 Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); }
96
97
98 } // namespace frontend
99 } // namespace lyx
100
101 #include "moc_GuiNote.cpp"