void recUndo(LCursor & cur, pit_type first) const;
/// returns true if par was empty and was removed
bool setCursorFromCoordinates(LCursor & cur, int x, int y);
- ///
+
+ /// sets cursor recursively descending into nested editable insets
+ /**
+ \return the inset pointer if x,y is covering that inset
+ \param x,y are absolute screen coordinates.
+ \retval inset is non-null if the cursor is positionned inside
+ */
InsetBase * editXY(LCursor & cur, int x, int y);
+
/// Move cursor one line up.
/**
* Returns true if an update is needed after the move.
/// sets row.end to the pos value *after* which a row should break.
/// for example, the pos after which isNewLine(pos) == true
- void rowBreakPoint(Buffer const &, pit_type pit, Row & row) const;
+ void rowBreakPoint(Buffer const &, int right_margin, pit_type pit,
+ Row & row) const;
/// sets row.width to the minimum space a row needs on the screen in pixel
void setRowWidth(Buffer const &, pit_type pit, Row & row) const;
/// the minimum space a manual label needs on the screen in pixels
};
-void LyXText::rowBreakPoint(Buffer const & buffer, pit_type const pit,
- Row & row) const
+void LyXText::rowBreakPoint(Buffer const & buffer, int right_margin,
+ pit_type const pit, Row & row) const
{
Paragraph const & par = pars_[pit];
pos_type const end = par.size();
}
// maximum pixel width of a row
- int width = maxwidth_ - rightMargin(buffer, par); // - leftMargin(buffer, pit, row);
+ int width = maxwidth_ - right_margin; // - leftMargin(buffer, pit, row);
if (width < 0) {
row.endpos(end);
return;
}
}
+ // Optimisation: this is used in the next two loops
+ // so better to calculate that once here.
+ int right_margin = rightMargin(buffer, par);
+
// redo insets
// FIXME: We should always use getFont(), see documentation of
// noFontChange() in insetbase.h.
for (; ii != iend; ++ii) {
Dimension dim;
int const w = maxwidth_ - leftMargin(buffer, pit, ii->pos)
- - rightMargin(buffer, par);
+ - right_margin;
LyXFont const & font = ii->inset->noFontChange() ?
bufferfont :
getFont(buffer, par, ii->pos);
pos_type z = 0;
do {
Row row(z);
- rowBreakPoint(buffer, pit, row);
+ rowBreakPoint(buffer, right_margin, pit, row);
setRowWidth(buffer, pit, row);
setHeightOfRow(bv, pit, row);
par.rows().push_back(row);