+2001-07-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * math_cursor.C (operator==): moved ouf of struct
+ (operator<): ditto
+ (normalAnchor): reversed one test (but shouldn't it really be >= ?)
+
2001-07-12 André Pönitz <poenitz@htwm.de>
* math_cursor.[hC]: multicell selection (multicell pasete still defunct)
2001-07-12 André Pönitz <poenitz@htwm.de>
* math_cursor.[hC]: multicell selection (multicell pasete still defunct)
std::vector<MathArray> data_;
};
std::vector<MathArray> data_;
};
bool IsMacro(short tok, int id)
bool IsMacro(short tok, int id)
!(tok == LM_TK_SYM && id < 255);
}
!(tok == LM_TK_SYM && id < 255);
}
-ostream & operator<<(ostream & os, MathCursorPos const & p)
+
+std::ostream & operator<<(std::ostream & os, MathCursorPos const & p)
- os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ")";
+ os << "(par: " << p.par_ << " idx: " << p.idx_
+ << " pos: " << p.pos_ << ")";
return Cursor_[i].par_;
}
return Cursor_[i].par_;
}
void MathCursor::dump(char const * what) const
{
return;
void MathCursor::dump(char const * what) const
{
return;
void MathCursor::seldump(char const *) const
{
//lyxerr << "SEL: " << str << ": '" << theSelection << "'\n";
void MathCursor::seldump(char const *) const
{
//lyxerr << "SEL: " << str << ": '" << theSelection << "'\n";
bool MathCursor::plainLeft()
{
return array().prev(cursor().pos_);
bool MathCursor::plainLeft()
{
return array().prev(cursor().pos_);
void MathCursor::SelCut()
{
seldump("SelCut");
void MathCursor::SelCut()
{
seldump("SelCut");
void MathCursor::SelHandle(bool sel)
{
if (sel && !selection)
void MathCursor::SelHandle(bool sel)
{
if (sel && !selection)
void MathCursor::drawSelection(Painter & pain) const
{
if (!selection)
void MathCursor::drawSelection(Painter & pain) const
{
if (!selection)
void MathCursor::handleDelim(int l, int r)
{
MathDelimInset * p = new MathDelimInset(l, r);
void MathCursor::handleDelim(int l, int r)
{
MathDelimInset * p = new MathDelimInset(l, r);
void MathCursor::pullArg()
{
// pullArg
void MathCursor::pullArg()
{
// pullArg
MathInset * MathCursor::prevInset() const
{
normalize();
MathInset * MathCursor::prevInset() const
{
normalize();
return xarray().pos2x(cursor().pos_);
}
return xarray().pos2x(cursor().pos_);
}
void MathCursor::gotoX(int x)
{
cursor().pos_ = xarray().x2pos(x);
}
void MathCursor::gotoX(int x)
{
cursor().pos_ = xarray().x2pos(x);
}
void MathCursor::idxNext()
{
cursor().par_->idxNext(cursor().idx_, cursor().pos_);
}
void MathCursor::idxNext()
{
cursor().par_->idxNext(cursor().idx_, cursor().pos_);
}
void MathCursor::idxPrev()
{
cursor().par_->idxPrev(cursor().idx_, cursor().pos_);
}
void MathCursor::idxPrev()
{
cursor().par_->idxPrev(cursor().idx_, cursor().pos_);
}
void MathCursor::splitCell()
{
if (cursor().idx_ == cursor().par_->nargs() - 1)
void MathCursor::splitCell()
{
if (cursor().idx_ == cursor().par_->nargs() - 1)
void MathCursor::breakLine()
{
MathMatrixInset * p = static_cast<MathMatrixInset *>(formula()->par());
void MathCursor::breakLine()
{
MathMatrixInset * p = static_cast<MathMatrixInset *>(formula()->par());
char MathCursor::valign() const
{
int idx;
char MathCursor::valign() const
{
int idx;
return p ? p->valign() : 0;
}
return p ? p->valign() : 0;
}
char MathCursor::halign() const
{
int idx;
char MathCursor::halign() const
{
int idx;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
-bool MathCursorPos::operator==(const MathCursorPos & it) const
+bool operator==(MathCursorPos const & ti, MathCursorPos const & it)
- return par_ == it.par_ && idx_ == it.idx_ && pos_ == it.pos_;
+ return ti.par_ == it.par_ && ti.idx_ == it.idx_ && ti.pos_ == it.pos_;
-bool MathCursorPos::operator<(const MathCursorPos & it) const
+
+bool operator<(MathCursorPos const & ti, MathCursorPos const & it)
+ if (ti.par_ != it.par_) {
lyxerr << "can't compare cursor and anchor in different insets\n";
return true;
}
lyxerr << "can't compare cursor and anchor in different insets\n";
return true;
}
- if (idx_ != it.idx_)
- return idx_ < it.idx_;
- return pos_ < it.pos_;
+ if (ti.idx_ != it.idx_)
+ return ti.idx_ < it.idx_;
+ return ti.pos_ < it.pos_;
return par_->xcell(idx);
}
return par_->xcell(idx);
}
MathXArray & MathCursorPos::xcell() const
{
return par_->xcell(idx_);
}
MathXArray & MathCursorPos::xcell() const
{
return par_->xcell(idx_);
}
MathCursorPos MathCursor::normalAnchor() const
{
// use Anchor on the same level as Cursor
MathCursorPos normal = Anchor_[Cursor_.size() - 1];
MathCursorPos MathCursor::normalAnchor() const
{
// use Anchor on the same level as Cursor
MathCursorPos normal = Anchor_[Cursor_.size() - 1];
- if (Cursor_.size() < Anchor_.size() && !(cursor() > normal)) {
+ if (Cursor_.size() < Anchor_.size() && !(normal < cursor())) {
// anchor is behind cursor -> move anchor behind the inset
normal.cell().next(normal.pos_);
}
// anchor is behind cursor -> move anchor behind the inset
normal.cell().next(normal.pos_);
}
bool MathCursorPos::idxUp()
{
return par_->idxUp(idx_, pos_);
}
bool MathCursorPos::idxUp()
{
return par_->idxUp(idx_, pos_);
}
bool MathCursorPos::idxDown()
{
return par_->idxDown(idx_, pos_);
}
bool MathCursorPos::idxDown()
{
return par_->idxDown(idx_, pos_);
}
bool MathCursorPos::idxLeft()
{
return par_->idxLeft(idx_, pos_);
}
bool MathCursorPos::idxLeft()
{
return par_->idxLeft(idx_, pos_);
}
bool MathCursorPos::idxRight()
{
return par_->idxRight(idx_, pos_);
bool MathCursorPos::idxRight()
{
return par_->idxRight(idx_, pos_);
int idx_;
/// cell position
int pos_;
int idx_;
/// cell position
int pos_;
- ///
- bool operator==(const MathCursorPos &) const;
- ///
- bool operator<(const MathCursorPos &) const;
/// returns cell corresponding to this position
MathArray & cell() const;
/// returns cell corresponding to this position
/// returns cell corresponding to this position
MathArray & cell() const;
/// returns cell corresponding to this position
+///
+bool operator==(MathCursorPos const &, MathCursorPos const &);
+///
+bool operator<(MathCursorPos const &, MathCursorPos const &);
+
/// This is the external interface of Math's subkernel
class MathCursor {
/// This is the external interface of Math's subkernel
class MathCursor {