4 * Copyright 2001 The LyX Team.
5 * See the file COPYING.
7 * \author Edwin Leuven, leuven@fee.uva.nl
13 #pragma implementation
17 #include "ControlPreamble.h"
18 #include "FormPreamble.h"
19 #include "form_preamble.h"
20 #include "xforms_helpers.h"
22 typedef FormCB<ControlPreamble, FormDB<FD_form_preamble> > base_class;
24 FormPreamble::FormPreamble(ControlPreamble & c)
25 : base_class(c, _("LaTeX preamble"))
29 void FormPreamble::build()
31 dialog_.reset(build_preamble());
33 fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED);
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);
43 void FormPreamble::apply()
45 controller().params() = fl_get_input(dialog_->input_preamble);
49 void FormPreamble::update()
51 fl_set_input(dialog_->input_preamble, controller().params().c_str());
53 bool const enable = (!controller().isReadonly());
54 setEnabled(dialog_->input_preamble, enable);
55 setEnabled(dialog_->button_ok, enable);
56 setEnabled(dialog_->button_apply, enable);