mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
some more getPar removals
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7539 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
85296c7253
commit
648523b389
@ -17,8 +17,7 @@ using std::min;
|
||||
bool isParEnd(LyXText const & lt,
|
||||
ParagraphList::iterator pit, RowList::iterator rit)
|
||||
{
|
||||
RowList::iterator next_row = boost::next(rit);
|
||||
return next_row == lt.rows().end() || lt.getPar(next_row) != pit;
|
||||
return boost::next(rit) == lt.endRow(pit);
|
||||
}
|
||||
|
||||
|
||||
|
@ -522,6 +522,14 @@ public:
|
||||
RowList::iterator beginRow(ParagraphList::iterator pit) const;
|
||||
/// return row "behind" last of par
|
||||
RowList::iterator endRow(ParagraphList::iterator pit) const;
|
||||
/// return first row of text
|
||||
RowList::iterator firstRow() const;
|
||||
/// return row "behind" last of par
|
||||
RowList::iterator lastRow() const;
|
||||
/// return next row crossing paragraph boundaries
|
||||
RowList::iterator nextRow(RowList::iterator rit) const;
|
||||
/// return previous row crossing paragraph boundaries
|
||||
RowList::iterator previousRow(RowList::iterator rit) const;
|
||||
|
||||
private:
|
||||
/** Cursor related data.
|
||||
|
79
src/text.C
79
src/text.C
@ -1246,8 +1246,7 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
|
||||
}
|
||||
|
||||
// is it a bottom line?
|
||||
RowList::iterator next_rit = boost::next(rit);
|
||||
if (next_rit == rows().end() || getPar(next_rit) != pit) {
|
||||
if (boost::next(rit) == endRow(pit)) {
|
||||
// the bottom margin
|
||||
ParagraphList::iterator nextpit = boost::next(pit);
|
||||
if (nextpit == ownerParagraphs().end() &&
|
||||
@ -1627,14 +1626,12 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
|
||||
{
|
||||
int const ns = numberOfSeparators(*this, pit, rit);
|
||||
RowList::iterator next_row = boost::next(rit);
|
||||
ParagraphList::iterator next_pit;
|
||||
|
||||
if (ns && next_row != rowlist_.end() &&
|
||||
(next_pit = getPar(next_row)) == pit &&
|
||||
!(next_pit->isNewline(next_row->pos() - 1))
|
||||
&& !(next_pit->isInset(next_row->pos()) &&
|
||||
next_pit->getInset(next_row->pos()) &&
|
||||
next_pit->getInset(next_row->pos())->display())
|
||||
if (ns
|
||||
&& next_row != endRow(pit)
|
||||
&& !pit->isNewline(next_row->pos() - 1)
|
||||
&& !(pit->isInset(next_row->pos())
|
||||
&& pit->getInset(next_row->pos())
|
||||
&& pit->getInset(next_row->pos())->display())
|
||||
) {
|
||||
fill_separator = w / ns;
|
||||
} else if (is_rtl) {
|
||||
@ -2153,23 +2150,15 @@ RowList::iterator LyXText::getRow(LyXCursor const & cur) const
|
||||
RowList::iterator
|
||||
LyXText::getRow(ParagraphList::iterator pit, pos_type pos) const
|
||||
{
|
||||
if (rows().empty())
|
||||
return rowlist_.end();
|
||||
RowList::iterator rit = beginRow(pit);
|
||||
RowList::iterator end = endRow(pit);
|
||||
|
||||
// find the first row of the specified paragraph
|
||||
RowList::iterator rit = rowlist_.begin();
|
||||
RowList::iterator end = rowlist_.end();
|
||||
while (boost::next(rit) != end && getPar(rit) != pit) {
|
||||
#warning Why is this next thing needed? (Andre)
|
||||
while (rit != end
|
||||
&& rit->pos() < pos
|
||||
&& boost::next(rit) != end
|
||||
&& boost::next(rit)->pos() <= pos)
|
||||
++rit;
|
||||
}
|
||||
|
||||
// now find the wanted row
|
||||
while (rit->pos() < pos
|
||||
&& boost::next(rit) != end
|
||||
&& getPar(boost::next(rit)) == pit
|
||||
&& boost::next(rit)->pos() <= pos) {
|
||||
++rit;
|
||||
}
|
||||
|
||||
return rit;
|
||||
}
|
||||
@ -2182,20 +2171,20 @@ LyXText::getRow(ParagraphList::iterator pit, pos_type pos, int & y) const
|
||||
y = 0;
|
||||
|
||||
if (rows().empty())
|
||||
return rowlist_.end();
|
||||
return firstRow();
|
||||
|
||||
RowList::iterator beg = beginRow(pit);
|
||||
RowList::iterator end = endRow(pit);
|
||||
RowList::iterator rit;
|
||||
|
||||
// find the first row of the specified paragraph
|
||||
RowList::iterator rit = rowlist_.begin();
|
||||
RowList::iterator end = rowlist_.end();
|
||||
while (boost::next(rit) != end && getPar(rit) != pit) {
|
||||
for (rit = firstRow(); rit != beg; rit = nextRow(rit))
|
||||
y += rit->height();
|
||||
++rit;
|
||||
}
|
||||
|
||||
// now find the wanted row
|
||||
while (rit->pos() < pos
|
||||
while (rit != end
|
||||
&& rit->pos() < pos
|
||||
&& boost::next(rit) != end
|
||||
&& getPar(boost::next(rit)) == pit
|
||||
&& boost::next(rit)->pos() <= pos) {
|
||||
y += rit->height();
|
||||
++rit;
|
||||
@ -2316,3 +2305,27 @@ RowList::iterator LyXText::endRow(ParagraphList::iterator pit) const
|
||||
{
|
||||
return beginRow(boost::next(pit));
|
||||
}
|
||||
|
||||
|
||||
RowList::iterator LyXText::firstRow() const
|
||||
{
|
||||
return rowlist_.begin();
|
||||
}
|
||||
|
||||
|
||||
RowList::iterator LyXText::lastRow() const
|
||||
{
|
||||
return boost::prior(rowlist_.end());
|
||||
}
|
||||
|
||||
|
||||
RowList::iterator LyXText::nextRow(RowList::iterator rit) const
|
||||
{
|
||||
return boost::next(rit);
|
||||
}
|
||||
|
||||
|
||||
RowList::iterator LyXText::previousRow(RowList::iterator rit) const
|
||||
{
|
||||
return boost::prior(rit);
|
||||
}
|
||||
|
28
src/text2.C
28
src/text2.C
@ -618,24 +618,8 @@ void LyXText::redoParagraphs(ParagraphList::iterator start,
|
||||
|
||||
void LyXText::redoParagraph(ParagraphList::iterator pit)
|
||||
{
|
||||
#if 0
|
||||
// find first row of given par
|
||||
RowList::iterator first;
|
||||
for (first = rows().begin(); first != rows().end(); ++first)
|
||||
if (getPar(first) == pit)
|
||||
break;
|
||||
|
||||
// find last row of given par
|
||||
RowList::iterator last = first;
|
||||
for ( ; last != rows().end() && getPar(last) == pit; ++last)
|
||||
;
|
||||
|
||||
Assert(first == beginRow(pit));
|
||||
Assert(last == endRow(pit));
|
||||
#else
|
||||
RowList::iterator first = beginRow(pit);
|
||||
RowList::iterator last = endRow(pit);
|
||||
#endif
|
||||
|
||||
// remove paragraph from rowlist
|
||||
while (first != last) {
|
||||
@ -1655,11 +1639,9 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
|
||||
|
||||
boundary = false;
|
||||
// This (rtl_support test) is not needed, but gives
|
||||
// some speedup if rtl_support=false
|
||||
RowList::iterator next_rit = boost::next(rit);
|
||||
|
||||
bool const lastrow = lyxrc.rtl_support &&
|
||||
(next_rit == rowlist_.end() || getPar(next_rit) != pit);
|
||||
// some speedup if rtl_support == false
|
||||
bool const lastrow = lyxrc.rtl_support
|
||||
&& boost::next(rit) == endRow(pit);
|
||||
|
||||
// If lastrow is false, we don't need to compute
|
||||
// the value of rtl.
|
||||
@ -1667,8 +1649,8 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
|
||||
? pit->isRightToLeftPar(bv()->buffer()->params)
|
||||
: false;
|
||||
if (lastrow &&
|
||||
((rtl && left_side && vc == rit->pos() && x < tmpx - 5) ||
|
||||
(!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
|
||||
((rtl && left_side && vc == rit->pos() && x < tmpx - 5) ||
|
||||
(!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
|
||||
c = last + 1;
|
||||
else if (vc == rit->pos()) {
|
||||
c = vis2log(vc);
|
||||
|
Loading…
Reference in New Issue
Block a user