fix cursorEnd, remove lastPrintablePos

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7664 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-09-04 15:21:34 +00:00
parent 2faa06b829
commit bf053299a6
6 changed files with 33 additions and 32 deletions

View File

@ -1,3 +1,21 @@
2003-09-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* text2.C (cursorEnd): simplify
(setCursor): adjust
(getColumnNearX): adjust
* text.C (computeBidiTables): adjust
(fill): adjust
* rowpainter.C (paintChars): adjust
(paintSelection): adjust
(paintChangeBar): adjust
(paintText): adjust
* lyxrow_funcs.C (lastPrintablePos): remove, all users now call
lastPos instead.
(numberOfSeparators): adjust
2003-09-03 Martin Vermeer <martin.vermeer@hut.fi>
* LyXAction.C:

View File

@ -44,7 +44,7 @@ bool isParEnd(Paragraph const & par, RowList::iterator rit)
return boost::next(rit) == par.rows.end();
}
#if 1
pos_type lastPos(Paragraph const & par, RowList::iterator rit)
{
if (par.empty())
@ -62,23 +62,17 @@ pos_type lastPos(Paragraph const & par, RowList::iterator rit)
}
return boost::next(rit)->pos() - 1;
}
pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit)
#else
pos_type lastPos(Paragraph const &, RowList::iterator rit)
{
pos_type const last = lastPos(par, rit);
// if this row is an end of par, just act like lastPos()
if (isParEnd(par, rit))
return last;
return last;
return rit->end() - 1;
}
#endif
int numberOfSeparators(Paragraph const & par, RowList::iterator rit)
{
pos_type const last = lastPrintablePos(par, rit);
pos_type const last = lastPos(par, rit);
int n = 0;
pos_type p = max(rit->pos(), par.beginningOfBody());
for ( ; p < last; ++p)

View File

@ -22,8 +22,6 @@ bool isParEnd(Paragraph const & par, RowList::iterator rit);
lyx::pos_type lastPos(Paragraph const & par, RowList::iterator rit);
lyx::pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit);
int numberOfSeparators(Paragraph const & par, RowList::iterator rit);
int numberOfHfills(Paragraph const & par, RowList::iterator rit);

View File

@ -257,7 +257,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos)
void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
{
pos_type pos = text_.vis2log(vpos);
pos_type const last = lastPrintablePos(*pit_, row_);
pos_type const last = lastPos(*pit_, row_);
LyXFont orig_font = getFont(pos);
// first character
@ -434,7 +434,7 @@ void RowPainter::paintSelection()
int(x_), row_->height(), LColor::selection);
pos_type const body_pos = pit_->beginningOfBody();
pos_type const last = lastPrintablePos(*pit_, row_);
pos_type const last = lastPos(*pit_, row_);
double tmpx = x_;
for (pos_type vpos = row_->pos(); vpos <= last; ++vpos) {
@ -486,7 +486,7 @@ void RowPainter::paintSelection()
void RowPainter::paintChangeBar()
{
pos_type const start = row_->pos();
pos_type const end = lastPrintablePos(*pit_, row_);
pos_type const end = lastPos(*pit_, row_);
if (!pit_->isChanged(start, end))
return;
@ -896,7 +896,7 @@ void RowPainter::paintLast()
void RowPainter::paintText()
{
pos_type const last = lastPrintablePos(*pit_, row_);
pos_type const last = lastPos(*pit_, row_);
pos_type body_pos = pit_->beginningOfBody();
if (body_pos > 0 &&
(body_pos - 1 > last || !pit_->isLineSeparator(body_pos - 1))) {

View File

@ -287,7 +287,7 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
}
bidi_start = row->pos();
bidi_end = lastPrintablePos(*pit, row);
bidi_end = lastPos(*pit, row);
if (bidi_start > bidi_end) {
bidi_start = -1;
@ -779,7 +779,7 @@ int LyXText::fill(ParagraphList::iterator pit,
int w;
// get the pure distance
pos_type const last = lastPrintablePos(*pit, row);
pos_type const last = lastPos(*pit, row);
LyXLayout_ptr const & layout = pit->layout();

View File

@ -672,16 +672,7 @@ void LyXText::cursorHome()
void LyXText::cursorEnd()
{
if (cursor.par()->empty())
return;
RowList::iterator rit = cursorRow();
ParagraphList::iterator pit = cursor.par();
pos_type pos = lastPos(*pit, rit);
/* cursor should be before a hard newline only */
if (!pit->isNewline(pos))
++pos;
setCursor(pit, pos);
setCursor(cursor.par(), cursorRow()->end() - 1);
}
@ -1358,7 +1349,7 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
// y is now the cursor baseline
cur.y(y);
pos_type last = lastPrintablePos(*pit, row);
pos_type last = lastPos(*pit, row);
// None of these should happen, but we're scaredy-cats
if (pos > pit->size()) {
@ -1497,7 +1488,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
double fill_label_hfill = rit->fill_label_hfill();
pos_type vc = rit->pos();
pos_type last = lastPrintablePos(*pit, rit);
pos_type last = lastPos(*pit, rit);
pos_type c = 0;
LyXLayout_ptr const & layout = pit->layout();