bool hasLayout = tclass.hasLayout(layoutname);
if (!hasLayout) {
- errorList.push_back(ErrorItem(lyx::to_utf8(_("Unknown layout")),
- bformat(lyx::to_utf8(_("Layout '%1$s' does not exist in textclass '%2$s'\nTrying to use the default instead.\n")),
- layoutname, tclass.name()), par.id(), 0, par.size()));
+ errorList.push_back(ErrorItem(_("Unknown layout"),
+ bformat(_("Layout '%1$s' does not exist in textclass '%2$s'\nTrying to use the default instead.\n"),
+ lyx::from_utf8(layoutname), lyx::from_utf8(tclass.name())), par.id(), 0, par.size()));
layoutname = tclass.defaultLayoutName();
}
par.insertInset(par.size(), inset, font, change);
else {
lex.eatLine();
- string line = lex.getString();
- errorList.push_back(ErrorItem(lyx::to_utf8(_("Unknown Inset")), line,
+ docstring line = lyx::from_utf8(lex.getString());
+ errorList.push_back(ErrorItem(_("Unknown Inset"), line,
par.id(), 0, par.size()));
}
} else if (token == "\\family") {
lyx::time_type ct;
is >> aid >> ct;
if (aid >= bp.author_map.size()) {
- errorList.push_back(ErrorItem(lyx::to_utf8(_("Change tracking error")),
- bformat(lyx::to_utf8(_("Unknown author index for insertion: %1$d\n")), aid),
+ errorList.push_back(ErrorItem(_("Change tracking error"),
+ bformat(_("Unknown author index for insertion: %1$d\n"), aid),
par.id(), 0, par.size()));
change = Change(Change::UNCHANGED);
lyx::time_type ct;
is >> aid >> ct;
if (aid >= bp.author_map.size()) {
- errorList.push_back(ErrorItem(lyx::to_utf8(_("Change tracking error")),
- bformat(lyx::to_utf8(_("Unknown author index for deletion: %1$d\n")), aid),
+ errorList.push_back(ErrorItem(_("Change tracking error"),
+ bformat(_("Unknown author index for deletion: %1$d\n"), aid),
par.id(), 0, par.size()));
change = Change(Change::UNCHANGED);
change = Change(Change::DELETED, bp.author_map[aid], ct);
} else {
lex.eatLine();
- errorList.push_back(ErrorItem(lyx::to_utf8(_("Unknown token")),
- bformat(lyx::to_utf8(_("Unknown token: %1$s %2$s\n")), token, lex.getString()),
+ errorList.push_back(ErrorItem(_("Unknown token"),
+ bformat(_("Unknown token: %1$s %2$s\n"), lyx::from_utf8(token),
+ lyx::from_utf8(lex.getString())),
par.id(), 0, par.size()));
}
}
int LyXText::rightMargin(Paragraph const & par) const
{
+ // FIXME: the correct way is to only call rightMargin() only
+ // within the main LyXText. The following test is thus bogus.
+ LyXText const & text = bv()->buffer()->text();
// We do not want rightmargins on inner texts.
- if (bv()->text() != this)
+ if (&text != this)
return 0;
BufferParams const & params = bv()->buffer()->params();
maxasc += int(layoutasc * 2 / (2 + pars_[pit].getDepth()));
maxdesc += int(layoutdesc * 2 / (2 + pars_[pit].getDepth()));
+ // FIXME: the correct way is to do the following is to move the
+ // following code in another method specially tailored for the
+ // main LyXText. The following test is thus bogus.
+ LyXText const & text = bv_owner->buffer()->text();
// Top and bottom margin of the document (only at top-level)
- if (bv_owner->text() == this) {
+ if (&text == this) {
if (pit == 0 && row.pos() == 0)
maxasc += 20;
if (pit + 1 == pit_type(pars_.size()) &&
if (cur.pos() == 0) {
static bool sent_space_message = false;
if (!sent_space_message) {
- cur.message(lyx::to_utf8(_("You cannot insert a space at the "
- "beginning of a paragraph. Please read the Tutorial.")));
+ cur.message(_("You cannot insert a space at the "
+ "beginning of a paragraph. Please read the Tutorial."));
sent_space_message = true;
}
return;
&& par.lookupChange(cur.pos() - 1) != Change::DELETED) {
static bool sent_space_message = false;
if (!sent_space_message) {
- cur.message(lyx::to_utf8(_("You cannot type two spaces this way. "
- "Please read the Tutorial.")));
+ cur.message(_("You cannot type two spaces this way. "
+ "Please read the Tutorial."));
sent_space_message = true;
}
return;
// avoid lyx::to_utf8(_(...)) re-entrance problem
string const s = font.stateText(&buf.params());
- os << bformat(lyx::to_utf8(_("Font: %1$s")), s);
+ os << lyx::to_utf8(bformat(_("Font: %1$s"), lyx::from_utf8(s)));
- // os << bformat(lyx::to_utf8(_("Font: %1$s")), font.stateText(&buf.params));
+ // os << lyx::to_utf8(bformat(_("Font: %1$s"), font.stateText(&buf.params)));
// The paragraph depth
int depth = cur.paragraph().getDepth();
if (depth > 0)
- os << bformat(lyx::to_utf8(_(", Depth: %1$d")), depth);
+ os << lyx::to_utf8(bformat(_(", Depth: %1$d"), depth));
// The paragraph spacing, but only if different from
// buffer spacing.
// sets cursor only within this LyXText
bool LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
{
+ BOOST_ASSERT(this == cur.text());
pit_type pit = getPitNearY(y);
int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent();
lyxerr[Debug::DEBUG]