]> git.lyx.org Git - features.git/commitdiff
brute force does not need much code...
authorAndré Pönitz <poenitz@gmx.net>
Wed, 5 Dec 2001 18:00:36 +0000 (18:00 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 5 Dec 2001 18:00:36 +0000 (18:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3154 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_nestinset.C
src/mathed/math_nestinset.h
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h
src/mathed/math_xdata.C
src/mathed/math_xdata.h

index 6c11fca0bcdd20058dd395d029db9272a9def1a9..876ac4a592cc3db7389120a2deb2a48feba0e937 100644 (file)
@@ -235,22 +235,6 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const
 }
 
 
-bool MathCursor::positionable(MathAtom const & t, int x, int y) const
-{
-       if (selection_) {
-               // we can't move into anything new during selection
-               if (Cursor_.size() >= Anchor_.size())
-                       return false;
-               if (t.nucleus() != Anchor_[Cursor_.size()].par_)
-                       return false;
-       }
-
-       //lyxerr << " positionable: 1 " << t->nargs() << "\n";
-       //lyxerr << " positionable: 2 " << t->covers(x, y) << "\n";
-       return t->nargs() && t->covers(x, y);
-}
-
-
 bool MathCursor::posLeft()
 {
        if (pos() == 0)
@@ -332,44 +316,6 @@ void MathCursor::last()
 }
 
 
-#if 0
-void MathCursor::setPos(int x, int y)
-{
-       //dump("setPos 1");
-       //lyxerr << "MathCursor::setPos x: " << x << " y: " << y << "\n";
-
-       macroModeClose();
-       lastcode_ = LM_TC_VAR;
-       first();
-
-       cursor().par_  = &formula_->par();
-
-       while (1) {
-               idx() = 0;
-               cursor().pos_ = 0;
-               //lyxerr << "found idx: " << idx() << " cursor: " << pos()  << "\n";
-               int distmin = 1 << 30; // large enough
-               for (unsigned int i = 0; i < par()->nargs(); ++i) {
-                       MathXArray const & ar = par()->xcell(i);
-                       int d = ar.dist(x, y);
-                       if (d <= distmin) {
-                               distmin = d;
-                               idx()   = i;
-                               pos()   = ar.x2pos(x - ar.xo());
-                       }
-               }
-               //lyxerr << "found idx: " << idx() << " cursor: " << pos()  << "\n";
-               if (hasNextAtom() && positionable(nextAtom(), x, y))
-                       pushLeft(nextAtom());
-               else if (hasPrevAtom() && positionable(prevAtom(), x, y))
-                       pushRight(prevAtom());
-               else 
-                       break;
-       }
-       //dump("setPos 2");
-}
-
-#else
 
 void MathCursor::setPos(int x, int y)
 {
@@ -406,9 +352,6 @@ void MathCursor::setPos(int x, int y)
        dump("setPos 2");
 }
 
-#endif
-
-
 
 
 void MathCursor::home(bool sel)
index 50533563090120ef1cf90bf0fccd0ae0da7aa0e8..50f5e95d2936c7c1a03c719a2afbc79a3cf7f9e4 100644 (file)
@@ -301,8 +301,6 @@ private:
        void insert(char, MathTextCodes t);
        /// can we enter the inset? 
        bool openable(MathAtom const &, bool selection) const;
-       /// can the setPos routine enter that inset?
-       bool positionable(MathAtom const &, int x, int y) const;
        /// write access to cursor cell position
        pos_type & pos();
        /// write access to cursor cell index
index ee98f6990123b6c332b75762590d309d0294105e..f13b3124b890e31799327603ab3f83086832f2e8 100644 (file)
@@ -195,13 +195,6 @@ void MathInset::dump() const
 }
 
 
-bool MathInset::covers(int, int) const
-{
-       lyxerr << "MathInset::covers() called directly!\n";
-       return false;
-}
-
-
 void MathInset::validate(LaTeXFeatures &) const
 {}
 
index 3acdd53a3bbd3c97ee60a67e745e537e237c6b32..1d56323a7d92620338090dfc50683061ba891837 100644 (file)
@@ -188,9 +188,6 @@ public:
        /// delete a given row
        virtual void delCol(col_type) {}
 
-       /// does this inset cover the pixel at (x,y)?
-       virtual bool covers(int x, int y) const;
-
        /// identifies certain types of insets
        virtual MathArrayInset        * asArrayInset()        { return 0; }
        virtual MathBoxInset          * asBoxInset()          { return 0; }
