From 9735a90b71db0733aef8b4c1782b075a56464939 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 12 Feb 2001 18:06:56 +0000 Subject: [PATCH] mathed14.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1492 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 7 +++++++ src/mathed/math_defs.h | 2 +- src/mathed/math_inset.C | 38 ++++++++++++++++---------------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 05557de75d..edf3df6c3c 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,10 @@ +2001-02-12 André Pönitz + + * math_macro.[hC]: replace MathMacroArgument[] with + std::vector + * math_defs.h: + math_inset.C: replace int[] with std::vector + 2001-02-12 Lars Gullik Bjønnes * math_defs.h (struct MathedRowSt): make all private variables end diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 4947204560..9421701036 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -505,7 +505,7 @@ class MathMatrixInset: public MathParInset { /// int nr; /// tab sizes - int * ws; + std::vector ws_; /// char v_align; // add approp. type /// diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index 58af303bb7..0882396fc1 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -287,11 +287,9 @@ void MathFracInset::SetFocus(int /*x*/, int y) MathMatrixInset::MathMatrixInset(int m, int n, short st) - : MathParInset(st, "array", LM_OT_MATRIX), nc(m), + : MathParInset(st, "array", LM_OT_MATRIX), nc(m), nr(0), ws_(m), v_align(0), h_align(nc, 'c') { - ws = new int[nc]; - nr = 0; row = 0; flag = 15; if (n > 0) { @@ -312,10 +310,8 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st) MathMatrixInset::MathMatrixInset(MathMatrixInset * mt) : MathParInset(mt->GetStyle(), mt->GetName(), mt->GetType()), - nc(mt->nc), v_align(mt->v_align), h_align(mt->h_align) + nc(mt->nc), nr(0), ws_(mt->nc), v_align(mt->v_align), h_align(mt->h_align) { - nr = 0; - ws = new int[nc]; MathedIter it; it.SetData(mt->GetData()); array = it.Copy(); @@ -343,8 +339,6 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset * mt) MathMatrixInset::~MathMatrixInset() { - delete[] ws; - MathedRowSt * r = row; while (r) { MathedRowSt * q = r->getNext(); @@ -439,9 +433,9 @@ void MathMatrixInset::Metrics() cxrow = row; while (cxrow) { for (i = 0; i < nc; ++i) { - if (cxrow == row || ws[i] < cxrow->getTab(i)) - ws[i] = cxrow->getTab(i); - if (cxrow->getNext() == 0 && ws[i] == 0) ws[i] = df_width; + if (cxrow == row || ws_[i] < cxrow->getTab(i)) + ws_[i] = cxrow->getTab(i); + if (cxrow->getNext() == 0 && ws_[i] == 0) ws_[i] = df_width; } cxrow->setBaseline((cxrow == row) ? @@ -464,14 +458,14 @@ void MathMatrixInset::Metrics() } descent = h - ascent + 2; - // Increase ws[i] for 'R' columns (except the first one) + // Increase ws_[i] for 'R' columns (except the first one) for (i = 1; i < nc; ++i) if (h_align[i] == 'R') - ws[i] += 10*df_width; - // Increase ws[i] for 'C' column + ws_[i] += 10*df_width; + // Increase ws_[i] for 'C' column if (h_align[0] == 'C') - if (ws[0] < 7*workWidth/8) - ws[0] = 7*workWidth/8; + if (ws_[0] < 7*workWidth/8) + ws_[0] = 7*workWidth/8; // Adjust local tabs cxrow = row; @@ -489,25 +483,25 @@ void MathMatrixInset::Metrics() lf = 0; break; case 'c': - lf = (ws[i] - cxrow->getTab(i))/2; + lf = (ws_[i] - cxrow->getTab(i))/2; break; case 'r': case 'R': - lf = ws[i] - cxrow->getTab(i); + lf = ws_[i] - cxrow->getTab(i); break; case 'C': if (cxrow == row) lf = 0; else if (!cxrow->getNext()) - lf = ws[i] - cxrow->getTab(i); + lf = ws_[i] - cxrow->getTab(i); else - lf = (ws[i] - cxrow->getTab(i))/2; + lf = (ws_[i] - cxrow->getTab(i))/2; break; } ww = (isvoid) ? lf : lf + cxrow->getTab(i); cxrow->setTab(i, lf + rg); - rg = ws[i] - ww + MATH_COLSEP; - if (cxrow == row) width += ws[i] + MATH_COLSEP; + rg = ws_[i] - ww + MATH_COLSEP; + if (cxrow == row) width += ws_[i] + MATH_COLSEP; } cxrow->setBaseline(cxrow->getBaseline() - ascent); cxrow = cxrow->getNext(); -- 2.39.5