]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsSpace.C
second part of Martin's patch
[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 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "FormMathsSpace.h"
21 #include "forms/form_maths_space.h"
22 #include FORMS_H_LOCATION
23
24 extern char * latex_mathspace[];
25
26 FormMathsSpace::FormMathsSpace(LyXView & lv, Dialogs & d,
27                                FormMathsPanel const & p)
28         : FormMathsSub(lv, d, p, _("Maths Spacing"), false),
29           space_(-1)
30 {}
31
32
33 FL_FORM * FormMathsSpace::form() const
34 {
35         if (dialog_.get())
36                 return dialog_->form;
37         return 0;
38 }
39
40
41 void FormMathsSpace::build()
42 {
43         dialog_.reset(build_maths_space(this));
44
45         space_ = -1;
46
47         bc().setCancel(dialog_->button_close);
48
49         bc().addReadOnly(dialog_->button_negative);
50         bc().addReadOnly(dialog_->button_negmedspace);
51         bc().addReadOnly(dialog_->button_negthickspace);
52         bc().addReadOnly(dialog_->button_thin);
53         bc().addReadOnly(dialog_->button_medium);
54         bc().addReadOnly(dialog_->button_thick);
55         bc().addReadOnly(dialog_->button_quadratin);
56         bc().addReadOnly(dialog_->button_twoquadratin);
57 }
58
59
60 void FormMathsSpace::apply()
61 {
62         if (space_ >= 0)
63                 parent_.insertSymbol(latex_mathspace[space_]);
64 }
65
66 bool FormMathsSpace::input(FL_OBJECT *, long data)
67 {
68         space_ = -1;
69
70         if (data >= 0 && data < 8) {
71                 space_ = short(data);
72                 apply();
73         }
74         return true;
75 }