]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsSpace.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / FormMathsSpace.C
1 /**
2  * \file FormMathsSpace.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Pablo De Napoli
8  * \author John Levon
9  * \author Angus Leeming
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "FormMathsSpace.h"
17 #include "forms/form_maths_space.h"
18 #include "ControlMath.h"
19 #include "xformsBC.h"
20
21 #include "lyx_forms.h"
22
23 extern char * latex_mathspace[];
24
25 namespace lyx {
26 namespace frontend {
27
28 typedef FormController<ControlMath, FormView<FD_maths_space> > base_class;
29
30 FormMathsSpace::FormMathsSpace(Dialog & parent)
31         : base_class(parent, _("Math Spacing"), false),
32           space_(-1)
33 {}
34
35
36 void FormMathsSpace::build()
37 {
38         dialog_.reset(build_maths_space(this));
39
40         space_ = -1;
41
42         bcview().setCancel(dialog_->button_close);
43
44         bcview().addReadOnly(dialog_->button_negative);
45         bcview().addReadOnly(dialog_->button_negmedspace);
46         bcview().addReadOnly(dialog_->button_negthickspace);
47         bcview().addReadOnly(dialog_->button_thin);
48         bcview().addReadOnly(dialog_->button_medium);
49         bcview().addReadOnly(dialog_->button_thick);
50         bcview().addReadOnly(dialog_->button_quadratin);
51         bcview().addReadOnly(dialog_->button_twoquadratin);
52 }
53
54
55 void FormMathsSpace::apply()
56 {
57         if (space_ >= 0)
58                 controller().dispatchInsert(latex_mathspace[space_]);
59 }
60
61 ButtonPolicy::SMInput FormMathsSpace::input(FL_OBJECT *, long data)
62 {
63         space_ = -1;
64
65         if (data >= 0 && data < 8) {
66                 space_ = short(data);
67                 apply();
68         }
69         return ButtonPolicy::SMI_VALID;
70 }
71
72 } // namespace frontend
73 } // namespace lyx