3 * Purpose: Implementation of insets for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
21 #pragma implementation
25 #include "math_iter.h"
26 #include "math_inset.h"
27 #include "symbol_def.h"
29 #include "mathed/support.h"
33 // Initialize some static class variables.
34 int MathedInset::df_asc;
35 int MathedInset::df_des;
36 int MathedInset::df_width;
37 int MathedInset::workWidth;
40 MathedInset::MathedInset(string const & nm, short ot, short st)
41 : name(nm), objtype(ot), width(0), ascent(0), descent(0),
46 // In a near future maybe we use a better fonts renderer
47 void MathedInset::drawStr(Painter & pain, short type, int siz,
48 int x, int y, string const & s)
51 if (MathIsBinary(type))
52 for (string::const_iterator it = s.begin();
53 it != s.end(); ++it) {
61 LyXFont const mf = mathed_get_font(type, siz);
62 pain.text(x, y, st, mf);
65 void MathedInset::substitute(MathMacro *)
70 int MathedInset::Ascent() const
76 int MathedInset::Descent() const
82 int MathedInset::Width() const
88 int MathedInset::Height() const
90 return ascent + descent;
94 bool MathedInset::GetLimits() const
100 void MathedInset::SetLimits(bool) {}
103 string const & MathedInset::GetName() const
109 short MathedInset::GetType() const
115 short MathedInset::GetStyle() const
121 void MathedInset::SetType(short t)
127 void MathedInset::SetStyle(short st)
133 void MathedInset::SetName(string const & n)
139 void MathedInset::defaultAscent(int da)
146 void MathedInset::defaultDescent(int dd)
152 void MathedInset::defaultWidth(int dw)
158 short MathedInset::size() const
164 void MathedInset::size(short s)
169 void MathedInset::incSize()