void InsetTabular::resetPos(LCursor & cur) const
{
+ //lyxerr << "InsetTabular::resetPos" << endl;
BufferView & bv = cur.bv();
int const maxwidth = bv.workWidth();
// col_type const actcol = tabular.column_of_cell(cur.idx());
// scx = 0;
// } else if (cursorx_ - offset > 20 &&
// cursorx_ - offset + col_width > maxwidth - 20) {
-// setScroll(maxwidth, - col_width - 20);
+// setScroll(maxwidth, - col_width - 20 - scx);
// } else if (cursorx_ - offset < 20) {
-// setScroll(maxwidth, 20 - cursorx_ + offset);
+// setScroll(maxwidth, 20 - cursorx_ + offset - scx);
// } else if (scroll() && xo() > 20 &&
// xo() + tabular.getWidthOfTabular() > maxwidth - 20) {
-// setScroll(maxwidth, old_x - cursorx_);
+// setScroll(maxwidth, old_x - cursorx_ - scx);
// }
if (&cur.inset() != this) {
int const X1 = 0;
int const X2 = maxwidth;
int const offset = ADD_TO_TABULAR_WIDTH + 2;
- int const x1 = xo() + scroll() + getCellXPos(cur.idx()) + offset;
+ int const x1 = xo() + getCellXPos(cur.idx()) + offset;
int const x2 = x1 + tabular.getWidthOfColumn(cur.idx());
if (x1 < X1)
- setScroll(maxwidth, X1 + 20 - x1);
+ scx = X1 + 20 - x1;
else if (x2 > X2)
- setScroll(maxwidth, X2 - 20 - x2);
+ scx = X2 - 20 - x2;
+ else
+ scx = 0;
}
cur.needsUpdate();
}
-void UpdatableInset::setScroll(int maxwidth, int offset) const
+void UpdatableInset::setScroll(int maxwidth, int pos) const
{
- lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << ' ' <<
-offset<< std::endl;
-
- int const xo_ = theCoords.getInsets().x(this);
- if (offset > 0) {
- if (!scx && xo_ >= 20)
- return;
- if (xo_ + offset > 20)
- scx = 0;
- // scx = - xo_;
- else
- scx += offset;
- } else {
-#ifdef WITH_WARNINGS
-#warning metrics?
-#endif
- if (!scx && xo_ + width() < maxwidth - 20)
- return;
-
- if (xo_ - scx + offset + width() < maxwidth - 20)
- scx += maxwidth - width() - xo_ - 20;
- else
- scx += offset;
- }
+ scx = pos;
}