]> git.lyx.org Git - lyx.git/commitdiff
work on inset scrolling
authorAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 16:44:41 +0000 (16:44 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 16:44:41 +0000 (16:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10222 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insettabular.C
src/insets/updatableinset.C

index fc98260d66c93ce803b0bc90a252282ecff962eb..a4ed85657020476a47a505a7b7d2f5e61f4483b8 100644 (file)
@@ -1,5 +1,5 @@
 
-2005-07-14  André Pönitz  <poenitz@gmx.net>
+2005-07-15  André Pönitz  <poenitz@gmx.net>
 
        * insetcollapsable.[Ch]:
        * updatableinset.[Ch]: (scroll, setScroll)
index a33a336fb337bfd36a9acd78017394759e98c133..81e757a1404b5f615954773f5b8a3467b70bddd9 100644 (file)
@@ -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();
index 71ff522583529f9a4847091ad2fbb4624987f4c2..55984a7782fc49d9238122b430cb593460976522 100644 (file)
@@ -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;
 }