]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
remove cruft
[lyx.git] / src / mathed / math_inset.C
1 /*
2  *  File:        math_inset.C
3  *  Purpose:     Implementation of insets for mathed
4  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
5  *  Created:     January 1996
6  *  Description: 
7  *
8  *  Dependencies: Xlib, XForms
9  *
10  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
11  *
12  *   Version: 0.8beta.
13  *
14  *   You are free to use and modify this code under the terms of
15  *   the GNU General Public Licence version 2 or later.
16  */
17
18 #include <config.h>
19
20 #ifdef __GNUG__
21 #pragma implementation
22 #endif
23
24 #include "math_iter.h"
25 #include "math_inset.h"
26 #include "symbol_def.h"
27 #include "lyxfont.h"
28 #include "mathed/support.h"
29 #include "Painter.h"
30
31 int MathedInset::df_asc;
32 int MathedInset::df_des;
33 int MathedInset::df_width;
34 int MathedInset::workWidth;
35
36
37 MathedInset::MathedInset(MathedInset * inset) 
38 {
39    if (inset) {
40       name = inset->GetName();
41       objtype = inset->GetType();
42       size = inset->GetStyle();
43       width = inset->Width();
44       ascent = inset->Ascent();
45       descent = inset->Descent();
46    } else {
47       objtype = LM_OT_UNDEF;
48       size = LM_ST_TEXT;
49       width = ascent = descent = 0;
50       //name = 0;
51    }
52 }
53
54
55 MathedInset::MathedInset(string const & nm, short ot, short st):
56   name(nm), objtype(ot), size(st) 
57 {
58    width = ascent = descent = 0;
59 }
60
61
62 // In a near future maybe we use a better fonts renderer
63 void MathedInset::drawStr(Painter & pain, short type, int siz,
64                           int x, int y, string const & s)
65 {
66         string st;
67         if (MathIsBinary(type))
68                 for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
69                         st += ' ';
70                         st += *it;
71                         st += ' ';
72                 }
73         else
74                 st = s;
75
76         LyXFont const mf = mathed_get_font(type, siz);
77         pain.text(x, y, st, mf);
78 }
79