]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormNote.C
Tiny clean-ups.
[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, _("Note"))
32 {}
33
34
35 void FormNote::build()
36 {
37         dialog_.reset(build_note(this));
38
39         note_gui_tokens(ids_, gui_names_);
40
41         for (string::size_type i = 0; i < gui_names_.size(); ++i) {
42                 fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
43         }
44
45         string str = _("Lyx Note: LyX internal only\n"
46                        "Comment: Export to LaTeX but don't print\n"
47                        "Greyed Out: Print as grey text");
48         tooltips().init(dialog_->choice_type, str);
49
50         bcview().setOK(dialog_->button_ok);
51         bcview().setApply(dialog_->button_apply);
52         bcview().setCancel(dialog_->button_cancel);
53 }
54
55
56 void FormNote::update()
57 {
58         string type(controller().params().type);
59         for (string::size_type i = 0; i < gui_names_.size(); ++i) {
60                 if (type == ids_[i])
61                         fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str());
62                 }
63 }
64
65
66 void FormNote::apply()
67 {
68         int i = fl_get_choice(dialog_->choice_type);
69         controller().params().type = ids_[i - 1];
70 }