|| !d->last_row_slice_.empty())) {
// FIXME: if one uses SingleParUpdate, then home/end
// will not work on long rows. Why?
- d->update_strategy_ = FullScreenUpdate;//DecorationUpdate;
+ d->update_strategy_ = FullScreenUpdate;
}
d->horiz_scroll_offset_ = offset;
case NoScreenUpdate:
// If no screen painting is actually needed, only some the different
// coordinates of insets and paragraphs needs to be updated.
+ LYXERR(Debug::PAINTING, "Strategy: NoScreenUpdate");
pi.full_repaint = true;
pi.pain.setDrawingEnabled(false);
tm.draw(pi, 0, y);
case SingleParUpdate:
pi.full_repaint = false;
+ LYXERR(Debug::PAINTING, "Strategy: SingleParUpdate");
// In general, only the current row of the outermost paragraph
// will be redrawn. Particular cases where selection spans
// multiple paragraph are correctly detected in TextMetrics.
// because of the single backing pixmap.
case FullScreenUpdate:
+
+ LYXERR(Debug::PAINTING,
+ ((d->update_strategy_ == FullScreenUpdate)
+ ? "Strategy: FullScreenUpdate"
+ : "Strategy: DecorationUpdate"));
+
// The whole screen, including insets, will be refreshed.
pi.full_repaint = true;
// Clear background of this row if paragraph background was not
// already cleared because of a full repaint.
if (!pi.full_repaint && row_has_changed) {
- pi.pain.fillRectangle(x, y - row.ascent(),
+ LYXERR(Debug::PAINTING, "Clear rect@("
+ << max(x, 0) << ", " << y-row.ascent() << ")="
+ << width() << " x " << row.height());
+ pi.pain.fillRectangle(max(x, 0), y - row.ascent(),
width(), row.height(), pi.background_color);
}
InsetTabular::InsetTabular(Buffer * buf, row_type rows,
col_type columns)
- : Inset(buf), tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))), scx_(0),
+ : Inset(buf), tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))),
rowselect_(false), colselect_(false)
{
}
InsetTabular::InsetTabular(InsetTabular const & tab)
- : Inset(tab), tabular(tab.tabular), scx_(0)
+ : Inset(tab), tabular(tab.tabular)
{
}
void InsetTabular::draw(PainterInfo & pi, int x, int y) const
{
- x += scx_ + ADD_TO_TABULAR_WIDTH;
+ x += ADD_TO_TABULAR_WIDTH;
BufferView * bv = pi.base.bv;
Cursor & cur = pi.base.bv->cursor();
- resetPos(cur);
// FIXME: As the full background is painted in drawBackground(),
// we have no choice but to do a full repaint for the Text cells.
void InsetTabular::drawBackground(PainterInfo & pi, int x, int y) const
{
- x += scx_ + ADD_TO_TABULAR_WIDTH;
+ x += ADD_TO_TABULAR_WIDTH;
y += offset_valign_ - tabular.rowAscent(0);
pi.pain.fillRectangle(x, y, tabular.width(), tabular.height(),
pi.backgroundColor(this));
void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
{
Cursor & cur = pi.base.bv->cursor();
- resetPos(cur);
- x += scx_ + ADD_TO_TABULAR_WIDTH;
+ x += ADD_TO_TABULAR_WIDTH;
if (!cur.selection())
return;
}
cur.setCurrentFont();
// FIXME: this accesses the position cache before it is initialized
- //resetPos(cur);
//cur.bv().fitCursor();
}
x += cellXPos(sl.idx());
x += tabular.textHOffset(sl.idx());
x += ADD_TO_TABULAR_WIDTH;
- x += scx_;
}
cur.setSelection(false);
cur.push(*this);
cur.idx() = getNearestCell(cur.bv(), x, y);
- resetPos(cur);
return cur.bv().textMetrics(&cell(cur.idx())->text()).editXY(cur, x, y);
}
}
-void InsetTabular::resetPos(Cursor & cur) const
-{
- BufferView & bv = cur.bv();
- int const maxwidth = bv.workWidth();
-
- int const scx_old = scx_;
- int const i = cur.find(this);
- if (i == -1) {
- scx_ = 0;
- } else {
- int const X1 = 0;
- int const X2 = maxwidth;
- int const offset = ADD_TO_TABULAR_WIDTH + 2;
- int const x1 = xo(cur.bv()) + cellXPos(cur[i].idx()) + offset;
- int const x2 = x1 + tabular.cellWidth(cur[i].idx());
-
- if (x1 < X1)
- scx_ = X1 + 20 - x1;
- else if (x2 > X2)
- scx_ = X2 - 20 - x2;
- else
- scx_ = 0;
- }
-
- // only update if offset changed
- if (scx_ != scx_old)
- cur.screenUpdateFlags(Update::Force | Update::FitCursor);
-}
-
-
void InsetTabular::moveNextCell(Cursor & cur, EntryDirection entry_from)
{
row_type const row = tabular.cellRow(cur.idx());
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
- resetPos(cur);
return;
}
}
cur.setCurrentFont();
- resetPos(cur);
}
if (cur.selIsMultiCell()) {
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
- resetPos(cur);
return;
}
}
cur.setCurrentFont();
- resetPos(cur);
}