4 #include "math_inset.h"
6 #include "support/LAssert.h"
7 #include "support/LOstream.h"
9 using namespace lyx::support;
14 CursorPos::CursorPos()
15 : inset_(0), idx_(0), pos_(0)
19 CursorPos::CursorPos(MathInset * p)
20 : inset_(p), idx_(0), pos_(0)
27 MathArray & CursorPos::cell(MathArray::idx_type idx) const
30 return inset_->cell(idx);
34 MathArray & CursorPos::cell() const
37 return inset_->cell(idx_);
41 void CursorPos::getPos(int & x, int & y) const
43 inset_->getPos(idx_, pos_, x, y);
47 void CursorPos::setPos(MathArray::pos_type pos)
53 std::ostream & operator<<(std::ostream & os, CursorPos const & p)
55 os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')';
60 bool operator==(CursorPos const & p, CursorPos const & q)
62 return p.inset_ == q.inset_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
66 bool operator!=(CursorPos const & p, CursorPos const & q)
68 return p.inset_ != q.inset_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
72 bool operator<(CursorPos const & p, CursorPos const & q)
74 if (p.inset_ != q.inset_) {
75 lyxerr << "can't compare cursor and anchor in different insets"
80 return p.idx_ < q.idx_;
81 return p.pos_ < q.pos_;