int LyXText::workWidth(BufferView * bview, Inset * inset) const
{
Paragraph * par = 0;
- pos_type pos = 0;
-
- Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
- Buffer::inset_iterator end = bview->buffer()->inset_iterator_end();
- for ( ; it != end; ++it) {
- if (*it == inset) {
- par = it.getPar();
- pos = it.getPos();
- break;
+ pos_type pos = -1;
+
+ par = inset->parOwner();
+ if (par)
+ pos = par->getPositionOfInset(inset);
+
+ if (!par || pos == -1) {
+ lyxerr << "LyXText::workWidth: something is wrong,"
+ " fall back to the brute force method" << endl;
+ Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
+ Buffer::inset_iterator end = bview->buffer()->inset_iterator_end();
+ for ( ; it != end; ++it) {
+ if (*it == inset) {
+ par = it.getPar();
+ pos = it.getPos();
+ break;
+ }
}
}
+
if (!par) {
return workWidth(bview);
}
pos_type pos) const
{
if (!Encodings::is_arabic(c))
- if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && isdigit(c))
+ if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && IsDigit(c))
return c + (0xb0 - '0');
else
return c;
static string const number_seperators = ".,:";
if (current_font.number() == LyXFont::ON) {
- if (!isdigit(c) && !contains(number_operators, c) &&
+ if (!IsDigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cursor.pos() >= 1 &&
cursor.pos() < cursor.par()->size() &&
cursor.pos() - 1).number() == LyXFont::ON)
)
number(bview); // Set current_font.number to OFF
- } else if (isdigit(c) &&
+ } else if (IsDigit(c) &&
real_current_font.isVisibleRightToLeft()) {
number(bview); // Set current_font.number to ON
y_top += asc;
int const w = (inset_owner ? inset_owner->width(p.bv, font) : ww);
- int const xp = static_cast<int>(inset_owner ? p.x : 0);
- p.pain->line(xp, p.yo + y_top, w, p.yo + y_top,
+ int const xp = static_cast<int>(inset_owner ? p.xo : 0);
+ p.pain->line(xp, p.yo + y_top, xp + w, p.yo + y_top,
LColor::topline, Painter::line_solid,
Painter::line_thick);
y_bottom -= asc;
int const w = (inset_owner ? inset_owner->width(p.bv, font) : ww);
- int const xp = static_cast<int>(inset_owner ? p.x : 0);
+ int const xp = static_cast<int>(inset_owner ? p.xo : 0);
int const y = p.yo + y_bottom;
- p.pain->line(xp, y, w, y, LColor::topline, Painter::line_solid,
+ p.pain->line(xp, y, xp + w, y, LColor::topline, Painter::line_solid,
Painter::line_thick);
y_bottom -= asc;
}
- pos_type const last = rowLastPrintable(p.row);
bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params);
int const endlabel = par->getEndLabel(buffer->params);
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX:
{
- LyXFont const font = getFont(buffer, par, last);
+ LyXFont const font = getLabelFont(buffer, par);
int const size = int(0.75 * lyxfont::maxAscent(font));
int const y = (p.yo + p.row->baseline()) - size;
int x = is_rtl ? LYX_PAPER_MARGIN : ww - LYX_PAPER_MARGIN - size;
x += (size - p.row->fill() + 1) * (is_rtl ? -1 : 1);
if (endlabel == END_LABEL_BOX) {
- p.pain->line(x, y, x, y + size, LColor::eolmarker);
- p.pain->line(x + size, y, x + size , y + size, LColor::eolmarker);
- p.pain->line(x, y, x + size, y, LColor::eolmarker);
- p.pain->line(x, y + size, x + size, y + size, LColor::eolmarker);
+ p.pain->rectangle(x, y, size, size, LColor::eolmarker);
} else {
- p.pain->fillRectangle(x, y, size, size, LColor::eolmarker);
+ p.pain->fillRectangle(x, y, size, size,
+ LColor::eolmarker);
}
break;
}