* LyXText:
- rowBreakPoint(): now requires the right margin value.
- redoParagraph(): factorize rightMargin() call from two loops.
- editXY(): add doxygen comments.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15802
a592a061-630c-0410-9148-
cb99ea01b6c8
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);
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);
InsetBase * editXY(LCursor & cur, int x, int y);
/// Move cursor one line up.
/**
* Returns true if an update is needed after the move.
/// 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
/// 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
/// 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();
{
Paragraph const & par = pars_[pit];
pos_type const end = par.size();
}
// maximum pixel width of a row
}
// 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;
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.
// 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)
for (; ii != iend; ++ii) {
Dimension dim;
int const w = maxwidth_ - leftMargin(buffer, pit, ii->pos)
- - rightMargin(buffer, par);
LyXFont const & font = ii->inset->noFontChange() ?
bufferfont :
getFont(buffer, par, ii->pos);
LyXFont const & font = ii->inset->noFontChange() ?
bufferfont :
getFont(buffer, par, ii->pos);
pos_type z = 0;
do {
Row row(z);
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);
setRowWidth(buffer, pit, row);
setHeightOfRow(bv, pit, row);
par.rows().push_back(row);