This should be a cure for the 'missing \nonumber after read'. Next step is to move the inline hacks to math_rowst.C and it really starts looking better... Andre' -- André Pönitz ........................................ [EMAIL PROTECTED]
Index: math_parser.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parser.C,v retrieving revision 1.42 diff -u -p -r1.42 math_parser.C --- math_parser.C 2001/03/15 10:10:01 1.42 +++ math_parser.C 2001/03/15 13:01:22 @@ -424,9 +424,6 @@ void mathed_parse(MathedArray & array, u int acc_brace = 0; int acc_braces[8]; MathParInset * mt = (mtx) ? *mtx : 0; - MathedRowContainer::iterator crow; - if (mt) - crow = mt->getRowSt().begin(); ++plevel; MathedIter data(&array); @@ -604,8 +601,7 @@ void mathed_parse(MathedArray & array, u case LM_TK_NEWLINE: if (mt && (flags & FLAG_END)) { if (mt->Permit(LMPF_ALLOW_CR)) { - mt->getRowSt().insert(crow); - ++crow; + mt->getRowSt().push_back(); data.insert('K', LM_TC_CR); } else mathPrintError("Unexpected newline"); @@ -757,8 +753,11 @@ void mathed_parse(MathedArray & array, u break; case LM_TK_NONUM: - if (crow) - crow->setNumbered(false); + if (mt) { + if (!mt->getRowSt().data_.size()) + mt->getRowSt().push_back(); + mt->getRowSt().back().setNumbered(false); + } break; case LM_TK_PMOD: @@ -869,7 +868,6 @@ void mathed_parse(MathedArray & array, u } mt->SetStyle(size); mt->SetType(mathed_env); - crow = mt->getRowSt().begin(); } lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl; @@ -914,8 +912,8 @@ void mathed_parse(MathedArray & array, u panic = true; break; } - if (crow) { - crow->setLabel(yytext.data()); + if (mt) { + mt->getRowSt().back().setLabel(yytext.data()); } else { mathed_label = yytext.data(); } Index: math_rowst.C =================================================================== RCS file: math_rowst.C diff -N math_rowst.C Index: math_rowst.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_rowst.h,v retrieving revision 1.11 diff -u -p -r1.11 math_rowst.h --- math_rowst.h 2001/03/15 10:10:01 1.11 +++ math_rowst.h 2001/03/15 13:01:22 @@ -44,10 +44,8 @@ public: void setNumbered(bool nf); /// void setTab(unsigned int i, int t); - /// - friend class MathedRowSt; protected: - /// Vericals + /// verticals int asc_; /// int desc_; @@ -62,11 +60,9 @@ protected: }; -// The idea is to change this MathedRowContainer to mimic the behaviour -// of std::list<MathedRowStruct> in several small steps. In the end it -// could be replaced by such a list and MathedRowSt can go as well. -struct MathedRowContainer { +class MathedRowContainer { +private: /// struct iterator { /// @@ -79,9 +75,9 @@ struct MathedRowContainer { /// MathedRowStruct & operator*() { Assert(st_); return st_->data_[pos_]; } /// - MathedRowStruct * operator->() { return &st_->data_[pos_]; } + MathedRowStruct * operator->() { Assert(st_); return +&st_->data_[pos_]; } /// - MathedRowStruct const * operator->() const { return &st_->data_[pos_]; } + MathedRowStruct const * operator->() const { Assert(st_); return +&st_->data_[pos_]; } /// void operator++() { Assert(st_); ++pos_; } /// @@ -92,26 +88,43 @@ struct MathedRowContainer { //private: /// + friend class MathedRowContainer; + + /// pointer to the container to which we belong MathedRowContainer * st_; - /// + /// position in this container, e.g. row number unsigned int pos_; }; - /// +public: + /// iterator begin() { return iterator(this); } /// bool empty() const { return data_.size() == 0; } - /// insert 'item' before 'iterator' + /// insert item before 'it' void insert(iterator const & it) { Assert(it.st_ == this); data_.insert(data_.begin() + it.pos_, MathedRowStruct()); } + /// erase item pointed to by 'it' void erase(iterator & it) { Assert(it.st_ == this); data_.erase(data_.begin() + it.pos_); } + + /// access to last item + MathedRowStruct & back() { + Assert(data_.size()); + return data_.back(); + } + + /// append empty element + void push_back() { + data_.push_back(MathedRowStruct()); + } + /// std::vector<MathedRowStruct> data_;