From 1fa0fb5c67656cacbe3cfe6e8b08dd98cada1f73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 21 Apr 2004 19:51:18 +0000 Subject: [PATCH] remove unneeded functions git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8689 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxtext.h | 13 ++--------- src/text.C | 63 ++++++--------------------------------------------- src/text2.C | 4 ++-- 3 files changed, 11 insertions(+), 69 deletions(-) diff --git a/src/lyxtext.h b/src/lyxtext.h index 99f69b30d5..7a489ac934 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -20,7 +20,6 @@ #include "lyxfont.h" #include "layout.h" #include "lyxlayout_ptr_fwd.h" -#include "RowList_fwd.h" #include "ParagraphList_fwd.h" #include @@ -144,7 +143,7 @@ public: * y-coordinate (relative to the whole text). y is set to the * real beginning of this row */ - RowList::iterator getRowNearY(int y, par_type & pit) const; + Row const & getRowNearY(int y, par_type & pit) const; /** returns the column near the specified x-coordinate of the row x is set to the real beginning of this column @@ -301,15 +300,7 @@ public: bool isMainText() const; /// return first row of text - RowList::iterator firstRow() const; - /// return last row of text - RowList::iterator lastRow() const; - /// return row "behind" last row of text - RowList::iterator endRow() const; - /// return next row crossing paragraph boundaries - void nextRow(par_type & pit, RowList::iterator & rit) const; - /// return previous row crossing paragraph boundaries - void previousRow(par_type & pit, RowList::iterator & rit) const; + Row const & firstRow() const; /// is this row the last in the text? bool isLastRow(par_type pit, Row const & row) const; diff --git a/src/text.C b/src/text.C index aeeee9743d..797f796823 100644 --- a/src/text.C +++ b/src/text.C @@ -1697,11 +1697,10 @@ Paragraph & LyXText::getPar(par_type par) const // y is relative to this LyXText's top -RowList::iterator LyXText::getRowNearY(int y, par_type & pit) const +Row const & LyXText::getRowNearY(int y, par_type & pit) const { BOOST_ASSERT(!paragraphs().empty()); BOOST_ASSERT(!paragraphs().begin()->rows.empty()); -#if 1 par_type const pend = paragraphs().size() - 1; pit = 0; while (int(pars_[pit].y + pars_[pit].height) < y && pit != pend) @@ -1713,61 +1712,13 @@ RowList::iterator LyXText::getRowNearY(int y, par_type & pit) const --rit; } while (rit != rbegin && int(pars_[pit].y + rit->y_offset()) > y); - return rit; -#else - pit = paragraphs().size() - 1; - - RowList::iterator rit = lastRow(); - RowList::iterator rbegin = firstRow(); - - while (rit != rbegin && int(pars_[pit].y + rit->y_offset()) > y) - previousRow(pit, rit); - - return rit; -#endif -} - - -RowList::iterator LyXText::firstRow() const -{ - return paragraphs().front().rows.begin(); + return *rit; } -RowList::iterator LyXText::lastRow() const +Row const & LyXText::firstRow() const { - return boost::prior(endRow()); -} - - -RowList::iterator LyXText::endRow() const -{ - return paragraphs().back().rows.end(); -} - - -void LyXText::nextRow(par_type & pit, RowList::iterator & rit) const -{ - ++rit; - if (rit == pars_[pit].rows.end()) { - ++pit; - if (pit == par_type(paragraphs().size())) - --pit; - else - rit = pars_[pit].rows.begin(); - } -} - - -void LyXText::previousRow(par_type & pit, RowList::iterator & rit) const -{ - if (rit != pars_[pit].rows.begin()) - --rit; - else { - BOOST_ASSERT(pit != 0); - --pit; - rit = boost::prior(pars_[pit].rows.end()); - } + return *paragraphs().front().rows.begin(); } @@ -1849,7 +1800,7 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim) width_ = maxParagraphWidth(paragraphs()); // final dimension - dim.asc = firstRow()->ascent_of_text(); + dim.asc = firstRow().ascent_of_text(); dim.des = height_ - dim.asc; dim.wid = width_; } @@ -2009,13 +1960,13 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex) int LyXText::ascent() const { - return firstRow()->ascent_of_text(); + return firstRow().ascent_of_text(); } int LyXText::descent() const { - return height_ - firstRow()->ascent_of_text(); + return height_ - firstRow().ascent_of_text(); } diff --git a/src/text2.C b/src/text2.C index 426cb90be0..36b40e3bc7 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1124,7 +1124,7 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y) x -= xo_; y -= yo_; par_type pit; - Row const & row = *getRowNearY(y, pit); + Row const & row = getRowNearY(y, pit); lyxerr << "setCursorFromCoordinates:: hit row at: " << row.pos() << endl; bool bound = false; int xx = x + xo_; // getRowNearX get absolute x coords @@ -1137,7 +1137,7 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y) InsetBase * LyXText::editXY(LCursor & cur, int x, int y) { par_type pit; - Row const & row = *getRowNearY(y - yo_, pit); + Row const & row = getRowNearY(y - yo_, pit); bool bound = false; int xx = x; // is modified by getColumnNearX -- 2.39.2