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