]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsDeco.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormMathsDeco.C
1 /**
2  * \file FormMathsDeco.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 "FormMathsDeco.h"
19 #include "form_maths_deco.h"
20 #include "Dialogs.h"
21 #include "bmtable.h"
22
23 #include "deco.xbm"
24
25
26 static char const * decoration_names[] = {
27         "widehat", "widetilde", "overbrace", "overleftarrow", "overrightarrow", 
28         "overline", "underbrace", "underline"
29 };
30
31
32 static int const nr_decoration_names = sizeof(decoration_names) / sizeof(char const *);
33  
34 FormMathsDeco::FormMathsDeco(LyXView * lv, Dialogs * d,
35                              FormMathsPanel const & p)
36         : FormMathsSub(lv, d, p, _("Maths Decorations"), false)
37 {}
38
39
40 FL_FORM * FormMathsDeco::form() const
41 {
42         if (dialog_.get())
43                 return dialog_->form;
44         return 0;
45 }
46
47
48 void FormMathsDeco::build()
49 {
50         dialog_.reset(build_maths_deco());
51
52         fl_set_bmtable_data(dialog_->bmtable, 3, 3,
53                             deco_width, deco_height, deco_bits);
54         fl_set_bmtable_maxitems(dialog_->bmtable, 8);
55
56         bc().setCancel(dialog_->button_cancel);
57         bc().addReadOnly(dialog_->bmtable);
58 }
59
60
61 void FormMathsDeco::apply()
62 {
63         int const i = fl_get_bmtable(dialog_->bmtable);
64  
65         if (i >= nr_decoration_names)
66                 return;
67  
68         parent_.insertSymbol(decoration_names[i]);
69 }