> Where's the diff? /usr/src/lyx/lyx-devel/src/mathed/mathed30.diff Oh.. you mean I'd better attach it to the mail? Andre' -- André Pönitz ........................................ [EMAIL PROTECTED]
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v retrieving revision 1.36 diff -u -p -u -r1.36 ChangeLog --- ChangeLog 2001/02/19 18:29:09 1.36 +++ ChangeLog 2001/02/20 10:01:01 @@ -1,3 +1,11 @@ +2001-02-14 André Pönitz <[EMAIL PROTECTED]> + + * math_parinset.[Ch]: make array a real MathArray, not just a + pointer to one. + + * several files: subsequent changes + + 2001-02-19 Dekel Tsur <[EMAIL PROTECTED]> * array.C (MathedArray): Fix compilation problem. Index: math_decorationinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.C,v retrieving revision 1.4 diff -u -p -u -r1.4 math_decorationinset.C --- math_decorationinset.C 2001/02/16 09:25:42 1.4 +++ math_decorationinset.C 2001/02/20 10:01:01 @@ -24,10 +24,7 @@ bool MathDecorationInset::GetLimits() co MathedInset * MathDecorationInset::Clone() { - MathDecorationInset * p = new MathDecorationInset(deco_, GetStyle()); - MathedIter it(array); - p->setData(it.Copy()); - return p; + return new MathDecorationInset(*this); } Index: math_deliminset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_deliminset.C,v retrieving revision 1.4 diff -u -p -u -r1.4 math_deliminset.C --- math_deliminset.C 2001/02/16 09:25:43 1.4 +++ math_deliminset.C 2001/02/20 10:01:01 @@ -17,10 +17,7 @@ MathDelimInset::MathDelimInset(int l, in MathedInset * MathDelimInset::Clone() { - MathDelimInset * p = new MathDelimInset(left_, right_, GetStyle()); - MathedIter it(array); - p->setData(it.Copy()); - return p; + return new MathDelimInset(*this); } Index: math_fracinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_fracinset.C,v retrieving revision 1.4 diff -u -p -u -r1.4 math_fracinset.C --- math_fracinset.C 2001/02/16 09:25:43 1.4 +++ math_fracinset.C 2001/02/20 10:01:01 @@ -32,12 +32,9 @@ MathFracInset::~MathFracInset() MathedInset * MathFracInset::Clone() { - MathFracInset * p = new MathFracInset(GetType()); - MathedIter itn(array); - MathedIter itd(den_->GetData()); - p->SetData(itn.Copy(), itd.Copy()); - p->idx_ = idx_; - p->dh_ = dh_; + MathFracInset * p = new MathFracInset(*this); + // this cast will go again... + p->den_ = (MathParInset*) (p->den_->Clone()); return p; } @@ -91,7 +88,7 @@ void MathFracInset::GetXY(int & x, int & MathedArray * MathFracInset::GetData() { if (idx_ == 0) - return array; + return &array; else return den_->GetData(); } Index: math_macro.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_macro.C,v retrieving revision 1.39 diff -u -p -u -r1.39 math_macro.C --- math_macro.C 2001/02/16 09:25:43 1.39 +++ math_macro.C 2001/02/20 10:01:01 @@ -69,20 +69,14 @@ MathMacro::MathMacro(MathMacro * m): SetName(tmplate_->GetName()); for (int i = 0; i < tmplate_->getNoArgs(); ++i) { m->setArgumentIdx(i); - MathedIter it(m->GetData()); args_[i].row = m->args_[i].row; - args_[i].array = it.Copy(); + args_[i].array = *(m->GetData()); } } MathMacro::~MathMacro() { - for (idx_ = 0; idx_ < nargs_; ++idx_) { - MathedIter it(args_[idx_].array); - it.Clear(); - delete args_[idx_].row; - } } @@ -142,7 +136,7 @@ int MathMacro::getMaxArgumentIdx() const MathedArray * MathMacro::GetData() { - return args_[idx_].array; + return &args_[idx_].array; } @@ -175,7 +169,7 @@ void MathMacro::SetFocus(int x, int y) void MathMacro::setData(MathedArray * a) { - args_[idx_].array = a; + args_[idx_].array = *a; } Index: math_macro.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_macro.h,v retrieving revision 1.30 diff -u -p -u -r1.30 math_macro.h --- math_macro.h 2001/02/16 09:25:43 1.30 +++ math_macro.h 2001/02/20 10:01:01 @@ -84,10 +84,10 @@ private: /// MathedRowSt * row; /// - MathedArray * array; + MathedArray array; /// MacroArgumentBase() - : x(0), y(0), row(0), array(0) + : x(0), y(0), row(0) {} }; std::vector<MacroArgumentBase> args_; Index: math_matrixinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_matrixinset.C,v retrieving revision 1.5 diff -u -p -u -r1.5 math_matrixinset.C --- math_matrixinset.C 2001/02/19 18:29:10 1.5 +++ math_matrixinset.C 2001/02/20 10:01:01 @@ -35,8 +35,7 @@ MathMatrixInset::MathMatrixInset(MathMat nc_(mt->nc_), nr_(0), ws_(mt->nc_), v_align_(mt->v_align_), h_align_(mt->h_align_) { - MathedIter it(mt->GetData()); - array = it.Copy(); + array = *(mt->GetData()); if (mt->row_ != 0) { MathedRowSt * ro = 0; MathedRowSt * mrow = mt->row_; @@ -116,7 +115,7 @@ void MathMatrixInset::setData(MathedArra // Automatically inserts tabs around bops // DISABLED because it's very easy to insert tabs - array = a; + array = *a; } Index: math_parinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parinset.C,v retrieving revision 1.6 diff -u -p -u -r1.6 math_parinset.C --- math_parinset.C 2001/02/17 16:43:31 1.6 +++ math_parinset.C 2001/02/20 10:01:01 @@ -26,7 +26,6 @@ MathedRowSt * MathParInset::getRowSt() c MathParInset::MathParInset(short st, string const & nm, short ot) : MathedInset(nm, ot, st) { - array = 0; ascent = 8; width = 4; descent = 0; @@ -48,11 +47,6 @@ MathParInset::MathParInset(MathParInset MathParInset::~MathParInset() { - if (array) { - MathedIter it(array); - it.Clear(); - delete array; - } } @@ -64,18 +58,16 @@ MathedInset * MathParInset::Clone() void MathParInset::setData(MathedArray * a) { - array = a; + array = *a; // A standard paragraph shouldn't have any tabs nor CRs. - if (array) { - MathedIter it(array); - while (it.OK()) { - char c = it.GetChar(); - if (c == LM_TC_TAB || c == LM_TC_CR) - it.Delete(); - else - it.Next(); - } + MathedIter it(&array); + while (it.OK()) { + char c = it.GetChar(); + if (c == LM_TC_TAB || c == LM_TC_CR) + it.Delete(); + else + it.Next(); } } @@ -91,11 +83,9 @@ MathParInset::draw(Painter & pain, int x xo_ = x; yo_ = y; - if (!array || array->empty()) { - if (array) { - MathedXIter data(this); - data.GetPos(x, y); - } + if (array.empty()) { + MathedXIter data(this); + data.GetPos(x, y); pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline); return; } @@ -187,8 +177,7 @@ MathParInset::Metrics() ascent = df_asc;//mathed_char_height(LM_TC_VAR, size, 'I', asc, des); width = df_width; descent = 0; - if (!array) return; - if (array->empty()) return; + if (array.empty()) return; ascent = 0; MathedXIter data(this); @@ -284,10 +273,10 @@ MathParInset::Metrics() void MathParInset::Write(ostream & os, bool fragile) { - if (!array) return; + if (array.empty()) return; int brace = 0; latexkeys const * l; - MathedIter data(array); + MathedIter data(&array); // hack MathedRowSt const * crow = getRowSt(); data.Reset(); @@ -442,7 +431,7 @@ bool MathParInset::Permit(short f) const MathedArray * MathParInset::GetData() { - return array; + return &array; } Index: math_parinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parinset.h,v retrieving revision 1.4 diff -u -p -u -r1.4 math_parinset.h --- math_parinset.h 2001/02/16 09:25:43 1.4 +++ math_parinset.h 2001/02/20 10:01:01 @@ -2,6 +2,7 @@ #ifndef MATH_PARINSET_H #define MATH_PARINSET_H +#include "array.h" #include "math_inset.h" #include "math_defs.h" @@ -80,7 +81,7 @@ public: } protected: /// Paragraph data is stored here - MathedArray * array; + MathedArray array; /// short flag; /// Index: math_root.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_root.C,v retrieving revision 1.18 diff -u -p -u -r1.18 math_root.C --- math_root.C 2001/02/16 09:25:43 1.18 +++ math_root.C 2001/02/20 10:01:01 @@ -41,13 +41,9 @@ MathRootInset::~MathRootInset() MathedInset * MathRootInset::Clone() { - MathRootInset * p = new MathRootInset(GetStyle()); - MathedIter it(array); - MathedIter itr(uroot_->GetData()); - p->setData(it.Copy()); + MathRootInset * p = new MathRootInset(*this); + p->uroot_ = (MathParInset *) p->uroot_->Clone(); p->setArgumentIdx(0); - p->setData(itr.Copy()); - return p; } @@ -84,7 +80,7 @@ void MathRootInset::GetXY(int & x, int & MathedArray * MathRootInset::GetData() { if (idx_ == 1) - return array; + return &array; else return uroot_->GetData(); } Index: math_sqrtinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_sqrtinset.C,v retrieving revision 1.4 diff -u -p -u -r1.4 math_sqrtinset.C --- math_sqrtinset.C 2001/02/16 09:25:43 1.4 +++ math_sqrtinset.C 2001/02/20 10:01:01 @@ -15,10 +15,7 @@ MathSqrtInset::MathSqrtInset(short st) MathedInset * MathSqrtInset::Clone() { - MathSqrtInset * p = new MathSqrtInset(GetStyle()); - MathedIter it(array); - p->setData(it.Copy()); - return p; + return new MathSqrtInset(*this); }