]> git.lyx.org Git - features.git/commitdiff
mathed32.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 20 Feb 2001 14:00:34 +0000 (14:00 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 20 Feb 2001 14:00:34 +0000 (14:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1570 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_cursor.C
src/mathed/math_fracinset.C
src/mathed/math_root.C

index d25266b1485739f858df459427b2242bad7b123f..4bfd90dffdb144011f0675eb5d77ba2f7502e8ec 100644 (file)
@@ -6,6 +6,8 @@
        * move MathIter::Copy(int, int) to MathArray::shrink(pos, pos)
 
        * several files: subsequent changes
+       
+       * math_cursor.C: make selarray a proper MathArray
 
 
 2001-02-19  Dekel Tsur  <dekelts@tau.ac.il>
index 45c58b7f6f23ebc110b7c6cdbd138dfbc13f7d45..ed18539c844894a00f3d3d4fb56fc508a4002f6c 100644 (file)
@@ -42,7 +42,7 @@
 #include "math_accentinset.h"
 #include "mathed/support.h"
 
-static MathedArray * selarray = 0;
+static MathedArray selarray;
 
 using std::endl;
 
@@ -130,7 +130,6 @@ MathedCursor::MathedCursor(MathParInset * p) // : par(p)
        anchor   = 0;
        lastcode = LM_TC_MIN;
        SetPar(p);
-       //    selarray = 0;
        if (!MathMacroTable::built)
                MathMacroTable::mathMTable.builtinMacros();
 }
@@ -510,7 +509,7 @@ void MathedCursor::insertInset(MathedInset * p, int t)
        if (selection) {
                if (MathIsActive(t)) {
                        SelCut();
-                       static_cast<MathParInset*>(p)->setData(selarray);
+                       static_cast<MathParInset*>(p)->setData(&selarray);
                } else
                        SelDel();
        }
@@ -845,8 +844,10 @@ bool MathedCursor::pullArg()
                MathedArray * a = p->GetData();
                p->clear();
                Delete();
-               cursor->Merge(a);
-               cursor->Adjust();
+               if (!a->empty()) {
+                       cursor->Merge(a);
+                       cursor->Adjust();
+               }
 
                return true;
        }
@@ -902,8 +903,8 @@ void MathedCursor::SelCopy()
                int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
                int p2 = (cursor->getPos() > selpos) ?
                        cursor->getPos() : selpos;
-               selarray = new MathedArray(*(cursor->GetData()));
-               selarray->shrink(p1, p2);
+               selarray = *(cursor->GetData());
+               selarray.shrink(p1, p2);
                cursor->Adjust();
                SelClear();
        }
@@ -918,8 +919,8 @@ void MathedCursor::SelCut()
 
                int p1 = (cursor->getPos() < selpos) ? cursor->getPos() : selpos;
                int p2 = (cursor->getPos() > selpos) ? cursor->getPos() : selpos;
-               selarray = new MathedArray(*(cursor->GetData()));
-               selarray->shrink(p1, p2);
+               selarray = *(cursor->GetData());
+               selarray.shrink(p1, p2);
                cursor->Clean(selpos);
                cursor->Adjust();
                SelClear();
@@ -946,8 +947,8 @@ void MathedCursor::SelPaste()
        if (selection)
                SelDel();
 
-       if (selarray) {
-               cursor->Merge(selarray);
+       if (!selarray.empty()) {
+               cursor->Merge(&selarray);
                cursor->Adjust();
        }
 }
index ecf2fcdaf0675412ff76738791c93ef7e8a19c2f..62768142e61fa35f87d3db0f6ec110652f607ff0 100644 (file)
@@ -34,7 +34,7 @@ MathedInset * MathFracInset::Clone()
 {   
        MathFracInset * p = new MathFracInset(*this);
        // this cast will go again...
-       p->den_ = (MathParInset*) (p->den_->Clone());
+       p->den_ = static_cast<MathParInset*>(p->den_->Clone());
        return p;
 }
 
index 5cfe9f692bd506fadfa76e5034bc66c0819855b5..d22d6c60a06387ee0eecfc1ba222f6e8899bb392 100644 (file)
@@ -42,7 +42,7 @@ MathRootInset::~MathRootInset()
 MathedInset * MathRootInset::Clone()
 {
        MathRootInset * p = new MathRootInset(*this);
-       p->uroot_ = (MathParInset *) p->uroot_->Clone();
+       p->uroot_ = static_cast<MathParInset *>(p->uroot_->Clone());
        p->setArgumentIdx(0);
        return p;
 }