]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsSpace.C
Yet more dialog tweaking from Rob.
[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_thin);
50         bc().addReadOnly(dialog_->button_medium);
51         bc().addReadOnly(dialog_->button_thick);
52         bc().addReadOnly(dialog_->button_negative);
53         bc().addReadOnly(dialog_->button_quadratin);
54         bc().addReadOnly(dialog_->button_twoquadratin);
55 }
56
57
58 void FormMathsSpace::apply()
59 {
60         if (space_ >= 0)
61                 parent_.insertSymbol(latex_mathspace[space_]);
62 }
63
64 bool FormMathsSpace::input(FL_OBJECT *, long data)
65 {
66         space_ = -1;
67
68         if (data >= 0 && data < 6) {
69                 space_ = short(data);
70                 apply();
71         }
72         return true;
73 }