]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiNote.cpp
Improve some debug messages
[lyx.git] / src / frontends / qt / 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 using namespace std;
19
20 namespace lyx {
21 namespace frontend {
22
23 GuiNote::GuiNote(GuiView & lv)
24         : GuiDialog(lv, "note", qt_("Note Settings"))
25 {
26         setupUi(this);
27
28         connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
29                 this, SLOT(slotButtonBox(QAbstractButton *)));
30
31         connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
32         connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
33         connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
34
35         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
36         bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
37         bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
38 }
39
40
41 void GuiNote::change_adaptor()
42 {
43         changed();
44 }
45
46
47 void GuiNote::updateContents()
48 {
49         switch (params_.type) {
50         case InsetNoteParams::Note:
51                 noteRB->setChecked(true);
52                 break;
53         case InsetNoteParams::Comment:
54                 commentRB->setChecked(true);
55                 break;
56         case InsetNoteParams::Greyedout:
57                 greyedoutRB->setChecked(true);
58                 break;
59         }
60 }
61
62
63 void GuiNote::applyView()
64 {
65         if (greyedoutRB->isChecked())
66                 params_.type = InsetNoteParams::Greyedout;
67         else if (commentRB->isChecked())
68                 params_.type = InsetNoteParams::Comment;
69         else
70                 params_.type = InsetNoteParams::Note;
71 }
72
73
74 bool GuiNote::initialiseParams(string const & sdata)
75 {
76         InsetNote::string2params(sdata, params_);
77         return true;
78 }
79
80
81 void GuiNote::clearParams()
82 {
83         params_ = InsetNoteParams();
84 }
85
86
87 void GuiNote::dispatchParams()
88 {
89         dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_)));
90 }
91
92
93 Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); }
94
95
96 } // namespace frontend
97 } // namespace lyx
98
99 #include "moc_GuiNote.cpp"