]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_pos.C
Georg Baum's vspace change
[lyx.git] / src / mathed / math_pos.C
index 2c8e7e6c26253715179e7aeefb459f429f073083..39381c9f23495ccbe8e8ace4a3eeff28936a1482 100644 (file)
@@ -1,85 +1,87 @@
-#include "config.h"
-
-#include <iostream>
+/**
+ * \file math_pos.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
 
 #include "math_pos.h"
 #include "math_inset.h"
 #include "debug.h"
-#include "support/LAssert.h"
 
+#include <boost/assert.hpp>
+
+using std::endl;
 
-using std::ostream;
 
-MathCursorPos::MathCursorPos()
-       : par_(0), idx_(0), pos_(0)
+CursorPos::CursorPos()
+       : inset_(0), idx_(0), pos_(0)
 {}
 
 
-MathCursorPos::MathCursorPos(MathInset * p)
-       : par_(p), idx_(0), pos_(0)
+CursorPos::CursorPos(MathInset * p)
+       : inset_(p), idx_(0), pos_(0)
 {
-       lyx::Assert(par_);
+       BOOST_ASSERT(inset_);
 }
 
 
 
-MathArray & MathCursorPos::cell(MathArray::idx_type idx) const
-{
-       lyx::Assert(par_);
-       return par_->cell(idx);
-}
-
-
-MathArray & MathCursorPos::cell() const
+MathArray & CursorPos::cell(MathArray::idx_type idx) const
 {
-       lyx::Assert(par_);
-       return par_->cell(idx_);
+       BOOST_ASSERT(inset_);
+       return inset_->cell(idx);
 }
 
 
-MathXArray & MathCursorPos::xcell(MathArray::idx_type idx) const
+MathArray & CursorPos::cell() const
 {
-       lyx::Assert(par_);
-       return par_->xcell(idx);
+       BOOST_ASSERT(inset_);
+       return inset_->cell(idx_);
 }
 
 
-MathXArray & MathCursorPos::xcell() const
+void CursorPos::getPos(int & x, int & y) const
 {
-       lyx::Assert(par_);
-       return par_->xcell(idx_);
+       inset_->getPos(idx_, pos_, x, y);
 }
 
 
-void MathCursorPos::getPos(int & x, int & y) const
+void CursorPos::setPos(MathArray::pos_type pos)
 {
-       par_->getPos(idx_, pos_, x, y);
+       pos_ = pos;
 }
 
 
-ostream & operator<<(ostream & os, MathCursorPos const & p)
+std::ostream & operator<<(std::ostream & os, CursorPos const & p)
 {
-       os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ")";
+       os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')';
        return os;
 }
 
 
-bool operator==(MathCursorPos const & p, MathCursorPos const & q)
+bool operator==(CursorPos const & p, CursorPos const & q)
 {
-       return p.par_ == q.par_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
+       return p.inset_ == q.inset_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
 }
 
 
-bool operator!=(MathCursorPos const & p, MathCursorPos const & q)
+bool operator!=(CursorPos const & p, CursorPos const & q)
 {
-       return p.par_ != q.par_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
+       return p.inset_ != q.inset_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
 }
 
 
-bool operator<(MathCursorPos const & p, MathCursorPos const & q)
+bool operator<(CursorPos const & p, CursorPos const & q)
 {
-       if (p.par_ != q.par_) {
-               lyxerr << "can't compare cursor and anchor in different insets\n";
+       if (p.inset_ != q.inset_) {
+               lyxerr << "can't compare cursor and anchor in different insets\n"
+                      << "p: " << p << '\n' << "q: " << q << endl;
                return true;
        }
        if (p.idx_ != q.idx_)