]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsPanel.C
Change the semantics of 'none' and 'auto' viewers/editors: 'none' means now
[lyx.git] / src / frontends / xforms / FormMathsPanel.C
1 /**
2  * \file FormMathsPanel.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 #include "FormMathsPanel.h"
17 #include "ControlMath.h"
18 #include "forms/form_maths_panel.h"
19
20 #include "xformsBC.h"
21
22 #include "lyx_forms.h"
23
24 #include "deco.xpm"
25 #include "delim.xpm"
26 #include "equation.xpm"
27 #include "frac-square.xpm"
28 #include "matrix.xpm"
29 #include "space.xpm"
30 #include "style.xpm"
31 #include "sqrt-square.xpm"
32 #include "sub.xpm"
33 #include "super.xpm"
34
35 namespace lyx {
36 namespace frontend {
37
38 typedef FormController<ControlMath, FormView<FD_maths_panel> > base_class;
39
40 FormMathsPanel::FormMathsPanel(Dialog & parent)
41         : base_class(parent, _("Math Panel"))
42 {}
43
44
45 void FormMathsPanel::build()
46 {
47         dialog_.reset(build_maths_panel(this));
48
49         for (int i = 0; i < nr_function_names; ++i)
50                 fl_add_browser_line(dialog_->browser_funcs,
51                                     function_names[i]);
52
53         fl_set_pixmap_data(dialog_->button_sqrt,
54                            const_cast<char**>(sqrt_xpm));
55         fl_set_pixmap_data(dialog_->button_frac,
56                            const_cast<char**>(frac));
57         fl_set_pixmap_data(dialog_->button_super,
58                            const_cast<char**>(super_xpm));
59         fl_set_pixmap_data(dialog_->button_sub,
60                            const_cast<char**>(sub_xpm));
61         fl_set_pixmap_data(dialog_->button_delim,
62                            const_cast<char**>(delim));
63         fl_set_pixmap_data(dialog_->button_deco,
64                            const_cast<char**>(deco));
65         fl_set_pixmap_data(dialog_->button_space,
66                            const_cast<char**>(space_xpm));
67         fl_set_pixmap_data(dialog_->button_style,
68                            const_cast<char**>(style_xpm));
69         fl_set_pixmap_data(dialog_->button_matrix,
70                            const_cast<char**>(matrix));
71         fl_set_pixmap_data(dialog_->button_equation,
72                            const_cast<char**>(equation));
73 }
74
75
76 ButtonPolicy::SMInput FormMathsPanel::input(FL_OBJECT * ob, long)
77 {
78         if (ob == dialog_->button_arrow) {
79                 controller().showDialog("matharrows");
80         } else if (ob == dialog_->button_deco) {
81                 controller().showDialog("mathaccents");
82         } else if (ob == dialog_->button_boperator) {
83                 controller().showDialog("mathoperators");
84         } else if (ob == dialog_->button_brelats) {
85                 controller().showDialog("mathrelations");
86         } else if (ob == dialog_->button_greek) {
87                 controller().showDialog("mathgreek");
88         } else if (ob == dialog_->button_misc) {
89                 controller().showDialog("mathmisc");
90         } else if (ob == dialog_->button_dots) {
91                 controller().showDialog("mathdots");
92         } else if (ob == dialog_->button_varsize) {
93                 controller().showDialog("mathbigoperators");
94         } else if (ob == dialog_->button_ams_misc) {
95                 controller().showDialog("mathamsmisc");
96         } else if (ob == dialog_->button_ams_arrows) {
97                 controller().showDialog("mathamsarrows");
98         } else if (ob == dialog_->button_ams_brel) {
99                 controller().showDialog("mathamsrelations");
100         } else if (ob == dialog_->button_ams_nrel) {
101                 controller().showDialog("mathamsnegatedrelations");
102         } else if (ob == dialog_->button_ams_ops) {
103                 controller().showDialog("mathamsoperators");
104         } else if (ob == dialog_->button_delim) {
105                 controller().showDialog("mathdelimiter");
106         } else if (ob == dialog_->button_matrix) {
107                 controller().showDialog("mathmatrix");
108         } else if (ob == dialog_->button_space) {
109                 controller().showDialog("mathspace");
110         } else if (ob == dialog_->button_style) {
111                 controller().showDialog("mathstyle");
112
113         } else if (ob == dialog_->button_super) {
114                 controller().dispatchSuperscript();
115
116         } else if (ob == dialog_->button_sub) {
117                 controller().dispatchSubscript();
118
119         } else if (ob == dialog_->button_equation) {
120                 controller().dispatchToggleDisplay();
121
122         } else if (ob == dialog_->button_frac) {
123                 controller().dispatchInsert("frac");
124
125         } else if (ob == dialog_->button_sqrt) {
126                 controller().dispatchInsert("sqrt");
127
128         } else if (ob == dialog_->browser_funcs) {
129                 int const i = fl_get_browser(dialog_->browser_funcs) - 1;
130                 controller().dispatchInsert(function_names[i]);
131         }
132
133         return ButtonPolicy::SMI_VALID;
134 }
135
136 } // namespace frontend
137 } // namespace lyx