* lyxfunc.C (getStatus): also set flag disabled if it is a unknown
action.
+2003-10-16 André Pönitz <poenitz@gmx.net>
+
+ * lyxrow.[Ch]:
+ * paragraph.h:
+ * rowpainter.C:
+ * text.C:
+ * text2.C:
+ * text3.C: speed up by storing y positions per paragraph plus per-row
+ offset instead of having a 'full' y position in the row.
+
2003-10-15 André Pönitz <poenitz@gmx.net>
* iterators.[Ch]:
Row::Row()
- : pos_(0), end_(0), fill_(0), height_(0), width_(0), y_(0),
+ : pos_(0), end_(0), fill_(0), height_(0), width_(0), y_offset_(0),
ascent_of_text_(0), baseline_(0),
x_(0), fill_separator_(0), fill_hfill_(0), fill_label_hfill_(0)
{}
Row::Row(pos_type pos)
- : pos_(pos), end_(0), fill_(0), height_(0), width_(0), y_(0),
+ : pos_(pos), end_(0), fill_(0), height_(0), width_(0), y_offset_(0),
ascent_of_text_(0), baseline_(0),
x_(0), fill_separator_(0), fill_hfill_(0), fill_label_hfill_(0)
{}
<< " fill: " << fill_
<< " ascent_of_text: " << ascent_of_text_
<< " top_of_text: " << top_of_text_
- << " y: " << y_ << std::endl;
+ << " y_offset: " << y_offset_ << std::endl;
}
/// return true if this row is the start of a paragraph
bool isParStart() const;
/// return the cached y position
- unsigned int y() const { return y_; }
+ unsigned int y_offset() const { return y_offset_; }
/// cache the y position
- void y(unsigned int newy) { y_ = newy; }
+ void y_offset(unsigned int newy) { y_offset_ = newy; }
///
float x() const;
///
///
unsigned int width_;
/// cached y position
- unsigned int y_;
+ unsigned int y_offset_;
/// ascent from baseline including prelude space
unsigned short ascent_of_text_;
/// the top of the real text in the row
Paragraph::Paragraph()
- : y(0), pimpl_(new Paragraph::Pimpl(this))
+ : y(0), height(0), pimpl_(new Paragraph::Pimpl(this))
{
itemdepth = 0;
params().clear();
Paragraph::Paragraph(Paragraph const & lp)
- : y(0), text_(lp.text_), pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this))
+ : y(0), height(0), text_(lp.text_), pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this))
{
itemdepth = 0;
// this is because of the dummy layout of the paragraphs that
mutable RowList rows;
/// last draw y position (baseline of top row)
int y;
+ ///
+ int height;
private:
///
int const topy = bv.top_y();
ParagraphList::iterator pit;
RowList::iterator rit = bv.text->getRowNearY(topy, pit);
- int y = rit->y() - topy;
+ int const y = pit->y + rit->y_offset() - topy;
return paintRows(bv, *bv.text, pit, rit, 0, y, y, 0);
}
ParagraphList::iterator pit = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end();
for (height = 0; pit != end; ++pit) {
- RowList::iterator rit = pit->rows.begin();
- RowList::iterator rend = pit->rows.end();
- for ( ; rit != rend ; ++rit) {
- rit->y(height);
- height += rit->height();
- }
+ pit->y = height;
+ height += pit->height;
}
}
}
-RowList::iterator LyXText::getRowNearY(int y,
- ParagraphList::iterator & pit) const
+RowList::iterator LyXText::getRowNearY(int y, ParagraphList::iterator & pit)
+ const
{
//lyxerr << "getRowNearY: y " << y << endl;
RowList::iterator rit = lastRow();
RowList::iterator rbegin = firstRow();
- while (rit != rbegin && static_cast<int>(rit->y()) > y)
+ while (rit != rbegin && pit->y + rit->y_offset() > y)
previousRow(pit, rit);
return rit;
int par_width = 0;
// set height and fill and width of rows
int const ww = workWidth();
+ pit->height = 0;
for (rit = pit->rows.begin(); rit != end; ++rit) {
int const f = fill(pit, rit, ww);
int const w = ww - f;
rit->width(w);
prepareToPrint(pit, rit);
setHeightOfRow(pit, rit);
- height += rit->height();
+ rit->y_offset(pit->height);
+ pit->height += rit->height();
}
+ height += pit->height;
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
return par_width;
ParagraphList::iterator pit = getPar(par);
RowList::iterator row = getRow(pit, pos);
- int y = row->y();
+ int y = pit->y + row->y_offset();
// y is now the beginning of the cursor row
y += row->baseline();
// Get the row first.
ParagraphList::iterator pit;
RowList::iterator rit = getRowNearY(y, pit);
- y = rit->y();
+ y = pit->y + rit->y_offset();
bool bound = false;
pos_type const column = getColumnNearX(pit, rit, x, bound);
}
ParagraphList::iterator dummypit;
- y = getRowNearY(y, dummypit)->y();
+ RowList::iterator rr = getRowNearY(y, dummypit);
+ y = dummypit->y + rr->y_offset();
setCursorFromCoordinates(cursor.x_fix(), y);
// + bv->workHeight());