]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
More 'standard conformant blurb' nonsense.
[lyx.git] / src / text2.C
index e4425f93559fb5a52263decb978b77c175df37f7..e2ae52d49394c18648f6a4b8a1e51a190f2f36b4 100644 (file)
@@ -59,19 +59,12 @@ using std::pair;
 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();
 }
 
 
@@ -87,8 +80,7 @@ void LyXText::init(BufferView * bview)
        width = 0;
        height = 0;
 
-       anchor_row_ = endRow();
-       anchor_row_offset_ = 0;
+       anchor_y_ = 0;
 
        current_font = getFont(beg, 0);
 
@@ -559,11 +551,9 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
        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
@@ -602,15 +592,15 @@ void LyXText::fullRebreak()
 
 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();
@@ -1383,7 +1373,7 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
 
        // None of these should happen, but we're scaredy-cats
        if (pos > pit->size()) {
-               lyxerr << "dont like 1 please report" << endl;
+               lyxerr << "dont like 1, pos: " << pos << " size: " << pit->size() << endl;
                pos = 0;
                cur.pos(0);
        } else if (pos > last + 1) {
@@ -1638,11 +1628,10 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
 
 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);
 }
 
 
@@ -1953,17 +1942,14 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & 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;
 }