]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibitem.C
Replace 'using namespace abc;' with 'using abc::xyz;'
[lyx.git] / src / frontends / xforms / FormBibitem.C
1 /**
2  * \file FormBibitem.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "FormBibitem.h"
15 #include "ControlCommand.h"
16 #include "forms/form_bibitem.h"
17
18 #include "Tooltips.h"
19 #include "xformsBC.h"
20
21 #include "support/lstrings.h" // compare
22
23 #include "lyx_forms.h"
24
25 using lyx::support::compare;
26
27
28 typedef FormController<ControlCommand, FormView<FD_bibitem> > base_class;
29
30 FormBibitem::FormBibitem(Dialog & parent)
31         : base_class(parent, _("Bibliography Entry"))
32 {}
33
34
35 void FormBibitem::build()
36 {
37         dialog_.reset(build_bibitem(this));
38
39         fl_set_input_return(dialog_->input_key,   FL_RETURN_CHANGED);
40         fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
41
42         setPrehandler(dialog_->input_key);
43         setPrehandler(dialog_->input_label);
44
45         // Manage the ok, apply, restore and cancel/close buttons
46         bcview().setOK(dialog_->button_ok);
47         bcview().setCancel(dialog_->button_close);
48
49         bcview().addReadOnly(dialog_->input_key);
50         bcview().addReadOnly(dialog_->input_label);
51
52         // set up the tooltips
53         string str = _("Key used within LyX document.");
54         tooltips().init(dialog_->input_key, str);
55         str = _("Label used for final output.");
56         tooltips().init(dialog_->input_label, str);
57 }
58
59
60 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
61 {
62         // minimal validation
63         if (!compare(fl_get_input(dialog_->input_key), ""))
64                 return ButtonPolicy::SMI_NOOP;
65
66         return ButtonPolicy::SMI_VALID;
67 }
68
69
70 void FormBibitem::update()
71 {
72         fl_set_input(dialog_->input_key,
73                      controller().params().getContents().c_str());
74         fl_set_input(dialog_->input_label,
75                      controller().params().getOptions().c_str());
76 }
77
78
79 void FormBibitem::apply()
80 {
81         controller().params().setContents(fl_get_input(dialog_->input_key));
82         controller().params().setOptions(fl_get_input(dialog_->input_label));
83 }