From 5059e558f1fdbe4713a01073a93921c93d029b9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 12 Feb 2001 14:59:46 +0000 Subject: [PATCH] mathed12.diff + some small tweeks git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1488 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 16 +++++-- src/mathed/math_defs.h | 104 +++++++++++++++++++---------------------- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 4535c63426..05557de75d 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,13 +1,23 @@ +2001-02-12 Lars Gullik Bjønnes + + * math_defs.h (struct MathedRowSt): make all private variables end + with '_', initialize in initializer list instead of in function + body. + 2001-02-12 Dekel Tsur * formula.C (LocalDispatch): Change the default action of break-line to create an align* environment instead of eqnarray*. - * math_inset.C (Metrics): Correct drawing of the multline environment. + * math_inset.C (Metrics): Correct drawing of the multline + environment. 2001-02-12 André Pönitz - * array.[hC]: replace private variable maxsize_ with call - to bf_.size() + + * array.[hC]: replace private variable maxsize_ with call to + bf_.size() + * math_defs.h: replace int[] by std::vector for + MathedRowSt::widths 2001-02-09 Lars Gullik Bjønnes diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 47dd114357..b2f7be1fc8 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -409,61 +409,55 @@ class MathParInset: public MathedInset { It allows to manage the extra info independently of the paragraph data. Only used for multiline paragraphs. */ -struct MathedRowSt { - /// - explicit - MathedRowSt(int n) { - w = new int[n + 1]; // this leaks - asc = desc = y = 0; - for (int i = 0 ; i < n + 1 ; ++i) - w[i] = 0; - next = 0; - numbered = true; - } - /// - ~MathedRowSt() { - delete[] w; - } - /// Should be const but... - MathedRowSt * getNext() const { return next; } - /// ...we couldn't use this. - void setNext(MathedRowSt * n) { next = n; } - /// - string const & getLabel() const { return label; } - /// - bool isNumbered() const { return numbered; } - /// - int getBaseline() const { return y; } - /// - void setBaseline(int b) { y = b; } - /// - int ascent() const { return asc; } - /// - int descent() const { return desc; } - /// - void ascent(int a) { asc = a; } - /// - void descent(int d) { desc = d; } - /// - int getTab(int i) const { return w[i]; } - /// - void setLabel(string const & l) { label = l; } - /// - void setNumbered(bool nf) { numbered = nf; } - /// - void setTab(int i, int t) { w[i] = t; } - - private: - /// Vericals - int asc, desc, y; - /// widths - int * w; - /// - string label; - /// - bool numbered; - /// - MathedRowSt * next; +struct MathedRowSt +{ + /// + explicit + MathedRowSt(int n) + : asc_(0), desc_(0), y_(0), widths_(n + 1, 0), + numbered_(true), next_(0) + {} + /// Should be const but... + MathedRowSt * getNext() const { return next_; } + /// ...we couldn't use this. + void setNext(MathedRowSt * n) { next_ = n; } + /// + string const & getLabel() const { return label_; } + /// + bool isNumbered() const { return numbered_; } + /// + int getBaseline() const { return y_; } + /// + void setBaseline(int b) { y_ = b; } + /// + int ascent() const { return asc_; } + /// + int descent() const { return desc_; } + /// + void ascent(int a) { asc_ = a; } + /// + void descent(int d) { desc_ = d; } + /// + int getTab(int i) const { return widths_[i]; } + /// + void setLabel(string const & l) { label_ = l; } + /// + void setNumbered(bool nf) { numbered_ = nf; } + /// + void setTab(int i, int t) { widths_[i] = t; } +private: + /// Vericals + int asc_; + int desc_; + int y_; + /// widths + std::vector widths_; + /// + string label_; + /// + bool numbered_; + /// + MathedRowSt * next_; }; -- 2.39.5