More unicode conversion

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15355 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-17 14:46:45 +00:00
parent 5ac136d708
commit 52bd213992
25 changed files with 191 additions and 197 deletions

View File

@ -699,7 +699,8 @@ void LCursor::insert(InsetBase * inset)
void LCursor::niceInsert(string const & t) void LCursor::niceInsert(string const & t)
{ {
MathArray ar; MathArray ar;
asArray(t, ar); // FIXME UNICODE
asArray(lyx::from_utf8(t), ar);
if (ar.size() == 1) if (ar.size() == 1)
niceInsert(ar[0]); niceInsert(ar[0]);
else else
@ -720,7 +721,8 @@ void LCursor::niceInsert(MathAtom const & t)
pushLeft(*nextInset()); pushLeft(*nextInset());
// We may not use niceInsert here (recursion) // We may not use niceInsert here (recursion)
MathArray ar; MathArray ar;
asArray(safe, ar); // FIXME UNICODE
asArray(lyx::from_utf8(safe), ar);
insert(ar); insert(ar);
} }
} }
@ -879,7 +881,8 @@ void LCursor::handleNest(MathAtom const & a, int c)
{ {
//lyxerr << "LCursor::handleNest: " << c << endl; //lyxerr << "LCursor::handleNest: " << c << endl;
MathAtom t = a; MathAtom t = a;
asArray(lyx::cap::grabAndEraseSelection(*this), t.nucleus()->cell(c)); // FIXME UNICODE
asArray(lyx::from_utf8(lyx::cap::grabAndEraseSelection(*this)), t.nucleus()->cell(c));
insert(t); insert(t);
posLeft(); posLeft();
pushLeft(*nextInset()); pushLeft(*nextInset());

View File

@ -159,20 +159,22 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
LyXFont msgFont(mi.base.font); LyXFont msgFont(mi.base.font);
msgFont.setFamily(LyXFont::SANS_FAMILY); msgFont.setFamily(LyXFont::SANS_FAMILY);
string const justname = onlyFilename(params_.filename); // FIXME UNICODE
docstring djust(justname.begin(), justname.end()); docstring const justname =
lyx::from_utf8(onlyFilename(params_.filename));
if (!justname.empty()) { if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE); msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
font_width = theFontMetrics(msgFont) font_width = theFontMetrics(msgFont)
.width(djust); .width(justname);
} }
string const msg = statusMessage(params_, loader_.status()); // FIXME UNICODE
docstring const msg =
lyx::from_utf8(statusMessage(params_, loader_.status()));
if (!msg.empty()) { if (!msg.empty()) {
docstring dmsg(msg.begin(), msg.end());
msgFont.setSize(LyXFont::SIZE_TINY); msgFont.setSize(LyXFont::SIZE_TINY);
font_width = std::max(font_width, font_width = std::max(font_width,
theFontMetrics(msgFont).width(dmsg)); theFontMetrics(msgFont).width(msg));
} }
dim.wid = std::max(50, font_width + 15); dim.wid = std::max(50, font_width + 15);

View File

@ -131,9 +131,9 @@ void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
LyXFont font(mi.base.font); LyXFont font(mi.base.font);
font.setFamily(LyXFont::SANS_FAMILY); font.setFamily(LyXFont::SANS_FAMILY);
font.setSize(LyXFont::SIZE_FOOTNOTE); font.setSize(LyXFont::SIZE_FOOTNOTE);
string stat = statusMessage(mi.base.bv, snippet_); // FIXME UNICODE
docstring dstat(stat.begin(), stat.end()); docstring const stat = lyx::from_utf8(statusMessage(mi.base.bv, snippet_));
dim.wid = 15 + theFontMetrics(font).width(dstat); dim.wid = 15 + theFontMetrics(font).width(stat);
} }
dim_ = dim; dim_ = dim;
@ -165,11 +165,11 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
font.setFamily(LyXFont::SANS_FAMILY); font.setFamily(LyXFont::SANS_FAMILY);
font.setSize(LyXFont::SIZE_FOOTNOTE); font.setSize(LyXFont::SIZE_FOOTNOTE);
string stat = statusMessage(pi.base.bv, snippet_); // FIXME UNICODE
docstring dstat(stat.begin(), stat.end()); docstring const stat = lyx::from_utf8(statusMessage(pi.base.bv, snippet_));
pi.pain.text(x + offset + 6, pi.pain.text(x + offset + 6,
y - theFontMetrics(font).maxAscent() - 4, y - theFontMetrics(font).maxAscent() - 4,
dstat, font); stat, font);
} }
} }

View File

@ -28,7 +28,8 @@ InsetMathComment::InsetMathComment()
InsetMathComment::InsetMathComment(string const & str) InsetMathComment::InsetMathComment(string const & str)
: InsetMathNest(1) : InsetMathNest(1)
{ {
asArray(str, cell(0)); // FIXME UNICODE
asArray(lyx::from_utf8(str), cell(0));
} }

View File

@ -41,13 +41,15 @@ auto_ptr<InsetBase> InsetMathExFunc::doClone() const
void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
{ {
mathed_string_dim(mi.base.font, name_, dim_); // FIXME UNICODE
mathed_string_dim(mi.base.font, lyx::from_utf8(name_), dim_);
} }
void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const
{ {
drawStrBlack(pi, x, y, name_); // FIXME UNICODE
drawStrBlack(pi, x, y, lyx::from_utf8(name_));
} }

View File

