]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormNote.C
Martin's changes to the Note inset.
[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
12 #include <config.h>
13
14 #include "xformsBC.h"
15 #include "ControlNote.h"
16 #include "FormNote.h"
17 #include "forms/form_note.h"
18 #include "Tooltips.h"
19 #include "lyx_forms.h"
20 #include "insets/insetnote.h"
21 #include "debug.h"
22
23 #include <vector>
24
25 using std::vector;
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 (int i = 0; i < 3; ++i) {   
42         }
43         
44         for (int i = 0; i < 3; ++i) {   
45                 fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
46         }
47
48         string str = _("Lyx Note: LyX internal only\n"
49                        "Comment: Export to LaTeX but don't print\n"
50                        "Greyed Out: Print as grey text");
51         tooltips().init(dialog_->choice_type, str);
52
53         bcview().setOK(dialog_->button_ok);
54         bcview().setApply(dialog_->button_apply);
55         bcview().setCancel(dialog_->button_cancel);
56 }
57
58
59 void FormNote::update()
60 {
61         string type(controller().params().type);
62         for (int i = 0; i < 3; ++i) {   
63         if (type == ids_[i])
64                 fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str());
65         }
66 }
67
68
69 void FormNote::apply()
70 {
71         int i = fl_get_choice(dialog_->choice_type);
72         controller().params().type = ids_[i - 1];
73 }
74