]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibtex.C
implement getLabelList
[lyx.git] / src / frontends / xforms / FormBibtex.C
1 /**
2  * \file FormBibtex.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Angus Leeming
7  * \author John Levon
8  */
9
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <config.h>
15 #include "xformsBC.h"
16 #include "ControlBibtex.h"
17 #include "FormBibtex.h"
18 #include "form_bibtex.h"
19 #include "gettext.h"
20 #include "debug.h"
21
22 typedef FormCB<ControlBibtex, FormDB<FD_form_bibtex> > base_class;
23
24 FormBibtex::FormBibtex(ControlBibtex & c)
25         : base_class(c, _("BibTeX Database"))
26 {}
27
28
29 void FormBibtex::build()
30 {
31         dialog_.reset(build_bibtex());
32
33         fl_set_input_return(dialog_->database, FL_RETURN_CHANGED);
34         fl_set_input_return(dialog_->style, FL_RETURN_CHANGED);
35
36         // Manage the ok, apply, restore and cancel/close buttons
37         bc().setOK(dialog_->button_ok);
38         bc().setCancel(dialog_->button_cancel);
39
40         bc().addReadOnly(dialog_->database);
41         bc().addReadOnly(dialog_->style);
42 }
43
44
45 ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT *, long)
46 {
47         // minimal validation 
48         if (!compare(fl_get_input(dialog_->database),""))
49                 return ButtonPolicy::SMI_NOOP;
50
51         return ButtonPolicy::SMI_VALID;
52 }
53
54
55 void FormBibtex::update()
56 {
57         fl_set_input(dialog_->database,
58                      controller().params().getContents().c_str());
59         fl_set_input(dialog_->style,
60                      controller().params().getOptions().c_str());
61 }
62
63
64 void FormBibtex::apply()
65 {
66         controller().params().setContents(fl_get_input(dialog_->database));
67         controller().params().setOptions(fl_get_input(dialog_->style));
68 }