@ -51,18 +51,18 @@ void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const
dim_.width() - 2, dim_.height() - 2, LColor::foreground); dim_.width() - 2, dim_.height() - 2, LColor::foreground);
x += 5; x += 5;
drawStrBlack(pi, x, y, "["); drawStrBlack(pi, x, y, lyx::from_ascii("["));
x += w_; x += w_;
cell(0).draw(pi, x, y); cell(0).draw(pi, x, y);
x += cell(0).width(); x += cell(0).width();
drawStrBlack(pi, x, y, "]"); drawStrBlack(pi, x, y, lyx::from_ascii("]"));
x += w_ + 4; x += w_ + 4;
drawStrBlack(pi, x, y, "["); drawStrBlack(pi, x, y, lyx::from_ascii("["));
x += w_; x += w_;
cell(1).draw(pi, x, y); cell(1).draw(pi, x, y);
x += cell(1).width(); x += cell(1).width();
drawStrBlack(pi, x, y, "]"); drawStrBlack(pi, x, y, lyx::from_ascii("]"));
x += w_ + 4; x += w_ + 4;
cell(2).draw(pi, x, y); cell(2).draw(pi, x, y);

View File

@ -347,9 +347,8 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
for (row_type row = 0; row < nrows(); ++row) { for (row_type row = 0; row < nrows(); ++row) {
int const yy = y + rowinfo_[row].offset_; int const yy = y + rowinfo_[row].offset_;
FontSetChanger dummy(pi.base, "mathrm"); FontSetChanger dummy(pi.base, "mathrm");
string const nl = nicelabel(row); docstring const nl = nicelabel(row);
docstring const dnl(nl.begin(), nl.end()); pi.draw(xx, yy, nl);
pi.draw(xx, yy, dnl);
} }
} }
setPosCache(pi, x, y); setPosCache(pi, x, y);
@ -663,13 +662,14 @@ void InsetMathHull::delCol(col_type col)
} }
string InsetMathHull::nicelabel(row_type row) const docstring InsetMathHull::nicelabel(row_type row) const
{ {
if (nonum_[row]) if (nonum_[row])
return string(); return docstring();
if (label_[row].empty()) if (label_[row].empty())
return string("(#)"); return lyx::from_ascii("(#)");
return '(' + label_[row] + ')'; // FIXME UNICODE
return lyx::from_utf8('(' + label_[row] + ')');
} }
@ -980,7 +980,8 @@ void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func)
size_type pos = cur.cell().find_last(eq); size_type pos = cur.cell().find_last(eq);
MathArray ar; MathArray ar;
if (cur.inMathed() && cur.selection()) { if (cur.inMathed() && cur.selection()) {
asArray(grabAndEraseSelection(cur), ar); // FIXME UNICODE
asArray(lyx::from_utf8(grabAndEraseSelection(cur)), ar);
} else if (pos == cur.cell().size()) { } else if (pos == cur.cell().size()) {
ar = cur.cell(); ar = cur.cell();
lyxerr << "use whole cell: " << ar << endl; lyxerr << "use whole cell: " << ar << endl;

View File

@ -141,7 +141,7 @@ private:
/// ///
void footer_write(WriteStream &) const; void footer_write(WriteStream &) const;
/// ///
std::string nicelabel(row_type row) const; lyx::docstring nicelabel(row_type row) const;
/// ///
void doExtern(LCursor & cur, FuncRequest & func); void doExtern(LCursor & cur, FuncRequest & func);
/// ///

View File

@ -60,14 +60,17 @@ void MathMacro::cursorPos(CursorSlice const & sl, bool boundary, int & x,
void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
if (!MacroTable::globalMacros().has(name())) { if (!MacroTable::globalMacros().has(name())) {
mathed_string_dim(mi.base.font, "Unknown: " + name(), dim); mathed_string_dim(mi.base.font, lyx::from_utf8("Unknown: " + name()), dim);
} else if (editing(mi.base.bv)) { } else if (editing(mi.base.bv)) {
asArray(MacroTable::globalMacros().get(name()).def(), tmpl_); // FIXME UNICODE
asArray(lyx::from_utf8(MacroTable::globalMacros().get(name()).def()), tmpl_);
LyXFont font = mi.base.font; LyXFont font = mi.base.font;
augmentFont(font, "lyxtex"); augmentFont(font, "lyxtex");
tmpl_.metrics(mi, dim); tmpl_.metrics(mi, dim);
dim.wid += mathed_string_width(font, name()) + 10; // FIXME UNICODE
int ww = mathed_string_width(font, "#1: "); dim.wid += mathed_string_width(font, lyx::from_utf8(name())) + 10;
// FIXME UNICODE
int ww = mathed_string_width(font, lyx::from_ascii("#1: "));
for (idx_type i = 0; i < nargs(); ++i) { for (idx_type i = 0; i < nargs(); ++i) {
MathArray const & c = cell(i); MathArray const & c = cell(i);
c.metrics(mi); c.metrics(mi);
@ -86,18 +89,20 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
void MathMacro::draw(PainterInfo & pi, int x, int y) const void MathMacro::draw(PainterInfo & pi, int x, int y) const
{ {
if (!MacroTable::globalMacros().has(name())) { if (!MacroTable::globalMacros().has(name())) {
drawStrRed(pi, x, y, "Unknown: " + name()); // FIXME UNICODE
drawStrRed(pi, x, y, lyx::from_utf8("Unknown: " + name()));
} else if (editing(pi.base.bv)) { } else if (editing(pi.base.bv)) {
LyXFont font = pi.base.font; LyXFont font = pi.base.font;
augmentFont(font, "lyxtex"); augmentFont(font, "lyxtex");
int h = y - dim_.ascent() + 2 + tmpl_.ascent(); int h = y - dim_.ascent() + 2 + tmpl_.ascent();
docstring dn(name().begin(), name().end()); // FIXME UNICODE
docstring dn = lyx::from_utf8(name());
pi.pain.text(x + 3, h, dn, font); pi.pain.text(x + 3, h, dn, font);
int const w = mathed_string_width(font, name()); int const w = mathed_string_width(font, dn);
tmpl_.draw(pi, x + w + 12, h); tmpl_.draw(pi, x + w + 12, h);
h += tmpl_.descent(); h += tmpl_.descent();
Dimension ldim; Dimension ldim;
mathed_string_dim(font, "#1: ", ldim); mathed_string_dim(font, lyx::from_ascii("#1: "), ldim);
for (idx_type i = 0; i < nargs(); ++i) { for (idx_type i = 0; i < nargs(); ++i) {
MathArray const & c = cell(i); MathArray const & c = cell(i);
h += max(c.ascent(), ldim.asc) + 5; h += max(c.ascent(), ldim.asc) + 5;

View File

@ -50,18 +50,18 @@ void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
FontSetChanger dummy(pi.base, "textnormal"); FontSetChanger dummy(pi.base, "textnormal");
drawMarkers(pi, x, y); drawMarkers(pi, x, y);
drawStrBlack(pi, x, y, "["); drawStrBlack(pi, x, y, lyx::from_ascii("["));
x += w_; x += w_;
cell(0).draw(pi, x, y); cell(0).draw(pi, x, y);
x += cell(0).width(); x += cell(0).width();
drawStrBlack(pi, x, y, "]"); drawStrBlack(pi, x, y, lyx::from_ascii("]"));
x += w_ + 2; x += w_ + 2;
drawStrBlack(pi, x, y, "["); drawStrBlack(pi, x, y, lyx::from_ascii("["));
x += w_; x += w_;
cell(1).draw(pi, x, y); cell(1).draw(pi, x, y);
x += cell(1).width(); x += cell(1).width();
drawStrBlack(pi, x, y, "]"); drawStrBlack(pi, x, y, lyx::from_ascii("]"));
x += w_ + 2; x += w_ + 2;
cell(2).draw(pi, x, y); cell(2).draw(pi, x, y);

View File

@ -1114,9 +1114,9 @@ void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
} else if (cmd.button() == mouse_button::button2) { } else if (cmd.button() == mouse_button::button2) {
MathArray ar; MathArray ar;
if (cur.selection()) if (cur.selection())
asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar); asArray(bv.cursor().selectionAsString(false), ar);
else else
asArray(lyx::to_utf8(theSelection().get()), ar); asArray(theSelection().get(), ar);
cur.insert(ar); cur.insert(ar);
bv.mouseSetCursor(cur); bv.mouseSetCursor(cur);

View File

@ -34,14 +34,15 @@ auto_ptr<InsetBase> InsetMathNumber::doClone() const
void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
mathed_string_dim(mi.base.font, str_, dim); // FIXME UNICODE
mathed_string_dim(mi.base.font, lyx::from_utf8(str_), dim);
} }
void InsetMathNumber::draw(PainterInfo & pi, int x, int y) const void InsetMathNumber::draw(PainterInfo & pi, int x, int y) const
{ {
docstring const dstr(str_.begin(), str_.end()); // FIXME UNICODE
pi.draw(x, y, dstr); pi.draw(x, y, lyx::from_utf8(str_));
} }

View File

@ -34,14 +34,16 @@ auto_ptr<InsetBase> InsetMathString::doClone() const
void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
mathed_string_dim(mi.base.font, str_, dim); // FIXME UNICODE
mathed_string_dim(mi.base.font, lyx::from_utf8(str_), dim);
} }
void InsetMathString::draw(PainterInfo & pi, int x, int y) const void InsetMathString::draw(PainterInfo & pi, int x, int y) const
{ {
//lyxerr << "drawing '" << str_ << "' code: " << code_ << endl; //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
docstring dstr(str_.begin(), str_.end()); // FIXME UNICODE
docstring dstr = lyx::from_utf8(str_);
pi.draw(x, y, dstr); pi.draw(x, y, dstr);
} }

View File

@ -62,7 +62,8 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
int const em = mathed_char_width(mi.base.font, 'M'); int const em = mathed_char_width(mi.base.font, 'M');
FontSetChanger dummy(mi.base, sym_->inset.c_str()); FontSetChanger dummy(mi.base, sym_->inset.c_str());
mathed_string_dim(mi.base.font, sym_->draw, dim); // FIXME UNICODE
mathed_string_dim(mi.base.font, lyx::from_utf8(sym_->draw), dim);
// correct height for broken cmex and wasy font // correct height for broken cmex and wasy font
#if defined(__APPLE__) && defined(__GNUC__) #if defined(__APPLE__) && defined(__GNUC__)
if (sym_->inset == "cmex") { if (sym_->inset == "cmex") {
@ -110,9 +111,8 @@ void InsetMathSymbol::draw(PainterInfo & pi, int x, int y) const
x += static_cast<int>(0.0833*em+0.5); x += static_cast<int>(0.0833*em+0.5);
FontSetChanger dummy(pi.base, sym_->inset.c_str()); FontSetChanger dummy(pi.base, sym_->inset.c_str());
string const sym = sym_->draw; // FIXME UNICODE
docstring const dsym(sym.begin(), sym.end()); pi.draw(x, y - h_, lyx::from_utf8(sym_->draw));
pi.draw(x, y - h_, dsym);
} }

View File

@ -51,17 +51,19 @@ void InsetMathUnknown::normalize(NormalStream & os) const
void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
mathed_string_dim(mi.base.font, name_, dim); // FIXME UNICODE
mathed_string_dim(mi.base.font, lyx::from_utf8(name_), dim);
dim_ = dim; dim_ = dim;
} }
void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
{ {
// FIXME UNICODE
if (black_) if (black_)
drawStrBlack(pi, x, y, name_); drawStrBlack(pi, x, y, lyx::from_utf8(name_));
else else
drawStrRed(pi, x, y, name_); drawStrRed(pi, x, y, lyx::from_utf8(name_));
setPosCache(pi, x, y); setPosCache(pi, x, y);
} }

View File

@ -88,7 +88,7 @@ void InsetMathXYArrow::metrics(MetricsInfo & mi) const
target_ = mi.inset ? mi.inset->asXYMatrixInset() : 0; target_ = mi.inset ? mi.inset->asXYMatrixInset() : 0;
if (editing()) { if (editing()) {
int w = mathed_string_width(mi.base.font, "target: "); int w = mathed_string_width(mi.base.font, lyx::from_ascii("target: "));
width_ = w + max(cell(0).width(), cell(1).width()); width_ = w + max(cell(0).width(), cell(1).width());
ascent_ = cell(0).ascent(); ascent_ = cell(0).ascent();
descent_ = cell(0).descent() + cell(1).height() + 10; descent_ = cell(0).descent() + cell(1).height() + 10;

View File

@ -49,14 +49,15 @@ void MathMacroArgument::write(WriteStream & os) const
void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
mathed_string_dim(mi.base.font, str_, dim_); mathed_string_dim(mi.base.font, lyx::from_utf8(str_), dim_);
dim = dim_; dim = dim_;
} }
void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
{ {
drawStrRed(pi, x, y, str_); // FIXME UNICODE
drawStrRed(pi, x, y, lyx::from_utf8(str_));
setPosCache(pi, x, y); setPosCache(pi, x, y);
} }

View File

@ -45,7 +45,8 @@ MacroData::MacroData(string const & def, int numargs, string const & disp)
void MacroData::expand(vector<MathArray> const & args, MathArray & to) const void MacroData::expand(vector<MathArray> const & args, MathArray & to) const
{ {
InsetMathSqrt inset; // Hack. Any inset with a cell would do. InsetMathSqrt inset; // Hack. Any inset with a cell would do.
asArray(disp_.empty() ? def_ : disp_, inset.cell(0)); // FIXME UNICODE
asArray(lyx::from_utf8(disp_.empty() ? def_ : disp_), inset.cell(0));
//lyxerr << "MathData::expand: args: " << args << endl; //lyxerr << "MathData::expand: args: " << args << endl;
//lyxerr << "MathData::expand: ar: " << inset.cell(0) << endl; //lyxerr << "MathData::expand: ar: " << inset.cell(0) << endl;
for (DocIterator it = doc_iterator_begin(inset); it; it.forwardChar()) { for (DocIterator it = doc_iterator_begin(inset); it; it.forwardChar()) {

View File

@ -1220,7 +1220,8 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
// FIXME: This is swallowed in inline formulas // FIXME: This is swallowed in inline formulas
string label = parse_verbatim_item(); string label = parse_verbatim_item();
MathArray ar; MathArray ar;
asArray(label, ar); // FIXME UNICODE
asArray(lyx::from_utf8(label), ar);
if (grid.asHullInset()) { if (grid.asHullInset()) {
grid.asHullInset()->label(cellrow, label); grid.asHullInset()->label(cellrow, label);
} else { } else {

View File

@ -365,7 +365,7 @@ deco_struct const * search_deco(string const & name)
} // namespace anon } // namespace anon
void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim) void mathed_char_dim(LyXFont const & font, lyx::char_type c, Dimension & dim)
{ {
lyx::frontend::FontMetrics const & fm = theFontMetrics(font); lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
dim.des = fm.descent(c); dim.des = fm.descent(c);
@ -374,35 +374,28 @@ void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
} }
int mathed_char_width(LyXFont const & font, unsigned char c) int mathed_char_width(LyXFont const & font, lyx::char_type c)
{ {
return theFontMetrics(font).width(c); return theFontMetrics(font).width(c);
} }
void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim) void mathed_string_dim(LyXFont const & font, docstring const & s, Dimension & dim)
{ {
lyx::frontend::FontMetrics const & fm = theFontMetrics(font); lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
#if 1
dim.asc = 0; dim.asc = 0;
dim.des = 0; dim.des = 0;
for (string::const_iterator it = s.begin(); it != s.end(); ++it) { for (docstring::const_iterator it = s.begin(); it != s.end(); ++it) {
dim.asc = max(dim.asc, fm.ascent(*it)); dim.asc = max(dim.asc, fm.ascent(*it));
dim.des = max(dim.des, fm.descent(*it)); dim.des = max(dim.des, fm.descent(*it));
} }
#else dim.wid = fm.width(s);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
#endif
docstring ds(s.begin(), s.end());
dim.wid = fm.width(ds);
} }
int mathed_string_width(LyXFont const & font, string const & s) int mathed_string_width(LyXFont const & font, docstring const & s)
{ {
docstring ds(s.begin(), s.end()); return theFontMetrics(font).width(s);
return theFontMetrics(font).width(ds);
} }
@ -476,21 +469,19 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
} }
void drawStrRed(PainterInfo & pi, int x, int y, string const & str) void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
{ {
LyXFont f = pi.base.font; LyXFont f = pi.base.font;
f.setColor(LColor::latex); f.setColor(LColor::latex);
docstring dstr(str.begin(), str.end()); pi.pain.text(x, y, str, f);
pi.pain.text(x, y, dstr, f);
} }
void drawStrBlack(PainterInfo & pi, int x, int y, string const & str) void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str)
{ {
LyXFont f = pi.base.font; LyXFont f = pi.base.font;
f.setColor(LColor::foreground); f.setColor(LColor::foreground);
docstring dstr(str.begin(), str.end()); pi.pain.text(x, y, str, f);
pi.pain.text(x, y, dstr, f);
} }
@ -687,9 +678,9 @@ string asString(MathArray const & ar)
} }
void asArray(string const & str, MathArray & ar) void asArray(docstring const & str, MathArray & ar)
{ {
mathed_parse_cell(ar, str); mathed_parse_cell(ar, lyx::to_utf8(str));
} }

View File

@ -13,7 +13,7 @@
#ifndef MATH_SUPPORT_H #ifndef MATH_SUPPORT_H
#define MATH_SUPPORT_H #define MATH_SUPPORT_H
#include <string> #include "support/docstring.h"
class PainterInfo; class PainterInfo;
class LyXFont; class LyXFont;
@ -23,17 +23,17 @@ class MathAtom;
class InsetMath; class InsetMath;
void mathed_char_dim(LyXFont const &, unsigned char c, Dimension & dim); void mathed_char_dim(LyXFont const &, lyx::char_type c, Dimension & dim);
int mathed_char_width(LyXFont const &, unsigned char c); int mathed_char_width(LyXFont const &, lyx::char_type c);
void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
std::string const & name); std::string const & name);
void mathed_string_dim(LyXFont const & font, std::string const & s, Dimension & dim); void mathed_string_dim(LyXFont const & font, lyx::docstring const & s, Dimension & dim);
int mathed_string_width(LyXFont const &, std::string const & s); int mathed_string_width(LyXFont const &, lyx::docstring const & s);
void drawStrRed(PainterInfo & pi, int x, int y, std::string const & s); void drawStrRed(PainterInfo & pi, int x, int y, lyx::docstring const & s);
void drawStrBlack(PainterInfo & pi, int x, int y, std::string const & s); void drawStrBlack(PainterInfo & pi, int x, int y, lyx::docstring const & s);
void math_font_max_dim(LyXFont const &, int & asc, int & desc); void math_font_max_dim(LyXFont const &, int & asc, int & desc);
@ -47,6 +47,6 @@ std::string asString(MathArray const & ar);
std::string asString(InsetMath const &); std::string asString(InsetMath const &);
std::string asString(MathAtom const &); std::string asString(MathAtom const &);
// converts string to single cell // converts string to single cell
void asArray(std::string const & str, MathArray & ar); void asArray(lyx::docstring const & str, MathArray & ar);
#endif #endif

View File

@ -194,7 +194,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
{ {
pos_type pos = text_.bidi.vis2log(vpos); pos_type pos = text_.bidi.vis2log(vpos);
string str; docstring str;
// first char // first char
char_type c = par_.getChar(pos); char_type c = par_.getChar(pos);
@ -220,15 +220,15 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
} }
// Draw nikud // Draw nikud
docstring dstr(str.begin(), str.end()); // FIXME UNICODE
pain_.text(int(x_) + dx, yo_, dstr, font); pain_.text(int(x_) + dx, yo_, str, font);
} }
void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font) void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
{ {
pos_type pos = text_.bidi.vis2log(vpos); pos_type pos = text_.bidi.vis2log(vpos);
string str; docstring str;
// first char // first char
char_type c = par_.getChar(pos); char_type c = par_.getChar(pos);
@ -251,8 +251,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
} }
} }
// Draw nikud // Draw nikud
docstring dstr(str.begin(), str.end()); pain_.text(int(x_) + dx, yo_, str, font);
pain_.text(int(x_) + dx, yo_, dstr, font);
} }
@ -458,17 +457,17 @@ int RowPainter::paintAppendixStart(int y)
pb_font.setColor(LColor::appendix); pb_font.setColor(LColor::appendix);
pb_font.decSize(); pb_font.decSize();
string const label = lyx::to_utf8(_("Appendix"));
int w = 0; int w = 0;
int a = 0; int a = 0;
int d = 0; int d = 0;
docstring dlab(label.begin(), label.end());
theFontMetrics(pb_font).rectText(dlab, w, a, d); docstring const label = _("Appendix");
theFontMetrics(pb_font).rectText(label, w, a, d);
int const text_start = int(xo_ + (width_ - w) / 2); int const text_start = int(xo_ + (width_ - w) / 2);
int const text_end = text_start + w; int const text_end = text_start + w;
pain_.rectText(text_start, y + d, dlab, pb_font, LColor::none, LColor::none); pain_.rectText(text_start, y + d, label, pb_font, LColor::none, LColor::none);
pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix); pain_.line(int(xo_ + 1), y, text_start, y, LColor::appendix);
pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix); pain_.line(text_end, y, int(xo_ + width_ - 2), y, LColor::appendix);
@ -520,10 +519,10 @@ void RowPainter::paintFirst()
LyXFont const font = getLabelFont(); LyXFont const font = getLabelFont();
FontMetrics const & fm = theFontMetrics(font); FontMetrics const & fm = theFontMetrics(font);
string const str = par_.getLabelstring(); // FIXME UNICODE
docstring const str = lyx::from_utf8(par_.getLabelstring());
if (!str.empty()) { if (!str.empty()) {
double x = x_; double x = x_;
docstring dstr(str.begin(), str.end());
// this is special code for the chapter layout. This is // this is special code for the chapter layout. This is
// printed in an extra row and has a pagebreak at // printed in an extra row and has a pagebreak at
@ -543,22 +542,22 @@ void RowPainter::paintFirst()
if (is_rtl) { if (is_rtl) {
x = width_ - leftMargin() - x = width_ - leftMargin() -
fm.width(dstr); fm.width(str);
} }
pain_.text(int(x), yo_ - maxdesc - labeladdon, dstr, font); pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
} else { } else {
string lab = layout->labelsep; // FIXME UNICODE
docstring dlab(lab.begin(), lab.end()); docstring lab = lyx::from_utf8(layout->labelsep);
if (is_rtl) { if (is_rtl) {
x = width_ - leftMargin() x = width_ - leftMargin()
+ fm.width(dlab); + fm.width(lab);
} else { } else {
x = x_ - fm.width(dlab) x = x_ - fm.width(lab)
- fm.width(dstr); - fm.width(str);
} }
pain_.text(int(x), yo_, dstr, font); pain_.text(int(x), yo_, str, font);
} }
} }
@ -570,8 +569,7 @@ void RowPainter::paintFirst()
layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) { layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
LyXFont font = getLabelFont(); LyXFont font = getLabelFont();
if (!par_.getLabelstring().empty()) { if (!par_.getLabelstring().empty()) {
string const str = par_.getLabelstring(); docstring const str = lyx::from_utf8(par_.getLabelstring());
docstring dstr(str.begin(), str.end());
double spacing_val = 1.0; double spacing_val = 1.0;
if (!parparams.spacing().isDefault()) if (!parparams.spacing().isDefault())
spacing_val = parparams.spacing().getValue(); spacing_val = parparams.spacing().getValue();
@ -592,11 +590,11 @@ void RowPainter::paintFirst()
if (is_rtl) if (is_rtl)
x = leftMargin(); x = leftMargin();
x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2; x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
x -= fm.width(dstr) / 2; x -= fm.width(str) / 2;
} else if (is_rtl) { } else if (is_rtl) {
x = width_ - leftMargin() - fm.width(dstr); x = width_ - leftMargin() - fm.width(str);
} }
pain_.text(int(x), yo_ - maxdesc - labeladdon, dstr, font); pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
} }
} }
} }
@ -630,12 +628,12 @@ void RowPainter::paintLast()
case END_LABEL_STATIC: { case END_LABEL_STATIC: {
LyXFont font = getLabelFont(); LyXFont font = getLabelFont();
FontMetrics const & fm = theFontMetrics(font); FontMetrics const & fm = theFontMetrics(font);
string const & str = par_.layout()->endlabelstring(); // FIXME UNICODE
docstring dstr(str.begin(), str.end()); docstring const & str = lyx::from_utf8(par_.layout()->endlabelstring());
double const x = is_rtl ? double const x = is_rtl ?
x_ - fm.width(dstr) x_ - fm.width(str)
: - text_.rightMargin(par_) - row_.width(); : - text_.rightMargin(par_) - row_.width();
pain_.text(int(x), yo_, dstr, font); pain_.text(int(x), yo_, str, font);
break; break;
} }
@ -713,10 +711,9 @@ void RowPainter::paintText()
} }
if (body_pos > 0 && pos == body_pos - 1) { if (body_pos > 0 && pos == body_pos - 1) {
string lab = layout->labelsep; // FIXME UNICODE
docstring dlab(lab.begin(), lab.end()); int const lwidth = theFontMetrics(getLabelFont())
int const lwidth .width(lyx::from_utf8(layout->labelsep));
= theFontMetrics(getLabelFont()).width(dlab);
x_ += label_hfill_ + lwidth - width_pos; x_ += label_hfill_ + lwidth - width_pos;
} }

