-
#include <config.h>
#include "math_support.h"
#include "lyxfont.h"
-#include "math_cursor.h"
#include "math_inset.h"
#include "math_parser.h"
#include "metricsinfo.h"
+#include "math_data.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
#include "frontends/lyx_gui.h"
#include "debug.h"
#include "lfuns.h"
#include "dimension.h"
+#include "Lsstream.h"
+#include "math_mathmlstream.h"
#include <map>
using std::max;
+using std::endl;
///
void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
{
- dim.d = font_metrics::descent(c, font);
- dim.a = font_metrics::ascent(c, font);
- dim.w = mathed_char_width(font, c);
+ dim.des = font_metrics::descent(c, font);
+ dim.asc = font_metrics::ascent(c, font);
+ dim.wid = mathed_char_width(font, c);
}
void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim)
{
#if 1
- dim.a = 0;
- dim.d = 0;
+ dim.asc = 0;
+ dim.des = 0;
for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
- dim.a = max(dim.a, font_metrics::ascent(*it, font));
- dim.d = max(dim.d, font_metrics::descent(*it, font));
+ dim.asc = max(dim.asc, font_metrics::ascent(*it, font));
+ dim.des = max(dim.des, font_metrics::descent(*it, font));
}
#else
- dim.a = font_metrics::maxAscent(font);
- dim.d = font_metrics::maxDescent(font);
+ dim.asc = font_metrics::maxAscent(font);
+ dim.des = font_metrics::maxDescent(font);
#endif
- dim.w = font_metrics::width(s, font);
+ dim.wid = font_metrics::width(s, font);
}
void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
- const string & name)
+ string const & name)
{
if (name == ".") {
pi.pain.line(x + w/2, y, x + w/2, y + h,
deco_struct const * mds = search_deco(name);
if (!mds) {
- lyxerr << "Deco was not found. Programming error?\n";
- lyxerr << "name: '" << name << "'\n";
+ lyxerr << "Deco was not found. Programming error?" << endl;
+ lyxerr << "name: '" << name << "'" << endl;
return;
}
}
-void mathed_draw_framebox(PainterInfo & pi, int x, int y, MathInset const * p)
-{
- if (mathcursor && mathcursor->isInside(p))
- pi.pain.rectangle(x, y - p->ascent(), p->width(), p->height(),
- LColor::mathframe);
-}
-
-
// In the future maybe we use a better fonts renderer
void drawStr(PainterInfo & pi, LyXFont const & font,
int x, int y, string const & str)
fontinfo * lookupFont(string const & name)
{
- //lyxerr << "searching font '" << name << "'\n";
+ //lyxerr << "searching font '" << name << "'" << endl;
int const n = sizeof(fontinfos) / sizeof(fontinfo);
for (int i = 0; i < n; ++i)
if (fontinfos[i].cmd_ == name) {
- //lyxerr << "found '" << i << "'\n";
+ //lyxerr << "found '" << i << "'" << endl;
return fontinfos + i;
}
return 0;
forig->shape_ = ffake->shape_;
forig->color_ = ffake->color_;
} else {
- lyxerr << "Can't fake font '" << orig << "' with '" << fake << "'\n";
+ lyxerr << "Can't fake font '" << orig << "' with '"
+ << fake << "'" << endl;
}
}
if (info->color_ != LColor::none)
font.setColor(info->color_);
}
+
+
+string asString(MathArray const & ar)
+{
+ std::ostringstream os;
+ WriteStream ws(os);
+ ws << ar;
+ return STRCONV(os.str());
+}
+
+
+void asArray(string const & str, MathArray & ar)
+{
+ mathed_parse_cell(ar, str);
+}