]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormPreamble.C
Convert the preamble dialog to the Dialog-based scheme.
[lyx.git] / src / frontends / xforms / FormPreamble.C
1 /**
2  * \file FormPreamble.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FormPreamble.h"
14 #include "forms/form_preamble.h"
15
16 #include "controllers/ControlPreamble.h"
17
18 #include "xforms_helpers.h"
19 #include "xformsBC.h"
20
21 #include "lyx_forms.h"
22
23
24 typedef FormController<ControlPreamble, FormView<FD_preamble> > base_class;
25
26 FormPreamble::FormPreamble(Dialog & parent)
27         : base_class(parent, _("LaTeX Preamble"))
28 {}
29
30
31 void FormPreamble::build()
32 {
33         dialog_.reset(build_preamble(this));
34
35         // Manage the ok, apply and cancel/close buttons
36         bcview().setOK(dialog_->button_ok);
37         bcview().setApply(dialog_->button_apply);
38         bcview().setCancel(dialog_->button_close);
39
40         // trigger an input event for cut&paste with middle mouse button.
41         setPrehandler(dialog_->input_preamble);
42
43         // for activate ok/apply immediately upon input
44         fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED);
45 }
46
47
48 void FormPreamble::apply()
49 {
50         controller().params(getString(dialog_->input_preamble));
51 }
52
53
54 void FormPreamble::update()
55 {
56         fl_set_input(dialog_->input_preamble, controller().params().c_str());
57 }