]> git.lyx.org Git - lyx.git/commitdiff
remove unneeded functions
authorAndré Pönitz <poenitz@gmx.net>
Wed, 21 Apr 2004 19:51:18 +0000 (19:51 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 21 Apr 2004 19:51:18 +0000 (19:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8689 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxtext.h
src/text.C
src/text2.C

index 99f69b30d57ec8bc134f64a53bd07bb5acebefc9..7a489ac934bdb36a29690cf38f1f524c702a2055 100644 (file)
@@ -20,7 +20,6 @@
 #include "lyxfont.h"
 #include "layout.h"
 #include "lyxlayout_ptr_fwd.h"
-#include "RowList_fwd.h"
 #include "ParagraphList_fwd.h"
 
 #include <iosfwd>
@@ -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;
index aeeee9743d8dd6b9a2179cc82840a54bd8ebeb87..797f7968233423c3904e16457c6e60a0067c2a77 100644 (file)
@@ -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();
 }
 
 
index 426cb90be03222c7d00131b5bbe8c411d4429b8f..36b40e3bc7a0d9dece3638f22c6295180193f5d9 100644 (file)
@@ -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