3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
13 #pragma implementation
18 #include "ControlBibitem.h"
19 #include "FormBibitem.h"
21 #include "forms/form_bibitem.h"
22 #include FORMS_H_LOCATION
24 #include "support/lstrings.h" // compare
26 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
28 FormBibitem::FormBibitem()
29 : base_class(_("Bibliography Entry"))
33 void FormBibitem::build()
35 dialog_.reset(build_bibitem(this));
37 fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
38 fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
40 setPrehandler(dialog_->input_key);
41 setPrehandler(dialog_->input_label);
43 // Manage the ok, apply, restore and cancel/close buttons
44 bc().setOK(dialog_->button_ok);
45 bc().setCancel(dialog_->button_close);
47 bc().addReadOnly(dialog_->input_key);
48 bc().addReadOnly(dialog_->input_label);
50 // set up the tooltips
51 string str = _("Key used within LyX document.");
52 tooltips().init(dialog_->input_key, str);
53 str = _("Label used for final output.");
54 tooltips().init(dialog_->input_label, str);
58 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
61 if (!compare(fl_get_input(dialog_->input_key), ""))
62 return ButtonPolicy::SMI_NOOP;
64 return ButtonPolicy::SMI_VALID;
68 void FormBibitem::update()
70 fl_set_input(dialog_->input_key,
71 controller().params().getContents().c_str());
72 fl_set_input(dialog_->input_label,
73 controller().params().getOptions().c_str());
77 void FormBibitem::apply()
79 controller().params().setContents(fl_get_input(dialog_->input_key));
80 controller().params().setOptions(fl_get_input(dialog_->input_label));