remove four getPar()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7537 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-14 09:59:05 +00:00
parent 003bb374a5
commit b54607cb4f
4 changed files with 20 additions and 26 deletions

View File

@ -404,7 +404,7 @@ private:
RowList::iterator rowit); RowList::iterator rowit);
/// Calculate and set the height of the row /// Calculate and set the height of the row
void setHeightOfRow(RowList::iterator rit); void setHeightOfRow(ParagraphList::iterator, RowList::iterator rit);
// fix the cursor `cur' after a characters has been deleted at `where' // fix the cursor `cur' after a characters has been deleted at `where'
// position. Called by deleteEmptyParagraphMechanism // position. Called by deleteEmptyParagraphMechanism
@ -482,7 +482,8 @@ private:
Row const & row) const; Row const & row) const;
/// returns the minimum space a row needs on the screen in pixel /// returns the minimum space a row needs on the screen in pixel
int fill(RowList::iterator row, int workwidth) const; int fill(ParagraphList::iterator pit,
RowList::iterator row, int workwidth) const;
/** /**
* returns the minimum space a manual label needs on the * returns the minimum space a manual label needs on the

View File

@ -605,18 +605,12 @@ int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const
// are *NOT* allowed in the LaTeX realisation of this layout. // are *NOT* allowed in the LaTeX realisation of this layout.
// find the first row of this paragraph // find the first row of this paragraph
RowList::iterator tmprit = rowlist_.begin(); RowList::iterator rit = beginRow(pit);
while (tmprit != rowlist_.end() RowList::iterator end = endRow(pit);
&& getPar(tmprit) != pit) int minfill = rit->fill();
++tmprit; for ( ; rit != end; ++rit)
if (rit->fill() < minfill)
int minfill = tmprit->fill(); minfill = rit->fill();
while (boost::next(tmprit) != rowlist_.end() &&
getPar(boost::next(tmprit)) == pit) {
++tmprit;
if (tmprit->fill() < minfill)
minfill = tmprit->fill();
}
x += font_metrics::signedWidth(layout->leftmargin, x += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont()); tclass.defaultfont());
@ -875,14 +869,14 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
// returns the minimum space a row needs on the screen in pixel // returns the minimum space a row needs on the screen in pixel
int LyXText::fill(RowList::iterator row, int paper_width) const int LyXText::fill(ParagraphList::iterator pit,
RowList::iterator row, int paper_width) const
{ {
if (paper_width < 0) if (paper_width < 0)
return 0; return 0;
int w; int w;
// get the pure distance // get the pure distance
ParagraphList::iterator pit = getPar(row);
pos_type const last = lastPrintablePos(*this, pit, row); pos_type const last = lastPrintablePos(*this, pit, row);
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
@ -1009,7 +1003,7 @@ LColor::color LyXText::backgroundColor() const
} }
void LyXText::setHeightOfRow(RowList::iterator rit) void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
{ {
Assert(rit != rows().end()); Assert(rit != rows().end());
@ -1021,8 +1015,6 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
// ok, let us initialize the maxasc and maxdesc value. // ok, let us initialize the maxasc and maxdesc value.
// Only the fontsize count. The other properties // Only the fontsize count. The other properties
// are taken from the layoutfont. Nicer on the screen :) // are taken from the layoutfont. Nicer on the screen :)
ParagraphList::iterator pit = getPar(rit);
LyXLayout_ptr const & layout = pit->layout(); LyXLayout_ptr const & layout = pit->layout();
// as max get the first character of this row then it can increase but not // as max get the first character of this row then it can increase but not
@ -2076,7 +2068,7 @@ void LyXText::backspace()
cursorLeft(bv()); cursorLeft(bv());
// the layout things can change the height of a row ! // the layout things can change the height of a row !
setHeightOfRow(cursorRow()); setHeightOfRow(cursor.par(), cursorRow());
return; return;
} }
} }

View File

@ -299,9 +299,9 @@ void LyXText::insertParagraph(ParagraphList::iterator pit,
// Set the dimensions of the row // Set the dimensions of the row
// fixed fill setting now by calling inset->update() in // fixed fill setting now by calling inset->update() in
// SingleWidth when needed! // singleWidth when needed!
tmprow->fill(fill(tmprow, workWidth())); tmprow->fill(fill(pit, tmprow, workWidth()));
setHeightOfRow(tmprow); setHeightOfRow(pit, tmprow);
} while (!done); } while (!done);
} }
@ -732,10 +732,11 @@ void LyXText::cursorEnd()
RowList::iterator rit = cursorRow(); RowList::iterator rit = cursorRow();
RowList::iterator next_rit = boost::next(rit); RowList::iterator next_rit = boost::next(rit);
RowList::iterator end = boost::next(rit);
ParagraphList::iterator pit = cursor.par(); ParagraphList::iterator pit = cursor.par();
pos_type last_pos = lastPos(*this, pit, rit); pos_type last_pos = lastPos(*this, pit, rit);
if (next_rit == rows().end() || getPar(next_rit) != pit) { if (next_rit == end) {
++last_pos; ++last_pos;
} else { } else {
if (pit->empty() || if (pit->empty() ||
@ -2010,7 +2011,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
redoParagraph(getPar(tmprit)); redoParagraph(getPar(tmprit));
updateCounters(); updateCounters();
} }
setHeightOfRow(prevrow); setHeightOfRow(getPar(prevrow), prevrow);
} else { } else {
RowList::iterator nextrow = boost::next(getRow(old_cursor)); RowList::iterator nextrow = boost::next(getRow(old_cursor));

View File

@ -409,7 +409,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (tmp->params().startOfAppendix()) { if (tmp->params().startOfAppendix()) {
recordUndo(bv, Undo::ATOMIC, tmp); recordUndo(bv, Undo::ATOMIC, tmp);
tmp->params().startOfAppendix(false); tmp->params().startOfAppendix(false);
setHeightOfRow(getRow(tmp, 0)); setHeightOfRow(tmp, getRow(tmp, 0));
break; break;
} }
} }