]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormNote.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / frontends / xforms / FormNote.C
1 /**
2  * \file FormNote.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Martin Vermeer
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FormNote.h"
14 #include "ControlNote.h"
15 #include "forms/form_note.h"
16
17 #include "Tooltips.h"
18 #include "xformsBC.h"
19
20 #include "insets/insetnote.h"
21
22 #include "lyx_forms.h"
23
24 using std::string;
25
26 namespace lyx {
27 namespace frontend {
28
29 typedef FormController<ControlNote, FormView<FD_note> > base_class;
30
31 FormNote::FormNote(Dialog & parent)
32         : base_class(parent, _("LyX: Note Settings"))
33 {}
34
35
36 void FormNote::build()
37 {
38         dialog_.reset(build_note(this));
39
40
41         tooltips().init(dialog_->radio_note,
42                         _("LyX internal only"));
43         tooltips().init(dialog_->radio_comment,
44                         _("Export to LaTeX/Docbook but don't print"));
45         tooltips().init(dialog_->radio_greyedout,
46                         _("Print as grey text"));
47
48         bcview().setOK(dialog_->button_ok);
49         bcview().setCancel(dialog_->button_cancel);
50 }
51
52
53 void FormNote::update()
54 {
55         FL_OBJECT * rb = 0;
56
57         switch (controller().params().type) {
58         case InsetNoteParams::Note:
59                 rb = dialog_->radio_note;
60                 break;
61         case InsetNoteParams::Comment:
62                 rb = dialog_->radio_comment;
63                 break;
64         case InsetNoteParams::Greyedout:
65                 rb = dialog_->radio_greyedout;
66                 break;
67         }
68
69         fl_set_button(rb, 1);
70 }
71
72
73 void FormNote::apply()
74 {
75         InsetNoteParams::Type type;
76
77         if (fl_get_button(dialog_->radio_greyedout))
78                 type = InsetNoteParams::Greyedout;
79         else if (fl_get_button(dialog_->radio_comment))
80                 type = InsetNoteParams::Comment;
81         else
82                 type = InsetNoteParams::Note;
83
84         controller().params().type = type;
85 }
86
87 } // namespace frontend
88 } // namespace lyx