mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
set fill in fill(...) istead of returning it.
use isLastRow() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7974 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fe1d419981
commit
70f983b97f
@ -1022,14 +1022,16 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
owner->view_state_changed();
|
||||
}
|
||||
goto exit_with_message;
|
||||
case LFUN_DOWN:
|
||||
if (view()->text->cursorRow() != view()->text->lastRow())
|
||||
case LFUN_DOWN: {
|
||||
LyXText * text = view()->text;
|
||||
if (text->isLastRow(text->cursorPar(), *text->cursorRow()))
|
||||
view()->text->cursorDown(view());
|
||||
else
|
||||
view()->text->cursorRight(view());
|
||||
moveCursorUpdate();
|
||||
owner->view_state_changed();
|
||||
goto exit_with_message;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -415,8 +415,8 @@ private:
|
||||
/// for example, the pos after which isNewLine(pos) == true
|
||||
void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
|
||||
|
||||
/// returns the minimum space a row needs on the screen in pixel
|
||||
int fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
||||
/// sets row.witdh to the minimum space a row needs on the screen in pixel
|
||||
void fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
||||
|
||||
/**
|
||||
* returns the minimum space a manual label needs on the
|
||||
|
@ -1055,7 +1055,6 @@ int paintRows(BufferView const & bv, LyXText const & text,
|
||||
int xo, int y, int yf, int yo)
|
||||
{
|
||||
//lyxerr << " paintRows: rit: " << &*rit << endl;
|
||||
//const_cast<LyXText&>(text).updateRowPositions();
|
||||
int const yy = yf - y;
|
||||
int const y2 = bv.painter().paperHeight();
|
||||
|
||||
|
35
src/text.C
35
src/text.C
@ -601,13 +601,8 @@ void LyXText::rowBreakPoint(ParagraphList::iterator pit, Row & row) const
|
||||
|
||||
|
||||
// returns the minimum space a row needs on the screen in pixel
|
||||
int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
void LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
{
|
||||
if (paper_width < 0) {
|
||||
lyxerr << "paperwidth < 0: " << paper_width << " Why?" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w;
|
||||
// get the pure distance
|
||||
pos_type const last = lastPos(*pit, row);
|
||||
@ -620,8 +615,9 @@ int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
row.fill(0); // the minfill in leftMargin()
|
||||
w = leftMargin(pit, row);
|
||||
row.fill(tmpfill);
|
||||
} else
|
||||
} else {
|
||||
w = leftMargin(pit, row);
|
||||
}
|
||||
|
||||
pos_type const body_pos = pit->beginningOfBody();
|
||||
pos_type i = row.pos();
|
||||
@ -659,20 +655,8 @@ int LyXText::fill(ParagraphList::iterator pit, Row & row, int paper_width) const
|
||||
}
|
||||
|
||||
int const fill = paper_width - w - rightMargin(*pit, *bv()->buffer(), row);
|
||||
|
||||
// If this case happens, it means that our calculation
|
||||
// of the widths of the chars when we do rowBreakPoint()
|
||||
// went wrong for some reason. Typically in list bodies.
|
||||
// Things just about hobble on anyway, though you'll end
|
||||
// up with a "fill_separator" less than zero, which corresponds
|
||||
// to inter-word spacing being too small. Hopefully this problem
|
||||
// will die when the label hacks die.
|
||||
if (lyxerr.debugging() && fill < 0) {
|
||||
lyxerr[Debug::GUI] << "Eek, fill() was < 0: " << fill
|
||||
<< " w " << w << " paper_width " << paper_width
|
||||
<< " right margin " << rightMargin(*pit, *bv()->buffer(), row) << endl;
|
||||
}
|
||||
return fill;
|
||||
row.fill(fill);
|
||||
row.width(paper_width - fill);
|
||||
}
|
||||
|
||||
|
||||
@ -1977,16 +1961,13 @@ void LyXText::redoParagraphInternal(ParagraphList::iterator pit)
|
||||
Row row(z);
|
||||
rowBreakPoint(pit, row);
|
||||
z = row.endpos();
|
||||
int const f = fill(pit, row, ww);
|
||||
unsigned int const w = ww - f;
|
||||
pit->width = std::max(pit->width, w);
|
||||
row.fill(f);
|
||||
row.width(w);
|
||||
fill(pit, row, ww);
|
||||
prepareToPrint(pit, row);
|
||||
setHeightOfRow(pit, row);
|
||||
row.y_offset(pit->height);
|
||||
pit->height += row.height();
|
||||
pit->rows.push_back(row);
|
||||
pit->width = std::max(pit->width, row.width());
|
||||
pit->height += row.height();
|
||||
}
|
||||
height += pit->height;
|
||||
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
|
||||
|
@ -302,7 +302,7 @@ void LyXText::cursorNext()
|
||||
int topy = bv_owner->top_y();
|
||||
|
||||
RowList::iterator rit = cursorRow();
|
||||
if (rit == lastRow()) {
|
||||
if (isLastRow(cursorPar(), *cursorRow())) {
|
||||
int y = cursor.y() - rit->baseline() + cursorRow()->height();
|
||||
if (y > topy + bv()->workHeight())
|
||||
bv_owner->updateScrollbar();
|
||||
|
Loading…
Reference in New Issue
Block a user