]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsSpace.C
xforms clean-up, described in detail in my mail of 31 May. See
[lyx.git] / src / frontends / xforms / FormMathsSpace.C
1 /**
2  * \file FormMathsSpace.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Pablo De Napoli, pdenapo@dm.uba.ar
8  * \author John Levon, moz@compsoc.man.ac.uk
9  * \author Angus Leeming, a.leeming@ic.ac.uk
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "FormMathsSpace.h"
19 #include "forms/form_maths_space.h"
20 #include FORMS_H_LOCATION
21
22 extern char * latex_mathspace[];
23
24 FormMathsSpace::FormMathsSpace(LyXView * lv, Dialogs * d,
25                                FormMathsPanel const & p)
26         : FormMathsSub(lv, d, p, _("Maths Spacing"), false),
27           space_(-1)
28 {}
29
30
31 FL_FORM * FormMathsSpace::form() const
32 {
33         if (dialog_.get())
34                 return dialog_->form;
35         return 0;
36 }
37
38
39 void FormMathsSpace::build()
40 {
41         dialog_.reset(build_maths_space(this));
42
43         space_ = -1;
44
45         bc().setCancel(dialog_->button_close);
46
47         bc().addReadOnly(dialog_->button_thin);
48         bc().addReadOnly(dialog_->button_medium);
49         bc().addReadOnly(dialog_->button_thick);
50         bc().addReadOnly(dialog_->button_negative);
51         bc().addReadOnly(dialog_->button_quadratin);
52         bc().addReadOnly(dialog_->button_twoquadratin);
53 }
54
55
56 void FormMathsSpace::apply()
57 {
58         if (space_ >= 0)
59                 parent_.insertSymbol(latex_mathspace[space_]);
60 }
61
62 bool FormMathsSpace::input(FL_OBJECT *, long data)
63 {
64         space_ = -1;
65
66         if (data >= 0 && data < 6) {
67                 space_ = short(data);
68                 apply();
69         }
70         return true;
71 }