brute force does not need much code...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3154 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-12-05 18:00:36 +00:00
parent ebe6d25126
commit e71bea78ca
10 changed files with 0 additions and 115 deletions

View 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)

View 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

View 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
{}

View 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; }

View 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())

View 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;

View 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);

View 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

View 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_;

View 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