]> git.lyx.org Git - lyx.git/commitdiff
some consolidation of inset scrolling
authorAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 12:50:10 +0000 (12:50 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 15 Jul 2005 12:50:10 +0000 (12:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10205 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insettabular.C
src/insets/updatableinset.C
src/insets/updatableinset.h

index 1b072f5fb85c9366fc4e9533e9b14a75240fe51f..36ea3c0ccc7cf958b6510f60d530ff8b029710b2 100644 (file)
@@ -493,16 +493,6 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
                cur.selection() = false;
                break;
 
-       case LFUN_SCROLL_INSET: 
-               if (!cmd.argument.empty()) {
-                       int const ww = cur.bv().workWidth();
-                       if (cmd.argument.find('.') != cmd.argument.npos)
-                               setScroll(ww, static_cast<float>(convert<double>(cmd.argument)));
-                       else
-                               setScroll(ww, convert<int>(cmd.argument));
-               }
-               break;
-
        case LFUN_RIGHTSEL:
        case LFUN_RIGHT:
                cell(cur.idx())->dispatch(cur, cmd);
@@ -1224,7 +1214,7 @@ void InsetTabular::resetPos(LCursor & cur) const
 //     if (actcol < tabular.columns() - 1 && scroll(false) &&
 //             tabular.getWidthOfTabular() < maxwidth - 20)
 //     {
-//             setScroll(maxwidth, 0.0F);
+//             scx = 0;
 //     } else if (cursorx_ - offset > 20 &&
 //                cursorx_ - offset + col_width > maxwidth - 20) {
 //             setScroll(maxwidth, - col_width - 20);
@@ -1236,7 +1226,7 @@ void InsetTabular::resetPos(LCursor & cur) const
 //     }
 
        if (&cur.inset() != this) {
-               setScroll(maxwidth, 0.0f);
+               scx = 0;
        } else {
                int const X1 = 0;
                int const X2 = maxwidth;
index 68fb6bd547a188a0e44a19e83147558fc75e44d0..71ff522583529f9a4847091ad2fbb4624987f4c2 100644 (file)
@@ -41,35 +41,11 @@ int UpdatableInset::scroll(bool) const
 }
 
 
-void UpdatableInset::setScroll(int maxwidth, double s) const
-{
-       lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << std::endl;
-       if (!s) {
-               scx = 0;
-               return;
-       }
-
-       int xo_ = theCoords.getInsets().x(this);
-       int const tmp_xo_ = xo_ - scx;
-
-       if (tmp_xo_ > 0 && tmp_xo_ + width() < maxwidth)
-               return;
-       if (s > 0.0 && xo_ > 0)
-               return;
-
-       scx = int(s * maxwidth / 2);
-
-#ifdef WITH_WARNINGS
-#warning metrics?
-#endif
-       if (tmp_xo_ + scx + width() < maxwidth / 2)
-               scx = maxwidth / 2 - tmp_xo_ - width();
-}
-
-
 void UpdatableInset::setScroll(int maxwidth, int offset) const
 {
-       lyxerr << "UpdatableInset::setScroll: (double) " << maxwidth << std::endl;
+       lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << ' ' <<
+offset<< std::endl;
+
        int const xo_ = theCoords.getInsets().x(this);
        if (offset > 0) {
                if (!scx && xo_ >= 20)
@@ -94,26 +70,6 @@ void UpdatableInset::setScroll(int maxwidth, int offset) const
 }
 
 
-void UpdatableInset::doDispatch(LCursor & cur, FuncRequest & cmd)
-{
-       switch (cmd.action) {
-       case LFUN_SCROLL_INSET:
-               if (cmd.argument.empty()) {
-                       const int maxwidth = cur.bv().workWidth();
-                       if (cmd.argument.find('.') != cmd.argument.npos)
-                               setScroll(maxwidth, static_cast<float>(convert<double>(cmd.argument)));
-                       else
-                               setScroll(maxwidth, convert<int>(cmd.argument));
-               } else
-                       cur.noUpdate();
-               break;
-
-       default:
-               InsetBase::dispatch(cur, cmd);
-       }
-}
-
-
 void UpdatableInset::getCursorDim(int &, int &) const
 {
        BOOST_ASSERT(false);
index b2074d21d5fb0298931adce8e9c4375d347acecc..3c29e649ba2b79d4257c13858379a39940902f62 100644 (file)
@@ -36,10 +36,6 @@ public:
        virtual bool showInsetDialog(BufferView *) const { return false; }
 
 protected:
-       ///  An updatable inset could handle lyx editing commands
-       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
-       /// scrolls to absolute position in maxwidth * sx units
-       void setScroll(int maxwidth, double sx) const;
        /// scrolls offset pixels
        void setScroll(int maxwidth, int offset) const;
        /// returns the actual scroll value