]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsStyle.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormMathsStyle.C
1 /**
2  * \file FormMathsStyle.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  * Adapted from FormMathsSpace martin.vermeer@hut.fi
11  */
12
13 #include <config.h>
14
15 #ifdef __GNUG_
16 #pragma implementation
17 #endif
18
19 #include "FormMathsStyle.h"
20 #include "form_maths_style.h"
21
22 extern char * latex_mathstyle[];
23 extern kb_action latex_mathfontcmds[];
24
25 FormMathsStyle::FormMathsStyle(LyXView * lv, Dialogs * d,
26                                FormMathsPanel const & p)
27         : FormMathsSub(lv, d, p, _("Maths Styles & Fonts"), false),
28           style_(-1)
29 {}
30
31
32 FL_FORM * FormMathsStyle::form() const
33 {
34         if (dialog_.get())
35                 return dialog_->form;
36         return 0;
37 }
38
39
40 void FormMathsStyle::build()
41 {
42         dialog_.reset(build_maths_style());
43
44         fl_set_button(dialog_->radio_text, 1);
45         style_ = 1;
46
47         bc().setOK(dialog_->button_ok);
48         bc().setApply(dialog_->button_apply);
49         bc().setCancel(dialog_->button_cancel);
50
51         bc().addReadOnly(dialog_->radio_display);
52         bc().addReadOnly(dialog_->radio_text);
53         bc().addReadOnly(dialog_->radio_script);
54         bc().addReadOnly(dialog_->radio_scriptscript);
55         bc().addReadOnly(dialog_->radio_bold);
56         bc().addReadOnly(dialog_->radio_calligraphic);
57         bc().addReadOnly(dialog_->radio_roman);
58         bc().addReadOnly(dialog_->radio_typewriter);
59         bc().addReadOnly(dialog_->radio_sans);
60         bc().addReadOnly(dialog_->radio_italic);
61         bc().addReadOnly(dialog_->radio_bbbold);
62         bc().addReadOnly(dialog_->radio_fraktur);
63         bc().addReadOnly(dialog_->radio_textrm);
64         bc().addReadOnly(dialog_->radio_normal);
65 }
66
67
68 void FormMathsStyle::apply()
69 {
70         if ( (style_ >= 0) && (style_ < 4) )
71                 parent_.insertSymbol(latex_mathstyle[style_]);
72         else
73                 parent_.dispatchFunc(latex_mathfontcmds[style_ - 4]);
74 }
75
76 bool FormMathsStyle::input(FL_OBJECT *, long data)
77 {
78         style_ = -1;
79  
80         if (data >= 0 && data < 14) {
81                 style_ = short(data);
82         }
83         return true;
84 }