index f7264827e04e97675da21c7c07dfb0f12f5b9776..6113621b43f1b8e583467055f433d5dc562c5775 100644 (file)
@@ -153,27 +153,6 @@ void MathNestInset::validate(LaTeXFeatures & features) const
 }
 
 
-bool MathNestInset::covers(int x, int y) const
-{
-       if (!nargs())
-               return false;
-       int x0 = xcell(0).xo();
-       int y0 = xcell(0).yo() - xcell(0).ascent();
-       int x1 = xcell(0).xo() + xcell(0).width();
-       int y1 = xcell(0).yo() + xcell(0).descent();
-       for (idx_type i = 1; i < nargs(); ++i) {
-               x0 = std::min(x0, xcell(i).xo());
-               y0 = std::min(y0, xcell(i).yo() - xcell(i).ascent());
-               x1 = std::max(x1, xcell(i).xo() + xcell(i).width());
-               y1 = std::max(y1, xcell(i).yo() + xcell(i).descent());
-       }
-       //lyxerr << "xO: " << x0 << " x1: " << x1 << " "
-       //       << "yO: " << y0 << " y1: " << y1 <<  "         "
-       //       << "x: " << x << " y: " << y << '\n';
-       return x >= x0 && x <= x1 && y >= y0 && y <= y1;
-}
-
-
 bool MathNestInset::match(MathInset * p) const
 {
        if (nargs() != p->nargs())
index 755198a8477e45ee5d13ad07c3464653a288cb53..f194e1662fe237efb97c8be5115006a5960e861a 100644 (file)
@@ -65,8 +65,6 @@ public:
        bool isActive() const { return nargs() > 0; }
        /// request "external features"
        void validate(LaTeXFeatures & features) const;
-       /// do we cover the point (x,y)?
-       bool covers(int x, int y) const;
 
        /// match in all cells
        bool match(MathInset *) const;
index ac4b098e78e8f271a4569e6cd7a64a7da5f911df..f05ed54b6d01443480eb1ec4a8f6138d4348cef8 100644 (file)
@@ -74,15 +74,6 @@ void MathScriptInset::ensure(bool up)
 }
 
 
-bool MathScriptInset::covers(int x, int y) const
-{
-       for (idx_type i = 0; i < 2; ++i)
-               if (has(i) && xcell(i).covers(x, y))
-                       return true;
-       return false;
-}
-
-
 int MathScriptInset::dy0(MathInset const * nuc) const
 {
        int nd = ndes(nuc);
index f11c6002505b9b40d1c87b0d7296fc1f63ff9151..669e0e9bfd99f0dcbe424a088bc5bc9004babca7 100644 (file)
@@ -82,8 +82,6 @@ public:
        void removeEmptyScripts();
        /// make sure a script is accessible
        void ensure(bool up);
-       /// only true if we are _in_ sub- or superscript, not in the convex hull
-       bool covers(int x, int y) const;
 
        // call these methods ...2 to make compaq cxx in anal mode happy...
        /// suppresses empty braces if necessary
index 37786bbc74f0585d87edf841977e486adaf9f090..28f5d5c32e40c15a38ba710d1ff1bf29240cf669 100644 (file)
@@ -143,16 +143,6 @@ int MathXArray::dist(int x, int y) const
 }
 
 
-bool MathXArray::covers(int x, int y) const
-{
-       int const x0 = xo_;
-       int const y0 = yo_ - ascent_;
-       int const x1 = xo_ + width_;
-       int const y1 = yo_ + descent_;
-       return x >= x0 && x <= x1 && y >= y0 && y <= y1;
-}
-
-
 void MathXArray::boundingBox(int & x1, int & x2, int & y1, int & y2)
 {
        x1 = xo_;
index dd059aaefb9066f8739b7a2f49f4f303abfb83bf..e4005c6316b3fae487c180b0c8e0d2942425a265 100644 (file)
@@ -53,8 +53,6 @@ public:
        int height() const { return ascent_ + descent_; }
        /// width of this cell
        int width() const { return width_; }
-       /// do we cover point(x, y)?
-       bool covers(int x, int y) const;
        /// bounding box of this cell
        void boundingBox(int & xlow, int & xhigh, int & ylow, int & yhigh);
        /// find best position to do things