]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsSpace.C
controller-view split of FormLog and FormVCLog.
[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 "form_maths_space.h"
20
21 extern char * latex_mathspace[];
22
23 FormMathsSpace::FormMathsSpace(LyXView * lv, Dialogs * d,
24                                FormMathsPanel const & p)
25         : FormMathsSub(lv, d, p, _("Maths Spacing")),
26           space_(-1)
27 {}
28
29
30 FL_FORM * FormMathsSpace::form() const
31 {
32         if (dialog_.get())
33                 return dialog_->form;
34         return 0;
35 }
36
37
38 void FormMathsSpace::build()
39 {
40         dialog_.reset(build_maths_space());
41
42         fl_set_button(dialog_->radio_thin, 1);
43
44         bc().setOK(dialog_->button_ok);
45         bc().setApply(dialog_->button_apply);
46         bc().setCancel(dialog_->button_cancel);
47
48         bc().addReadOnly(dialog_->radio_thin);
49         bc().addReadOnly(dialog_->radio_medium);
50         bc().addReadOnly(dialog_->radio_thick);
51         bc().addReadOnly(dialog_->radio_negative);
52         bc().addReadOnly(dialog_->radio_quadratin);
53         bc().addReadOnly(dialog_->radio_twoquadratin);
54
55         bc().refresh();
56 }
57
58
59 void FormMathsSpace::apply()
60 {
61         if (space_ > 0)
62                 parent_.insertSymbol(latex_mathspace[space_]);
63 }
64
65 bool FormMathsSpace::input(FL_OBJECT *, long data)
66 {
67         space_ = -1;
68  
69         if (data >= 0 && data < 6) {
70                 space_ = short(data);
71         }
72         return true;
73 }