From 7abb55666ca7fb58b8fcfcef6d8ac684ad1c9504 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 6 Mar 2001 18:17:16 +0000 Subject: [PATCH] mathed46.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1696 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formula.C | 8 ++++---- src/mathed/math_matrixinset.C | 6 +++--- src/mathed/math_matrixinset.h | 10 +++++----- src/mathed/math_parinset.C | 9 +++++---- src/mathed/math_parinset.h | 6 +++--- src/mathed/math_parser.C | 4 ++-- src/mathed/math_xiter.C | 6 +++--- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/mathed/formula.C b/src/mathed/formula.C index c16e3a0b58..05277e7eeb 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -393,7 +393,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f, } else { MathMatrixInset * mt = static_cast(par); - MathedRowSt const * crow = mt->getRowSt(); + MathedRowContainer::iterator crow = mt->getRowSt().begin(); while (crow) { int const y = baseline + crow->getBaseline(); if (crow->isNumbered()) { @@ -404,7 +404,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f, str = "(#)"; pain.text(int(x + 20), y, str, wfont); } - crow = crow->getNext(); + ++crow; } } } @@ -557,11 +557,11 @@ vector const InsetFormula::getLabelList() const if (is_multi_numbered(par->GetType())) { MathMatrixInset * mt = static_cast(par); - MathedRowSt const * crow = mt->getRowSt(); + MathedRowContainer::iterator crow = mt->getRowSt().begin(); while (crow) { if (!crow->getLabel().empty()) label_list.push_back(crow->getLabel()); - crow = crow->getNext(); + ++crow; } } else if (!label_.empty()) label_list.push_back(label_); diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index cddfe2566d..ee3393d06a 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -53,7 +53,7 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset const & mt) row_ = r; else ro->setNext(r); - mrow = mrow->getNext(); + mrow = mrow->next_; ro = r; ++nr_; } @@ -67,7 +67,7 @@ MathMatrixInset::~MathMatrixInset() { MathedRowSt * r = row_.data_; while (r) { - MathedRowSt * q = r->getNext(); + MathedRowSt * q = r->next_; delete r; r = q; } @@ -184,7 +184,7 @@ void MathMatrixInset::Metrics() ascent = h - hl; break; default: - ascent = (row_.data_->getNext()) ? h / 2 : h - hl; + ascent = (row_.begin().is_last()) ? h / 2 : h - hl; break; } descent = h - ascent + 2; diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index c8c7cc45b7..6ee2478ec0 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -45,9 +45,9 @@ public: virtual bool isMatrix() const; /// Use this to manage the extra information independently of paragraph - MathedRowSt * getRowSt() const; + MathedRowContainer & getRowSt(); /// - void setRowSt(MathedRowSt * r); + void setRowSt(MathedRowContainer & r); private: /// Number of columns & rows int nc_; @@ -87,14 +87,14 @@ bool MathMatrixInset::isMatrix() const inline -MathedRowSt * MathMatrixInset::getRowSt() const +MathedRowContainer & MathMatrixInset::getRowSt() { - return row_.data_; + return row_; } inline -void MathMatrixInset::setRowSt(MathedRowSt * r) +void MathMatrixInset::setRowSt(MathedRowContainer & r) { row_ = r; } diff --git a/src/mathed/math_parinset.C b/src/mathed/math_parinset.C index ae43ae750f..7728671c71 100644 --- a/src/mathed/math_parinset.C +++ b/src/mathed/math_parinset.C @@ -21,9 +21,10 @@ using std::endl; extern int number_of_newlines; -MathedRowSt * MathParInset::getRowSt() const +MathedRowContainer & MathParInset::getRowSt() { - return 0; + static MathedRowContainer dummy; + return dummy; } @@ -270,7 +271,7 @@ void MathParInset::Write(ostream & os, bool fragile) latexkeys const * l; MathedIter data(&array); // hack - MathedRowSt const * crow = getRowSt(); + MathedRowContainer::iterator crow = getRowSt().begin(); data.Reset(); if (!Permit(LMPF_FIXED_SIZE)) { @@ -348,7 +349,7 @@ void MathParInset::Write(ostream & os, bool fragile) << crow->getLabel() << "} "; } - crow = crow->getNext(); + ++crow; } if (fragile) os << "\\protect"; diff --git a/src/mathed/math_parinset.h b/src/mathed/math_parinset.h index c5af2cfb5c..b3d8bc7d06 100644 --- a/src/mathed/math_parinset.h +++ b/src/mathed/math_parinset.h @@ -67,9 +67,9 @@ public: /// virtual void SetStyle(short); /// - virtual MathedRowSt * getRowSt() const; + virtual MathedRowContainer & getRowSt(); /// - virtual void setRowSt(MathedRowSt *); + virtual void setRowSt(MathedRowContainer &); /// virtual bool Permit(short f) const; /// @@ -150,7 +150,7 @@ int MathParInset::getMaxArgumentIdx() const inline -void MathParInset::setRowSt(MathedRowSt *) +void MathParInset::setRowSt(MathedRowContainer &) {} diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 1b67bb40e0..a4c33ef978 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -424,7 +424,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0, int acc_brace = 0; int acc_braces[8]; MathParInset * mt = (mtx) ? *mtx : 0; - MathedRowSt * crow = (mt) ? mt->getRowSt() : 0; + MathedRowSt * crow = (mt) ? mt->getRowSt().data_ : 0; ++plevel; MathedIter data(&array); @@ -869,7 +869,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0, } mt->SetStyle(size); mt->SetType(mathed_env); - crow = mt->getRowSt(); + crow = mt->getRowSt().data_; } lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl; diff --git a/src/mathed/math_xiter.C b/src/mathed/math_xiter.C index e14cc4c3e8..17fb01b10e 100644 --- a/src/mathed/math_xiter.C +++ b/src/mathed/math_xiter.C @@ -186,7 +186,7 @@ void MathedXIter::SetData(MathParInset * pp) x_ = y_ = 0; array = &p_->GetData(); ncols = p_->GetColumns(); - crow_ = p_->getRowSt(); + crow_ = p_->getRowSt().data_; if (p_->Permit(LMPF_ALLOW_CR)) flags |= MthIF_CR; if (p_->Permit(LMPF_ALLOW_TAB)) @@ -272,7 +272,7 @@ void MathedXIter::GoBegin() x_ = y_ = 0; sw_ = sx_ = 0; if (p_) { - crow_ = p_->getRowSt(); + crow_ = p_->getRowSt().data_; if (crow_) { x_ = crow_->getTab(0); y_ = crow_->getBaseline(); @@ -447,7 +447,7 @@ void MathedXIter::ipop() x_ = stck.x; y_ = stck.y; if (p_) { - crow_ = p_->getRowSt(); + crow_ = p_->getRowSt().data_; if (crow_) for (int i = 0; i < row; ++i) crow_ = crow_->getNext(); -- 2.39.2