]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormNote.C
Introduce LFUN_PRINT.
[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
25 using std::string;
26
27
28 typedef FormController<ControlNote, FormView<FD_note> > base_class;
29
30 FormNote::FormNote(Dialog & parent)
31         : base_class(parent, _("LyX: Note Settings"))
32 {}
33
34
35 void FormNote::build()
36 {
37         dialog_.reset(build_note(this));
38
39
40         tooltips().init(dialog_->radio_note,
41                         _("LyX internal only"));
42         tooltips().init(dialog_->radio_comment,
43                         _("Export to LaTeX/Docbook but don't print"));
44         tooltips().init(dialog_->radio_greyedout,
45                         _("Print as grey text"));
46
47         bcview().setOK(dialog_->button_ok);
48         bcview().setCancel(dialog_->button_cancel);
49 }
50
51
52 void FormNote::update()
53 {
54         FL_OBJECT * rb = 0;
55
56         switch (controller().params().type) {
57         case InsetNoteParams::Note:
58                 rb = dialog_->radio_note;
59                 break;
60         case InsetNoteParams::Comment:
61                 rb = dialog_->radio_comment;
62                 break;
63         case InsetNoteParams::Greyedout:
64                 rb = dialog_->radio_greyedout;
65                 break;
66         }
67
68         fl_set_button(rb, 1);
69 }
70
71
72 void FormNote::apply()
73 {
74         InsetNoteParams::Type type;
75
76         if (fl_get_button(dialog_->radio_greyedout))
77                 type = InsetNoteParams::Greyedout;
78         else if (fl_get_button(dialog_->radio_comment))
79                 type = InsetNoteParams::Comment;
80         else
81                 type = InsetNoteParams::Note;
82
83         controller().params().type = type;
84 }