View File

@ -501,9 +501,9 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
if (isMainText()) if (isMainText())
l_margin += changebarMargin(); l_margin += changebarMargin();
string leftm = tclass.leftmargin(); // FIXME UNICODE
docstring dleft(leftm.begin(), leftm.end()); docstring leftm = lyx::from_utf8(tclass.leftmargin());
l_margin += theFontMetrics(params.getFont()).signedWidth(dleft); l_margin += theFontMetrics(params.getFont()).signedWidth(leftm);
if (par.getDepth() != 0) { if (par.getDepth() != 0) {
// find the next level paragraph // find the next level paragraph
@ -534,45 +534,41 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
switch (layout->margintype) { switch (layout->margintype) {
case MARGIN_DYNAMIC: case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty()) { if (!layout->leftmargin.empty()) {
string leftm = layout->leftmargin; // FIXME UNICODE
docstring dleft(leftm.begin(), leftm.end()); docstring leftm = lyx::from_utf8(layout->leftmargin);
l_margin += theFontMetrics(params.getFont()).signedWidth(dleft); l_margin += theFontMetrics(params.getFont()).signedWidth(leftm);
} }
if (!par.getLabelstring().empty()) { if (!par.getLabelstring().empty()) {
string labin = layout->labelindent; // FIXME UNICODE
docstring dlabin(labin.begin(), labin.end()); docstring labin = lyx::from_utf8(layout->labelindent);
l_margin += labelfont_metrics.signedWidth(dlabin); l_margin += labelfont_metrics.signedWidth(labin);
string labstr = par.getLabelstring(); docstring labstr = lyx::from_utf8(par.getLabelstring());
docstring dlabstr(labstr.begin(), labstr.end()); l_margin += labelfont_metrics.width(labstr);
l_margin += labelfont_metrics.width(dlabstr); docstring labsep = lyx::from_utf8(layout->labelsep);
string labsep = layout->labelsep; l_margin += labelfont_metrics.width(labsep);
docstring dlabsep(labsep.begin(), labsep.end());
l_margin += labelfont_metrics.width(dlabsep);
} }
break; break;
case MARGIN_MANUAL: { case MARGIN_MANUAL: {
string labin = layout->labelindent; // FIXME UNICODE
docstring dlabin(labin.begin(), labin.end()); docstring labin = lyx::from_utf8(layout->labelindent);
l_margin += labelfont_metrics.signedWidth(dlabin); l_margin += labelfont_metrics.signedWidth(labin);
// The width of an empty par, even with manual label, should be 0 // The width of an empty par, even with manual label, should be 0
if (!par.empty() && pos >= par.beginOfBody()) { if (!par.empty() && pos >= par.beginOfBody()) {
if (!par.getLabelWidthString().empty()) { if (!par.getLabelWidthString().empty()) {
string labstr = par.getLabelWidthString(); docstring labstr = lyx::from_utf8(par.getLabelWidthString());
docstring dlabstr(labstr.begin(), labstr.end()); l_margin += labelfont_metrics.width(labstr);
l_margin += labelfont_metrics.width(dlabstr); docstring labsep = lyx::from_utf8(layout->labelsep);
string labsep = layout->labelsep; l_margin += labelfont_metrics.width(labsep);
docstring dlabsep(labsep.begin(), labsep.end());
l_margin += labelfont_metrics.width(dlabsep);
} }
} }
break; break;
} }
case MARGIN_STATIC: { case MARGIN_STATIC: {
string leftm = layout->leftmargin; // FIXME UNICODE
docstring dleft(leftm.begin(), leftm.end()); docstring leftm = lyx::from_utf8(layout->leftmargin);
l_margin += theFontMetrics(params.getFont()).signedWidth(dleft) l_margin += theFontMetrics(params.getFont()).signedWidth(leftm)
* 4 / (par.getDepth() + 4); * 4 / (par.getDepth() + 4);
break; break;
} }
@ -580,13 +576,13 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
case MARGIN_FIRST_DYNAMIC: case MARGIN_FIRST_DYNAMIC:
if (layout->labeltype == LABEL_MANUAL) { if (layout->labeltype == LABEL_MANUAL) {
if (pos >= par.beginOfBody()) { if (pos >= par.beginOfBody()) {
string leftm = layout->leftmargin; // FIXME UNICODE
docstring dleft(leftm.begin(), leftm.end()); l_margin += labelfont_metrics.signedWidth(
l_margin += labelfont_metrics.signedWidth(dleft); lyx::from_utf8(layout->leftmargin));
} else { } else {
string labin = layout->labelindent; // FIXME UNICODE
docstring dlabin(labin.begin(), labin.end()); l_margin += labelfont_metrics.signedWidth(
l_margin += labelfont_metrics.signedWidth(dlabin); lyx::from_utf8(layout->labelindent));
} }
} else if (pos != 0 } else if (pos != 0
// Special case to fix problems with // Special case to fix problems with
@ -594,22 +590,15 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
|| (layout->labeltype == LABEL_STATIC || (layout->labeltype == LABEL_STATIC
&& layout->latextype == LATEX_ENVIRONMENT && layout->latextype == LATEX_ENVIRONMENT
&& !isFirstInSequence(pit, pars_))) { && !isFirstInSequence(pit, pars_))) {
string leftm = layout->leftmargin; // FIXME UNICODE
docstring dleft(leftm.begin(), leftm.end()); l_margin += labelfont_metrics.signedWidth(lyx::from_utf8(layout->leftmargin));
l_margin += labelfont_metrics.signedWidth(dleft);
} else if (layout->labeltype != LABEL_TOP_ENVIRONMENT } else if (layout->labeltype != LABEL_TOP_ENVIRONMENT
&& layout->labeltype != LABEL_BIBLIO && layout->labeltype != LABEL_BIBLIO
&& layout->labeltype != && layout->labeltype !=
LABEL_CENTERED_TOP_ENVIRONMENT) { LABEL_CENTERED_TOP_ENVIRONMENT) {
string labin = layout->labelindent; l_margin += labelfont_metrics.signedWidth(lyx::from_utf8(layout->labelindent));
docstring dlabin(labin.begin(), labin.end()); l_margin += labelfont_metrics.width(lyx::from_utf8(layout->labelsep));
l_margin += labelfont_metrics.signedWidth(dlabin); l_margin += labelfont_metrics.width(lyx::from_utf8(par.getLabelstring()));
string labsep = layout->labelsep;
docstring dlabsep(labsep.begin(), labsep.end());
l_margin += labelfont_metrics.width(dlabsep);
string labstr = par.getLabelstring();
docstring dlabstr(labstr.begin(), labstr.end());
l_margin += labelfont_metrics.width(dlabstr);
} }
break; break;
@ -665,7 +654,7 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
|| bv()->buffer()->params().paragraph_separation == || bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT)) BufferParams::PARSEP_INDENT))
{ {
docstring din(parindent.begin(), parindent.end()); docstring din = lyx::from_utf8(parindent);
l_margin += theFontMetrics(params.getFont()).signedWidth(din); l_margin += theFontMetrics(params.getFont()).signedWidth(din);
} }
@ -684,15 +673,13 @@ int LyXText::rightMargin(Paragraph const & par) const
BufferParams const & params = bv()->buffer()->params(); BufferParams const & params = bv()->buffer()->params();
LyXTextClass const & tclass = params.getLyXTextClass(); LyXTextClass const & tclass = params.getLyXTextClass();
string trmarg = tclass.rightmargin(); docstring trmarg = lyx::from_utf8(tclass.rightmargin());
docstring dtrmarg(trmarg.begin(), trmarg.end()); docstring lrmarg = lyx::from_utf8(par.layout()->rightmargin);
string lrmarg = par.layout()->rightmargin;
docstring dlrmarg(lrmarg.begin(), lrmarg.end());
FontMetrics const & fm = theFontMetrics(params.getFont()); FontMetrics const & fm = theFontMetrics(params.getFont());
int const r_margin = int const r_margin =
::rightMargin() ::rightMargin()
+ fm.signedWidth(dtrmarg) + fm.signedWidth(trmarg)
+ fm.signedWidth(dlrmarg) + fm.signedWidth(lrmarg)
* 4 / (par.getDepth() + 4); * 4 / (par.getDepth() + 4);
return r_margin; return r_margin;
@ -773,9 +760,8 @@ void LyXText::rowBreakPoint(pit_type const pit, Row & row) const
// add the auto-hfill from label end to the body // add the auto-hfill from label end to the body
if (body_pos && i == body_pos) { if (body_pos && i == body_pos) {
string lsep = layout->labelsep; docstring lsep = lyx::from_utf8(layout->labelsep);
docstring dlsep(lsep.begin(), lsep.end()); int add = fm.width(lsep);
int add = fm.width(dlsep);
if (par.isLineSeparator(i - 1)) if (par.isLineSeparator(i - 1))
add -= singleWidth(par, i - 1); add -= singleWidth(par, i - 1);
@ -848,8 +834,7 @@ void LyXText::setRowWidth(pit_type const pit, Row & row) const
pos_type const end = row.endpos(); pos_type const end = row.endpos();
Paragraph const & par = pars_[pit]; Paragraph const & par = pars_[pit];
string const & labelsep = par.layout()->labelsep; docstring const labelsep = lyx::from_utf8(par.layout()->labelsep);
docstring dlsep(labelsep.begin(), labelsep.end());
int w = leftMargin(pit, row.pos()); int w = leftMargin(pit, row.pos());
pos_type const body_pos = par.beginOfBody(); pos_type const body_pos = par.beginOfBody();
@ -861,7 +846,7 @@ void LyXText::setRowWidth(pit_type const pit, Row & row) const
FontIterator fi = FontIterator(*this, par, i); FontIterator fi = FontIterator(*this, par, i);
for ( ; i < end; ++i, ++fi) { for ( ; i < end; ++i, ++fi) {
if (body_pos > 0 && i == body_pos) { if (body_pos > 0 && i == body_pos) {
w += fm.width(dlsep); w += fm.width(labelsep);
if (par.isLineSeparator(i - 1)) if (par.isLineSeparator(i - 1))
w -= singleWidth(par, i - 1); w -= singleWidth(par, i - 1);
w = max(w, labelEnd(pit)); w = max(w, labelEnd(pit));
@ -872,7 +857,7 @@ void LyXText::setRowWidth(pit_type const pit, Row & row) const
} }
if (body_pos > 0 && body_pos >= end) { if (body_pos > 0 && body_pos >= end) {
w += fm.width(dlsep); w += fm.width(labelsep);
if (end > 0 && par.isLineSeparator(end - 1)) if (end > 0 && par.isLineSeparator(end - 1))
w -= singleWidth(par, end - 1); w -= singleWidth(par, end - 1);
w = max(w, labelEnd(pit)); w = max(w, labelEnd(pit));
@ -904,11 +889,10 @@ int LyXText::labelFill(Paragraph const & par, Row const & row) const
if (label.empty()) if (label.empty())
return 0; return 0;
docstring dlab(label.begin(), label.end());
FontMetrics const & fm = theFontMetrics(getLabelFont(par)); FontMetrics const & fm = theFontMetrics(getLabelFont(par));
return max(0, fm.width(dlab) - w); // FIXME UNICODE
return max(0, fm.width(lyx::from_utf8(label)) - w);
} }
@ -1393,9 +1377,8 @@ LyXText::computeRowMetrics(pit_type const pit, Row const & row) const
if (body_pos > 0 if (body_pos > 0
&& (body_pos > end || !par.isLineSeparator(body_pos - 1))) && (body_pos > end || !par.isLineSeparator(body_pos - 1)))
{ {
string lsep = layout->labelsep; docstring const lsep = lyx::from_utf8(layout->labelsep);
docstring dlsep(lsep.begin(), lsep.end()); result.x += theFontMetrics(getLabelFont(par)).width(lsep);
result.x += theFontMetrics(getLabelFont(par)).width(dlsep);
if (body_pos <= end) if (body_pos <= end)
result.x += result.label_hfill; result.x += result.label_hfill;
} }
@ -2313,9 +2296,9 @@ int LyXText::cursorX(CursorSlice const & sl, bool boundary) const
for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) { for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) {
pos_type pos = bidi.vis2log(vpos); pos_type pos = bidi.vis2log(vpos);
if (body_pos > 0 && pos == body_pos - 1) { if (body_pos > 0 && pos == body_pos - 1) {
string lsep = par.layout()->labelsep; // FIXME UNICODE
docstring dlsep(lsep.begin(), lsep.end()); docstring const lsep = lyx::from_utf8(par.layout()->labelsep);
x += m.label_hfill + labelfm.width(dlsep); x += m.label_hfill + labelfm.width(lsep);
if (par.isLineSeparator(body_pos - 1)) if (par.isLineSeparator(body_pos - 1))
x -= singleWidth(par, body_pos - 1); x -= singleWidth(par, body_pos - 1);
} }

View File

@ -812,9 +812,9 @@ pos_type LyXText::getColumnNearX(pit_type const pit,
c = bidi.vis2log(vc); c = bidi.vis2log(vc);
last_tmpx = tmpx; last_tmpx = tmpx;
if (body_pos > 0 && c == body_pos - 1) { if (body_pos > 0 && c == body_pos - 1) {
string lsep = layout->labelsep; // FIXME UNICODE
docstring dlsep(lsep.begin(), lsep.end()); docstring const lsep = lyx::from_utf8(layout->labelsep);
tmpx += r.label_hfill + fm.width(dlsep); tmpx += r.label_hfill + fm.width(lsep);
if (par.isLineSeparator(body_pos - 1)) if (par.isLineSeparator(body_pos - 1))
tmpx -= singleWidth(par, body_pos - 1); tmpx -= singleWidth(par, body_pos - 1);
} }

View File

@ -169,7 +169,8 @@ bool textUndoOrRedo(BufferView & bv,
// gained by storing just 'a few' paragraphs (most if not // gained by storing just 'a few' paragraphs (most if not
// all math inset cells have just one paragraph!) // all math inset cells have just one paragraph!)
//lyxerr << "undo.array=" << undo.array <<endl; //lyxerr << "undo.array=" << undo.array <<endl;
asArray(undo.array, dit.cell()); // FIXME UNICODE
asArray(lyx::from_utf8(undo.array), dit.cell());
} else { } else {
// Some finer machinery is needed here. // Some finer machinery is needed here.
LyXText * text = dit.text(); LyXText * text = dit.text();