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