using lyx::pos_type;
-LyXText::LyXText(BufferView * bv)
- : height(0), width(0), anchor_row_offset_(0),
- inset_owner(0), the_locking_inset(0), bv_owner(bv)
+LyXText::LyXText(BufferView * bv, InsetText * inset, bool ininset,
+ ParagraphList & paragraphs)
+ : height(0), width(0), anchor_y_(0),
+ inset_owner(inset), the_locking_inset(0), bv_owner(bv),
+ in_inset_(ininset), paragraphs_(paragraphs)
{
- anchor_row_ = endRow();
-}
-
-
-LyXText::LyXText(BufferView * bv, InsetText * inset)
- : height(0), width(0), anchor_row_offset_(0),
- inset_owner(inset), the_locking_inset(0), bv_owner(bv)
-{
- anchor_row_ = endRow();
}
width = 0;
height = 0;
- anchor_row_ = endRow();
- anchor_row_offset_ = 0;
+ anchor_y_ = 0;
current_font = getFont(beg, 0);
RowList::iterator end = pit->rows.end();
// remove rows of paragraph
- for ( ; rit != end; ++rit) {
- if (rit == anchor_row_)
- anchor_row_ = endRow();
+ for (int i = 0; rit != end; ++rit, ++i)
height -= rit->height();
- }
+
pit->rows.clear();
// rebreak the paragraph
void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
{
- //lyxerr << "LyXText::metrics: width: " << mi.base.textwidth << endl;
+ //lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
+ // << " workWidth: " << workWidth() << endl;
//Assert(mi.base.textwidth);
// rebuild row cache
width = 0;
height = 0;
- anchor_row_ = endRow();
- anchor_row_offset_ = 0;
+ //anchor_y_ = 0;
ParagraphList::iterator pit = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end();
void LyXText::setCursorFromCoordinates(int x, int y)
{
- //LyXCursor old_cursor = cursor;
+ LyXCursor old_cursor = cursor;
setCursorFromCoordinates(cursor, x, y);
setCurrentFont();
-#warning DEPM disabled, otherwise crash when entering new table
- //deleteEmptyParagraphMechanism(old_cursor);
+ deleteEmptyParagraphMechanism(old_cursor);
}
ParagraphList & LyXText::ownerParagraphs() const
{
- if (inset_owner) {
- return inset_owner->paragraphs;
- }
- return bv_owner->buffer()->paragraphs;
+ return paragraphs_;
}
bool LyXText::isInInset() const
{
// Sub-level has non-null bv owner and non-null inset owner.
- return inset_owner != 0 && bv_owner != 0;
+ return inset_owner != 0;
}