From 303a6c126c3b00a831053897cba7a18615ef60eb Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Wed, 31 Mar 2004 19:11:56 +0000 Subject: [PATCH] s/DocumentIterator/DocIterator/g a.k.a showing off my sed abilities. Sorry for the cvs spam. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8574 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 6 +- src/BufferView.h | 4 +- src/ChangeLog | 14 ++- src/cursor.C | 36 ++++---- src/cursor.h | 12 +-- src/dociterator.C | 92 +++++++++---------- src/dociterator.h | 28 +++--- src/frontends/controllers/ChangeLog | 10 ++ .../controllers/ControlSpellchecker.C | 12 +-- src/insetiterator.C | 2 +- src/insetiterator.h | 2 +- src/lyxfind.C | 14 +-- src/lyxfunc.C | 4 +- src/mathed/ChangeLog | 4 + src/mathed/math_hullinset.C | 4 +- src/pariterator.C | 24 ++--- src/pariterator.h | 10 +- src/text2.C | 4 +- src/undo.C | 8 +- src/undo.h | 2 +- 20 files changed, 157 insertions(+), 135 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 0215990ca4..f517757966 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -371,7 +371,7 @@ void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos) for (int i = 0; i < last; ++i) par[i].inset().edit(cursor(), true); - cursor().setCursor(makeDocumentIterator(par, pos), false); + cursor().setCursor(makeDocIterator(par, pos), false); } @@ -389,7 +389,7 @@ this is solved in putSelectionAt with: Ab. */ -void BufferView::putSelectionAt(DocumentIterator const & cur, +void BufferView::putSelectionAt(DocIterator const & cur, int length, bool backwards) { ParIterator par(cur); @@ -409,7 +409,7 @@ void BufferView::putSelectionAt(DocumentIterator const & cur, if (length) { if (backwards) { cursor().setSelection(cursor(), -length); - DocumentIterator const it = cursor(); + DocIterator const it = cursor(); cursor().setCursor(cursor().anchor_, true); cursor().anchor_ = it; } else diff --git a/src/BufferView.h b/src/BufferView.h index 3a2a7d03c6..10ee911ab7 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -23,7 +23,7 @@ class Buffer; class Change; -class DocumentIterator; +class DocIterator; class Encoding; class ErrorList; class FuncRequest; @@ -173,7 +173,7 @@ public: /// void setCursor(ParIterator const & par, lyx::pos_type pos); /// - void putSelectionAt(DocumentIterator const & cur, + void putSelectionAt(DocIterator const & cur, int length, bool backwards); private: diff --git a/src/ChangeLog b/src/ChangeLog index c24bff5714..51a08ccb6d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,12 +3,22 @@ * lyxfunc.C (getStatus, dispatch): changed invocation of the preferences dialog. +2004-03-31 Alfredo Braunstein + + * BufferView.C + * cursor.[Ch] + * dociterator.[Ch]: + * insetiterator.[Ch]: + * lyxfind.C: + * lyxfunc.C: + * pariterator.[Ch]: + * text2.C: + * undo.[Ch]: s/DocumentIterator/DocIterator/g + 2004-03-31 Alfredo Braunstein * BufferView.C (setCursor, putSelectionAt): call edit to open the insets where we are putting the cursor. - * ControlSpellchecker.C (isLetter, nextWord): check for inTextEd, - use forwardPos. 2004-03-31 Angus Leeming diff --git a/src/cursor.C b/src/cursor.C index 22029e884b..926c341e86 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -84,7 +84,7 @@ void region(CursorSlice const & i1, CursorSlice const & i2, LCursor::LCursor(BufferView & bv) - : DocumentIterator(), bv_(&bv), + : DocIterator(), bv_(&bv), anchor_(), cached_y_(0), x_target_(-1), selection_(false), mark_(false) {} @@ -94,7 +94,7 @@ void LCursor::reset(InsetBase & inset) { clear(); push_back(CursorSlice(inset)); - anchor_ = DocumentIterator(inset); + anchor_ = DocIterator(inset); cached_y_ = 0; clearTargetX(); selection_ = false; @@ -102,10 +102,10 @@ void LCursor::reset(InsetBase & inset) } -void LCursor::setCursor(DocumentIterator const & cur, bool sel) +void LCursor::setCursor(DocIterator const & cur, bool sel) { // this (intentionally) does not touch the anchor - DocumentIterator::operator=(cur); + DocIterator::operator=(cur); selection() = sel; } @@ -344,7 +344,7 @@ CursorSlice const & LCursor::selEnd() const } -DocumentIterator LCursor::selectionBegin() const +DocIterator LCursor::selectionBegin() const { if (!selection()) return *this; @@ -352,7 +352,7 @@ DocumentIterator LCursor::selectionBegin() const } -DocumentIterator LCursor::selectionEnd() const +DocIterator LCursor::selectionEnd() const { if (!selection()) return *this; @@ -369,7 +369,7 @@ void LCursor::setSelection() } -void LCursor::setSelection(DocumentIterator const & where, size_t n) +void LCursor::setSelection(DocIterator const & where, size_t n) { selection() = true; setCursor(where, false); @@ -631,8 +631,8 @@ bool LCursor::openable(MathAtom const & t) const } -bool positionable(DocumentIterator const & cursor, - DocumentIterator const & anchor) +bool positionable(DocIterator const & cursor, + DocIterator const & anchor) { // avoid deeper nested insets when selecting if (cursor.size() > anchor.size()) @@ -836,7 +836,7 @@ bool LCursor::erase() bool LCursor::up() { macroModeClose(); - DocumentIterator save = *this; + DocIterator save = *this; if (goUpDown(true)) return true; setCursor(save, false); @@ -848,7 +848,7 @@ bool LCursor::up() bool LCursor::down() { macroModeClose(); - DocumentIterator save = *this; + DocIterator save = *this; if (goUpDown(false)) return true; setCursor(save, false); @@ -977,8 +977,8 @@ void LCursor::touch() { #warning look here #if 0 - DocumentIterator::const_iterator it = begin(); - DocumentIterator::const_iterator et = end(); + DocIterator::const_iterator it = begin(); + DocIterator::const_iterator et = end(); for ( ; it != et; ++it) it->cell().touch(); #endif @@ -1118,8 +1118,8 @@ bool LCursor::bruteFind(int x, int y, int xlow, int xhigh, int ylow, int yhigh) BOOST_ASSERT(text); getParsInRange(text->paragraphs(), ylow, yhigh, beg, end); - DocumentIterator it = doc_iterator_begin(bv().buffer()->inset()); - DocumentIterator et = doc_iterator_end(bv().buffer()->inset()); + DocIterator it = doc_iterator_begin(bv().buffer()->inset()); + DocIterator et = doc_iterator_end(bv().buffer()->inset()); //lyxerr << "x: " << x << " y: " << y << endl; //lyxerr << "xlow: " << xlow << " ylow: " << ylow << endl; //lyxerr << "xhigh: " << xhigh << " yhigh: " << yhigh << endl; @@ -1128,7 +1128,7 @@ bool LCursor::bruteFind(int x, int y, int xlow, int xhigh, int ylow, int yhigh) //et.par() = text->parOffset(end); double best_dist = 10e10; - DocumentIterator best_cursor = it; + DocIterator best_cursor = it; for ( ; it != et; it.forwardPos()) { // avoid invalid nesting when selecting @@ -1161,9 +1161,9 @@ void LCursor::bruteFind2(int x, int y) { double best_dist = 1e10; - DocumentIterator it = *this; + DocIterator it = *this; it.back().pos() = 0; - DocumentIterator et = *this; + DocIterator et = *this; et.back().pos() = et.back().asMathInset()->cell(et.back().idx()).size(); for (int i = 0; ; ++i) { int xo, yo; diff --git a/src/cursor.h b/src/cursor.h index d39c2e3e52..ad3cf1fbb8 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -32,7 +32,7 @@ class Encoding; // The public inheritance should go in favour of a suitable data member // (or maybe private inheritance) at some point of time. -class LCursor : public DocumentIterator { +class LCursor : public DocIterator { public: /// create the cursor of a BufferView explicit LCursor(BufferView & bv); @@ -53,7 +53,7 @@ public: /// pop one slice off the cursor stack and go right bool popRight(); /// sets cursor part - void setCursor(DocumentIterator const & it, bool sel); + void setCursor(DocIterator const & it, bool sel); // // selection @@ -69,7 +69,7 @@ public: /// void setSelection(); /// set selection at given position - void setSelection(DocumentIterator const & where, size_t n); + void setSelection(DocIterator const & where, size_t n); /// void clearSelection(); /// access start of selection @@ -77,9 +77,9 @@ public: /// access end of selection CursorSlice const & selEnd() const; /// access start of selection - DocumentIterator selectionBegin() const; + DocIterator selectionBegin() const; /// access start of selection - DocumentIterator selectionEnd() const; + DocIterator selectionEnd() const; /// std::string grabSelection(); /// @@ -181,7 +181,7 @@ public: BufferView * bv_; //private: /// the anchor position - DocumentIterator anchor_; + DocIterator anchor_; /// DispatchResult disp_; diff --git a/src/dociterator.C b/src/dociterator.C index cab8d199d7..97630288c3 100644 --- a/src/dociterator.C +++ b/src/dociterator.C @@ -29,29 +29,29 @@ using std::endl; //we could be able to get rid of this if only every BufferView were //associated to a buffer on construction -DocumentIterator::DocumentIterator() : inset_(0) +DocIterator::DocIterator() : inset_(0) {} -DocumentIterator doc_iterator_begin(InsetBase & inset) +DocIterator doc_iterator_begin(InsetBase & inset) { - DocumentIterator dit(inset); + DocIterator dit(inset); dit.forwardPos(); return dit; } -DocumentIterator doc_iterator_end(InsetBase & inset) +DocIterator doc_iterator_end(InsetBase & inset) { - return DocumentIterator(inset); + return DocIterator(inset); } -DocumentIterator::DocumentIterator(InsetBase & inset) : inset_(&inset) +DocIterator::DocIterator(InsetBase & inset) : inset_(&inset) {} -InsetBase * DocumentIterator::nextInset() +InsetBase * DocIterator::nextInset() { BOOST_ASSERT(!empty()); if (pos() == lastpos()) @@ -62,7 +62,7 @@ InsetBase * DocumentIterator::nextInset() } -InsetBase * DocumentIterator::prevInset() +InsetBase * DocIterator::prevInset() { BOOST_ASSERT(!empty()); if (pos() == 0) @@ -73,7 +73,7 @@ InsetBase * DocumentIterator::prevInset() } -InsetBase const * DocumentIterator::prevInset() const +InsetBase const * DocIterator::prevInset() const { BOOST_ASSERT(!empty()); if (pos() == 0) @@ -84,7 +84,7 @@ InsetBase const * DocumentIterator::prevInset() const } -MathAtom const & DocumentIterator::prevAtom() const +MathAtom const & DocIterator::prevAtom() const { BOOST_ASSERT(!empty()); BOOST_ASSERT(pos() > 0); @@ -92,7 +92,7 @@ MathAtom const & DocumentIterator::prevAtom() const } -MathAtom & DocumentIterator::prevAtom() +MathAtom & DocIterator::prevAtom() { BOOST_ASSERT(!empty()); BOOST_ASSERT(pos() > 0); @@ -100,7 +100,7 @@ MathAtom & DocumentIterator::prevAtom() } -MathAtom const & DocumentIterator::nextAtom() const +MathAtom const & DocIterator::nextAtom() const { BOOST_ASSERT(!empty()); BOOST_ASSERT(pos() < lastpos()); @@ -108,7 +108,7 @@ MathAtom const & DocumentIterator::nextAtom() const } -MathAtom & DocumentIterator::nextAtom() +MathAtom & DocIterator::nextAtom() { BOOST_ASSERT(!empty()); BOOST_ASSERT(pos() < lastpos()); @@ -116,129 +116,129 @@ MathAtom & DocumentIterator::nextAtom() } -LyXText * DocumentIterator::text() const +LyXText * DocIterator::text() const { BOOST_ASSERT(!empty()); return top().text(); } -Paragraph & DocumentIterator::paragraph() +Paragraph & DocIterator::paragraph() { BOOST_ASSERT(inTexted()); return top().paragraph(); } -Paragraph const & DocumentIterator::paragraph() const +Paragraph const & DocIterator::paragraph() const { BOOST_ASSERT(inTexted()); return top().paragraph(); } -Row & DocumentIterator::textRow() +Row & DocIterator::textRow() { return *paragraph().getRow(pos()); } -Row const & DocumentIterator::textRow() const +Row const & DocIterator::textRow() const { return *paragraph().getRow(pos()); } -DocumentIterator::par_type DocumentIterator::lastpar() const +DocIterator::par_type DocIterator::lastpar() const { return inMathed() ? 0 : text()->paragraphs().size() - 1; } -DocumentIterator::pos_type DocumentIterator::lastpos() const +DocIterator::pos_type DocIterator::lastpos() const { return inMathed() ? cell().size() : paragraph().size(); } -DocumentIterator::row_type DocumentIterator::crow() const +DocIterator::row_type DocIterator::crow() const { return paragraph().row(pos()); } -DocumentIterator::row_type DocumentIterator::lastcrow() const +DocIterator::row_type DocIterator::lastcrow() const { return paragraph().rows.size(); } -DocumentIterator::idx_type DocumentIterator::lastidx() const +DocIterator::idx_type DocIterator::lastidx() const { return top().lastidx(); } -size_t DocumentIterator::nargs() const +size_t DocIterator::nargs() const { // assume 1x1 grid for main text return top().nargs(); } -size_t DocumentIterator::ncols() const +size_t DocIterator::ncols() const { // assume 1x1 grid for main text return top().ncols(); } -size_t DocumentIterator::nrows() const +size_t DocIterator::nrows() const { // assume 1x1 grid for main text return top().nrows(); } -DocumentIterator::row_type DocumentIterator::row() const +DocIterator::row_type DocIterator::row() const { return top().row(); } -DocumentIterator::col_type DocumentIterator::col() const +DocIterator::col_type DocIterator::col() const { return top().col(); } -MathArray const & DocumentIterator::cell() const +MathArray const & DocIterator::cell() const { BOOST_ASSERT(inMathed()); return top().cell(); } -MathArray & DocumentIterator::cell() +MathArray & DocIterator::cell() { BOOST_ASSERT(inMathed()); return top().cell(); } -bool DocumentIterator::inMathed() const +bool DocIterator::inMathed() const { return !empty() && inset().inMathed(); } -bool DocumentIterator::inTexted() const +bool DocIterator::inTexted() const { return !empty() && !inset().inMathed(); } -LyXText * DocumentIterator::innerText() const +LyXText * DocIterator::innerText() const { BOOST_ASSERT(!empty()); // go up until first non-0 text is hit @@ -250,7 +250,7 @@ LyXText * DocumentIterator::innerText() const } -InsetBase * DocumentIterator::innerInsetOfType(int code) const +InsetBase * DocIterator::innerInsetOfType(int code) const { for (int i = size() - 1; i >= 0; --i) if (operator[](i).inset_->lyxCode() == code) @@ -259,7 +259,7 @@ InsetBase * DocumentIterator::innerInsetOfType(int code) const } -void DocumentIterator::forwardPos() +void DocIterator::forwardPos() { //this dog bites his tail if (empty()) { @@ -327,7 +327,7 @@ void DocumentIterator::forwardPos() } -void DocumentIterator::forwardPar() +void DocIterator::forwardPar() { forwardPos(); while (!empty() && (!inTexted() || pos() != 0)) @@ -335,7 +335,7 @@ void DocumentIterator::forwardPar() } -void DocumentIterator::forwardChar() +void DocIterator::forwardChar() { forwardPos(); while (size() != 0 && pos() == lastpos()) @@ -343,7 +343,7 @@ void DocumentIterator::forwardChar() } -void DocumentIterator::forwardInset() +void DocIterator::forwardInset() { forwardPos(); while (size() != 0 && (pos() == lastpos() || nextInset() == 0)) @@ -351,7 +351,7 @@ void DocumentIterator::forwardInset() } -void DocumentIterator::backwardChar() +void DocIterator::backwardChar() { backwardPos(); while (size() != 0 && pos() == lastpos()) @@ -359,7 +359,7 @@ void DocumentIterator::backwardChar() } -void DocumentIterator::backwardPos() +void DocIterator::backwardPos() { //this dog bites his tail if (empty()) { @@ -407,7 +407,7 @@ void DocumentIterator::backwardPos() } -std::ostream & operator<<(std::ostream & os, DocumentIterator const & dit) +std::ostream & operator<<(std::ostream & os, DocIterator const & dit) { for (size_t i = 0, n = dit.size(); i != n; ++i) os << " " << dit.operator[](i) << "\n"; @@ -418,7 +418,7 @@ std::ostream & operator<<(std::ostream & os, DocumentIterator const & dit) /////////////////////////////////////////////////////// -StableDocumentIterator::StableDocumentIterator(const DocumentIterator & dit) +StableDocIterator::StableDocIterator(const DocIterator & dit) { data_ = dit; for (size_t i = 0, n = data_.size(); i != n; ++i) @@ -426,12 +426,12 @@ StableDocumentIterator::StableDocumentIterator(const DocumentIterator & dit) } -DocumentIterator -StableDocumentIterator::asDocumentIterator(InsetBase * inset) const +DocIterator +StableDocIterator::asDocIterator(InsetBase * inset) const { // this function re-creates the cache of inset pointers //lyxerr << "converting:\n" << *this << endl; - DocumentIterator dit = DocumentIterator(*inset); + DocIterator dit = DocIterator(*inset); for (size_t i = 0, n = data_.size(); i != n; ++i) { dit.push_back(data_[i]); dit.back().inset_ = inset; @@ -443,7 +443,7 @@ StableDocumentIterator::asDocumentIterator(InsetBase * inset) const } -std::ostream & operator<<(std::ostream & os, StableDocumentIterator const & dit) +std::ostream & operator<<(std::ostream & os, StableDocIterator const & dit) { for (size_t i = 0, n = dit.data_.size(); i != n; ++i) os << " " << dit.data_[i] << "\n"; diff --git a/src/dociterator.h b/src/dociterator.h index 9023450259..9d6119d426 100644 --- a/src/dociterator.h +++ b/src/dociterator.h @@ -34,7 +34,7 @@ bool ptr_cmp(A const * a, B const * b) // The public inheritance should go in favour of a suitable data member // (or maybe private inheritance) at some point of time. -class DocumentIterator : public std::vector +class DocIterator : public std::vector { public: /// type for cell number in inset @@ -50,9 +50,9 @@ public: public: /// - DocumentIterator(); + DocIterator(); /// - explicit DocumentIterator(InsetBase & inset); + explicit DocIterator(InsetBase & inset); /// is the iterator valid? operator const void*() const { return empty() ? 0 : this; } @@ -187,40 +187,40 @@ public: /// output friend std::ostream & - operator<<(std::ostream & os, DocumentIterator const & cur); + operator<<(std::ostream & os, DocIterator const & cur); private: InsetBase * inset_; }; -DocumentIterator doc_iterator_begin(InsetBase & inset); -DocumentIterator doc_iterator_end(InsetBase & inset); +DocIterator doc_iterator_begin(InsetBase & inset); +DocIterator doc_iterator_end(InsetBase & inset); -// The difference to a ('non stable') DocumentIterator is the removed +// The difference to a ('non stable') DocIterator is the removed // (overwritte by 0...) part of the CursorSlice data items. So this thing // is suitable for external storage, but not for iteration as such. -class StableDocumentIterator { +class StableDocIterator { public: /// - StableDocumentIterator() {} + StableDocIterator() {} /// non-explicit intended - StableDocumentIterator(const DocumentIterator & it); + StableDocIterator(const DocIterator & it); /// - DocumentIterator asDocumentIterator(InsetBase * start) const; + DocIterator asDocIterator(InsetBase * start) const; /// size_t size() const { return data_.size(); } /// friend std::ostream & - operator<<(std::ostream & os, StableDocumentIterator const & cur); + operator<<(std::ostream & os, StableDocIterator const & cur); /// friend std::istream & - operator>>(std::istream & is, StableDocumentIterator & cur); + operator>>(std::istream & is, StableDocIterator & cur); private: std::vector data_; }; -bool operator==(StableDocumentIterator const &, StableDocumentIterator const &); +bool operator==(StableDocIterator const &, StableDocIterator const &); #endif diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 35050585cb..1761867027 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,13 @@ + +2004-03-31 Alfredo Braunstein + + * ControlSpellchecker.C: s/DocumentIterator/DocIterator/g + +2004-03-31 Alfredo Braunstein + + * ControlSpellchecker.C (isLetter, nextWord): check for inTextEd, + use forwardPos. + 2004-03-31 Angus Leeming * ControlPrefs.[Ch]: converted to the dialog-based scheme. diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 0a6b9a6daf..67fe27771e 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -149,7 +149,7 @@ void ControlSpellchecker::endSession() namespace { -bool isLetter(DocumentIterator const & cur) +bool isLetter(DocIterator const & cur) { return cur.inTexted() && cur.inset().allowSpellCheck() @@ -159,7 +159,7 @@ bool isLetter(DocumentIterator const & cur) } -WordLangTuple nextWord(DocumentIterator & cur, ptrdiff_t & progress, +WordLangTuple nextWord(DocIterator & cur, ptrdiff_t & progress, BufferParams & bp) { // skip until we have real text (will jump paragraphs) @@ -193,14 +193,14 @@ void ControlSpellchecker::check() SpellBase::Result res = SpellBase::OK; - DocumentIterator cur = bufferview()->cursor(); + DocIterator cur = bufferview()->cursor(); // a rough estimate should be sufficient: - //DocumentIterator::difference_type start = distance(beg, cur); - //DocumentIterator::difference_type const total = start + distance(cur, end); + //DocIterator::difference_type start = distance(beg, cur); + //DocIterator::difference_type const total = start + distance(cur, end); ptrdiff_t start = 0, total = 0; - DocumentIterator it = DocumentIterator(buffer()->inset()); + DocIterator it = DocIterator(buffer()->inset()); for (start = 0; it != cur; it.forwardPos()) ++start; diff --git a/src/insetiterator.C b/src/insetiterator.C index 25240d0568..c3d5fc392f 100644 --- a/src/insetiterator.C +++ b/src/insetiterator.C @@ -17,7 +17,7 @@ InsetIterator::InsetIterator(InsetBase & inset) - : DocumentIterator(inset) + : DocIterator(inset) { } diff --git a/src/insetiterator.h b/src/insetiterator.h index 93752b632c..8e29200537 100644 --- a/src/insetiterator.h +++ b/src/insetiterator.h @@ -15,7 +15,7 @@ #include "dociterator.h" -class InsetIterator : public DocumentIterator +class InsetIterator : public DocIterator { public: /// diff --git a/src/lyxfind.C b/src/lyxfind.C index dc12c17d39..ba654484c7 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -106,7 +106,7 @@ private: }; -bool findForward(DocumentIterator & cur, MatchString const & match) +bool findForward(DocIterator & cur, MatchString const & match) { for (; cur.size(); cur.forwardChar()) if (match(cur.paragraph(), cur.pos())) @@ -115,7 +115,7 @@ bool findForward(DocumentIterator & cur, MatchString const & match) } -bool findBackwards(DocumentIterator & cur, MatchString const & match) +bool findBackwards(DocIterator & cur, MatchString const & match) { for (; cur.size(); cur.backwardChar()) if (match(cur.paragraph(), cur.pos())) @@ -124,7 +124,7 @@ bool findBackwards(DocumentIterator & cur, MatchString const & match) } -bool findChange(DocumentIterator & cur) +bool findChange(DocIterator & cur) { for (; cur.size(); cur.forwardChar()) if ((cur.paragraph().empty() || !cur.empty()) @@ -149,7 +149,7 @@ bool find(BufferView * bv, string const & searchstr, bool cs, bool mw, bool fw) if (!searchAllowed(bv, searchstr)) return false; - DocumentIterator cur = bv->cursor(); + DocIterator cur = bv->cursor(); MatchString const match(searchstr, cs, mw); @@ -179,7 +179,7 @@ int replaceAll(BufferView * bv, int const rsize = replacestr.size(); int const ssize = searchstr.size(); - DocumentIterator cur = DocumentIterator(buf.inset()); + DocIterator cur = DocIterator(buf.inset()); while (findForward(cur, match)) { lyx::pos_type pos = cur.pos(); LyXFont const font @@ -192,7 +192,7 @@ int replaceAll(BufferView * bv, } bv->text()->init(bv); - bv->putSelectionAt(DocumentIterator(buf.inset()), 0, false); + bv->putSelectionAt(DocIterator(buf.inset()), 0, false); if (num) buf.markDirty(); return num; @@ -337,7 +337,7 @@ bool findNextChange(BufferView * bv) if (!bv->available()) return false; - DocumentIterator cur = DocumentIterator(bv->buffer()->inset()); + DocIterator cur = DocIterator(bv->buffer()->inset()); if (!findChange(cur)) return false; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 4c506e2d78..5a316ad6d4 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1349,9 +1349,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose) // nothing to do break; - owner->message( - _("Converting document to new document class...")); - + owner->message(_("Converting document to new document class...")); ErrorList el; lyx::cap::SwitchLayoutsBetweenClasses( old_class, new_class, diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index ba06be1fdf..bda82d7b9c 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,4 +1,8 @@ +2004-03-31 Alfredo Braunstein + + * math_hullinset.C: s/DocumentIterator/DocIterator/g + 2004-02-04 Martin Vermeer * math_nestinset.C: workaround gcc 2.95 pointer comparison bug, diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 2d6f6b7880..3cb51fbbbd 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -1034,7 +1034,7 @@ bool MathHullInset::searchForward(BufferView * bv, string const & str, #warning pretty ugly #endif static MathHullInset * lastformula = 0; - static CursorBase current = DocumentIterator(ibegin(nucleus())); + static CursorBase current = DocIterator(ibegin(nucleus())); static MathArray ar; static string laststr; @@ -1050,7 +1050,7 @@ bool MathHullInset::searchForward(BufferView * bv, string const & str, } //lyxerr << "searching '" << str << "' in " << this << ar << endl; - for (DocumentIterator it = current; it != iend(nucleus()); increment(it)) { + for (DocIterator it = current; it != iend(nucleus()); increment(it)) { CursorSlice & top = it.back(); MathArray const & a = top.asMathInset()->cell(top.idx_); if (a.matchpart(ar, top.pos_)) { diff --git a/src/pariterator.C b/src/pariterator.C index 7be725d298..efb94c14ea 100644 --- a/src/pariterator.C +++ b/src/pariterator.C @@ -26,7 +26,7 @@ using lyx::par_type; /// ParIterator /// -ParIterator::ParIterator(DocumentIterator const & cur) : DocumentIterator(cur) +ParIterator::ParIterator(DocIterator const & cur) : DocIterator(cur) {} @@ -43,7 +43,7 @@ ParIterator par_iterator_end(InsetBase & inset) ParIterator::ParIterator(ParIterator const & pi) - : DocumentIterator(DocumentIterator(pi)) + : DocIterator(DocIterator(pi)) {} @@ -56,7 +56,7 @@ ParIterator & ParIterator::operator++() ParIterator & ParIterator::operator--() { -// DocumentIterator::backwardPar(); +// DocIterator::backwardPar(); return *this; } @@ -93,7 +93,7 @@ ParagraphList & ParIterator::plist() const bool operator==(ParIterator const & iter1, ParIterator const & iter2) { - return DocumentIterator(iter1) == DocumentIterator(iter2); + return DocIterator(iter1) == DocIterator(iter2); } @@ -102,10 +102,10 @@ bool operator!=(ParIterator const & iter1, ParIterator const & iter2) return !(iter1 == iter2); } -DocumentIterator -makeDocumentIterator(ParIterator const & par, lyx::pos_type pos) +DocIterator +makeDocIterator(ParIterator const & par, lyx::pos_type pos) { - DocumentIterator dit(par); + DocIterator dit(par); dit.pos() = pos; return dit; } @@ -115,19 +115,19 @@ makeDocumentIterator(ParIterator const & par, lyx::pos_type pos) /// -ParConstIterator::ParConstIterator(DocumentIterator const & dit) - : DocumentIterator(dit) +ParConstIterator::ParConstIterator(DocIterator const & dit) + : DocIterator(dit) {} ParConstIterator::ParConstIterator(ParConstIterator const & pi) - : DocumentIterator(DocumentIterator(pi)) + : DocIterator(DocIterator(pi)) {} ParConstIterator & ParConstIterator::operator++() { - DocumentIterator::forwardPar(); + DocIterator::forwardPar(); return *this; } @@ -152,7 +152,7 @@ ParagraphList const & ParConstIterator::plist() const bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2) { - return DocumentIterator(iter1) == DocumentIterator(iter2); + return DocIterator(iter1) == DocIterator(iter2); } diff --git a/src/pariterator.h b/src/pariterator.h index 31227926d7..4ce2b05994 100644 --- a/src/pariterator.h +++ b/src/pariterator.h @@ -28,7 +28,7 @@ class ParagraphList; class ParIterator : public std::iterator, - public DocumentIterator + public DocIterator { public: /// @@ -36,7 +36,7 @@ public: /// ParIterator(ParIterator const &); /// - ParIterator(DocumentIterator const &); + ParIterator(DocIterator const &); /// void operator=(ParIterator const &); @@ -57,7 +57,7 @@ public: }; -DocumentIterator makeDocumentIterator(ParIterator const &, lyx::pos_type); +DocIterator makeDocIterator(ParIterator const &, lyx::pos_type); ParIterator par_iterator_begin(InsetBase & inset); @@ -73,13 +73,13 @@ bool operator!=(ParIterator const & iter1, ParIterator const & iter2); class ParConstIterator : public std::iterator, - public DocumentIterator + public DocIterator { public: /// ParConstIterator(ParConstIterator const &); /// - ParConstIterator(DocumentIterator const &); + ParConstIterator(DocIterator const &); /// ParConstIterator & operator++(); diff --git a/src/text2.C b/src/text2.C index 19606e11c4..f1725de2a1 100644 --- a/src/text2.C +++ b/src/text2.C @@ -412,8 +412,8 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall) par_type const beg = cur.selBegin().par(); par_type const end = cur.selEnd().par(); - DocumentIterator pos = cur.selectionBegin(); - DocumentIterator posend = cur.selectionEnd(); + DocIterator pos = cur.selectionBegin(); + DocIterator posend = cur.selectionEnd(); BufferParams const & params = bv()->buffer()->params(); diff --git a/src/undo.C b/src/undo.C index 3530a88787..ed7445bba7 100644 --- a/src/undo.C +++ b/src/undo.C @@ -61,7 +61,7 @@ void recordUndo(Undo::undo_kind kind, // create the position information of the Undo entry Undo undo; undo.kind = kind; - undo.cursor = StableDocumentIterator(cur); + undo.cursor = StableDocIterator(cur); undo.from = first_par; undo.end = cur.lastpar() - last_par; @@ -108,7 +108,7 @@ void performUndoOrRedo(BufferView & bv, Undo const & undo) { LCursor & cur = bv.cursor(); lyxerr << "undo, performing: " << undo << std::endl; - cur.setCursor(undo.cursor.asDocumentIterator(&bv.buffer()->inset()), false); + cur.setCursor(undo.cursor.asDocIterator(&bv.buffer()->inset()), false); if (cur.inMathed()) { // We stored the full cell here as there is not much to be @@ -155,8 +155,8 @@ bool textUndoOrRedo(BufferView & bv, // this implements redo otherstack.push(undo); - DocumentIterator dit = - undo.cursor.asDocumentIterator(&bv.buffer()->inset()); + DocIterator dit = + undo.cursor.asDocIterator(&bv.buffer()->inset()); if (dit.inMathed()) { // Easy way out: store a full cell. otherstack.top().array = asString(dit.cell()); diff --git a/src/undo.h b/src/undo.h index 3759ae067c..67a0bfddc9 100644 --- a/src/undo.h +++ b/src/undo.h @@ -52,7 +52,7 @@ struct Undo { /// which kind of operation are we recording for? undo_kind kind; /// the position of the cursor - StableDocumentIterator cursor; + StableDocIterator cursor; /// counted from begin of buffer lyx::par_type from; /// complement to end of this cell