From 6100178a3744c5464a3a5398d015d774db83241e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 15 Jul 2005 16:44:41 +0000 Subject: [PATCH] work on inset scrolling git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10222 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 2 +- src/insets/insettabular.C | 15 +++++++++------ src/insets/updatableinset.C | 27 ++------------------------- 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index fc98260d66..a4ed856570 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,5 @@ -2005-07-14 André Pönitz +2005-07-15 André Pönitz * insetcollapsable.[Ch]: * updatableinset.[Ch]: (scroll, setScroll) diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index a33a336fb3..81e757a140 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1203,6 +1203,7 @@ int InsetTabular::getCellXPos(idx_type const cell) const 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()); @@ -1218,12 +1219,12 @@ void InsetTabular::resetPos(LCursor & cur) const // 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) { @@ -1232,13 +1233,15 @@ void InsetTabular::resetPos(LCursor & cur) const 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(); diff --git a/src/insets/updatableinset.C b/src/insets/updatableinset.C index 71ff522583..55984a7782 100644 --- a/src/insets/updatableinset.C +++ b/src/insets/updatableinset.C @@ -41,32 +41,9 @@ int UpdatableInset::scroll(bool) const } -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; } -- 2.39.5