]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_pos.C
small up/down tweaking
[lyx.git] / src / mathed / math_pos.C
index 889f13782a73ce563b4b94cc9b1430f0f88fe2f4..82ab4c5a4513f4e5dab28b2fa5c33ae60b188e1e 100644 (file)
@@ -1,11 +1,13 @@
-#include "config.h"
-
-#include <iostream>
+#ifdef __GNUG__
+#pragma implementation
+#endif
 
+#include "config.h"
 #include "math_pos.h"
 #include "math_inset.h"
 #include "debug.h"
 #include "support/LAssert.h"
+#include "support/LOstream.h"
 
 
 MathCursorPos::MathCursorPos()
@@ -13,61 +15,43 @@ MathCursorPos::MathCursorPos()
 {}
 
 
-MathCursorPos::MathCursorPos(MathAtom & t)
-       : par_(&t), idx_(0), pos_(0)
+MathCursorPos::MathCursorPos(MathInset * p)
+       : par_(p), idx_(0), pos_(0)
 {
        lyx::Assert(par_);
-       lyx::Assert(par_->nucleus());
 }
 
 
+
 MathArray & MathCursorPos::cell(MathArray::idx_type idx) const
 {
        lyx::Assert(par_);
-       lyx::Assert(par_->nucleus());
-       return par_->nucleus()->cell(idx);
+       return par_->cell(idx);
 }
 
 
 MathArray & MathCursorPos::cell() const
 {
        lyx::Assert(par_);
-       lyx::Assert(par_->nucleus());
-       return par_->nucleus()->cell(idx_);
-}
-
-
-MathXArray & MathCursorPos::xcell(MathArray::idx_type idx) const
-{
-       lyx::Assert(par_);
-       lyx::Assert(par_->nucleus());
-       return par_->nucleus()->xcell(idx);
-}
-
-
-MathXArray & MathCursorPos::xcell() const
-{
-       lyx::Assert(par_);
-       lyx::Assert(par_->nucleus());
-       return par_->nucleus()->xcell(idx_);
+       return par_->cell(idx_);
 }
 
 
-int MathCursorPos::xpos() const
+void MathCursorPos::getPos(int & x, int & y) const
 {
-       return xcell().xo() + xcell().pos2x(pos_);
+       par_->getPos(idx_, pos_, x, y);
 }
 
 
-int MathCursorPos::ypos() const
+void MathCursorPos::setPos(MathArray::pos_type pos)
 {
-       return xcell().yo();
+       pos_ = pos;
 }
 
 
 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 os;
 }
 
@@ -94,5 +78,3 @@ bool operator<(MathCursorPos const & p, MathCursorPos const & q)
                return p.idx_ < q.idx_;
        return p.pos_ < q.pos_;
 }
-
-