]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_nestinset.C
revert Buffer LyxText->InsetText commit
[lyx.git] / src / mathed / math_nestinset.C
index 6667318101ab8c07f53e85a94a9160ffe68ad63d..2c58c03fb33391a58005113ad35385e75b8f068b 100644 (file)
@@ -87,7 +87,7 @@ MathArray const & MathNestInset::cell(idx_type i) const
 void MathNestInset::getCursorPos(CursorSlice const & cur,
        int & x, int & y) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        MathArray const & ar = cur.cell();
        x = ar.xo() + ar.pos2x(cur.pos());
        y = ar.yo();
@@ -114,7 +114,7 @@ void MathNestInset::metrics(MetricsInfo const & mi) const
 
 bool MathNestInset::idxNext(LCursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.idx() == cur.lastidx())
                return false;
        ++cur.idx();
@@ -131,7 +131,7 @@ bool MathNestInset::idxRight(LCursor & cur) const
 
 bool MathNestInset::idxPrev(LCursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (cur.idx() == 0)
                return false;
        --cur.idx();
@@ -148,7 +148,7 @@ bool MathNestInset::idxLeft(LCursor & cur) const
 
 bool MathNestInset::idxFirst(LCursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (nargs() == 0)
                return false;
        cur.idx() = 0;
@@ -159,7 +159,7 @@ bool MathNestInset::idxFirst(LCursor & cur) const
 
 bool MathNestInset::idxLast(LCursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(ptr_cmp(cur.inset(), this));
        if (nargs() == 0)
                return false;
        cur.idx() = cur.lastidx();
@@ -197,7 +197,7 @@ void MathNestInset::drawSelection(PainterInfo & pi, int, int) const
        LCursor & cur = pi.base.bv->cursor();
        if (!cur.selection())
                return;
-       if (!ptr_cmp(&cur.inset(), this))
+       if (!ptr_cmp(cur.inset(), this))
                return;
        CursorSlice & s1 = cur.selBegin();
        CursorSlice & s2 = cur.selEnd();
@@ -309,7 +309,7 @@ void MathNestInset::handleFont
        // changes...
        recordUndo(cur, Undo::ATOMIC);
 
-       if (cur.inset().asMathInset()->name() == font)
+       if (cur.inset()->asMathInset()->name() == font)
                cur.handleFont(font);
        else {
                cur.handleNest(createMathInset(font));
@@ -411,8 +411,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
                if (cur.inMacroMode())
                        cur.macroModeClose();
                else if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
-                       cur.pushLeft(*cur.nextAtom().nucleus());
-                       cur.inset().idxFirst(cur);
+                       cur.pushLeft(cur.nextAtom().nucleus());
+                       cur.inset()->idxFirst(cur);
                } else if (cur.posRight() || idxRight(cur)
                        || cur.popRight() || cur.selection())
                        ;
@@ -430,8 +430,8 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
                        cur.macroModeClose();
                else if (cur.pos() != 0 && cur.openable(cur.prevAtom())) {
                        cur.posLeft();
-                       cur.push(*cur.nextAtom().nucleus());
-                       cur.inset().idxLast(cur);
+                       cur.push(cur.nextAtom().nucleus());
+                       cur.inset()->idxLast(cur);
                } else if (cur.posLeft() || idxLeft(cur)
                        || cur.popLeft() || cur.selection())
                        ;
@@ -522,11 +522,11 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
                break;
 
        case LFUN_CELL_FORWARD:
-               cur.inset().idxNext(cur);
+               cur.inset()->idxNext(cur);
                break;
 
        case LFUN_CELL_BACKWARD:
-               cur.inset().idxPrev(cur);
+               cur.inset()->idxPrev(cur);
                break;
 
        case LFUN_DELETE_WORD_BACKWARD:
@@ -682,7 +682,7 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
                cur.selClearOrDel();
                cur.plainInsert(MathAtom(new MathMBoxInset(cur.bv())));
                cur.posLeft();
-               cur.pushLeft(*cur.nextInset());
+               cur.pushLeft(cur.nextInset());
 #else
                if (currentMode() == InsetBase::TEXT_MODE)
                        cur.niceInsert(MathAtom(new MathHullInset("simple")));
@@ -821,7 +821,7 @@ void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
 
 void MathNestInset::edit(LCursor & cur, bool left)
 {
-       cur.push(*this);
+       cur.push(this);
        cur.idx() = left ? 0 : cur.lastidx();
        cur.pos() = left ? 0 : cur.lastpos();
        cur.resetAnchor();
@@ -840,7 +840,7 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
                }
        }
        MathArray & ar = cell(idx_min);
-       cur.push(*this);
+       cur.push(this);
        cur.idx() = idx_min;
        cur.pos() = ar.x2pos(x - ar.xo());
        lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
@@ -1083,20 +1083,20 @@ bool MathNestInset::script(LCursor & cur, bool up)
        } else if (cur.pos() != 0 && cur.prevAtom()->asScriptInset()) {
                --cur.pos();
                cur.nextAtom().nucleus()->asScriptInset()->ensure(up);
-               cur.push(*cur.nextInset());
+               cur.push(cur.nextInset());
                cur.idx() = up;
                cur.pos() = cur.lastpos();
        } else if (cur.pos() != 0) {
                --cur.pos();
                cur.cell()[cur.pos()] = MathAtom(new MathScriptInset(cur.nextAtom(), up));
-               cur.push(*cur.nextInset());
+               cur.push(cur.nextInset());
                cur.idx() = up;
                cur.pos() = 0;
        } else {
                cur.plainInsert(MathAtom(new MathScriptInset(up)));
                --cur.pos();
                cur.nextAtom().nucleus()->asScriptInset()->ensure(up);
-               cur.push(*cur.nextInset());
+               cur.push(cur.nextInset());
                cur.idx() = up;
                cur.pos() = 0;
        }