]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsDeco.C
use latex_deco
[lyx.git] / src / frontends / xforms / FormMathsDeco.C
1 /**
2  * \file FormMathsDeco.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 "FormMathsDeco.h"
21 #include "forms/form_maths_deco.h"
22 #include "bmtable.h"
23 #include FORMS_H_LOCATION
24
25 #include "deco.xbm"
26
27
28 FormMathsDeco::FormMathsDeco(LyXView & lv, Dialogs & d,
29                              FormMathsPanel const & p)
30         : FormMathsSub(lv, d, p, _("Maths Decorations & Accents"), false)
31 {}
32
33
34 FL_FORM * FormMathsDeco::form() const
35 {
36         if (dialog_.get())
37                 return dialog_->form;
38         return 0;
39 }
40
41
42 void FormMathsDeco::build()
43 {
44         dialog_.reset(build_maths_deco(this));
45
46         fl_set_bmtable_data(dialog_->bmtable_deco1, 3, 4,
47                             deco1_width, deco1_height, deco1_bits);
48         fl_set_bmtable_maxitems(dialog_->bmtable_deco1, 12);
49
50         fl_set_bmtable_data(dialog_->bmtable_deco2, 4, 3,
51                             deco2_width, deco2_height, deco2_bits);
52         fl_set_bmtable_maxitems(dialog_->bmtable_deco2, 10);
53
54         bc().setCancel(dialog_->button_close);
55         bc().addReadOnly(dialog_->bmtable_deco1);
56         bc().addReadOnly(dialog_->bmtable_deco2);
57 }
58
59
60 void FormMathsDeco::apply()
61 {
62         if (deco_ < nr_latex_deco)
63                 parent_.insertSymbol(latex_deco[deco_]);
64 }
65
66
67 bool FormMathsDeco::input(FL_OBJECT * ob, long)
68 {
69         deco_ = fl_get_bmtable(ob);
70         if (deco_ < 0)
71                 return false;
72         //if (ob == dialog_->bmtable_deco1)
73         //      deco_ += 0;
74         if (ob == dialog_->bmtable_deco2)
75                 deco_ += 12;
76         apply();
77         return true;
78 }