remove unneeded functions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8689 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-04-21 19:51:18 +00:00
parent 60c6212be4
commit 1fa0fb5c67
3 changed files with 11 additions and 69 deletions

View 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;

View 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
return *rit;
}
RowList::iterator LyXText::firstRow() const
Row const & LyXText::firstRow() const
{
return paragraphs().front().rows.begin();
}
RowList::iterator LyXText::lastRow() 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();
}

View 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