mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Remove the special horizontal scrolling support in InsetTabular
It is not necessary anymore now that there is a global mechanism. Also, fix the clearing of rows in SingleParUpdate mode.
This commit is contained in:
parent
a7ba04dbaf
commit
fcaf5b5fc8
@ -2955,7 +2955,7 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
|
|||||||
|| !d->last_row_slice_.empty())) {
|
|| !d->last_row_slice_.empty())) {
|
||||||
// FIXME: if one uses SingleParUpdate, then home/end
|
// FIXME: if one uses SingleParUpdate, then home/end
|
||||||
// will not work on long rows. Why?
|
// will not work on long rows. Why?
|
||||||
d->update_strategy_ = FullScreenUpdate;//DecorationUpdate;
|
d->update_strategy_ = FullScreenUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->horiz_scroll_offset_ = offset;
|
d->horiz_scroll_offset_ = offset;
|
||||||
@ -2982,6 +2982,7 @@ void BufferView::draw(frontend::Painter & pain)
|
|||||||
case NoScreenUpdate:
|
case NoScreenUpdate:
|
||||||
// If no screen painting is actually needed, only some the different
|
// If no screen painting is actually needed, only some the different
|
||||||
// coordinates of insets and paragraphs needs to be updated.
|
// coordinates of insets and paragraphs needs to be updated.
|
||||||
|
LYXERR(Debug::PAINTING, "Strategy: NoScreenUpdate");
|
||||||
pi.full_repaint = true;
|
pi.full_repaint = true;
|
||||||
pi.pain.setDrawingEnabled(false);
|
pi.pain.setDrawingEnabled(false);
|
||||||
tm.draw(pi, 0, y);
|
tm.draw(pi, 0, y);
|
||||||
@ -2989,6 +2990,7 @@ void BufferView::draw(frontend::Painter & pain)
|
|||||||
|
|
||||||
case SingleParUpdate:
|
case SingleParUpdate:
|
||||||
pi.full_repaint = false;
|
pi.full_repaint = false;
|
||||||
|
LYXERR(Debug::PAINTING, "Strategy: SingleParUpdate");
|
||||||
// In general, only the current row of the outermost paragraph
|
// In general, only the current row of the outermost paragraph
|
||||||
// will be redrawn. Particular cases where selection spans
|
// will be redrawn. Particular cases where selection spans
|
||||||
// multiple paragraph are correctly detected in TextMetrics.
|
// multiple paragraph are correctly detected in TextMetrics.
|
||||||
@ -3001,6 +3003,12 @@ void BufferView::draw(frontend::Painter & pain)
|
|||||||
// because of the single backing pixmap.
|
// because of the single backing pixmap.
|
||||||
|
|
||||||
case FullScreenUpdate:
|
case FullScreenUpdate:
|
||||||
|
|
||||||
|
LYXERR(Debug::PAINTING,
|
||||||
|
((d->update_strategy_ == FullScreenUpdate)
|
||||||
|
? "Strategy: FullScreenUpdate"
|
||||||
|
: "Strategy: DecorationUpdate"));
|
||||||
|
|
||||||
// The whole screen, including insets, will be refreshed.
|
// The whole screen, including insets, will be refreshed.
|
||||||
pi.full_repaint = true;
|
pi.full_repaint = true;
|
||||||
|
|
||||||
|
@ -1903,7 +1903,10 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
|
|||||||
// Clear background of this row if paragraph background was not
|
// Clear background of this row if paragraph background was not
|
||||||
// already cleared because of a full repaint.
|
// already cleared because of a full repaint.
|
||||||
if (!pi.full_repaint && row_has_changed) {
|
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);
|
width(), row.height(), pi.background_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3456,14 +3456,14 @@ docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
|||||||
|
|
||||||
InsetTabular::InsetTabular(Buffer * buf, row_type rows,
|
InsetTabular::InsetTabular(Buffer * buf, row_type rows,
|
||||||
col_type columns)
|
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)
|
rowselect_(false), colselect_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetTabular::InsetTabular(InsetTabular const & tab)
|
InsetTabular::InsetTabular(InsetTabular const & tab)
|
||||||
: Inset(tab), tabular(tab.tabular), scx_(0)
|
: Inset(tab), tabular(tab.tabular)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3714,11 +3714,10 @@ bool InsetTabular::isCellSelected(Cursor & cur, row_type row, col_type col)
|
|||||||
|
|
||||||
void InsetTabular::draw(PainterInfo & pi, int x, int y) const
|
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;
|
BufferView * bv = pi.base.bv;
|
||||||
Cursor & cur = pi.base.bv->cursor();
|
Cursor & cur = pi.base.bv->cursor();
|
||||||
resetPos(cur);
|
|
||||||
|
|
||||||
// FIXME: As the full background is painted in drawBackground(),
|
// FIXME: As the full background is painted in drawBackground(),
|
||||||
// we have no choice but to do a full repaint for the Text cells.
|
// we have no choice but to do a full repaint for the Text cells.
|
||||||
@ -3766,7 +3765,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
|
|||||||
|
|
||||||
void InsetTabular::drawBackground(PainterInfo & pi, int x, int y) const
|
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);
|
y += offset_valign_ - tabular.rowAscent(0);
|
||||||
pi.pain.fillRectangle(x, y, tabular.width(), tabular.height(),
|
pi.pain.fillRectangle(x, y, tabular.width(), tabular.height(),
|
||||||
pi.backgroundColor(this));
|
pi.backgroundColor(this));
|
||||||
@ -3776,9 +3775,8 @@ void InsetTabular::drawBackground(PainterInfo & pi, int x, int y) const
|
|||||||
void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
Cursor & cur = pi.base.bv->cursor();
|
Cursor & cur = pi.base.bv->cursor();
|
||||||
resetPos(cur);
|
|
||||||
|
|
||||||
x += scx_ + ADD_TO_TABULAR_WIDTH;
|
x += ADD_TO_TABULAR_WIDTH;
|
||||||
|
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
return;
|
return;
|
||||||
@ -3894,7 +3892,6 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection)
|
|||||||
}
|
}
|
||||||
cur.setCurrentFont();
|
cur.setCurrentFont();
|
||||||
// FIXME: this accesses the position cache before it is initialized
|
// FIXME: this accesses the position cache before it is initialized
|
||||||
//resetPos(cur);
|
|
||||||
//cur.bv().fitCursor();
|
//cur.bv().fitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5083,7 +5080,6 @@ void InsetTabular::cursorPos(BufferView const & bv,
|
|||||||
x += cellXPos(sl.idx());
|
x += cellXPos(sl.idx());
|
||||||
x += tabular.textHOffset(sl.idx());
|
x += tabular.textHOffset(sl.idx());
|
||||||
x += ADD_TO_TABULAR_WIDTH;
|
x += ADD_TO_TABULAR_WIDTH;
|
||||||
x += scx_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5124,7 +5120,6 @@ Inset * InsetTabular::editXY(Cursor & cur, int x, int y)
|
|||||||
cur.setSelection(false);
|
cur.setSelection(false);
|
||||||
cur.push(*this);
|
cur.push(*this);
|
||||||
cur.idx() = getNearestCell(cur.bv(), x, y);
|
cur.idx() = getNearestCell(cur.bv(), x, y);
|
||||||
resetPos(cur);
|
|
||||||
return cur.bv().textMetrics(&cell(cur.idx())->text()).editXY(cur, x, y);
|
return cur.bv().textMetrics(&cell(cur.idx())->text()).editXY(cur, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5174,36 +5169,6 @@ int InsetTabular::cellXPos(idx_type const cell) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)
|
void InsetTabular::moveNextCell(Cursor & cur, EntryDirection entry_from)
|
||||||
{
|
{
|
||||||
row_type const row = tabular.cellRow(cur.idx());
|
row_type const row = tabular.cellRow(cur.idx());
|
||||||
@ -5238,7 +5203,6 @@ void InsetTabular::moveNextCell(Cursor & cur, EntryDirection entry_from)
|
|||||||
if (cur.selIsMultiCell()) {
|
if (cur.selIsMultiCell()) {
|
||||||
cur.pit() = cur.lastpit();
|
cur.pit() = cur.lastpit();
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
resetPos(cur);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5261,7 +5225,6 @@ void InsetTabular::moveNextCell(Cursor & cur, EntryDirection entry_from)
|
|||||||
|
|
||||||
}
|
}
|
||||||
cur.setCurrentFont();
|
cur.setCurrentFont();
|
||||||
resetPos(cur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5296,7 +5259,6 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from)
|
|||||||
if (cur.selIsMultiCell()) {
|
if (cur.selIsMultiCell()) {
|
||||||
cur.pit() = cur.lastpit();
|
cur.pit() = cur.lastpit();
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
resetPos(cur);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5319,7 +5281,6 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from)
|
|||||||
|
|
||||||
}
|
}
|
||||||
cur.setCurrentFont();
|
cur.setCurrentFont();
|
||||||
resetPos(cur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -989,8 +989,6 @@ private:
|
|||||||
///
|
///
|
||||||
int cellYPos(idx_type cell) const;
|
int cellYPos(idx_type cell) const;
|
||||||
///
|
///
|
||||||
void resetPos(Cursor & cur) const;
|
|
||||||
///
|
|
||||||
bool copySelection(Cursor & cur);
|
bool copySelection(Cursor & cur);
|
||||||
///
|
///
|
||||||
bool pasteClipboard(Cursor & cur);
|
bool pasteClipboard(Cursor & cur);
|
||||||
@ -1013,8 +1011,6 @@ private:
|
|||||||
col_type col_start, col_type col_end) const;
|
col_type col_start, col_type col_end) const;
|
||||||
///
|
///
|
||||||
mutable idx_type first_visible_cell;
|
mutable idx_type first_visible_cell;
|
||||||
///
|
|
||||||
mutable int scx_;
|
|
||||||
/// The vertical offset of the table due to the vertical
|
/// The vertical offset of the table due to the vertical
|
||||||
/// alignment with respect to the baseline.
|
/// alignment with respect to the baseline.
|
||||||
mutable int offset_valign_;
|
mutable int offset_valign_;
|
||||||
|
Loading…
Reference in New Issue
Block a user