From 7511cc189e3fdb881fd292366741796fcbabb4e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 20 Feb 2001 14:00:34 +0000 Subject: [PATCH] mathed32.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1570 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 2 ++ src/mathed/math_cursor.C | 23 ++++++++++++----------- src/mathed/math_fracinset.C | 2 +- src/mathed/math_root.C | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index d25266b148..4bfd90dffd 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -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 diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 45c58b7f6f..ed18539c84 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -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(p)->setData(selarray); + static_cast(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(); } } diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index ecf2fcdaf0..62768142e6 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -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(p->den_->Clone()); return p; } diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index 5cfe9f692b..d22d6c60a0 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -42,7 +42,7 @@ MathRootInset::~MathRootInset() MathedInset * MathRootInset::Clone() { MathRootInset * p = new MathRootInset(*this); - p->uroot_ = (MathParInset *) p->uroot_->Clone(); + p->uroot_ = static_cast(p->uroot_->Clone()); p->setArgumentIdx(0); return p; } -- 2.39.2