]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormPreamble.C
Added // -*- C++ -*- to the top of all files in controllers/ and xforms/
[lyx.git] / src / frontends / xforms / FormPreamble.C
1 // -*- C++ -*-
2 /**
3  * \file FormPreamble.C
4  * Copyright 2001 The LyX Team.
5  * See the file COPYING.
6  *
7  * \author Edwin Leuven, leuven@fee.uva.nl
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "xformsBC.h"
17 #include "ControlPreamble.h"
18 #include "FormPreamble.h"
19 #include "form_preamble.h"
20 #include "xforms_helpers.h"
21
22 typedef FormCB<ControlPreamble, FormDB<FD_form_preamble> > base_class;
23
24 FormPreamble::FormPreamble(ControlPreamble & c)
25         : base_class(c, _("LaTeX preamble"))
26 {}
27
28
29 void FormPreamble::build()
30 {
31         dialog_.reset(build_preamble());
32    
33         fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED);
34
35         // Manage the ok, apply and cancel/close buttons
36         bc().setOK(dialog_->button_ok);
37         bc().setApply(dialog_->button_apply);
38         bc().setCancel(dialog_->button_cancel);
39         bc().addReadOnly(dialog_->input_preamble);
40 }
41
42
43 void FormPreamble::apply()
44 {
45         controller().params() = fl_get_input(dialog_->input_preamble);
46 }
47
48
49 void FormPreamble::update()
50 {
51         fl_set_input(dialog_->input_preamble, controller().params().c_str());
52
53         bool const enable = (!controller().isReadonly());
54         setEnabled(dialog_->input_preamble, enable);
55         setEnabled(dialog_->button_ok,      enable);
56         setEnabled(dialog_->button_apply,   enable);
57 }
58
59